Re: Key Release Events



This behavior is actually super tricky to get right and is implemented
with a complex state machine in mutter.

https://git.gnome.org/browse/mutter/tree/src/core/keybindings.c#n1722

You cannot implement something similar from a GNOME Shell Extension. Sorry.

On Thu, Apr 23, 2015 at 7:52 PM, Vjekoslav Brajkovic
<vjeko brajkovic org> wrote:
Thanks Jasper!

Let me try to narrow down my question. Gnome appears to be doing the thing I
want, I just cannot figure out how it's doing it.

1) I press and hold the <Super> key.
2) The current active window does retains focus. If I type anything while
I'm holding the key, that window will receive keyboard input.
3) Once I release the <Super> key, overview actor will become active.

I would like to get the same functionality. I would like to get notified
when that key gets released the same way overview does. In order to get this
working do I have to change main.js?


On 04/23/2015 07:32 PM, Jasper St. Pierre wrote:

X11 has no such mechanism to give that to you. Key presses and
releases are sent directly to the application that has focus, not to
the window manager.

Main.wm.addKeybinding allows you to register a "grab", which is a way
of punching through this model, but unfortunately, grab semantics are
hard to make work for the release case. So we don't properly trigger
keybindings for key release.

On Thu, Apr 23, 2015 at 4:40 PM, Vjekoslav Brajkovic
<vjeko brajkovic org> wrote:

Hi!

I am writing an extension and would like to get notified when a
key-*release*-event has occurred regardless of which actor has key focus
and
without changing it.

 From what I understand, the indented way of doing this would be by
registering a callback with Main.wm.addKeybinding() and specifying a
desired
KeyHandlerFunc. The problem is that key release/press information seems
to
be missing when the handler gets invoked -- the  ClutterKeyEvent
parameter
is missing and instead of it I get Meta.KeyBinding.

I have also tried doing global.stage.connect('key-release-event', ...),
but
the stage does not receive any signals unless I change the key focus to
an
actor like overview, which I assume propagates its signals.

Does anyone have any ideas or suggestions?

Thanks!
Vjeko


_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list







-- 
  Jasper


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