Finding if a window is disabled

Suma Byrappa suma_byrappa at
Sat Nov 4 10:09:16 PST 2006

Hi All,
  This is the continuation of my previous mail. I started to find out if I can use Toolkits to help me in determining if a window is modal or not. But, so far haven't seen any silver bullets.
  Is there a way, I can find out if a window is disabled or not, i.e, mouse and key inputs are of no effect on this particular window. (an example for this case is a window having a modal dialog running). 
  This is an important requirement for me. Any help is greatly appreciated.

Glynn Clements <glynn at> wrote:
  From: Glynn Clements <glynn at>
Date: Sat, 28 Oct 2006 22:10:32 +0100
To: Suma Byrappa <suma_byrappa at>
CC: xorg at
Subject: Re: Finding modal dialogs

Suma Byrappa wrote:

> I need to fnd out if a dialog (or window) is modal or modeless using
> Xlib APIs. What can I use to differentiate between modal and
> modeless?

You can't; at least, not reliably. So far as X is concerned, a window
is a window.

Whether or not a dialog is modal depends upon how the application (or
the toolkit which it uses) treats it. Toolkits typically implement
modal dialogs by ignoring user input events sent to other windows
while a modal dialog is being displayed.

The fact that certain events are being ignored is internal to the
application. You can't reliably detect this from another application.

> I found few topics which mention about override_redirect and
> WM_TRANSIENT_FOR properties. But, when I read the properties of
> dialog windows, they don't match with the usage of
> override_redirect.

If a window has a WM_TRANSIENT_FOR property, it's likely to be a
dialog (rather than e.g. a "document" window), although not
necessarily a modal one. However, nothing forces an application to set
this property on modal dialogs, and nothing prevents it from setting
it on other windows. However, this is the closest that you're likely
to be able to get to determining whether or not a top-level window is
a dialog.

The override_redirect flag is a separate issue. This is used for
windows which should be completely ignored by the WM, e.g. pop-up
menus, tooltips, etc. Any window with this flag probably isn't a
"dialog" of any sort.

Glynn Clements 

 Find out what India is talking about on  - Yahoo! Answers India 
 Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the xorg mailing list