Gtk3 - fixed HiDPI patch
This commit is contained in:
parent
c498dd1344
commit
8fc5a26b8c
@ -1,17 +1,7 @@
|
|||||||
# HG changeset patch
|
diff -up mozilla-release/widget/gtk/nsGtkUtils.h.975919-gtk3-hidpi mozilla-release/widget/gtk/nsGtkUtils.h
|
||||||
# Parent 7b33ee7fd162d784f382250d3fa811e86a1b7348
|
--- mozilla-release/widget/gtk/nsGtkUtils.h.975919-gtk3-hidpi 2015-01-09 05:38:28.000000000 +0100
|
||||||
# User Andrew Comminos <andrew@morlunk.com>
|
+++ mozilla-release/widget/gtk/nsGtkUtils.h 2015-01-19 18:43:30.101191071 +0100
|
||||||
Bug 975919 - Added support for HiDPI on GTK 3.10+
|
@@ -9,6 +9,7 @@
|
||||||
|
|
||||||
diff --git a/widget/gtk/nsGtkUtils.h b/widget/gtk/nsGtkUtils.h
|
|
||||||
--- a/widget/gtk/nsGtkUtils.h
|
|
||||||
+++ b/widget/gtk/nsGtkUtils.h
|
|
||||||
@@ -4,16 +4,17 @@
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#ifndef nsGtkUtils_h__
|
|
||||||
#define nsGtkUtils_h__
|
#define nsGtkUtils_h__
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
@ -19,20 +9,18 @@ diff --git a/widget/gtk/nsGtkUtils.h b/widget/gtk/nsGtkUtils.h
|
|||||||
|
|
||||||
// Some gobject functions expect functions for gpointer arguments.
|
// Some gobject functions expect functions for gpointer arguments.
|
||||||
// gpointer is void* but C++ doesn't like casting functions to void*.
|
// gpointer is void* but C++ doesn't like casting functions to void*.
|
||||||
template<class T> static inline gpointer
|
diff -up mozilla-release/widget/gtk/nsLookAndFeel.cpp.975919-gtk3-hidpi mozilla-release/widget/gtk/nsLookAndFeel.cpp
|
||||||
FuncToGpointer(T aFunction)
|
--- mozilla-release/widget/gtk/nsLookAndFeel.cpp.975919-gtk3-hidpi 2015-01-19 18:43:30.081191055 +0100
|
||||||
{
|
+++ mozilla-release/widget/gtk/nsLookAndFeel.cpp 2015-01-20 13:16:48.005399364 +0100
|
||||||
return reinterpret_cast<gpointer>
|
@@ -7,6 +7,7 @@
|
||||||
(reinterpret_cast<uintptr_t>
|
|
||||||
diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp
|
|
||||||
--- a/widget/gtk/nsLookAndFeel.cpp
|
|
||||||
+++ b/widget/gtk/nsLookAndFeel.cpp
|
|
||||||
@@ -728,16 +728,27 @@ GetSystemFontInfo(GtkWidget *aWidget,
|
|
||||||
|
|
||||||
// |size| is now either pixels or pango-points (not Mozilla-points!)
|
// for strtod()
|
||||||
|
#include <stdlib.h>
|
||||||
|
+#include <dlfcn.h>
|
||||||
|
|
||||||
if (!pango_font_description_get_size_is_absolute(desc)) {
|
#include "nsLookAndFeel.h"
|
||||||
// |size| is in pango-points, so convert to pixels.
|
|
||||||
|
@@ -733,6 +734,17 @@ GetSystemFontInfo(GtkWidget *aWidget,
|
||||||
size *= float(gfxPlatformGtk::GetDPI()) / POINTS_PER_INCH_FLOAT;
|
size *= float(gfxPlatformGtk::GetDPI()) / POINTS_PER_INCH_FLOAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,20 +38,10 @@ diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp
|
|||||||
// |size| is now pixels
|
// |size| is now pixels
|
||||||
|
|
||||||
aFontStyle->size = size;
|
aFontStyle->size = size;
|
||||||
|
diff -up mozilla-release/widget/gtk/nsScreenGtk.cpp.975919-gtk3-hidpi mozilla-release/widget/gtk/nsScreenGtk.cpp
|
||||||
pango_font_description_free(desc);
|
--- mozilla-release/widget/gtk/nsScreenGtk.cpp.975919-gtk3-hidpi 2015-01-09 05:38:28.000000000 +0100
|
||||||
}
|
+++ mozilla-release/widget/gtk/nsScreenGtk.cpp 2015-01-19 18:43:30.102191072 +0100
|
||||||
|
@@ -11,10 +11,10 @@
|
||||||
static void
|
|
||||||
diff --git a/widget/gtk/nsScreenGtk.cpp b/widget/gtk/nsScreenGtk.cpp
|
|
||||||
--- a/widget/gtk/nsScreenGtk.cpp
|
|
||||||
+++ b/widget/gtk/nsScreenGtk.cpp
|
|
||||||
@@ -6,20 +6,20 @@
|
|
||||||
#include "nsScreenGtk.h"
|
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
|
||||||
#ifdef MOZ_X11
|
|
||||||
#include <gdk/gdkx.h>
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#endif
|
#endif
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
@ -75,17 +53,7 @@ diff --git a/widget/gtk/nsScreenGtk.cpp b/widget/gtk/nsScreenGtk.cpp
|
|||||||
nsScreenGtk :: nsScreenGtk ( )
|
nsScreenGtk :: nsScreenGtk ( )
|
||||||
: mScreenNum(0),
|
: mScreenNum(0),
|
||||||
mRect(0, 0, 0, 0),
|
mRect(0, 0, 0, 0),
|
||||||
mAvailRect(0, 0, 0, 0),
|
@@ -40,6 +40,37 @@ nsScreenGtk :: GetId(uint32_t *aId)
|
||||||
mId(++sScreenId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -35,37 +35,68 @@ nsScreenGtk :: GetId(uint32_t *aId)
|
|
||||||
*aId = mId;
|
|
||||||
return NS_OK;
|
|
||||||
} // GetId
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsScreenGtk :: GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
|
nsScreenGtk :: GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
|
||||||
{
|
{
|
||||||
@ -123,7 +91,7 @@ diff --git a/widget/gtk/nsScreenGtk.cpp b/widget/gtk/nsScreenGtk.cpp
|
|||||||
*outLeft = mRect.x;
|
*outLeft = mRect.x;
|
||||||
*outTop = mRect.y;
|
*outTop = mRect.y;
|
||||||
*outWidth = mRect.width;
|
*outWidth = mRect.width;
|
||||||
*outHeight = mRect.height;
|
@@ -47,11 +78,11 @@ nsScreenGtk :: GetRect(int32_t *outLeft,
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
@ -137,8 +105,7 @@ diff --git a/widget/gtk/nsScreenGtk.cpp b/widget/gtk/nsScreenGtk.cpp
|
|||||||
{
|
{
|
||||||
*outLeft = mAvailRect.x;
|
*outLeft = mAvailRect.x;
|
||||||
*outTop = mAvailRect.y;
|
*outTop = mAvailRect.y;
|
||||||
*outWidth = mAvailRect.width;
|
@@ -60,7 +91,7 @@ nsScreenGtk :: GetAvailRect(int32_t *out
|
||||||
*outHeight = mAvailRect.height;
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
@ -147,17 +114,7 @@ diff --git a/widget/gtk/nsScreenGtk.cpp b/widget/gtk/nsScreenGtk.cpp
|
|||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsScreenGtk :: GetPixelDepth(int32_t *aPixelDepth)
|
@@ -82,6 +113,23 @@ nsScreenGtk :: GetColorDepth(int32_t *aC
|
||||||
{
|
|
||||||
GdkVisual * visual = gdk_screen_get_system_visual(gdk_screen_get_default());
|
|
||||||
*aPixelDepth = gdk_visual_get_depth(visual);
|
|
||||||
|
|
||||||
@@ -77,16 +108,33 @@ nsScreenGtk :: GetPixelDepth(int32_t *aP
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsScreenGtk :: GetColorDepth(int32_t *aColorDepth)
|
|
||||||
{
|
|
||||||
return GetPixelDepth ( aColorDepth );
|
|
||||||
|
|
||||||
} // GetColorDepth
|
} // GetColorDepth
|
||||||
|
|
||||||
|
|
||||||
@ -181,20 +138,10 @@ diff --git a/widget/gtk/nsScreenGtk.cpp b/widget/gtk/nsScreenGtk.cpp
|
|||||||
void
|
void
|
||||||
nsScreenGtk :: Init (GdkWindow *aRootWindow)
|
nsScreenGtk :: Init (GdkWindow *aRootWindow)
|
||||||
{
|
{
|
||||||
// We listen for configure events on the root window to pick up
|
diff -up mozilla-release/widget/gtk/nsScreenGtk.h.975919-gtk3-hidpi mozilla-release/widget/gtk/nsScreenGtk.h
|
||||||
// changes to this rect. We could listen for "size_changed" signals
|
--- mozilla-release/widget/gtk/nsScreenGtk.h.975919-gtk3-hidpi 2015-01-09 05:38:28.000000000 +0100
|
||||||
// on the default screen to do this, except that doesn't work with
|
+++ mozilla-release/widget/gtk/nsScreenGtk.h 2015-01-19 18:43:30.102191072 +0100
|
||||||
// versions of GDK predating the GdkScreen object. See bug 256646.
|
@@ -33,8 +33,11 @@ public:
|
||||||
mAvailRect = mRect = nsIntRect(0, 0, gdk_screen_width(), gdk_screen_height());
|
|
||||||
diff --git a/widget/gtk/nsScreenGtk.h b/widget/gtk/nsScreenGtk.h
|
|
||||||
--- a/widget/gtk/nsScreenGtk.h
|
|
||||||
+++ b/widget/gtk/nsScreenGtk.h
|
|
||||||
@@ -28,18 +28,21 @@ class nsScreenGtk : public nsBaseScreen
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsScreenGtk();
|
|
||||||
~nsScreenGtk();
|
|
||||||
|
|
||||||
NS_IMETHOD GetId(uint32_t* aId);
|
NS_IMETHOD GetId(uint32_t* aId);
|
||||||
NS_IMETHOD GetRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight);
|
NS_IMETHOD GetRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight);
|
||||||
NS_IMETHOD GetAvailRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight);
|
NS_IMETHOD GetAvailRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight);
|
||||||
@ -206,20 +153,10 @@ diff --git a/widget/gtk/nsScreenGtk.h b/widget/gtk/nsScreenGtk.h
|
|||||||
|
|
||||||
void Init(GdkWindow *aRootWindow);
|
void Init(GdkWindow *aRootWindow);
|
||||||
#ifdef MOZ_X11
|
#ifdef MOZ_X11
|
||||||
void Init(XineramaScreenInfo *aScreenInfo);
|
diff -up mozilla-release/widget/gtk/nsWindow.cpp.975919-gtk3-hidpi mozilla-release/widget/gtk/nsWindow.cpp
|
||||||
#endif /* MOZ_X11 */
|
--- mozilla-release/widget/gtk/nsWindow.cpp.975919-gtk3-hidpi 2015-01-19 18:43:30.084191057 +0100
|
||||||
|
+++ mozilla-release/widget/gtk/nsWindow.cpp 2015-01-19 18:43:30.104191074 +0100
|
||||||
private:
|
@@ -471,6 +471,9 @@ nsWindow::DispatchEvent(WidgetGUIEvent*
|
||||||
uint32_t mScreenNum;
|
|
||||||
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|
||||||
--- a/widget/gtk/nsWindow.cpp
|
|
||||||
+++ b/widget/gtk/nsWindow.cpp
|
|
||||||
@@ -466,16 +466,19 @@ nsWindow::DispatchResized(int32_t aWidth
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsWindow::DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
debug_DumpEvent(stdout, aEvent->widget, aEvent,
|
debug_DumpEvent(stdout, aEvent->widget, aEvent,
|
||||||
nsAutoCString("something"), 0);
|
nsAutoCString("something"), 0);
|
||||||
#endif
|
#endif
|
||||||
@ -229,17 +166,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
|
|
||||||
aStatus = nsEventStatus_eIgnore;
|
aStatus = nsEventStatus_eIgnore;
|
||||||
nsIWidgetListener* listener =
|
nsIWidgetListener* listener =
|
||||||
mAttachedWidgetListener ? mAttachedWidgetListener : mWidgetListener;
|
@@ -729,6 +732,12 @@ nsWindow::GetDPI()
|
||||||
if (listener) {
|
|
||||||
aStatus = listener->HandleEvent(aEvent, mUseAttachedEvents);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -724,16 +727,22 @@ nsWindow::GetDPI()
|
|
||||||
double heightInches = DisplayHeightMM(dpy, defaultScreen)/MM_PER_INCH_FLOAT;
|
|
||||||
if (heightInches < 0.25) {
|
|
||||||
// Something's broken, but we'd better not crash.
|
|
||||||
return 96.0f;
|
|
||||||
}
|
|
||||||
return float(DisplayHeight(dpy, defaultScreen)/heightInches);
|
return float(DisplayHeight(dpy, defaultScreen)/heightInches);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,17 +179,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWindow::SetParent(nsIWidget *aNewParent)
|
nsWindow::SetParent(nsIWidget *aNewParent)
|
||||||
{
|
{
|
||||||
if (mContainer || !mGdkWindow) {
|
@@ -827,8 +836,9 @@ nsWindow::ReparentNativeWidgetInternal(n
|
||||||
NS_NOTREACHED("nsWindow::SetParent called illegally");
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -822,18 +831,19 @@ nsWindow::ReparentNativeWidgetInternal(n
|
|
||||||
SetWidgetForHierarchy(mGdkWindow, aOldContainer, aNewContainer);
|
|
||||||
|
|
||||||
if (aOldContainer == gInvisibleContainer) {
|
|
||||||
CheckDestroyInvisibleContainer();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mIsTopLevel) {
|
if (!mIsTopLevel) {
|
||||||
@ -274,17 +191,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsWindow* newParent = static_cast<nsWindow*>(aNewParent);
|
@@ -863,26 +873,26 @@ NS_IMETHODIMP
|
||||||
bool parentHasMappedToplevel =
|
|
||||||
newParent && newParent->mHasMappedToplevel;
|
|
||||||
if (mHasMappedToplevel != parentHasMappedToplevel) {
|
|
||||||
SetHasMappedToplevel(parentHasMappedToplevel);
|
|
||||||
@@ -858,52 +868,56 @@ nsWindow::IsVisible() const
|
|
||||||
{
|
|
||||||
return mIsShown;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsWindow::ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY)
|
nsWindow::ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY)
|
||||||
{
|
{
|
||||||
if (mIsTopLevel && mShell) {
|
if (mIsTopLevel && mShell) {
|
||||||
@ -321,12 +228,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
@@ -895,10 +905,14 @@ void nsWindow::SetSizeConstraints(const
|
||||||
|
|
||||||
void nsWindow::SetSizeConstraints(const SizeConstraints& aConstraints)
|
|
||||||
{
|
|
||||||
mSizeConstraints.mMinSize = GetSafeWindowSize(aConstraints.mMinSize);
|
|
||||||
mSizeConstraints.mMaxSize = GetSafeWindowSize(aConstraints.mMaxSize);
|
|
||||||
|
|
||||||
if (mShell) {
|
if (mShell) {
|
||||||
GdkGeometry geometry;
|
GdkGeometry geometry;
|
||||||
@ -345,17 +247,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
|
|
||||||
uint32_t hints = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
uint32_t hints = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||||
gtk_window_set_geometry_hints(GTK_WINDOW(mShell), nullptr,
|
gtk_window_set_geometry_hints(GTK_WINDOW(mShell), nullptr,
|
||||||
&geometry, GdkWindowHints(hints));
|
@@ -1161,11 +1175,13 @@ nsWindow::Move(double aX, double aY)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
@@ -1156,21 +1170,23 @@ nsWindow::Move(double aX, double aY)
|
|
||||||
mBounds.x = x;
|
|
||||||
mBounds.y = y;
|
|
||||||
|
|
||||||
if (!mCreated)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
mNeedsMove = false;
|
mNeedsMove = false;
|
||||||
|
|
||||||
@ -371,17 +263,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
NotifyRollupGeometryChange();
|
NotifyRollupGeometryChange();
|
||||||
return NS_OK;
|
@@ -1432,7 +1448,7 @@ nsWindow::GetScreenBounds(nsIntRect &aRe
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
|
||||||
@@ -1427,17 +1443,17 @@ nsWindow::SetFocus(bool aRaise)
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsWindow::GetScreenBounds(nsIntRect &aRect)
|
|
||||||
{
|
|
||||||
if (mIsTopLevel && mContainer) {
|
|
||||||
// use the point including window decorations
|
// use the point including window decorations
|
||||||
gint x, y;
|
gint x, y;
|
||||||
gdk_window_get_root_origin(gtk_widget_get_window(GTK_WIDGET(mContainer)), &x, &y);
|
gdk_window_get_root_origin(gtk_widget_get_window(GTK_WIDGET(mContainer)), &x, &y);
|
||||||
@ -390,17 +272,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aRect.MoveTo(WidgetToScreenOffset());
|
aRect.MoveTo(WidgetToScreenOffset());
|
||||||
}
|
@@ -1602,17 +1618,12 @@ nsWindow::Invalidate(const nsIntRect &aR
|
||||||
// mBounds.Size() is the window bounds, not the window-manager frame
|
|
||||||
// bounds (bug 581863). gdk_window_get_frame_extents would give the
|
|
||||||
// frame bounds, but mBounds.Size() is returned here for consistency
|
|
||||||
// with Resize.
|
|
||||||
@@ -1597,27 +1613,22 @@ nsWindow::SetCursor(imgIContainer* aCurs
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsWindow::Invalidate(const nsIntRect &aRect)
|
|
||||||
{
|
|
||||||
if (!mGdkWindow)
|
if (!mGdkWindow)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
@ -420,17 +292,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
@@ -1750,7 +1761,7 @@ nsWindow::WidgetToScreenOffset()
|
||||||
nsWindow::GetNativeData(uint32_t aDataType)
|
|
||||||
{
|
|
||||||
switch (aDataType) {
|
|
||||||
case NS_NATIVE_WINDOW:
|
|
||||||
@@ -1745,17 +1756,17 @@ nsIntPoint
|
|
||||||
nsWindow::WidgetToScreenOffset()
|
|
||||||
{
|
|
||||||
gint x = 0, y = 0;
|
|
||||||
|
|
||||||
if (mGdkWindow) {
|
|
||||||
gdk_window_get_origin(mGdkWindow, &x, &y);
|
gdk_window_get_origin(mGdkWindow, &x, &y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,17 +301,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWindow::EnableDragDrop(bool aEnable)
|
@@ -2042,7 +2053,9 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2037,17 +2048,19 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
|
||||||
#if (MOZ_WIDGET_GTK == 2)
|
|
||||||
if (!exposeRegion.Init(aEvent)) {
|
|
||||||
#else
|
|
||||||
if (!exposeRegion.Init(cr)) {
|
|
||||||
#endif
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,17 +312,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
|
|
||||||
ClientLayerManager *clientLayers =
|
ClientLayerManager *clientLayers =
|
||||||
(GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT)
|
(GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT)
|
||||||
? static_cast<ClientLayerManager*>(GetLayerManager())
|
@@ -2382,21 +2395,24 @@ nsWindow::OnSizeAllocate(GtkAllocation *
|
||||||
: nullptr;
|
|
||||||
|
|
||||||
if (clientLayers && mCompositorParent) {
|
|
||||||
// We need to paint to the screen even if nothing changed, since if we
|
|
||||||
@@ -2377,31 +2390,34 @@ nsWindow::OnContainerUnrealize()
|
|
||||||
|
|
||||||
void
|
|
||||||
nsWindow::OnSizeAllocate(GtkAllocation *aAllocation)
|
|
||||||
{
|
|
||||||
LOG(("size_allocate [%p] %d %d %d %d\n",
|
|
||||||
(void *)this, aAllocation->x, aAllocation->y,
|
(void *)this, aAllocation->x, aAllocation->y,
|
||||||
aAllocation->width, aAllocation->height));
|
aAllocation->width, aAllocation->height));
|
||||||
|
|
||||||
@ -500,17 +342,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
gdk_window_invalidate_rect(mGdkWindow, &rect, FALSE);
|
gdk_window_invalidate_rect(mGdkWindow, &rect, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
mBounds.SizeTo(size);
|
@@ -3848,14 +3864,17 @@ nsWindow::SetWindowClass(const nsAString
|
||||||
|
|
||||||
if (!mGdkWindow)
|
|
||||||
return;
|
|
||||||
|
|
||||||
@@ -3843,67 +3859,75 @@ nsWindow::SetWindowClass(const nsAString
|
|
||||||
nsMemory::Free(res_name);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsWindow::NativeResize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
nsWindow::NativeResize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||||
{
|
{
|
||||||
@ -530,7 +362,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
}
|
}
|
||||||
else if (mContainer) {
|
else if (mContainer) {
|
||||||
GtkWidget *widget = GTK_WIDGET(mContainer);
|
GtkWidget *widget = GTK_WIDGET(mContainer);
|
||||||
GtkAllocation allocation, prev_allocation;
|
@@ -3863,12 +3882,12 @@ nsWindow::NativeResize(int32_t aWidth, i
|
||||||
gtk_widget_get_allocation(widget, &prev_allocation);
|
gtk_widget_get_allocation(widget, &prev_allocation);
|
||||||
allocation.x = prev_allocation.x;
|
allocation.x = prev_allocation.x;
|
||||||
allocation.y = prev_allocation.y;
|
allocation.y = prev_allocation.y;
|
||||||
@ -546,8 +378,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
@@ -3877,28 +3896,33 @@ nsWindow::NativeResize(int32_t aX, int32
|
||||||
nsWindow::NativeResize(int32_t aX, int32_t aY,
|
|
||||||
int32_t aWidth, int32_t aHeight,
|
int32_t aWidth, int32_t aHeight,
|
||||||
bool aRepaint)
|
bool aRepaint)
|
||||||
{
|
{
|
||||||
@ -590,17 +421,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
@@ -6109,8 +6133,8 @@ nsWindow::GetThebesSurface(cairo_t *cr)
|
||||||
nsWindow::NativeShow(bool aAction)
|
|
||||||
{
|
|
||||||
if (aAction) {
|
|
||||||
// unset our flag now that our window has been shown
|
|
||||||
@@ -6178,18 +6202,18 @@ nsWindow::GetThebesSurface(cairo_t *cr)
|
|
||||||
#if (MOZ_WIDGET_GTK == 2)
|
|
||||||
gdk_drawable_get_size(GDK_DRAWABLE(mGdkWindow), &width, &height);
|
|
||||||
#else
|
|
||||||
width = gdk_window_get_width(mGdkWindow);
|
|
||||||
height = gdk_window_get_height(mGdkWindow);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Owen Taylor says this is the right thing to do!
|
// Owen Taylor says this is the right thing to do!
|
||||||
@ -611,17 +432,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
gfxIntSize size(width, height);
|
gfxIntSize size(width, height);
|
||||||
|
|
||||||
GdkVisual *gdkVisual = gdk_window_get_visual(mGdkWindow);
|
GdkVisual *gdkVisual = gdk_window_get_visual(mGdkWindow);
|
||||||
Visual* visual = gdk_x11_visual_get_xvisual(gdkVisual);
|
@@ -6135,8 +6159,17 @@ nsWindow::GetThebesSurface(cairo_t *cr)
|
||||||
|
|
||||||
# ifdef MOZ_HAVE_SHMIMAGE
|
|
||||||
bool usingShm = false;
|
|
||||||
if (nsShmImage::UseShm()) {
|
|
||||||
@@ -6204,18 +6228,27 @@ nsWindow::GetThebesSurface(cairo_t *cr)
|
|
||||||
}
|
|
||||||
if (!usingShm)
|
|
||||||
# endif // MOZ_HAVE_SHMIMAGE
|
|
||||||
{
|
|
||||||
#if (MOZ_WIDGET_GTK == 3)
|
|
||||||
#if MOZ_TREE_CAIRO
|
#if MOZ_TREE_CAIRO
|
||||||
#error "cairo-gtk3 target must be built with --enable-system-cairo"
|
#error "cairo-gtk3 target must be built with --enable-system-cairo"
|
||||||
#else
|
#else
|
||||||
@ -639,17 +450,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) {
|
if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) {
|
||||||
NS_NOTREACHED("Missing cairo target?");
|
NS_NOTREACHED("Missing cairo target?");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
@@ -6217,6 +6250,8 @@ nsWindow::BeginMoveDrag(WidgetMouseEvent
|
||||||
mThebesSurface = gfxASurface::Wrap(surf);
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
#endif // (MOZ_WIDGET_GTK == 3)
|
|
||||||
@@ -6286,16 +6319,18 @@ nsWindow::BeginMoveDrag(WidgetMouseEvent
|
|
||||||
|
|
||||||
GdkWindow *gdk_window;
|
|
||||||
gint button, screenX, screenY;
|
|
||||||
if (!GetDragInfo(aEvent, &gdk_window, &button, &screenX, &screenY)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// tell the window manager to start the move
|
// tell the window manager to start the move
|
||||||
@ -658,17 +459,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
gdk_window_begin_move_drag(gdk_window, button, screenX, screenY,
|
gdk_window_begin_move_drag(gdk_window, button, screenX, screenY,
|
||||||
aEvent->time);
|
aEvent->time);
|
||||||
|
|
||||||
return NS_OK;
|
@@ -6308,6 +6343,70 @@ nsWindow::ClearCachedResources()
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent,
|
|
||||||
@@ -6377,16 +6412,80 @@ nsWindow::ClearCachedResources()
|
|
||||||
for (GList* list = children; list; list = list->next) {
|
|
||||||
nsWindow* window = get_window_for_gdk_window(GDK_WINDOW(list->data));
|
|
||||||
if (window) {
|
|
||||||
window->ClearCachedResources();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -739,20 +530,10 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|||||||
nsresult
|
nsresult
|
||||||
nsWindow::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
nsWindow::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||||
uint32_t aNativeMessage,
|
uint32_t aNativeMessage,
|
||||||
uint32_t aModifierFlags)
|
diff -up mozilla-release/widget/gtk/nsWindow.h.975919-gtk3-hidpi mozilla-release/widget/gtk/nsWindow.h
|
||||||
{
|
--- mozilla-release/widget/gtk/nsWindow.h.975919-gtk3-hidpi 2015-01-09 05:38:28.000000000 +0100
|
||||||
if (!mGdkWindow) {
|
+++ mozilla-release/widget/gtk/nsWindow.h 2015-01-19 18:43:30.104191074 +0100
|
||||||
return NS_OK;
|
@@ -97,6 +97,7 @@ public:
|
||||||
}
|
|
||||||
diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
|
|
||||||
--- a/widget/gtk/nsWindow.h
|
|
||||||
+++ b/widget/gtk/nsWindow.h
|
|
||||||
@@ -92,16 +92,17 @@ public:
|
|
||||||
NS_IMETHOD Create(nsIWidget *aParent,
|
|
||||||
nsNativeWidget aNativeParent,
|
|
||||||
const nsIntRect &aRect,
|
|
||||||
nsDeviceContext *aContext,
|
|
||||||
nsWidgetInitData *aInitData);
|
|
||||||
NS_IMETHOD Destroy(void);
|
NS_IMETHOD Destroy(void);
|
||||||
virtual nsIWidget *GetParent();
|
virtual nsIWidget *GetParent();
|
||||||
virtual float GetDPI();
|
virtual float GetDPI();
|
||||||
@ -760,17 +541,7 @@ diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
|
|||||||
virtual nsresult SetParent(nsIWidget* aNewParent);
|
virtual nsresult SetParent(nsIWidget* aNewParent);
|
||||||
NS_IMETHOD SetModal(bool aModal);
|
NS_IMETHOD SetModal(bool aModal);
|
||||||
virtual bool IsVisible() const;
|
virtual bool IsVisible() const;
|
||||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
@@ -467,6 +468,20 @@ private:
|
||||||
int32_t *aX,
|
|
||||||
int32_t *aY);
|
|
||||||
virtual void SetSizeConstraints(const SizeConstraints& aConstraints);
|
|
||||||
NS_IMETHOD Move(double aX,
|
|
||||||
@@ -468,16 +469,30 @@ private:
|
|
||||||
* The instance is created when the top level widget is created. And when
|
|
||||||
* the widget is destroyed, it's released. All child windows refer its
|
|
||||||
* ancestor widget's instance. So, one set of IM contexts is created for
|
|
||||||
* all windows in a hierarchy. If the children are released after the top
|
|
||||||
* level window is released, the children still have a valid pointer,
|
|
||||||
* however, IME doesn't work at that time.
|
* however, IME doesn't work at that time.
|
||||||
*/
|
*/
|
||||||
nsRefPtr<nsGtkIMModule> mIMModule;
|
nsRefPtr<nsGtkIMModule> mIMModule;
|
||||||
@ -791,8 +562,3 @@ diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
|
|||||||
};
|
};
|
||||||
|
|
||||||
class nsChildWindow : public nsWindow {
|
class nsChildWindow : public nsWindow {
|
||||||
public:
|
|
||||||
nsChildWindow();
|
|
||||||
~nsChildWindow();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user