Skip to content
Browse files
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
  • Loading branch information
lukefromdc authored and monsta committed Nov 26, 2018
1 parent a014c7a commit 2c548d163faa0a15deeb8ec4de85f758bda4d4b0
Showing with 5 additions and 38 deletions.
  1. +5 −38 applets/notification_area/system-tray/na-tray-child.c
@@ -559,44 +559,11 @@ na_tray_child_force_redraw (NaTrayChild *child)

if (gtk_widget_get_mapped (widget))
#if 1
/* Sending an ExposeEvent might cause redraw problems if the
* icon is expecting the server to clear-to-background before
* the redraw. It should be ok for GtkStatusIcon or EggTrayIcon.
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget));
XEvent xev;
GdkWindow *plug_window;
GtkAllocation allocation;

plug_window = gtk_socket_get_plug_window (GTK_SOCKET (child));
gtk_widget_get_allocation (widget, &allocation);

xev.xexpose.type = Expose;
xev.xexpose.window = GDK_WINDOW_XID (plug_window);
xev.xexpose.x = 0;
xev.xexpose.y = 0;
xev.xexpose.width = allocation.width;
xev.xexpose.height = allocation.height;
xev.xexpose.count = 0;

gdk_error_trap_push ();
XSendEvent (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget)),
False, ExposureMask,
/* We have to sync to reliably catch errors from the XSendEvent(),
* since that is asynchronous.
XSync (xdisplay, False);
gdk_error_trap_pop_ignored ();
/* Hiding and showing is the safe way to do it, but can result in more
* flickering.
gdk_window_hide (widget->window);
gdk_window_show (widget->window);
/* Hiding and showing is the safe way to do it, but can result in more
* flickering.

0 comments on commit 2c548d1

Please sign in to comment.