Re: Help: raising x-window on top of a display through HPUX shell command?

From: Chuck Dillon (spam_at_nimblegen.com)
Date: 04/29/04


Date: Thu, 29 Apr 2004 08:41:36 -0500

cbfk23 wrote:
>
> Thanks a lot for the information which is helpful for me. I can't
> control the name of the X-window and the name seems to be not unique.
> I tried to run dtksk and I got "command not found".
>
> Any information on the little application" to do the raise?

Something like...

#include <X.h>

Display *d=XOpenDisplay(NULL);
if (NULL != d) {
        XRaiseWindow(d,windowid);
        XCloseDisplay(d);
}

Of course you have to identify the windowid. I didn't mention the
xprop client. If you look at the X properties of an application's main
window you find a number of the for WM_* which are standard properties
that the window manager needs and/or sets. For example a typical xterm
on Solaris has:
WM_STATE(WM_STATE):
                 window state: Normal
                 icon window: 0x2c0036c
_DT_WORKSPACE_PRESENCE(_DT_WORKSPACE_PRESENCE) = 0xc6
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW
WM_CLIENT_LEADER(WINDOW): window id # 0x440000d
WM_CLASS(STRING) = "xterm", "XTerm"
WM_HINTS(WM_HINTS):
                 Client accepts input or input focus: True
                 Initial state is Normal State.
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                 user specified size: 742 by 420
                 program specified size: 742 by 420
                 program specified minimum size: 10 by 17
                 program specified resize increment: 6 by 13
                 program specified base size: 4 by 4
WM_CLIENT_MACHINE(STRING) = "aruba"
WM_COMMAND(STRING) = { "xterm", "-ls", "-geometry", "123x32" }
WM_ICON_NAME(STRING) = "xterm"
WM_NAME(STRING) = "xterm"

The WM_CLASS, WM_NAME and WM_COMMAND properties might be of use to you.

What a call like "xwininfo -name foobar" does is seach the window tree
for WM_NAME properties and compares their content to "foobar". I don't
know of any standard client to do a similar search on other properties.
  You could get the sources for xwininfo (or some other similar client)
and use it as a basis for your search.

Also, to raise the application it might or might not be sufficient to
call XRaiseWindow on the application's window. You might have to find
the window manager's wrapper window and raise that. It's been a while
since I done these kinds of things. My X is a bit stale. I think you
need to raise the WM's window which is the window that is a direct
descendent of the root window that is also an ancestor of the
application's window.

As I said before. I suggest you follow-up to comp.windows.x where
there are folks with fresh memories of X esoterics.

-- ced

>
> Neil

-- 
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.


Relevant Pages