panel: global keybindings activated on key release, not press?
- From: Oskar Liljeblad <osk hem passagen se>
- To: gnome-devel-list gnome org
- Subject: panel: global keybindings activated on key release, not press?
- Date: Mon, 26 Mar 2001 21:30:55 +0200
In panel of gnome-core 1.4.0 you can associate global key bindings
for these two commands:
Popup menu key
Run dialog key
They are handled in panel_global_keys_filter in panel/global-key.c.
The strange thing about these commands are that they are activated
when you *release* the keys bound to them. This is annoying, since
there is a 250-1000 ms delay (depending on key repeat rate) before
they are activated - if you happen to hold the key and not release
it immediately.
So basicly my idea to fix this is to s/KeyRelease/KeyPress/
in the first lines in panel_global_keys_filter:
if(xevent->type != KeyRelease)
return GDK_FILTER_CONTINUE;
I have no idea what unexpected consequences this might have though...
I also did another thing, changing the "Popup menu key" command.
This command makes a panel-like menu pop up under the mouse cursor.
With the patch below this behaves more like Ctrl+Escape in
Windows/IceWM (to open the Start menu).
I'd like comments about the patch below...
Oskar Liljeblad (osk hem passagen se)
diff -ruN gnome-core-1.4.0/panel/global-keys.c gnome-core-1.4.0-fix2/panel/global-keys.c
--- gnome-core-1.4.0/panel/global-keys.c Wed Mar 7 20:21:03 2001
+++ gnome-core-1.4.0-fix2/panel/global-keys.c Mon Mar 26 21:28:51 2001
@@ -147,7 +147,7 @@
guint menu_keycode, menu_state;
guint run_keycode, run_state;
- if(xevent->type != KeyRelease)
+ if(xevent->type != KeyPress)
return GDK_FILTER_CONTINUE;
keycode = xevent->xkey.keycode;
@@ -164,7 +164,7 @@
if (keycode == menu_keycode &&
(state & menu_state) == menu_state) {
PanelWidget *panel;
- GtkWidget *menu, *basep;
+ GList *node;
/* check if anybody else has a grab */
if (gdk_pointer_grab (GDK_ROOT_PARENT(), FALSE,
0, NULL, NULL, GDK_CURRENT_TIME)
@@ -175,15 +175,18 @@
}
panel = panels->data;
- menu = make_popup_panel_menu (panel);
- basep = panel->panel_parent;
- if (IS_BASEP_WIDGET(basep)) {
- BASEP_WIDGET(basep)->autohide_inhibit = TRUE;
- basep_widget_autohide (BASEP_WIDGET (basep));
+ for (node = panel->applet_list; node != NULL; node = node->next) {
+ AppletData *data = node->data;
+ AppletInfo *info = gtk_object_get_data (GTK_OBJECT (data->applet),
+ "applet_info");
+
+ if (info->type == APPLET_MENU) {
+ button_widget_down(BUTTON_WIDGET(info->widget));
+ return GDK_FILTER_REMOVE;
+ }
}
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
- NULL, NULL, 0, GDK_CURRENT_TIME);
- return GDK_FILTER_REMOVE;
+
+ return GDK_FILTER_CONTINUE;
} else if (keycode == run_keycode &&
(state & run_state) == run_state) {
/* check if anybody else has a grab */
diff -ruN gnome-core-1.4.0/panel/menu.c gnome-core-1.4.0-fix2/panel/menu.c
--- gnome-core-1.4.0/panel/menu.c Wed Mar 7 20:21:04 2001
+++ gnome-core-1.4.0-fix2/panel/menu.c Mon Mar 26 21:28:30 2001
@@ -5369,10 +5369,19 @@
gtk_grab_remove(menu->button);
menu->age = 0;
- gtk_menu_popup(GTK_MENU(menu->menu), 0, 0,
- applet_menu_position,
- menu->info, bevent->button, bevent->time);
- gdk_event_free((GdkEvent *)bevent);
+
+ /* bevent will be NULL when a menu button press was
+ simulated as a result of button_widget_down */
+ if (bevent != NULL) {
+ gtk_menu_popup(GTK_MENU(menu->menu), 0, 0,
+ applet_menu_position,
+ menu->info, bevent->button, bevent->time);
+ gdk_event_free((GdkEvent *)bevent);
+ } else {
+ gtk_menu_popup(GTK_MENU(menu->menu), 0, 0,
+ applet_menu_position,
+ menu->info, 0, GDK_CURRENT_TIME);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]