Bug 1457309 - [Gtk+/CSD] Reset toplevel window offset when it's at maximized/fulscreenstate, r?jhorak
MozReview-Commit-ID: DQTVuquMSXn
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3391,16 +3391,20 @@ nsWindow::OnWindowStateEvent(GtkWidget *
if (mWidgetListener) {
mWidgetListener->SizeModeChanged(mSizeState);
if (aEvent->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) {
mWidgetListener->FullscreenChanged(
aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN);
}
}
+
+ if (mCSDSupportLevel == CSD_SUPPORT_CLIENT) {
+ UpdateClientOffsetForCSDWindow();
+ }
}
void
nsWindow::ThemeChanged()
{
NotifyThemeChanged();
if (!mGdkWindow || MOZ_UNLIKELY(mIsDestroyed))
@@ -6629,19 +6633,23 @@ nsWindow::ClearCachedResources()
* It works only for CSD decorated GtkWindow.
*/
void
nsWindow::UpdateClientOffsetForCSDWindow()
{
// _NET_FRAME_EXTENTS is not set on client decorated windows,
// so we need to read offset between mContainer and toplevel mShell
// window.
- GtkBorder decorationSize;
- GetCSDDecorationSize(GTK_WINDOW(mShell), &decorationSize);
- mClientOffset = nsIntPoint(decorationSize.left, decorationSize.top);
+ if (mSizeState == nsSizeMode_Normal) {
+ GtkBorder decorationSize;
+ GetCSDDecorationSize(GTK_WINDOW(mShell), &decorationSize);
+ mClientOffset = nsIntPoint(decorationSize.left, decorationSize.top);
+ } else {
+ mClientOffset = nsIntPoint(0, 0);
+ }
// Send a WindowMoved notification. This ensures that TabParent
// picks up the new client offset and sends it to the child process
// if appropriate.
NotifyWindowMoved(mBounds.x, mBounds.y);
}
nsresult