window: Set the type hint when it changes, not just on map()

There is no reason to wait until map() to reset a type hint on the GDK
window. Just set it when it changes.
This commit is contained in:
Benjamin Otte 2015-07-19 04:44:17 +02:00
parent b0ac837271
commit 04883e72fa

View File

@ -219,7 +219,6 @@ struct _GtkWindowPrivate
guint focus_visible : 1; guint focus_visible : 1;
guint modal : 1; guint modal : 1;
guint position : 3; guint position : 3;
guint reset_type_hint : 1;
guint resizable : 1; guint resizable : 1;
guint skips_pager : 1; guint skips_pager : 1;
guint skips_taskbar : 1; guint skips_taskbar : 1;
@ -3501,6 +3500,7 @@ gtk_window_set_type_hint (GtkWindow *window,
GdkWindowTypeHint hint) GdkWindowTypeHint hint)
{ {
GtkWindowPrivate *priv; GtkWindowPrivate *priv;
GdkWindow *gdk_window;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
@ -3511,10 +3511,9 @@ gtk_window_set_type_hint (GtkWindow *window,
priv->type_hint = hint; priv->type_hint = hint;
if (gtk_widget_get_mapped (GTK_WIDGET (window))) gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
gdk_window_set_type_hint (gtk_widget_get_window (GTK_WIDGET (window)), hint); if (gdk_window)
else gdk_window_set_type_hint (gdk_window, hint);
priv->reset_type_hint = TRUE;
g_object_notify (G_OBJECT (window), "type-hint"); g_object_notify (G_OBJECT (window), "type-hint");
@ -6116,17 +6115,6 @@ gtk_window_map (GtkWidget *widget)
priv->need_default_size = FALSE; priv->need_default_size = FALSE;
priv->need_default_position = FALSE; priv->need_default_position = FALSE;
if (priv->reset_type_hint)
{
/* We should only reset the type hint when the application
* used gtk_window_set_type_hint() to change the hint.
* Some applications use X directly to change the properties;
* in that case, we shouldn't overwrite what they did.
*/
gdk_window_set_type_hint (gdk_window, priv->type_hint);
priv->reset_type_hint = FALSE;
}
gdk_window_show (gdk_window); gdk_window_show (gdk_window);
if (!disable_startup_notification && if (!disable_startup_notification &&