|
Lines 43-48
Link Here
|
| 43 |
|
43 |
|
| 44 |
static gboolean all_bindings_disabled = FALSE; |
44 |
static gboolean all_bindings_disabled = FALSE; |
| 45 |
|
45 |
|
|
|
46 |
/* This keycode, if set, will activate the main menu when released */ |
| 47 |
unsigned int main_menu_keycode = FALSE; |
| 48 |
|
| 46 |
typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display, |
49 |
typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display, |
| 47 |
MetaScreen *screen, |
50 |
MetaScreen *screen, |
| 48 |
MetaWindow *window, |
51 |
MetaWindow *window, |
|
Lines 195-200
Link Here
|
| 195 |
XEvent *event, |
198 |
XEvent *event, |
| 196 |
MetaKeyBinding *binding); |
199 |
MetaKeyBinding *binding); |
| 197 |
|
200 |
|
|
|
201 |
static void handle_panel_action (MetaDisplay *display, |
| 202 |
MetaScreen *screen, |
| 203 |
MetaWindow *window, |
| 204 |
XEvent *event, |
| 205 |
MetaKeyBindingAction action); |
| 206 |
|
| 198 |
/* debug */ |
207 |
/* debug */ |
| 199 |
static gboolean process_mouse_move_resize_grab (MetaDisplay *display, |
208 |
static gboolean process_mouse_move_resize_grab (MetaDisplay *display, |
| 200 |
MetaScreen *screen, |
209 |
MetaScreen *screen, |
|
Lines 881-886
Link Here
|
| 881 |
switch (pref) |
890 |
switch (pref) |
| 882 |
{ |
891 |
{ |
| 883 |
case META_PREF_SCREEN_KEYBINDINGS: |
892 |
case META_PREF_SCREEN_KEYBINDINGS: |
|
|
893 |
case META_PREF_ENABLE_WINDOWS_KEYS: |
| 884 |
rebuild_screen_binding_table (display); |
894 |
rebuild_screen_binding_table (display); |
| 885 |
reload_keycodes (display); |
895 |
reload_keycodes (display); |
| 886 |
reload_modifiers (display); |
896 |
reload_modifiers (display); |
|
Lines 1107-1112
Link Here
|
| 1107 |
meta_error_trap_pop (display, FALSE); |
1117 |
meta_error_trap_pop (display, FALSE); |
| 1108 |
} |
1118 |
} |
| 1109 |
|
1119 |
|
|
|
1120 |
/* Hardcoded keycodes for the Windows flag keys */ |
| 1121 |
#define WINDOWS_KEY_1_KEYCODE 115 |
| 1122 |
#define WINDOWS_KEY_2_KEYCODE 116 |
| 1123 |
|
| 1124 |
static void |
| 1125 |
meta_screen_grab_ungrab_windows_keys (MetaScreen *screen) |
| 1126 |
{ |
| 1127 |
gboolean grab = meta_prefs_get_enable_windows_keys (); |
| 1128 |
|
| 1129 |
meta_error_trap_push (screen->display); |
| 1130 |
|
| 1131 |
meta_change_keygrab (screen->display, screen->xroot, grab, 0, WINDOWS_KEY_1_KEYCODE, 0); |
| 1132 |
meta_change_keygrab (screen->display, screen->xroot, grab, 0, WINDOWS_KEY_2_KEYCODE, 0); |
| 1133 |
|
| 1134 |
meta_error_trap_pop (screen->display, FALSE); |
| 1135 |
} |
| 1136 |
|
| 1110 |
void |
1137 |
void |
| 1111 |
meta_screen_grab_keys (MetaScreen *screen) |
1138 |
meta_screen_grab_keys (MetaScreen *screen) |
| 1112 |
{ |
1139 |
{ |
|
Lines 1116-1121
Link Here
|
| 1116 |
if (screen->keys_grabbed) |
1143 |
if (screen->keys_grabbed) |
| 1117 |
return; |
1144 |
return; |
| 1118 |
|
1145 |
|
|
|
1146 |
meta_screen_grab_ungrab_windows_keys (screen); |
| 1147 |
|
| 1119 |
grab_keys (screen->display->screen_bindings, |
1148 |
grab_keys (screen->display->screen_bindings, |
| 1120 |
screen->display->n_screen_bindings, |
1149 |
screen->display->n_screen_bindings, |
| 1121 |
screen->display, screen->xroot); |
1150 |
screen->display, screen->xroot); |
|
Lines 1539-1545
Link Here
|
| 1539 |
/* we used to have release-based bindings but no longer. */ |
1568 |
/* we used to have release-based bindings but no longer. */ |
| 1540 |
if (event->type == KeyRelease) |
1569 |
if (event->type == KeyRelease) |
| 1541 |
return; |
1570 |
return; |
| 1542 |
|
1571 |
|
| 1543 |
i = 0; |
1572 |
i = 0; |
| 1544 |
while (i < n_bindings) |
1573 |
while (i < n_bindings) |
| 1545 |
{ |
1574 |
{ |
|
Lines 1636-1641
Link Here
|
| 1636 |
all_keys_grabbed = window ? window->all_keys_grabbed : screen->all_keys_grabbed; |
1665 |
all_keys_grabbed = window ? window->all_keys_grabbed : screen->all_keys_grabbed; |
| 1637 |
if (!all_keys_grabbed) |
1666 |
if (!all_keys_grabbed) |
| 1638 |
{ |
1667 |
{ |
|
|
1668 |
/* Handle the special action for the main menu. This binding provides |
| 1669 |
for a one-touch main menu while also leaving the key available for |
| 1670 |
use as a modifier */ |
| 1671 |
if (event->type == KeyPress |
| 1672 |
&& meta_prefs_get_enable_windows_keys () |
| 1673 |
&& (event->xkey.state & ~display->ignored_modifier_mask) == 0 |
| 1674 |
&& (event->xkey.keycode == WINDOWS_KEY_1_KEYCODE |
| 1675 |
|| event->xkey.keycode == WINDOWS_KEY_2_KEYCODE)) |
| 1676 |
|
| 1677 |
/* Record this key depressed in case main menu wanted */ |
| 1678 |
main_menu_keycode = event->xkey.keycode; |
| 1679 |
|
| 1680 |
else if (main_menu_keycode == FALSE) |
| 1681 |
/* No pending main menu event, just continue */; |
| 1682 |
|
| 1683 |
else if (event->xkey.keycode != main_menu_keycode) |
| 1684 |
/* An event, other than main_menu_keycode release, took place, |
| 1685 |
so cancel the pending menu event */ |
| 1686 |
main_menu_keycode = FALSE; |
| 1687 |
|
| 1688 |
else if (event->xkey.keycode == main_menu_keycode) |
| 1689 |
{ |
| 1690 |
main_menu_keycode = FALSE; |
| 1691 |
handle_panel_action (display,screen, NULL, event, |
| 1692 |
META_KEYBINDING_ACTION_PANEL_MAIN_MENU); |
| 1693 |
} |
| 1694 |
|
| 1639 |
/* Do the normal keybindings */ |
1695 |
/* Do the normal keybindings */ |
| 1640 |
process_event (display->screen_bindings, |
1696 |
process_event (display->screen_bindings, |
| 1641 |
display->n_screen_bindings, |
1697 |
display->n_screen_bindings, |
|
Lines 1649-1655
Link Here
|
| 1649 |
display, screen, window, event, keysym); |
1705 |
display, screen, window, event, keysym); |
| 1650 |
|
1706 |
|
| 1651 |
return; |
1707 |
return; |
| 1652 |
} |
1708 |
} |
| 1653 |
|
1709 |
|
| 1654 |
if (display->grab_op == META_GRAB_OP_NONE) |
1710 |
if (display->grab_op == META_GRAB_OP_NONE) |
| 1655 |
return; |
1711 |
return; |
|
Lines 2955-2972
Link Here
|
| 2955 |
} |
3011 |
} |
| 2956 |
|
3012 |
|
| 2957 |
static void |
3013 |
static void |
| 2958 |
handle_panel_keybinding (MetaDisplay *display, |
3014 |
handle_panel_action (MetaDisplay *display, |
| 2959 |
MetaScreen *screen, |
3015 |
MetaScreen *screen, |
| 2960 |
MetaWindow *window, |
3016 |
MetaWindow *window, |
| 2961 |
XEvent *event, |
3017 |
XEvent *event, |
| 2962 |
MetaKeyBinding *binding) |
3018 |
MetaKeyBindingAction action) |
| 2963 |
{ |
3019 |
{ |
| 2964 |
MetaKeyBindingAction action; |
|
|
| 2965 |
Atom action_atom; |
3020 |
Atom action_atom; |
| 2966 |
XClientMessageEvent ev; |
3021 |
XClientMessageEvent ev; |
| 2967 |
|
3022 |
|
| 2968 |
action = GPOINTER_TO_INT (binding->handler->data); |
|
|
| 2969 |
|
| 2970 |
action_atom = None; |
3023 |
action_atom = None; |
| 2971 |
switch (action) |
3024 |
switch (action) |
| 2972 |
{ |
3025 |
{ |
|
Lines 3005-3010
Link Here
|
| 3005 |
} |
3058 |
} |
| 3006 |
|
3059 |
|
| 3007 |
static void |
3060 |
static void |
|
|
3061 |
handle_panel_keybinding (MetaDisplay *display, |
| 3062 |
MetaScreen *screen, |
| 3063 |
MetaWindow *window, |
| 3064 |
XEvent *event, |
| 3065 |
MetaKeyBinding *binding) |
| 3066 |
{ |
| 3067 |
MetaKeyBindingAction action; |
| 3068 |
|
| 3069 |
action = GPOINTER_TO_INT (binding->handler->data); |
| 3070 |
handle_panel_action (display, screen, window, event, action); |
| 3071 |
} |
| 3072 |
|
| 3073 |
static void |
| 3008 |
handle_activate_menu (MetaDisplay *display, |
3074 |
handle_activate_menu (MetaDisplay *display, |
| 3009 |
MetaScreen *screen, |
3075 |
MetaScreen *screen, |
| 3010 |
MetaWindow *event_window, |
3076 |
MetaWindow *event_window, |