[dev] [surf] Double execution of masked key binding

From: Carlos Pita <carlosjosepita_AT_gmail.com>
Date: Fri, 12 Oct 2012 04:47:24 -0300

Hi,

this seems like a bug in surf 0.5 to me. When defining a couple of key
bindings for the same key, one with a shift mask and the other without
the mask, the commands for both bindings are executed in sequence when
I press the shift-masked key once.

For example:

My keys[]
....
    { MODKEY, GDK_g, spawn, OPENHERE },
    { MODKEY|GDK_SHIFT_MASK,GDK_g, spawn, OPENWIN },
....

And doing some debugging _AT_ surf.c:366

printf("%d %d %d\n", keys[i].keyval, keys[i].mod, ev->state); <---

I get:

103 4 5
103 5 5

Notice the condition there is:

    if(gdk_keyval_to_lower(ev->keyval) == keys[i].keyval
        && (ev->state & keys[i].mod) == keys[i].mod
        && keys[i].func)

So:

(ev->state & keys[i].mod) == keys[i].mod
(5 & 4) == 4
(5 & 5) == 5

which is true in both cases.

I don't know how this ev->state stuff works but maybe it's fine and
the problem is related to the gdk_keyval_to_lower invocation instead
(remember that I'm using the shift mask here).

Best regards
--
Carlos
Received on Fri Oct 12 2012 - 09:47:24 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 12 2012 - 09:48:05 CEST