From 496ca17a77d18be94af87a97a9f7bd6b4cb1d030 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 30 May 2012 16:31:42 +0100 Subject: [PATCH] Convert Weston modifier #defines to an enum To avoid any possible collision between the disparate XKB and Weston modifier namespaces. Signed-off-by: Daniel Stone --- src/compositor.c | 2 +- src/compositor.h | 14 ++++++++------ src/shell.c | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index bfca256..d71cf65 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1732,7 +1732,7 @@ static int update_modifier_state(struct weston_seat *seat, uint32_t key, uint32_t state) { struct weston_compositor *compositor = seat->compositor; - uint32_t modifier; + enum weston_keyboard_modifier modifier; uint32_t mods_depressed, mods_latched, mods_locked, group; int ret = 0; diff --git a/src/compositor.h b/src/compositor.h index 40301ae..8cf0ce8 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -48,6 +48,12 @@ struct shell_surface; struct weston_seat; struct weston_output; +enum weston_keyboard_modifier { + MODIFIER_CTRL = (1 << 0), + MODIFIER_ALT = (1 << 1), + MODIFIER_SUPER = (1 << 2), +}; + struct weston_mode { uint32_t flags; int32_t width, height; @@ -161,7 +167,7 @@ struct weston_seat { struct wl_listener drag_surface_destroy_listener; int32_t hotspot_x, hotspot_y; struct wl_list link; - uint32_t modifier_state; + enum weston_keyboard_modifier modifier_state; int hw_cursor; struct wl_surface *saved_kbd_focus; struct wl_listener saved_kbd_focus_listener; @@ -299,10 +305,6 @@ struct weston_compositor { } xkb_info; }; -#define MODIFIER_CTRL (1 << 8) -#define MODIFIER_ALT (1 << 9) -#define MODIFIER_SUPER (1 << 10) - enum weston_output_flags { WL_OUTPUT_FLIPPED = 0x01 }; @@ -513,7 +515,7 @@ typedef void (*weston_binding_handler_t)(struct wl_seat *seat, struct weston_binding * weston_compositor_add_binding(struct weston_compositor *compositor, uint32_t key, uint32_t button, uint32_t axis, - uint32_t modifier, + enum weston_keyboard_modifier modifier, weston_binding_handler_t binding, void *data); void weston_binding_destroy(struct weston_binding *binding); diff --git a/src/shell.c b/src/shell.c index 4d11ba4..fcac599 100644 --- a/src/shell.c +++ b/src/shell.c @@ -242,7 +242,7 @@ static void center_on_output(struct weston_surface *surface, struct weston_output *output); -static uint32_t +static enum weston_keyboard_modifier get_modifier(char *modifier) { if (!modifier) -- 2.7.4