b4n left a comment (geany/geany-plugins#1093)

> I'll try to prepare a PR with this one plus the KP support.

<details><summary>FWIW, I had that before I went back to day work:</summary>

```diff
diff --git a/geanynumberedbookmarks/src/geanynumberedbookmarks.c 
b/geanynumberedbookmarks/src/geanynumberedbookmarks.c
index 206c460c..67f85506 100644
--- a/geanynumberedbookmarks/src/geanynumberedbookmarks.c
+++ b/geanynumberedbookmarks/src/geanynumberedbookmarks.c
@@ -1482,6 +1482,7 @@ static gboolean Key_Released_CallBack(GtkWidget *widget, 
GdkEventKey *ev, gpoint
 {
        GeanyDocument *doc;
        gint i;
+       GdkModifierType state = keybindings_get_modifiers(ev->state);
 
        doc=document_get_current();
        if(doc==NULL)
@@ -1490,27 +1491,56 @@ static gboolean Key_Released_CallBack(GtkWidget 
*widget, GdkEventKey *ev, gpoint
        if(ev->type!=GDK_KEY_RELEASE)
                return FALSE;
 
+
+       fprintf(stderr, "(GdkEventKey*) {\n"
+               "       state=%x (filtered=%x)\n"
+               "       keyval=%x (%u)\n"
+               "       length=%d\n"
+               "       string=%s\n"
+               "       hardware_keycode=%x (%u)\n"
+               "       group=%u\n"
+               "       is_modifier=%u\n"
+               "}\n",
+               ev->state, state,
+               ev->keyval, ev->keyval,
+               ev->length,
+               ev->string,
+               ev->hardware_keycode, ev->hardware_keycode,
+               ev->group,
+               ev->is_modifier
+       );
+
        /* control and number pressed */
-       if(ev->state==4)
+       if(state == GDK_CONTROL_MASK)
        {
                i=((gint)(ev->keyval))-'0';
-               if(i<0 || i>9)
-                       return FALSE;
+               if(i<0 || i>9) {
+                       i=((gint)(ev->keyval))-GDK_KEY_KP_0;
+                       if(i<0 || i>9)
+                               return FALSE;
+               }
 
                GotoBookMark(doc, i);
                return TRUE;
        }
        /* control+shift+number */
-       if(ev->state==5) {
+       if(state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) {
                /* could use hardware keycode instead of keyvals but if unable 
to get keyode then don't
                 * have logical default to fall back on
                */
-               for(i=0;i<10;i++) if((gint)(ev->keyval)==iShiftNumbers[i])
-               {
-                       SetBookMark(doc, i);
-                       return TRUE;
+               for(i=0;i<10;i++) {
+                       if((gint)(ev->keyval)==iShiftNumbers[i])
+                               break;
+               }
+
+               if (i<0 || i>9) {
+                       i=((gint)(ev->keyval))-GDK_KEY_KP_0;
+                       if(i<0 || i>9)
+                               return FALSE;
                }
 
+               SetBookMark(doc, i);
+               return TRUE;
        }
 
        return FALSE;
```
</details>

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/1093#issuecomment-3008390081
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/pull/1093/[email protected]>

Reply via email to