twm and intel dual head using xrandr

Eeri Kask Eeri.Kask at inf.tu-dresden.de
Tue Jun 10 05:12:40 PDT 2008


Hugo.Jacques at verint.com:

 > The only problem I have is that the top left corner of each of
 > my windows always end up on my first screen when I try to move
 > them on my secondary screen.

 > I am using 1280x768 resolution on my first screen and 1024x768
 > on my second one.  My Virtual screen size as set in Xorg.conf
 > is 2048x2048.  I am using TWM.

 > Would that be a TWM limitation? (I could not find anything
 > while searching the web)


Not having recent enough hardware which is supported by xrandr dynamic 
screen management nevertheless let me explain what twm-1.0.4 probably does.

During startup the screen width/height are detected by

     DisplayWidth()
     DisplayHeight()

functions and any further access to the screen size is done by reading 
these values saved during startup.  Next, if one tries to put a window 
to the far right or bottom off screen (there is no test in respect to 
top/left screen edges in the twm code though), i.e. having the window 
top/left corner beyond one of the values above, the corresponding 
coordinate of the window origin is shifted "back", resulting in being 
slightly "on screen".

Now if during runtime the X server or whoever decides to enlarge/shrink 
the screen, i.e. any further executing of the above functions would 
return greater/smaller values, the twm's knowledge about the screen size 
is not updated.  (Probably manually checking by 'xdpyinfo' would 
disclose any X11-screen size change?)

Recently I added Xinerama support to twm, download the script

     www1.inf.tu-dresden.de/~ek1/TWM-Tweaked.sh

and run this, this downloads the Xorg twm-1.0.4 sources, a smaller patch 
set (www1.inf.tu-dresden.de/~ek1/twm-1.0.4-tweaked-diffs.tar) and 
compiles a twm with Xinerama support included.


Not surprisingly twm's internal architecture does not manage screens 
"dynamically" (even does not favor such management) and a major code 
redesign in that respect does not make that much sense (to me).

For now it is much easier to catch the RRScreenChangeNotify event and 
then automatically execute f.restart:  so if you put 
'RestartOnScreenChangeNotify' into .twmrc then XRANDR minimalistic 
support in twm is activated in form of this small feature.  Beware, all 
'zoomed' windows are unzoomed first, as their unzoomed size/position 
would not survive f.restart otherwise.
(The patchset includes a .twmrc with other twm novel features as well.)


If starting twm with '-xinerama' then the geometrical tile arrangement 
is not scanned by XineramaQueryScreens() but with 
XRRGetScreenResources() and by successive XRRGetCrtcInfo(); and if given 
'-v' the detected arrangement is printed to the screen on startup.


As I am not in position to investigate your issue due to lack of 
hardware, I am very glad if you could help me carry out some 
'experiments' if problems exist with the above applied patches.

Greetings,

     Eeri Kask

P.S. In the iconmanager I corrected thousand bugs and introduced one 
which I am currently chasing, so the painting in rare cases in 
SloppyFocus mode paints kind of too much; don't be surprised. :-) :-)




More information about the xorg mailing list