Reserving key combinations for special clients
Peter Hutterer
peter.hutterer at who-t.net
Sun Dec 13 14:30:06 PST 2009
On Sat, Dec 12, 2009 at 11:52:22PM +0200, Alex Dănilă wrote:
> Could you make me a small roadmap for implementing this feature?
> I mean like telling what parts of xorg to study, where to
> concentrate to make the quantity of my learning stuff smaller, a few
> more details about the solution, any other things that come to your
> mind.
the X protocol specification describes five requests of interest:
GrabPointer, GrabKeyboard, GrabButton, GrabKey, and AllowEvents. For each of
them the server makes certain guarantees in regards to the delivery of the
events and the behaviour of the pointer and keyboard (watch out for the
changed Enter/Leave and FocusIn/Out semantics during grabs).
then on top of that you have the X Input Extension's GrabDevice and
GrabDeviceButton/Key requests. They are similar but not quite the same. the
XI2 requests XIGrabDevice and XIPassiveGrabDevice are just more of the same.
Once you have that picture formed, you can look at adding a priority to the
XI2 requests. e.g. given a default priority of 0 for core and XI, an XI2
request with a higher priority may override an already existing grab.
Since you can't break the protocol, you need to make sure that the semantics
for grabs are still correct after you override grabs with others. That's the
tricky bit and there's some use-cases that are difficult to determine. I
wouldn't be surprised if there's some ambiguity where it's not clear which
behaviour is the better one. in those cases, it's best to implement and test
which behaviour is the most sensible.
IIRC most of the server grab code for this is in dix/events.c.
Cheers,
Peter
> On 12/07/2009 03:23 AM, Peter Hutterer wrote:
> >On Sun, Dec 06, 2009 at 01:08:37PM +0200, Alex Dănilă wrote:
> >>I would like to make it possible for window managers to reserve a couple
> >>of key combinations no matter what other applications do. Specifically I
> >>want keys/combinations like Alt+Tab, Ctrl+Alt+Del, XF86VolumeUp to never
> >>be taken away by fulscreen apps that grab the keyboard(ex. Boswars) or by
> >>missbehaving/frozen apps.
> >>
> >>In my understanding, I would need to make two changes:
> >>
> >>-from X provide a way for an application to reserve keys forever
> >>
> >>-modify the window manager (and maybe the service that replies to ex.
> >> XF86VolumeUp) such that it makes use of the reservation method.
> >>
> >>What are a few alternatives for doing this? Which is the easiest, which is
> >>the most correct one?
> >>
> >>I can understand if this is not how things work in X, and it is no problem
> >>if such a patch (if ever created) would never be accepted. I will give it
> >>some time anyway. Thank you for your time.
> >
> >I think the better option is to introduce grab priorities for passive grabs.
> >this way the WM can register grabs with a higher priority than default and
> >these grabs are triggered even if a device is already grabbed.
> >this has the potential to be more future-proof than having reserved key
> >combinations.
> >
> >the tricky bit is sorting out these grab priorities in light of the core
> >protocol - assuming all core grabs are on a default priority.
> >
> >Cheers,
> > Peter
>
More information about the xorg-devel
mailing list