зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1449166: Trick GTK into using values from gtk_window_resize when showing maximized windows. r=karlt
So as to provide a sensible size for the window when the user exits maximized state. MozReview-Commit-ID: DSXawb85xmL --HG-- extra : rebase_source : b65f9d8238061dab4b53ef2282d1d1102ec11ace
This commit is contained in:
Родитель
39d0e25c38
Коммит
c20d7a21d2
|
@ -3327,6 +3327,33 @@ nsWindow::OnWindowStateEvent(GtkWidget *aWidget, GdkEventWindowState *aEvent)
|
|||
}
|
||||
// else the widget is a shell widget.
|
||||
|
||||
// The block below is a bit evil.
|
||||
//
|
||||
// When a window is resized before it is shown, gtk_window_resize() delays
|
||||
// resizes until the window is shown. If gtk_window_state_event() sees a
|
||||
// GDK_WINDOW_STATE_MAXIMIZED change [1] before the window is shown, then
|
||||
// gtk_window_compute_configure_request_size() ignores the values from the
|
||||
// resize [2]. See bug 1449166 for an example of how this could happen.
|
||||
//
|
||||
// [1] https://gitlab.gnome.org/GNOME/gtk/blob/3.22.30/gtk/gtkwindow.c#L7967
|
||||
// [2] https://gitlab.gnome.org/GNOME/gtk/blob/3.22.30/gtk/gtkwindow.c#L9377
|
||||
//
|
||||
// In order to provide a sensible size for the window when the user exits
|
||||
// maximized state, we hide the GDK_WINDOW_STATE_MAXIMIZED change from
|
||||
// gtk_window_state_event() so as to trick GTK into using the values from
|
||||
// gtk_window_resize() in its configure request.
|
||||
//
|
||||
// We instead notify gtk_window_state_event() of the maximized state change
|
||||
// once the window is shown.
|
||||
if (!mIsShown) {
|
||||
aEvent->changed_mask = static_cast<GdkWindowState>
|
||||
(aEvent->changed_mask & ~GDK_WINDOW_STATE_MAXIMIZED);
|
||||
} else if (aEvent->changed_mask & GDK_WINDOW_STATE_WITHDRAWN &&
|
||||
aEvent->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) {
|
||||
aEvent->changed_mask = static_cast<GdkWindowState>
|
||||
(aEvent->changed_mask | GDK_WINDOW_STATE_MAXIMIZED);
|
||||
}
|
||||
|
||||
// We don't care about anything but changes in the maximized/icon/fullscreen
|
||||
// states
|
||||
if ((aEvent->changed_mask
|
||||
|
|
Загрузка…
Ссылка в новой задаче