Closed rozniak closed 1 year ago
There is some old code from the SDL mailing list that might assist with this (I'm not familiar with the X11 API itself).
Potential solution from there involves creating a dummy window, changing a property on it, and then the property changed event can give us an X timestamp we can base future requests from?
https://discourse.libsdl.org/t/patch-event-timestamp-propagation-for-x11/20379
Retrieved the attached patch from Wayback Machine: attachment-0001.txt
Looking into integrating this into libwintc-shelldpa
after #219 is done.
The above is stupid. Obviously libxfce4windowing
will have already solved this problem for WNCK.
wnck_window_unminimize(priv->wnck_window, g_get_monotonic_time() / 1000);
Didn't realise g_get_monotonic_time()
would work for this, but it does seem like it solves the problem.
This is still a problem.
I can reproduce this reliably by having a Mono window create a child window. Window switching immediately stops working.
I have tried compiling xfwm4 with tracing on to get to the bottom of this, and I'm none the wiser.
Maybe I'll have to dig around tomorrow, failing that I might have to see if I can ask an XFCE developer. I have logged out the windows we're attempting to pop up, and for some reason it seems like xfwm4 has other ideas (I request Discord, and it's focusing VirtualBox? which doesn't even actually get focused either)
EDIT: This is with Focus Stealing Prevention on
Some more digging - turns out a call to wnck_set_client_type(WNCK_CLIENT_TYPE_PAGER);
is needed.
I found this via a forum post which mentions a related code snippet - https://forum.xfce.org/viewtopic.php?pid=34604#p34604
This snippet is updated now as it was bugged in that forum post, but it mentions ignoring the request if the source is an 'application' rather than a pager. Did a search for 'pager' under XFCE Panel source and found that call to wnck_set_client_type
. Lo' and behold it works!
Just need to tidy up this fix.
On a separate note I think something funky causes this, whether it's a Mono bug I'm not sure. Poking around the XFWM debug logged revealed this:
TRACE[display.c:832] myDisplayGetCurrentTime(): timestamp=97889298
TRACE[hints.c:1339] getXServerTime(): timestamp=97889298
TRACE[display.c:847] myDisplayGetTime(): timestamp=97889298
TRACE[display.c:856] myDisplayGetLastUserTime(): timestamp=1693609877
TRACE[netwm.c:1443] clientHandleNetActiveWindow(): time of event received is 97889298, current XServer time is 1693609877
Why the 'user time' is this massively high value, I have no idea. Probably warrants further investigation, as this also causes other issues related to focus stealing prevention (eg. the run
dialog cannot raise itself once the Mono child window has opened).
This is probably specific to X, when Mono or WINE is running a program, the taskbar buttons stop being able to pop up windows.
This is most likely due to the timestamp here: https://github.com/rozniak/xfce-winxp-tc/blob/master/shared/shelldpa/src/impl-wndmgmt-wnck.c#L132