Re: can you help w/ a Xlib question?




lm@who.net (Larry McVoy) writes:

> Hi folks, sorry to bother this list but I figured this is where the 
> X talent is these days.  I'm trying to make a little program that is
> essentially a command line window manager, you give it xids and 
> commands and it does them.  So far, I'm hung up on movement.  I'm
> getting weird interaction with different window managers.  The 
> easiest way to explain it is a demo.  So try this:
> 
> 	. unpack this program into xmove.c
> 	. cc xmove.c -l/usr/X11R6/lib -lX11
> 	. xterm &
> 	. xterm &
> 	. xlsclients -l
> 	. a.out 0x1234 0x5678
> 	  >>> where the 0x1234 & 0x5678 are the window ids for the last
> 	  >>> two xterms in xlsclients' output
> 
> 	  then give it x y coords, those are deltas. Like so
> 
> 	  $ a.out 0x280000e 0x2c0000e
> 	  10 10	# move to over, 10 down
> 	  0 -50	# move up 50
> 	  ^D
> 
> This works well under ctwm but not under redhat's default window manager.
> It's a tiny program, can anyone tell me how this should be done?

Well, without trying things out, I'm not sure exactly - but here
is my guess. You probably realize that a client window is typically
not an immediate child of the root window. The window manager
reparents the window into one of its own windows and uses that
to display the decorations.

Your code is trying to move that WM's window - but that is going
to, I suspect, produce undefined results. (The WM intercepts
all ConfigureRequest calls and processes them itself)

You should, instead, probably be making the XMoveWindow call directly
on the client window - (and should realize that the coordinates that
you give in that call will be interpreted as root relative, not
parent relative). You probably will still have to walk up the tree
to figure out what the _current_ position of the window is relative
to the root. 

(You should be able to convert your code to do that pretty easily,
but just to make this somewhat GNOME/GTK relevant, the code
is in gtk+/gdk/gdkinputcommon.h as well)

There is lots of information about this in the chapter 4 of the
ICCCM.

Hope this helps,
                                        Owen



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