ssanthosh243 / semicomplete

Automatically exported from code.google.com/p/semicomplete
0 stars 0 forks source link

RFE: "getwindowfocus" switch to get the top-level parent of the focussed window #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. start a gnome-terminal
2. run 'wid=`xdotool getwindowfocus`'
3. run 'xdotool windowmove $wid 200 200'

What is the expected output? What do you see instead?

The window should move to [200, 200].  it doesn't move at all.  This
appears to be because the returned wid is a subwindow, instead of the
top-level gnome-terminal window...

xwininfo -root -tree -int output:

     57542037 "jmason@casper (pts/10)  - /nb": ("gnome-terminal"
"Gnome-terminal")  737
x457+5+49  +5+49
        5 children:
        57542049 "jmason@casper (pts/10)  - /nb": ()  722x434+15+23  +20+72
        57542060 (has no name): ()  15x434+0+23  +5+72
        57542053 (has no name): ()  737x23+0+0  +5+49
           6 children:
           57542059 (has no name): ()  43x21+231+1  +236+50
           57542058 (has no name): ()  43x21+188+1  +193+50
           57542057 (has no name): ()  67x21+121+1  +126+50
           57542056 (has no name): ()  44x21+77+1  +82+50
           57542055 (has no name): ()  40x21+37+1  +42+50
           57542054 (has no name): ()  36x21+1+1  +6+50
        57542040 (has no name): ()  10x10+0+0  +5+49
        57542038 (has no name): ()  1x1+200+200  +205+249 <<<

the one highlighted with "<<<" is the wid that getwindowfocus returned.
I can turn that into the correct wid using:

xwininfo -id 57542038 -tree -int

xwininfo: Window id: 57542038 (has no name)

  Root window id: 139 (the root window) (has no name)
  Parent window id: 57542037 "jmason@casper (pts/10)  - /nb"
     0 children.

What version of the product are you using? On what operating system?

20080606-1, also 20080720, Ubuntu intrepid.

Please provide any additional information below.

Original issue reported on code.google.com by jma...@gmail.com on 5 Jan 2009 at 10:38

GoogleCodeExporter commented 9 years ago
oh. to be clear, I'm looking for either (a) a switch to automatically traverse 
the
tree up to the nearest top-level window or (b) that to be the default behaviour 
of
getwindowfocus. cheers ;)

Original comment by jma...@gmail.com on 5 Jan 2009 at 10:39

GoogleCodeExporter commented 9 years ago
Emacs has this problem, too, or something very similar.

I'll look into it. Thanks :)

Original comment by jls.semi...@gmail.com on 26 Jan 2009 at 10:06

GoogleCodeExporter commented 9 years ago
From gnome-terminal:

% xdotool getwindowfocus
56623111
% echo $WINDOWID
56623153

gnome-terminal, xterm, and others, set the env var WINDOWID before launching 
shells
and such. 

Seems like the default behavior should be to pull the toplevel window, so I'll 
work
on making this the default and, if necessary, provide a switch to use the 
current
behavior.

Original comment by jls.semi...@gmail.com on 26 Jan 2009 at 10:11

GoogleCodeExporter commented 9 years ago
Fixed:

% xwininfo -id $(./xdotool getwindowfocus) | grep 'Window id'
xwininfo: Window id: 0x3600007 "zsh"

To get the old behavior, use 'getwindowfocus -f'
% xwininfo -id $(./xdotool getwindowfocus -f) | grep 'Window id'
xwininfo: Window id: 0x3600008 (has no name)

Original comment by jls.semi...@gmail.com on 26 Jan 2009 at 11:04

GoogleCodeExporter commented 9 years ago

Original comment by jls.semi...@gmail.com on 26 Jan 2009 at 11:17

GoogleCodeExporter commented 9 years ago
thanks!

Original comment by jma...@gmail.com on 26 Jan 2009 at 12:19