XFWM4 Window Problems, Part Deux

Olivier Fourdan fourdan at xfce.org
Wed Nov 15 14:49:28 CET 2006


Sorry, I was wrong, the problem doesn't lie in gtk+ at all. It's in your program. Let me explain, if you will...


With your given sample program, the window application sometime shows mapped, sometime it appears iconified.


There is a race condition between the application and the window manager. That's why it's not 100% reproducible, even between different window managers.

The scenario of events, as they occur in time:

1) the user iconifies the window,
2) The window manager unmaps the frame and then the client window,
3) The application unmaps the window, again, with on_window_state_event() callback
   line 62: gtk_widget_hide (widget);
   => It's where the race condition occurs, depending on which unmap event reaches the X server first.
4) The timeout occurs present_window () gets called, and the application invokes gtk_window_present (window);
5) The window manager remaps the frame and the client window, unfortuantely, the widget could be unmapped, and then the window shows hidden.


Either call gtk_widget_show () in present_window () to remap the widget or avoid calling gtk_widget_hide (); in on_window_state_event (). Both methods work and avoid the nasty race condition that occurs in your code.

Sample program fixed attached.

I hope you can understand and accept this explanation. Race conditions are quite common in the X11 world...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: iconify-present-correct.c
Type: text/x-csrc
Size: 3493 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20061115/06c50820/attachment.c>

More information about the Xfce4-dev mailing list