Detecting window visibility?



Hi all,

I need to query or to know if a window is minimized or totally visible,
and and don't see how.  Here is why and what I've tried:

My application allows creating or opening a stack of many documents,
each in its own toplevel window.

There is one distinct toolbox window, working for all documents, so I
must know what is the "active" document at any moment to apply the
current tool on the right document.

Documents are in a list.  A global variable contains the pointer of the
current node. So, the solution was to find one (Gdk)Event (or maybe
more) which activates the document visible on the top of the stack by
initializing the global variable with its node.

I've found that "focus-in-event", connected on the GtkWindow, does the
job pretty well:  it is triggered when the user clicks on a window for
bringing it on the top, and also when the user clicks on the window's
icon in the KDE or Gnome top or bottom bar.

However, there is a problem when the user minimizes the topmost window.
If the mouse pointer is over the window which is just under the
minimized window, a "focus-in-event" is emitted for the window now
uncovered.  But if the mouse pointer is outside any window, the
"focus-in-event" is not emitted, and the toolbox works on an invisible
window, except, naturally, when the user clicks on the uncovered window.

I've tried to connect an "expose-event" to the window, but the event is
emitted too often in an irrelevant way.  For instance, when the user
moves the topmost window, an expose event is emitted for the window
under it, because it is partially uncovered.


How can I be sure that I do not apply a process on a document which is
in a minimized window, when at least one document is visible?  I would
probably be able to do that if I can test that a window
    (1) is now in a minimized state, or
    (2) has just been minimized (what is the event?), or
    (3) is now totally visible

But how can it be done?

I work with Gtk 1.2.8, for now.


Thanks!

Patrice St-Gelais




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