Bug 673360 - accel cell renderer: support modifier 'tapping'
accel cell renderer: support modifier 'tapping'
Status: NEW
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-04-02 14:00 UTC by Allison Lortie (desrt) (extended vacation)
Modified: 2014-11-01 15:51 UTC (History)
2 users (show)

See Also:
GNOME target: ---
GNOME version: ---


Attachments
accel cell renderer: support modifier 'tapping' (3.41 KB, patch)
2012-04-02 14:00 UTC, Allison Lortie (desrt) (extended vacation)
none Details | Diff | Review
accel cell renderer: support modifier 'tapping' (4.47 KB, patch)
2014-10-23 13:27 UTC, Lars Karlitski
accepted-commit_now Details | Diff | Review

Description Allison Lortie (desrt) (extended vacation) 2012-04-02 14:00:11 UTC
Introduce a new GTK_CELL_RENDERER_ACCEL_MODE_MODIFIER_TAP that accepts
tapping modifier keys (eg: simply pressing and releasing the Windows
key) as accelerators.


Note: it may look in the patch like I forgot to disconnect a signal, but
the signal handler is disconnected 'by func' later, so it will
disconnect both signals.
Comment 1 Allison Lortie (desrt) (extended vacation) 2012-04-02 14:00:13 UTC
Created attachment 211135 [details] [review]
accel cell renderer: support modifier 'tapping'

Introduce a new GTK_CELL_RENDERER_ACCEL_MODE_MODIFIER_TAP that accepts
tapping modifier keys (eg: simply pressing and releasing the Windows
key) as accelerators.
Comment 2 Matthias Clasen 2012-04-02 14:13:37 UTC
I could see allowing modifiers as keys, but it doesn't make much sense to me as an accel-mode. The documentation for accel-mode says:

  Determines if the edited accelerators are GTK+ accelerators.

Which is not really what this is about, right ?

I'm somewhat worried that allowing this is highly 'anti-social', in terms of claiming large swaths of accelerator space for a single action.
Comment 3 Allison Lortie (desrt) (extended vacation) 2012-04-02 14:18:51 UTC
The status quo is that we have two types of accels:

 1) gtk style
 2) "other" style

I added this as a 3rd option to prevent changing the semantics of the existing "other" option.  It could just be inserted there if you think that makes more sense.

I'm incline to agree with the comments about anti-social behaviour, but there are already two noteworthy cases where this happens.  The first is the windows key in the shell (and unity).  The second is how unity uses the alt key to open to the HUD.  In that case, it only performs the action in the case of a tap as described here (ie: press followed by immediate release with no other keys/mousebuttons pressed).  In that case it's not really eating up accelerator space since the other accelerators (or mnemonics) on the alt key continue to function normally.

As for the shell, I can imagine that we'd one day add accelerators based on the windows key in a similar way to what windows itself has done.  In that case I'd expect what happens now -- the overview is not activated unless the windows key is tapped (ie: press/release with nothing between).
Comment 4 Matthias Clasen 2012-04-02 15:43:22 UTC
Here is a proposal: 
- Make this a separate boolean, 'allow-bare-modifiers' or so
- Make it work for both accel-modes
- Make sure GtkKeyHash accepts bare modifiers as accels

Then you need to make sure that gsd and all the other places where system-wide accels are implemented deal properly with bare modifiers
Comment 5 Allison Lortie (desrt) (extended vacation) 2012-04-02 16:14:12 UTC
I can accept that the user may want to assign tapped modifiers as keyboard shortcuts for random things in g-s-d, but I'm not sure I agree about Gtk...
Comment 6 Matthias Clasen 2012-04-03 15:34:21 UTC
That would then point towards accepting naked modifiers as part of OTHER ?
Since the control-center panel is already using that mode...
Comment 7 Allison Lortie (desrt) (extended vacation) 2012-04-03 17:57:44 UTC
I looked a bit into this.  Grabbing naked modifiers in a way that doesn't break everything else is a tricky business.  You can see we already have a rather visible existing bug:

  - try to bind something g-s-d handles to Windows+X (like opening calculator)

  - notice that the key is taken, saying the key sequence is 'Super + X'

  - notice that the key sequence doesn't actually do anything

Try the same thing again with a function that's handled by the shell -- like showing the command prompt.  That works just fine.

Obviously the way the shell is handling the super key is interfering with g-s-d's ability to grab other keys.  That's an existing bug.  It would be rather unfortunate to worsen the situation by having g-s-d do the same thing with other modifiers.
Comment 8 Allison Lortie (desrt) (extended vacation) 2012-04-03 18:04:56 UTC
Worth mentioning one bit of prior art that we have here: the 'press control to show the mouse position' thing.

That's pretty close to the behaviour we want.  Control + another key = mouse is not shown.  Tap control = mouse is shown.

Probably the method used here (labeled "Owen magic" at the site of implementation) is the way to proceed...

We could conceivably turn that into a generic keybinding with this work...
Comment 9 Matthias Clasen 2012-07-11 03:20:59 UTC
A related use case is bug 678155
Comment 10 Lars Karlitski 2014-10-23 13:27:10 UTC
Created attachment 289203 [details] [review]
accel cell renderer: support modifier 'tapping'

Ported to master
Comment 11 Matthias Clasen 2014-11-01 15:51:26 UTC
Review of attachment 289203 [details] [review]:

did you want to push this, Lars ?

Note You need to log in before you can comment on or make changes to this bug.