Skip to content

Commit 9de3a86

Browse files
committed
Tray: simplify force-redraw, use code that actually works
Prevent most corruption of tray icons and reduce by half incomplete rendering of them, replace a never-built code block that could not be built, and replace (deprecated) direct expose handling with gtk_widget_hide/gtk_widget_show_all *Note that this is needed for GTK 3.23 but may help remaining icon issues with GTK 3.22 as well and is simpler code in any case
1 parent 17ac8aa commit 9de3a86

File tree

1 file changed

+5
-42
lines changed

1 file changed

+5
-42
lines changed

applets/notification_area/system-tray/na-tray-child.c

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -561,48 +561,11 @@ na_tray_child_force_redraw (NaTrayChild *child)
561561

562562
if (gtk_widget_get_mapped (widget))
563563
{
564-
#if 1
565-
/* Sending an ExposeEvent might cause redraw problems if the
566-
* icon is expecting the server to clear-to-background before
567-
* the redraw. It should be ok for GtkStatusIcon or EggTrayIcon.
568-
*/
569-
GdkDisplay *display;
570-
Display *xdisplay;
571-
XEvent xev;
572-
GdkWindow *plug_window;
573-
GtkAllocation allocation;
574-
575-
display = gtk_widget_get_display (widget);
576-
xdisplay = GDK_DISPLAY_XDISPLAY (display);
577-
578-
plug_window = gtk_socket_get_plug_window (GTK_SOCKET (child));
579-
gtk_widget_get_allocation (widget, &allocation);
580-
581-
xev.xexpose.type = Expose;
582-
xev.xexpose.window = GDK_WINDOW_XID (plug_window);
583-
xev.xexpose.x = 0;
584-
xev.xexpose.y = 0;
585-
xev.xexpose.width = allocation.width;
586-
xev.xexpose.height = allocation.height;
587-
xev.xexpose.count = 0;
588-
589-
gdk_x11_display_error_trap_push (display);
590-
XSendEvent (xdisplay,
591-
xev.xexpose.window,
592-
False, ExposureMask,
593-
&xev);
594-
/* We have to sync to reliably catch errors from the XSendEvent(),
595-
* since that is asynchronous.
596-
*/
597-
XSync (xdisplay, False);
598-
gdk_x11_display_error_trap_pop_ignored (display);
599-
#else
600-
/* Hiding and showing is the safe way to do it, but can result in more
601-
* flickering.
602-
*/
603-
gdk_window_hide (widget->window);
604-
gdk_window_show (widget->window);
605-
#endif
564+
/* Hiding and showing is the safe way to do it, but can result in more
565+
* flickering.
566+
*/
567+
gtk_widget_hide(widget);
568+
gtk_widget_show_all(widget);
606569
}
607570
}
608571

0 commit comments

Comments
 (0)