Skip to content

Commit 2c548d1

Browse files
lukefromdcmonsta
authored andcommitted
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 a014c7a commit 2c548d1

File tree

1 file changed

+5
-38
lines changed

1 file changed

+5
-38
lines changed

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

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -559,44 +559,11 @@ na_tray_child_force_redraw (NaTrayChild *child)
559559

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

0 commit comments

Comments
 (0)