Re: Gtk::Widget::is_mapped ()



No, it's not. The issue is not GTK: it's the windowing system.

With the advent of compositing, all windows are "visible" all the time, from a toolkit perspective. The compositor is responsible for building what's presented to the user. For example: are windows fully visible when doing an "exposé"-like view? Are they not? If the compositor is ultimately responsible of creating the final result of what's on the screen, it could put each window on separate planets as far as the toolkit is concerned (assuming latency and coordinate space size aren't a problem).

On Wayland is even "worse", because each window surface is completely separate from every other window surface by design; each window has its own coordinate system, that has an origin in the top-left corner of the window. A window *cannot* be obscured by another window, as far as the toolkit is concerned.

If you're targeting an X11 system from the late '90s/early '00s, then visibility notifications *may* be emitted (though they are never guaranteed). On anything more modern than that, or on Wayland/Windows/macOS, visibility notification events are either non-sensical, not emitted, or not possible by design.

This is why I said: "there is no way to know".

Ciao,
 Emmanuele.

On Sun, 3 Mar 2019 at 16:10, Paul Davis <paul linuxaudiosystems com> wrote:



On Sun, Mar 3, 2019 at 6:26 AM Emmanuele Bassi via gtk-devel-list <gtk-devel-list gnome org> wrote:
On Sun, 3 Mar 2019 at 12:58, John Emmas <john creativepost co uk> wrote:

For example... let's say the widget is a top-level window.  If it's currently displayed on screen but there's some other window hiding it (maybe from a totally different app) would 'is_visible()' return true or false?

That's entirely different, and you should have said so at the very beginning of the thread. Yes, both "visible" and "mapped" would be set to true because you called show() on the window, and a window has no parents, so once it's visible and realized, it'll be mapped as well; there is no way to know, from a toolkit perspective, if a top level is being partially, or totally, covered by some other window, either in the same process or from a different process. That information is only available to the window manager.

John should really know that there's code to do this (to the best extent possible) within the Ardour source code at libs/gtkmm2ext/visibility_tracker.cc :)))

It works (to whatever extent it does work) by handling GtkEventVisibility notifications. Hopefully this is still possible in GTK3 ?



--
https://www.bassi.io
[@] ebassi [@gmail.com]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]