Spent some time hacking on this tonight. I read about how to do this
in the X11 manuals, twm's source, and wmii's source, and I was still
completely unsuccessful drawing in XOR'ed mode. Not sure what I was
doing wrong, but I gave up for tonight :)
According to the docs, to actually draw in XOR mode you have to:
- draw on the root window
- XGrabServer() throughout the drawing
The 2nd one is what concerns me. Doing XGrabServer will block all
other events to other clients in the server, blocking interactivity
and other stuff (especially dragging and clicking) while the server
grab is held.
It's possible I can support this, but the server grab would be not
default. Most of this hinges on a functioning XOR graphics
implementation. I'll take patches or even sample code, but given the
circus of failures from tonight, I think I'll defer working XOR myself
until some other features get finished (macro recording, mouse cursor
pixel clipping (see below), etc).
> - You still cannot click 'through' the grid: if you move the mouse over
> the grid, and attempt a click (with a keynav binding or though the
> real thing) it's still sent to keynav, not to the underlying
> application. This especially happens if you reduce the grid area a
> lot: with a 3x3 grid, you can get up to a point (very quickly) where
> you cannot 'click' anymore by using a 'click [123]' action *unless*
> you also remove the grid by 'end'ing.
This can be fixed by making sure the pixel under the mouse is always
clipped clean (just like the grid areas and the center are today).
Shouldn't be too difficult to do this. I put it on the todo list ;)
>
> If Jordan remembers, I was asking for 'click [123]' to avoid warping,
> so that I could use keynav to perform clicks without exiting (for
> driving menus or other stuff that requires nearby clicks). In the last
> version this feature works correctly, but it doesn't play well with GTK
> menus: if you start keynav, move the pointer over a menu and 'click 1',
> you will see that the menu gets highlighted (the click is sent to the
> application), but the menu doesn't appear -> it's shown as soon as you
> exit keynav. This is probably a 'grab' issue... I'm just mentioning
> this here for posterity.
Yeah, popups generally invoke XGrabKeyboard or XGrabPointer. For
example, in Google Chrome linux, if I attach via gdb:
(gdb) break XGrabPointer
Breakpoint 1 at 0x7f659a826500
(gdb) break XGrabKeyboard
Breakpoint 2 at 0x7f659a8262e0
(gdb) cont
Continuing.
[Switching to Thread 0x7f659ace6790 (LWP 20020)]
# Now, I right-click in Chrome:
Breakpoint 1, 0x00007f659a826500 in XGrabPointer () from /usr/lib/libX11.so.6
:(
-Jordan
svn r2547 implements click-through by detecting mouse movement and
making that portion of the window vanish.
http://code.google.com/p/semicomplete/source/detail?r=2547
The current size of the 'click through' is a 1x1 (svn r2548) so you
shouldn't notice any visible changes in the window when you mouse over
it other than that your clicks/drags/etc go through the window. I've
experimented with a 20x20 cut, but this looks blocky.
This does introduce some flicker as the window is reshaped every time
the mouse overs over it. We can fix that later. The important feature
of 'click through' is now available in svn.
-Jordan
>> This can be fixed by making sure the pixel under the mouse is always
>> clipped clean (just like the grid areas and the center are today).
>> Shouldn't be too difficult to do this. I put it on the todo list ;)
>
> svn r2547 implements click-through by detecting mouse movement and
> making that portion of the window vanish.
> http://code.google.com/p/semicomplete/source/detail?r=2547
>
> The current size of the 'click through' is a 1x1 (svn r2548) so you
> shouldn't notice any visible changes in the window when you mouse over
> it other than that your clicks/drags/etc go through the window. I've
> experimented with a 20x20 cut, but this looks blocky.
>
> This does introduce some flicker as the window is reshaped every time
> the mouse overs over it. We can fix that later. The important feature
> of 'click through' is now available in svn.
Just out of curiosity: can't you just receive the mouse event/s, and
reinject them in the event queue below the keynav window?
I don't think there's a way to simply specify "pass this event to the
window directly below this window, at this pixel"
In theory, we'd have to search for windows that occupy that pixel and
inspect the window stack, then use XSendEvent to send the event to
that window. However, most apps ignore events that come from other
applications via XSendEvent. Using XShape to clip the pixel seemed the
shortest path (it was a tiny amount of code) and seems to work well.
There may be other ways, but none I am aware of.
-Jordan
>> Just out of curiosity: can't you just receive the mouse event/s, and
>> reinject them in the event queue below the keynav window?
>
> I don't think there's a way to simply specify "pass this event to the
> window directly below this window, at this pixel"
Unfortunately, yes, you have to locate the window id at the requested
coordinates yourself.
> In theory, we'd have to search for windows that occupy that pixel and
> inspect the window stack, then use XSendEvent to send the event to
> that window. However, most apps ignore events that come from other
> applications via XSendEvent. Using XShape to clip the pixel seemed the
> shortest path (it was a tiny amount of code) and seems to work well.
What method are you using to send 'click' and 'drag' events then? I
thought you were sending synthetic events through XSendEvent.
> There may be other ways, but none I am aware of.
A quick look at the x11 reference manual didn't help, but I would
need to look into the new event device/handling mechanism xev/
xinput2, of which I'm totally clueless.
Poking holes via xshape is reasonable, but you know, doesn't seem the
'right way'.
I was just thinking aloud.
It uses XTEST. The XTEST extension lets you send input as if you were
a mouse or keyboard. This extension has no way to send events to a
specific window, as far as I can tell. Applications have no knowledge
that events they receive come from XTEST, unlike with XSendEvent.
>> There may be other ways, but none I am aware of.
>
> A quick look at the x11 reference manual didn't help, but I would
> need to look into the new event device/handling mechanism xev/
> xinput2, of which I'm totally clueless.
>
> Poking holes via xshape is reasonable, but you know, doesn't seem the
> 'right way'.
> I was just thinking aloud.
Thinking aloud always welcome; it actually made me double check some
of the xlib apis to make sure I wasn't missing something. ;)
-Jordan
I found an alternative to this tonight.
Turns out xcompmgr has gotten way less crappy since I tried it years
ago. Using xcompmgr, transset-df, and xdotool, we can make the keynav
window translucent.
This requires the latest svn HEAD as of tonight, and the following in
.keynavrc (or however you start your keynavrc)
ctrl+semicolon start, sh "exec transset-df -i $(xdotool search
--class keynav) 0.3"
This will have xdotool find the window 'keynav' and tell transset-df
to set the opacity to 30%. Seems to work OK, but has some strange
copy-artifacts I see when moving the window. At any rate, the next
release should provide y'all with the ability (should you choose to
use xcompmgr) to make the grid see-through.
-Jordan
4. 0004-Dejavu-Re-run-previous-click-at-previous-clicked-loc.patch
New command - "save-dejavu" and "dejavu". This is for remembering
a certain location and click so that we can re-click that same
position later on without having to manually warp to that location.
See the 'Example use case' usage instruction.
Thanks for the notice. I'll check it out later using subversion.
Nazri.