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 <daniel@fooishbar.org>
dev
Daniel Stone 13 years ago committed by Kristian Høgsberg
parent 351eb61fbc
commit 496ca17a77
  1. 2
      src/compositor.c
  2. 14
      src/compositor.h
  3. 2
      src/shell.c

@ -1732,7 +1732,7 @@ static int
update_modifier_state(struct weston_seat *seat, uint32_t key, uint32_t state) update_modifier_state(struct weston_seat *seat, uint32_t key, uint32_t state)
{ {
struct weston_compositor *compositor = seat->compositor; struct weston_compositor *compositor = seat->compositor;
uint32_t modifier; enum weston_keyboard_modifier modifier;
uint32_t mods_depressed, mods_latched, mods_locked, group; uint32_t mods_depressed, mods_latched, mods_locked, group;
int ret = 0; int ret = 0;

@ -48,6 +48,12 @@ struct shell_surface;
struct weston_seat; struct weston_seat;
struct weston_output; struct weston_output;
enum weston_keyboard_modifier {
MODIFIER_CTRL = (1 << 0),
MODIFIER_ALT = (1 << 1),
MODIFIER_SUPER = (1 << 2),
};
struct weston_mode { struct weston_mode {
uint32_t flags; uint32_t flags;
int32_t width, height; int32_t width, height;
@ -161,7 +167,7 @@ struct weston_seat {
struct wl_listener drag_surface_destroy_listener; struct wl_listener drag_surface_destroy_listener;
int32_t hotspot_x, hotspot_y; int32_t hotspot_x, hotspot_y;
struct wl_list link; struct wl_list link;
uint32_t modifier_state; enum weston_keyboard_modifier modifier_state;
int hw_cursor; int hw_cursor;
struct wl_surface *saved_kbd_focus; struct wl_surface *saved_kbd_focus;
struct wl_listener saved_kbd_focus_listener; struct wl_listener saved_kbd_focus_listener;
@ -299,10 +305,6 @@ struct weston_compositor {
} xkb_info; } xkb_info;
}; };
#define MODIFIER_CTRL (1 << 8)
#define MODIFIER_ALT (1 << 9)
#define MODIFIER_SUPER (1 << 10)
enum weston_output_flags { enum weston_output_flags {
WL_OUTPUT_FLIPPED = 0x01 WL_OUTPUT_FLIPPED = 0x01
}; };
@ -513,7 +515,7 @@ typedef void (*weston_binding_handler_t)(struct wl_seat *seat,
struct weston_binding * struct weston_binding *
weston_compositor_add_binding(struct weston_compositor *compositor, weston_compositor_add_binding(struct weston_compositor *compositor,
uint32_t key, uint32_t button, uint32_t axis, uint32_t key, uint32_t button, uint32_t axis,
uint32_t modifier, enum weston_keyboard_modifier modifier,
weston_binding_handler_t binding, void *data); weston_binding_handler_t binding, void *data);
void void
weston_binding_destroy(struct weston_binding *binding); weston_binding_destroy(struct weston_binding *binding);

@ -242,7 +242,7 @@ static void
center_on_output(struct weston_surface *surface, center_on_output(struct weston_surface *surface,
struct weston_output *output); struct weston_output *output);
static uint32_t static enum weston_keyboard_modifier
get_modifier(char *modifier) get_modifier(char *modifier)
{ {
if (!modifier) if (!modifier)

Loading…
Cancel
Save