trayicon: Change to use gtk_window_set_visual()
One less user of colormaps, and the code is cleaner, too!
This commit is contained in:
parent
59b227e123
commit
4515f0803b
@ -821,12 +821,10 @@ gtk_tray_icon_delete (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_tray_icon_set_colormap (GtkTrayIcon *icon)
|
gtk_tray_icon_set_visual (GtkTrayIcon *icon)
|
||||||
{
|
{
|
||||||
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (icon));
|
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (icon));
|
||||||
GdkColormap *colormap;
|
|
||||||
GdkVisual *visual = icon->priv->manager_visual;
|
GdkVisual *visual = icon->priv->manager_visual;
|
||||||
gboolean new_colormap = FALSE;
|
|
||||||
|
|
||||||
/* To avoid uncertainty about colormaps, _NET_SYSTEM_TRAY_VISUAL is supposed
|
/* To avoid uncertainty about colormaps, _NET_SYSTEM_TRAY_VISUAL is supposed
|
||||||
* to be either the screen default visual or a TrueColor visual; ignore it
|
* to be either the screen default visual or a TrueColor visual; ignore it
|
||||||
@ -835,20 +833,10 @@ gtk_tray_icon_set_colormap (GtkTrayIcon *icon)
|
|||||||
if (visual && visual->type != GDK_VISUAL_TRUE_COLOR)
|
if (visual && visual->type != GDK_VISUAL_TRUE_COLOR)
|
||||||
visual = NULL;
|
visual = NULL;
|
||||||
|
|
||||||
if (visual == NULL || visual == gdk_screen_get_system_visual (screen))
|
if (visual == NULL)
|
||||||
colormap = gdk_screen_get_system_colormap (screen);
|
visual = gdk_screen_get_system_visual (screen);
|
||||||
else if (visual == gdk_screen_get_rgba_visual (screen))
|
|
||||||
colormap = gdk_screen_get_rgba_colormap (screen);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
colormap = gdk_colormap_new (visual, FALSE);
|
|
||||||
new_colormap = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_set_colormap (GTK_WIDGET (icon), colormap);
|
gtk_window_set_visual (GTK_WINDOW (icon), visual);
|
||||||
|
|
||||||
if (new_colormap)
|
|
||||||
g_object_unref (colormap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -857,8 +845,8 @@ gtk_tray_icon_realize (GtkWidget *widget)
|
|||||||
GtkTrayIcon *icon = GTK_TRAY_ICON (widget);
|
GtkTrayIcon *icon = GTK_TRAY_ICON (widget);
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
|
|
||||||
/* Set our colormap before realizing */
|
/* Set our visual before realizing */
|
||||||
gtk_tray_icon_set_colormap (icon);
|
gtk_tray_icon_set_visual (icon);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_tray_icon_parent_class)->realize (widget);
|
GTK_WIDGET_CLASS (gtk_tray_icon_parent_class)->realize (widget);
|
||||||
window = gtk_widget_get_window (widget);
|
window = gtk_widget_get_window (widget);
|
||||||
|
Loading…
Reference in New Issue
Block a user