Forum > Linux

X11 - IsWindow ?

(1/1)

Dibo:
Hi,

On windows, if I have handle to window (HWND), I can check if it exists calling function:
IsWindow(window: HWND): Boolean

Is there a similar function in X11? I'm looking in xlib, xutil units but I don't see anything interesting. I have some TWindow and I want check if it still exists. Now I'm calling some XEvent and checking for BadWindow X11 error code :P

Regards and sorry for English

theo:
I wrote some code to list and activate top-level windows:
http://www.theo.ch/lazarus/winlist.zip
Maybe it helps.

Dibo:
I have not found exactly such a function but I use XGetWindowAttributes from your sources instead of checking events. At the end I'm Checking for BadWindow. It's good for me. Thanks

theo:
It should be easy. You get a list of all toplevel windows.
This should be enough to check if a XID (HWND) exists:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Function IsWindow(XID:Cardinal):Boolean;var xwl:TXWindowList;beginxwl:=TXWindowList.Create;xwl.UpdateWindowList;Result:=xwl.WindowList.IndexOf(XID)>-1;xwl.free;end;

You can also check by window name.

Dibo:
Thanks!

Navigation

[0] Message Index

Go to full version