Finding modal dialogs

Suma Byrappa suma_byrappa at yahoo.co.in
Sun Oct 29 06:08:44 PST 2006


Thanks a lot, Glynn!
   
  Now that X is not of any hope for me, are there other ways which I can look for? Is there a way I can ask the toolkit or window manager to tell me if a window is disabled (or modal)?
   
  I was looking for conditions to detect if a window is a modal dialog. But, if it is not possible, at the least, I need to find out if a window is in a disabled (i.e, mouse/key events can't be sent to it) or enabled. 
   
  Any hope?
   
  Also, could you please point me to some documents which I can read to understand the internals of Xlib, tool kits and window managers?
   
  Thanks and regards,
  Suma.

Glynn Clements <glynn at gclements.plus.com> wrote:
  
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: <http://lists.x.org/archives/xorg/attachments/20061029/4f61afd3/attachment.html>


More information about the xorg mailing list