summaryrefslogtreecommitdiff
path: root/mozilla-1144745-2.patch
diff options
context:
space:
mode:
authorMartin Stransky <stransky@anakreon.cz>2015-05-13 10:33:21 +0200
committerMartin Stransky <stransky@anakreon.cz>2015-05-13 10:33:21 +0200
commit92ebef22abe058e37325e488907fb7b5110b3843 (patch)
tree9c2c006946849b259b7cb25611d8d456f5ae3630 /mozilla-1144745-2.patch
parentAdded fix for rhbz#1219542 (diff)
downloadlibrewolf-fedora-ff-92ebef22abe058e37325e488907fb7b5110b3843.tar.gz
librewolf-fedora-ff-92ebef22abe058e37325e488907fb7b5110b3843.tar.bz2
librewolf-fedora-ff-92ebef22abe058e37325e488907fb7b5110b3843.zip
Added patch for mozilla#1144745 - HiDPI Gtk3 fixes
Diffstat (limited to 'mozilla-1144745-2.patch')
-rw-r--r--mozilla-1144745-2.patch185
1 files changed, 185 insertions, 0 deletions
diff --git a/mozilla-1144745-2.patch b/mozilla-1144745-2.patch
new file mode 100644
index 0000000..e3b9cdf
--- /dev/null
+++ b/mozilla-1144745-2.patch
@@ -0,0 +1,185 @@
+diff -up mozilla-release/widget/gtk/nsLookAndFeel.cpp.1144745-2 mozilla-release/widget/gtk/nsLookAndFeel.cpp
+--- mozilla-release/widget/gtk/nsLookAndFeel.cpp.1144745-2 2015-05-13 10:30:08.204367309 +0200
++++ mozilla-release/widget/gtk/nsLookAndFeel.cpp 2015-05-13 10:30:08.208367321 +0200
+@@ -18,6 +18,7 @@
+
+ #include <fontconfig/fontconfig.h>
+ #include "gfxPlatformGtk.h"
++#include "nsScreenGtk.h"
+
+ #include "gtkdrawing.h"
+ #include "nsStyleConsts.h"
+@@ -742,12 +743,7 @@ GetSystemFontInfo(GtkWidget *aWidget,
+ // Scale fonts up on HiDPI displays.
+ // This would be done automatically with cairo, but we manually manage
+ // the display scale for platform consistency.
+- static auto sGdkScreenGetMonitorScaleFactorPtr = (gint (*)(GdkScreen*,gint))
+- dlsym(RTLD_DEFAULT, "gdk_screen_get_monitor_scale_factor");
+- if (sGdkScreenGetMonitorScaleFactorPtr) {
+- GdkScreen *screen = gdk_screen_get_default();
+- size *= (*sGdkScreenGetMonitorScaleFactorPtr)(screen, 0);
+- }
++ size *= nsScreenGtk::GetGtkMonitorScaleFactor();
+
+ // |size| is now pixels
+
+diff -up mozilla-release/widget/gtk/nsNativeThemeGTK.cpp.1144745-2 mozilla-release/widget/gtk/nsNativeThemeGTK.cpp
+--- mozilla-release/widget/gtk/nsNativeThemeGTK.cpp.1144745-2 2015-05-13 10:30:08.206367315 +0200
++++ mozilla-release/widget/gtk/nsNativeThemeGTK.cpp 2015-05-13 10:30:46.966488584 +0200
+@@ -6,6 +6,7 @@
+ #include "nsNativeThemeGTK.h"
+ #include "nsThemeConstants.h"
+ #include "gtkdrawing.h"
++#include "nsScreenGtk.h"
+
+ #include "nsIObserverService.h"
+ #include "nsIServiceManager.h"
+@@ -89,23 +90,6 @@ nsNativeThemeGTK::RefreshWidgetWindow(ns
+ vm->InvalidateAllViews();
+ }
+
+-gint
+-nsNativeThemeGTK::GdkScaleFactor()
+-{
+-#if (MOZ_WIDGET_GTK >= 3)
+- // Since GDK 3.10
+- static auto sGdkScreenGetMonitorScaleFactorPtr = (gint (*)(GdkScreen*, gint))
+- dlsym(RTLD_DEFAULT, "gdk_screen_get_monitor_scale_factor");
+- if (sGdkScreenGetMonitorScaleFactorPtr) {
+- // FIXME: In the future, we'll want to fix this for GTK on Wayland which
+- // supports a variable scale factor per display.
+- GdkScreen *screen = gdk_screen_get_default();
+- return sGdkScreenGetMonitorScaleFactorPtr(screen, 0);
+- }
+-#endif
+- return 1;
+-}
+-
+
+ static bool IsFrameContentNodeInNamespace(nsIFrame *aFrame, uint32_t aNamespace)
+ {
+@@ -796,10 +780,11 @@ nsNativeThemeGTK::GetExtraSizeForWidget(
+ default:
+ return false;
+ }
+- aExtra->top *= GdkScaleFactor();
+- aExtra->right *= GdkScaleFactor();
+- aExtra->bottom *= GdkScaleFactor();
+- aExtra->left *= GdkScaleFactor();
++ gint scale = nsScreenGtk::GetGtkMonitorScaleFactor();
++ aExtra->top *= scale;
++ aExtra->right *= scale;
++ aExtra->bottom *= scale;
++ aExtra->left *= scale;
+ return true;
+ }
+
+@@ -827,7 +812,7 @@ nsNativeThemeGTK::DrawWidgetBackground(n
+
+ gfxRect rect = presContext->AppUnitsToGfxUnits(aRect);
+ gfxRect dirtyRect = presContext->AppUnitsToGfxUnits(aDirtyRect);
+- gint scaleFactor = GdkScaleFactor();
++ gint scaleFactor = nsScreenGtk::GetGtkMonitorScaleFactor();
+
+ // Align to device pixels where sensible
+ // to provide crisper and faster drawing.
+@@ -1066,10 +1051,11 @@ nsNativeThemeGTK::GetWidgetPadding(nsDev
+ aResult->left += horizontal_padding;
+ aResult->right += horizontal_padding;
+
+- aResult->top *= GdkScaleFactor();
+- aResult->right *= GdkScaleFactor();
+- aResult->bottom *= GdkScaleFactor();
+- aResult->left *= GdkScaleFactor();
++ gint scale = nsScreenGtk::GetGtkMonitorScaleFactor();
++ aResult->top *= scale;
++ aResult->right *= scale;
++ aResult->bottom *= scale;
++ aResult->left *= scale;
+
+ return true;
+ }
+@@ -1332,7 +1318,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
+ break;
+ }
+
+- *aResult = *aResult * GdkScaleFactor();
++ *aResult = *aResult * nsScreenGtk::GetGtkMonitorScaleFactor();
+
+ return NS_OK;
+ }
+diff -up mozilla-release/widget/gtk/nsNativeThemeGTK.h.1144745-2 mozilla-release/widget/gtk/nsNativeThemeGTK.h
+--- mozilla-release/widget/gtk/nsNativeThemeGTK.h.1144745-2 2015-05-13 10:30:08.206367315 +0200
++++ mozilla-release/widget/gtk/nsNativeThemeGTK.h 2015-05-13 10:30:08.209367325 +0200
+@@ -81,7 +81,6 @@ private:
+ nsIntMargin* aExtra);
+
+ void RefreshWidgetWindow(nsIFrame* aFrame);
+- gint GdkScaleFactor();
+
+ uint8_t mDisabledWidgetTypes[32];
+ uint8_t mSafeWidgetStates[1024]; // 256 widgets * 32 bits per widget
+diff -up mozilla-release/widget/gtk/nsScreenGtk.cpp.1144745-2 mozilla-release/widget/gtk/nsScreenGtk.cpp
+--- mozilla-release/widget/gtk/nsScreenGtk.cpp.1144745-2 2015-05-08 18:55:27.000000000 +0200
++++ mozilla-release/widget/gtk/nsScreenGtk.cpp 2015-05-13 10:30:08.209367325 +0200
+@@ -63,6 +63,23 @@ nsScreenGtk :: GetAvailRect(int32_t *out
+
+ } // GetAvailRect
+
++gint
++nsScreenGtk :: GetGtkMonitorScaleFactor()
++{
++#if (MOZ_WIDGET_GTK >= 3)
++ // Since GDK 3.10
++ static auto sGdkScreenGetMonitorScaleFactorPtr = (gint (*)(GdkScreen*, gint))
++ dlsym(RTLD_DEFAULT, "gdk_screen_get_monitor_scale_factor");
++ if (sGdkScreenGetMonitorScaleFactorPtr) {
++ // FIXME: In the future, we'll want to fix this for GTK on Wayland which
++ // supports a variable scale factor per display.
++ GdkScreen *screen = gdk_screen_get_default();
++ return sGdkScreenGetMonitorScaleFactorPtr(screen, 0);
++ }
++#endif
++ return 1;
++}
++
+ double
+ nsScreenGtk :: GetDPIScale()
+ {
+@@ -127,20 +144,9 @@ nsScreenGtk :: GetColorDepth(int32_t *aC
+ void
+ nsScreenGtk :: Init (GdkWindow *aRootWindow)
+ {
+- gint width = gdk_screen_width();
+- gint height = gdk_screen_height();
+-
+- // Since GDK 3.10
+- static auto sGdkScreenGetMonitorScaleFactorPtr = (gint (*)(GdkScreen*, gint))
+- dlsym(RTLD_DEFAULT, "gdk_screen_get_monitor_scale_factor");
+- if (sGdkScreenGetMonitorScaleFactorPtr) {
+- // FIXME: In the future, we'll want to fix this for GTK on Wayland which
+- // supports a variable scale factor per display.
+- GdkScreen *screen = gdk_window_get_screen(aRootWindow);
+- gint scale = sGdkScreenGetMonitorScaleFactorPtr(screen, 0);
+- width *= scale;
+- height *= scale;
+- }
++ gint scale = nsScreenGtk::GetGtkMonitorScaleFactor();
++ gint width = gdk_screen_width()*scale;
++ gint height = gdk_screen_height()*scale;
+
+ // We listen for configure events on the root window to pick up
+ // changes to this rect. We could listen for "size_changed" signals
+diff -up mozilla-release/widget/gtk/nsScreenGtk.h.1144745-2 mozilla-release/widget/gtk/nsScreenGtk.h
+--- mozilla-release/widget/gtk/nsScreenGtk.h.1144745-2 2015-05-08 18:55:27.000000000 +0200
++++ mozilla-release/widget/gtk/nsScreenGtk.h 2015-05-13 10:30:08.209367325 +0200
+@@ -43,7 +43,8 @@ public:
+ void Init(XineramaScreenInfo *aScreenInfo);
+ #endif /* MOZ_X11 */
+
+- static double GetDPIScale();
++ static gint GetGtkMonitorScaleFactor();
++ static double GetDPIScale();
+
+ private:
+ uint32_t mScreenNum;
bgstack15