Re: Gtk::Widget::is_mapped ()

On Sun, 3 Mar 2019 at 12:58, John Emmas <john creativepost co uk> wrote:
On 03/03/2019 11:22, Emmanuele Bassi wrote:
On Sun, 3 Mar 2019 at 11:09, John Emmas <john creativepost co uk> wrote:
Sorry to ask a dumb question...

What does it mean if a widget is "mapped" ?

It means that:

 - the widget is visible
 - the widget is realized
 - all its ancestors up to the top level window are mapped

Thanks Emmanuele - can I just check 'is_visible()'?  Does it mean 'literally visible' or 'capable of being visible'?

If it were enough, why would we have two flags? :-)

The "visible" property means "you, or something else, called gtk_widget_show()" on the widget. A widget can be visible and not have any parent, for instance.

If you want to know that a widget is going to be drawn, and respond to events, then you have to check the "mapped" state.

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.



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