gtk: fix over-eager attempt at alt- menu activation

Closes PR 11843

original commit: aabd5f7bd2e0b71ad218f9f0475abcd64e4b9afa
This commit is contained in:
Matthew Flatt 2011-04-11 07:16:11 -06:00
parent 2db01ab5e4
commit cc9dc765c3
4 changed files with 19 additions and 6 deletions

View File

@ -145,4 +145,16 @@
(g_object_ref gtk)
(gtk_menu_item_set_submenu item gtk))
(gtk_menu_shell_append gtk item)
(gtk_widget_show item)))))
(gtk_widget_show item))))
(define/public (activate-item menu)
;; Gtk takes care of menu activation as appropriate;
;; return #f to indcate that the key wasn't handled
#f
#;
(let loop ([menus menus])
(cond
[(null? menus) (void)]
[(eq? menu (cadar menus))
(gtk_menu_shell_select_item gtk (caar menus))]
[else (loop (cdr menus))]))))

View File

@ -237,7 +237,9 @@
(gtk_menu_shell_append gtk item-gtk)
(gtk_widget_show item-gtk))))
(def/public-unimplemented select)
(define/public (select bm)
(send parent activate-item this))
(def/public-unimplemented get-font)
(def/public-unimplemented set-width)
(def/public-unimplemented set-title)

View File

@ -53,7 +53,8 @@
(when parent
(let ([m (regexp-match #rx"&[^&]" label)])
(when m
(send parent popup-menu-with-char (string-ref (car m) 1))))))
(send parent popup-menu-with-char (string-ref (car m) 1)))))
#t)
(def/public-unimplemented get-font)
(def/public-unimplemented set-width)

View File

@ -68,9 +68,7 @@
[label (mcar data)]
[menu (mcdr data)])
(if (regexp-match re label)
(begin
(send menu select this)
#t)
(send menu select this)
#f)))
items)))))))))]
[on-demand (lambda () (as-exit (lambda () (send mred on-demand))))]