[MetaDisplay] Expose meta_display_get_keybinding_action

This can be used when a plugin has control of input to determine
what action would be done, and thus filter to a subset of them.

https://bugzilla.gnome.org/show_bug.cgi?id=613100
This commit is contained in:
Colin Walters 2010-03-16 18:05:13 -04:00
parent 67f8a33cad
commit 650a1e807c
2 changed files with 24 additions and 9 deletions

View File

@ -499,11 +499,21 @@ display_get_keybinding (MetaDisplay *display,
return NULL; return NULL;
} }
static MetaKeyBindingAction /**
display_get_keybinding_action (MetaDisplay *display, * meta_display_get_keybinding_action:
unsigned int keysym, * @display: A #MetaDisplay
unsigned int keycode, * @keysym: Key symbol
unsigned long mask) * @keycode: Raw keycode
* @mask: Event mask
*
* Returns: The action that should be taken for the given key, or %META_KEYBINDING_ACTION_NONE.
*
*/
MetaKeyBindingAction
meta_display_get_keybinding_action (MetaDisplay *display,
unsigned int keysym,
unsigned int keycode,
unsigned long mask)
{ {
MetaKeyBinding *binding; MetaKeyBinding *binding;
@ -2756,10 +2766,10 @@ process_workspace_switch_grab (MetaDisplay *display,
MetaWorkspace *target_workspace; MetaWorkspace *target_workspace;
MetaKeyBindingAction action; MetaKeyBindingAction action;
action = display_get_keybinding_action (display, action = meta_display_get_keybinding_action (display,
keysym, keysym,
event->xkey.keycode, event->xkey.keycode,
display->grab_mask); display->grab_mask);
switch (action) switch (action)
{ {

View File

@ -26,6 +26,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "types.h" #include "types.h"
#include "prefs.h"
#include "common.h" #include "common.h"
typedef enum typedef enum
@ -117,6 +118,10 @@ void meta_display_end_grab_op (MetaDisplay *display,
MetaGrabOp meta_display_get_grab_op (MetaDisplay *display); MetaGrabOp meta_display_get_grab_op (MetaDisplay *display);
MetaKeyBindingAction meta_display_get_keybinding_action (MetaDisplay *display,
unsigned int keysym,
unsigned int keycode,
unsigned long mask);
/* meta_display_set_input_focus_window is like XSetInputFocus, except /* meta_display_set_input_focus_window is like XSetInputFocus, except
* that (a) it can't detect timestamps later than the current time, * that (a) it can't detect timestamps later than the current time,