Bug 1196494 - part 2: only update nsWindow client offset when _NET_FRAME_EXTENTS property actually changes. r=eihrul

This commit is contained in:
Lee Salzman 2015-10-09 09:24:48 -04:00
parent 723b4059af
commit c72d423c47
2 changed files with 37 additions and 9 deletions

View File

@ -1490,14 +1490,15 @@ nsWindow::GetClientBounds(nsIntRect &aRect)
return NS_OK;
}
nsIntPoint
nsWindow::GetClientOffset()
void
nsWindow::UpdateClientOffset()
{
PROFILER_LABEL("nsWindow", "GetClientOffset", js::ProfileEntry::Category::GRAPHICS);
PROFILER_LABEL("nsWindow", "UpdateClientOffset", js::ProfileEntry::Category::GRAPHICS);
if (!mIsTopLevel || !mShell || !mGdkWindow ||
gtk_window_get_window_type(GTK_WINDOW(mShell)) == GTK_WINDOW_POPUP) {
return nsIntPoint(0, 0);
mClientOffset = nsIntPoint(0, 0);
return;
}
GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL);
@ -1518,8 +1519,8 @@ nsWindow::GetClientOffset()
&length_returned,
(guchar **) &frame_extents) ||
length_returned/sizeof(glong) != 4) {
return nsIntPoint(0, 0);
mClientOffset = nsIntPoint(0, 0);
return;
}
// data returned is in the order left, right, top, bottom
@ -1528,7 +1529,29 @@ nsWindow::GetClientOffset()
g_free(frame_extents);
return nsIntPoint(left, top);
mClientOffset = nsIntPoint(left, top);
}
nsIntPoint
nsWindow::GetClientOffset()
{
return mClientOffset;
}
gboolean
nsWindow::OnPropertyNotifyEvent(GtkWidget* aWidget, GdkEventProperty* aEvent)
{
if (aEvent->atom == gdk_atom_intern("_NET_FRAME_EXTENTS", FALSE)) {
UpdateClientOffset();
return FALSE;
}
if (GetCurrentTimeGetter()->PropertyNotifyHandler(aWidget, aEvent)) {
return TRUE;
}
return FALSE;
}
NS_IMETHODIMP
@ -5747,8 +5770,7 @@ property_notify_event_cb(GtkWidget* aWidget, GdkEventProperty* aEvent)
if (!window)
return FALSE;
CurrentX11TimeGetter* currentTimeGetter = window->GetCurrentTimeGetter();
return currentTimeGetter->PropertyNotifyHandler(aWidget, aEvent);
return window->OnPropertyNotifyEvent(aWidget, aEvent);
}
static gboolean

View File

@ -205,6 +205,8 @@ public:
guint aInfo,
guint aTime,
gpointer aData);
gboolean OnPropertyNotifyEvent(GtkWidget *aWidget,
GdkEventProperty *aEvent);
virtual already_AddRefed<mozilla::gfx::DrawTarget>
StartRemoteDrawingInRegion(nsIntRegion& aInvalidRegion) override;
@ -226,6 +228,8 @@ private:
void GrabPointer (guint32 aTime);
void ReleaseGrabs (void);
void UpdateClientOffset();
public:
enum PluginType {
PluginType_NONE = 0, /* do not have any plugin */
@ -390,6 +394,8 @@ private:
int32_t mTransparencyBitmapWidth;
int32_t mTransparencyBitmapHeight;
nsIntPoint mClientOffset;
#if GTK_CHECK_VERSION(3,4,0)
// This field omits duplicate scroll events caused by GNOME bug 726878.
guint32 mLastScrollEventTime;