focus stealing prevention in xfdesktop

Olivier Fourdan fourdan at xfce.org
Thu Feb 23 18:33:23 CET 2006


Brian J. Tarricone wrote:
>> To achieve what you want, you may use the following (which is perfectly standard):
>>
>>   gdk_x11_window_set_user_time (GdkWindow, GDK_CURRENT_TIME);
>>
>> That will tell the WM that you mean to focus the window anyway even if focus prevention is enabled.
> 
> Ah, cool, thanks.  Which GdkWindow should be set as the parameter here?
>  I assume xfdesktop's vroot window, since that's really the only
> persistent window, but technically it's the menu shell window that
> causes the event.


Well, maybe I missed the point. If you map an existing window (such as 
MCS plug-ins windows for example), then GTK doesn't update the user_time 
as there was no real user activity on the widnow since the last unmap. 
As a result, the window will unlikely be focused.

To avoid that, prior to show the window, you should reset the user_time 
to GTK_CURRENT_TIME (actually 0) on the corresponding GdkWindow so that 
the windows gets focused.

Now, I'm not sure what you mean by xfdesktop window as the vroot window 
is unlikely to be mapped/unmapped.

Cheers,
Olivier.




More information about the Xfce4-dev mailing list