On Freitag, 14. August 2015 18:00:52 CEST, Cosmin Apreutesei wrote:

Well, I'm using XWithdrawWindow() if it makes any difference, because
XUnmapWindow() doesn't properly hide minimized windows (it doesn't
send UnmapNotify).

Aha.

XWithdrawWindow() basically tells the windowmanager: "please forget about this 
window. I'll now re-use it for entirely different purposes"

The fact that you're skeptical of this makes me think this is a bug in
Unity.

Yesno. (Some) compositing windowmanagers (conditionally) do no unmap iconified (ie. 
"minimized") windows in order to keep the redirected windows updated (when 
showing previews in exposé clones or the taskbar tooltips etc.)



The correct solution depends on what you're trying to do, but if you want to know when a 
window was "minimized" (in a managed environment and that *is* supposed to work 
with compositing WMs as well) you'd rather track the WM_STATE¹ and/or _NET_WM_STATE² (for 
_NET_WM_STATE_HIDDEN) properties.

If you want to "minimize" the window, the "proper" approach is to ask³ the 
windowmanager to do so.

FYI, X11 is not an API but a protocol. APIs like Xlib or xcb implement it and 
user code would rather use toolkits like Qt, gtk, fltk, ... which more or less 
nicely abtract the usual tasks.

function restore()
   if minimized() then
      unminimize()
   elseif maximized() then
      unmaximize()
   end
end

If that's not provided by the API already, how can I possibly
implement the above with an async API?

I'm not actually sure where you see an async problem in the above - "minimized" would query formentioned WM_STATE 
property (as "minimized" does *not* equal unmapped - notably windows can be unmapped w/o being tagged 
"iconified", eg. when being shaded; for "unmapped" use XGetWindowAttributes[4]) and "of course" X11 
knows something like a blocking (not actually, though) process via XSync()[5] which will ensure at least the calls of your client 
have been processed (how other clients react to this is a different question - if you want to wait for a reaction of the window 
manager process, you obviously need to wait for that)

You're confusing things here in that X11 is, as mentioned, NOT an API and Xlib is a very 
low-level API. It's not meant to be "simple".
Also Wayland is like X, but unlike Mir, a protocol - (rather) not an API.

Doing what you suggested in an abstraction layer like eg. Qt is indeed /that/ 
simple as you wrote it down.


Cheers,
Thomas

[1] https://tronche.com/gui/x/icccm/sec-4.html
[2] 
http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472615568
[3] 
https://tronche.com/gui/x/xlib/ICC/client-to-window-manager/XIconifyWindow.html
[4] https://tronche.com/gui/x/xlib/window-information/XGetWindowAttributes.html
[5] https://tronche.com/gui/x/xlib/event-handling/XSync.html
_______________________________________________
[email protected]: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Reply via email to