Another fix for unmapped window states

The previous fix was falling into the crack between
realized and mapped - we would apply the state when a window
is just realized, then unset the _initially flag, and then
when the window gets mapped, we'd undo the state. To fix
this, go back to the way things were when these flags were
first introduced.

https://bugzilla.gnome.org/show_bug.cgi?id=752765
This commit is contained in:
Matthias Clasen 2015-07-23 17:53:13 -04:00
parent 56051b0bd8
commit 1138d4f489

View File

@ -9957,26 +9957,20 @@ gtk_window_present_with_time (GtkWindow *window,
* *
* You can track iconification via the window-state-event signal * You can track iconification via the window-state-event signal
* on #GtkWidget. * on #GtkWidget.
*
**/ **/
void void
gtk_window_iconify (GtkWindow *window) gtk_window_iconify (GtkWindow *window)
{ {
GtkWindowPrivate *priv;
GtkWidget *widget;
GdkWindow *toplevel; GdkWindow *toplevel;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
priv = window->priv; window->priv->iconify_initially = TRUE;
widget = GTK_WIDGET (window);
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_iconify (toplevel); gdk_window_iconify (toplevel);
else
priv->iconify_initially = TRUE;
} }
/** /**
@ -9995,21 +9989,16 @@ gtk_window_iconify (GtkWindow *window)
void void
gtk_window_deiconify (GtkWindow *window) gtk_window_deiconify (GtkWindow *window)
{ {
GtkWindowPrivate *priv;
GtkWidget *widget;
GdkWindow *toplevel; GdkWindow *toplevel;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
priv = window->priv; window->priv->iconify_initially = FALSE;
widget = GTK_WIDGET (window);
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_deiconify (toplevel); gdk_window_deiconify (toplevel);
else
priv->iconify_initially = FALSE;
} }
/** /**
@ -10028,26 +10017,20 @@ gtk_window_deiconify (GtkWindow *window)
* *
* You can track stickiness via the window-state-event signal * You can track stickiness via the window-state-event signal
* on #GtkWidget. * on #GtkWidget.
*
**/ **/
void void
gtk_window_stick (GtkWindow *window) gtk_window_stick (GtkWindow *window)
{ {
GtkWindowPrivate *priv;
GtkWidget *widget;
GdkWindow *toplevel; GdkWindow *toplevel;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
priv = window->priv; window->priv->stick_initially = TRUE;
widget = GTK_WIDGET (window);
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_stick (toplevel); gdk_window_stick (toplevel);
else
priv->stick_initially = TRUE;
} }
/** /**
@ -10063,26 +10046,20 @@ gtk_window_stick (GtkWindow *window)
* *
* You can track stickiness via the window-state-event signal * You can track stickiness via the window-state-event signal
* on #GtkWidget. * on #GtkWidget.
*
**/ **/
void void
gtk_window_unstick (GtkWindow *window) gtk_window_unstick (GtkWindow *window)
{ {
GtkWindowPrivate *priv;
GtkWidget *widget;
GdkWindow *toplevel; GdkWindow *toplevel;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
priv = window->priv; window->priv->stick_initially = FALSE;
widget = GTK_WIDGET (window);
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_unstick (toplevel); gdk_window_unstick (toplevel);
else
priv->stick_initially = FALSE;
} }
/** /**
@ -10104,26 +10081,20 @@ gtk_window_unstick (GtkWindow *window)
* You can track maximization via the window-state-event signal * You can track maximization via the window-state-event signal
* on #GtkWidget, or by listening to notifications on the * on #GtkWidget, or by listening to notifications on the
* #GtkWindow:is-maximized property. * #GtkWindow:is-maximized property.
*
**/ **/
void void
gtk_window_maximize (GtkWindow *window) gtk_window_maximize (GtkWindow *window)
{ {
GtkWindowPrivate *priv;
GtkWidget *widget;
GdkWindow *toplevel; GdkWindow *toplevel;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
priv = window->priv; window->priv->maximize_initially = TRUE;
widget = GTK_WIDGET (window);
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_maximize (toplevel); gdk_window_maximize (toplevel);
else
priv->maximize_initially = TRUE;
} }
/** /**
@ -10139,26 +10110,20 @@ gtk_window_maximize (GtkWindow *window)
* *
* You can track maximization via the window-state-event signal * You can track maximization via the window-state-event signal
* on #GtkWidget. * on #GtkWidget.
*
**/ **/
void void
gtk_window_unmaximize (GtkWindow *window) gtk_window_unmaximize (GtkWindow *window)
{ {
GtkWindowPrivate *priv;
GtkWidget *widget;
GdkWindow *toplevel; GdkWindow *toplevel;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
priv = window->priv; window->priv->maximize_initially = FALSE;
widget = GTK_WIDGET (window);
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_unmaximize (toplevel); gdk_window_unmaximize (toplevel);
else
priv->maximize_initially = FALSE;
} }
/** /**
@ -10181,21 +10146,16 @@ gtk_window_unmaximize (GtkWindow *window)
void void
gtk_window_fullscreen (GtkWindow *window) gtk_window_fullscreen (GtkWindow *window)
{ {
GtkWindowPrivate *priv;
GtkWidget *widget;
GdkWindow *toplevel; GdkWindow *toplevel;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
priv = window->priv; window->priv->fullscreen_initially = TRUE;
widget = GTK_WIDGET (window);
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_fullscreen (toplevel); gdk_window_fullscreen (toplevel);
else
priv->fullscreen_initially = TRUE;
} }
/** /**
@ -10218,21 +10178,16 @@ gtk_window_fullscreen (GtkWindow *window)
void void
gtk_window_unfullscreen (GtkWindow *window) gtk_window_unfullscreen (GtkWindow *window)
{ {
GtkWidget *widget;
GdkWindow *toplevel; GdkWindow *toplevel;
GtkWindowPrivate *priv;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
priv = window->priv; window->priv->fullscreen_initially = FALSE;
widget = GTK_WIDGET (window);
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_unfullscreen (toplevel); gdk_window_unfullscreen (toplevel);
else
priv->fullscreen_initially = FALSE;
} }
/** /**
@ -10267,26 +10222,19 @@ void
gtk_window_set_keep_above (GtkWindow *window, gtk_window_set_keep_above (GtkWindow *window,
gboolean setting) gboolean setting)
{ {
GtkWidget *widget;
GtkWindowPrivate *priv;
GdkWindow *toplevel; GdkWindow *toplevel;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
setting = setting != FALSE; setting = setting != FALSE;
priv = window->priv; window->priv->above_initially = setting;
widget = GTK_WIDGET (window); window->priv->below_initially &= !setting;
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_set_keep_above (toplevel, setting); gdk_window_set_keep_above (toplevel, setting);
else
{
priv->above_initially = setting;
priv->below_initially &= !setting;
}
} }
/** /**
@ -10321,26 +10269,19 @@ void
gtk_window_set_keep_below (GtkWindow *window, gtk_window_set_keep_below (GtkWindow *window,
gboolean setting) gboolean setting)
{ {
GtkWidget *widget;
GtkWindowPrivate *priv;
GdkWindow *toplevel; GdkWindow *toplevel;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
setting = setting != FALSE; setting = setting != FALSE;
priv = window->priv; window->priv->below_initially = setting;
widget = GTK_WIDGET (window); window->priv->above_initially &= !setting;
toplevel = gtk_widget_get_window (widget); toplevel = gtk_widget_get_window (GTK_WIDGET (window));
if (toplevel != NULL) if (toplevel != NULL)
gdk_window_set_keep_below (toplevel, setting); gdk_window_set_keep_below (toplevel, setting);
else
{
priv->below_initially = setting;
priv->above_initially &= !setting;
}
} }
/** /**