X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtktrayicon-x11.c;h=8295161d7758e11fce46bb9e8e4a9710c07302f5;hb=1247a842a228980a06893e6167ae8c73a4bb6eed;hp=9c35dafd70389116cadbb0238bed76d0ac650a85;hpb=52711beba57239aadde460d49d492ef6951f9335;p=~andy%2Fgtk diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c index 9c35dafd7..8295161d7 100644 --- a/gtk/gtktrayicon-x11.c +++ b/gtk/gtktrayicon-x11.c @@ -12,9 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library. If not, see . */ /* @@ -390,20 +388,13 @@ gtk_tray_icon_draw (GtkWidget *widget, if (focus_child && gtk_widget_has_visible_focus (focus_child)) { GtkStyleContext *context; - GtkStateFlags state; border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); context = gtk_widget_get_style_context (widget); - state = gtk_widget_get_state_flags (widget); - - gtk_style_context_save (context); - gtk_style_context_set_state (context, state); gtk_render_focus (context, cr, border_width, border_width, gtk_widget_get_allocated_width (widget) - 2 * border_width, gtk_widget_get_allocated_height (widget) - 2 * border_width); - - gtk_style_context_restore (context); } return retval; @@ -478,10 +469,6 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon) gulong nitems; gulong bytes_after; int error, result; - GdkVisual *visual; - gint red_prec; - gint green_prec; - gint blue_prec; g_assert (icon->priv->manager_window != None); @@ -496,25 +483,31 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon) &bytes_after, &(prop.prop_ch)); error = gdk_error_trap_pop (); - visual = NULL; - if (!error && result == Success && type == XA_VISUALID && nitems == 1 && format == 32) { - VisualID visual_id = prop.prop[0]; + VisualID visual_id; + GdkVisual *visual; + gint red_prec, green_prec, blue_prec; + + visual_id = prop.prop[0]; visual = gdk_x11_screen_lookup_visual (screen, visual_id); + gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec); + gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec); + gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec); + icon->priv->manager_visual = visual; + icon->priv->manager_visual_rgba = + (red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual)); + } + else + { + icon->priv->manager_visual = NULL; + icon->priv->manager_visual_rgba = FALSE; } - gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec); - gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec); - gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec); - - icon->priv->manager_visual = visual; - icon->priv->manager_visual_rgba = visual != NULL && - (red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual)); - - /* For the background-relative hack we use when we aren't using a real RGBA - * visual, we can't be double-buffered */ + /* For the background-relative hack we use when we aren't + * using a real RGBA visual, we can't be double-buffered + */ gtk_widget_set_double_buffered (GTK_WIDGET (icon), icon->priv->manager_visual_rgba); if (type != None) @@ -762,8 +755,10 @@ gtk_tray_icon_manager_filter (GdkXEvent *xevent, gtk_tray_icon_manager_window_destroyed (icon); } else - GTK_NOTE (PLUGSOCKET, - g_print ("GtkStatusIcon %p: got other message on manager window\n", icon)); + { + GTK_NOTE (PLUGSOCKET, + g_print ("GtkStatusIcon %p: got other message on manager window\n", icon)); + } } return GDK_FILTER_CONTINUE; @@ -886,8 +881,10 @@ gtk_tray_icon_update_manager_window (GtkTrayIcon *icon) } } else - GTK_NOTE (PLUGSOCKET, - g_print ("GtkStatusIcon %p: no tray manager found\n", icon)); + { + GTK_NOTE (PLUGSOCKET, + g_print ("GtkStatusIcon %p: no tray manager found\n", icon)); + } } static void @@ -959,8 +956,8 @@ gtk_tray_icon_realize (GtkWidget *widget) if (icon->priv->manager_visual_rgba) { /* Set a transparent background */ - GdkColor transparent = { 0, 0, 0, 0 }; /* Only pixel=0 matters */ - gdk_window_set_background (window, &transparent); + GdkRGBA transparent = { 0.0, 0.0, 0.0, 0.0 }; + gdk_window_set_background_rgba (window, &transparent); } else {