keyboard: Reorder

The correct order is:

init
release
update
handle_event
set_focus
start_grab
end_grab
other stuff
This commit is contained in:
Jasper St. Pierre 2014-04-17 18:50:16 -04:00
parent 678fa52ae1
commit 4f2dc77ec3
2 changed files with 48 additions and 47 deletions

View File

@ -238,29 +238,6 @@ default_grab_key (MetaWaylandKeyboardGrab *grab,
return (keyboard->focus_surface != NULL); return (keyboard->focus_surface != NULL);
} }
static void
move_resources (struct wl_list *destination, struct wl_list *source)
{
wl_list_insert_list (destination, source);
wl_list_init (source);
}
static void
move_resources_for_client (struct wl_list *destination,
struct wl_list *source,
struct wl_client *client)
{
struct wl_resource *resource, *tmp;
wl_resource_for_each_safe (resource, tmp, source)
{
if (wl_resource_get_client (resource) == client)
{
wl_list_remove (wl_resource_get_link (resource));
wl_list_insert (destination, wl_resource_get_link (resource));
}
}
}
static void static void
default_grab_modifiers (MetaWaylandKeyboardGrab *grab, uint32_t serial, default_grab_modifiers (MetaWaylandKeyboardGrab *grab, uint32_t serial,
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_depressed, uint32_t mods_latched,
@ -328,6 +305,16 @@ meta_wayland_xkb_info_destroy (MetaWaylandXkbInfo *xkb_info)
close (xkb_info->keymap_fd); close (xkb_info->keymap_fd);
} }
void
meta_wayland_keyboard_release (MetaWaylandKeyboard *keyboard)
{
meta_wayland_xkb_info_destroy (&keyboard->xkb_info);
xkb_context_unref (keyboard->xkb_context);
/* XXX: What about keyboard->resource_list? */
wl_array_release (&keyboard->keys);
}
static void static void
update_pressed_keys (MetaWaylandKeyboard *keyboard, update_pressed_keys (MetaWaylandKeyboard *keyboard,
uint32_t evdev_code, uint32_t evdev_code,
@ -429,6 +416,29 @@ meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
return handled; return handled;
} }
static void
move_resources (struct wl_list *destination, struct wl_list *source)
{
wl_list_insert_list (destination, source);
wl_list_init (source);
}
static void
move_resources_for_client (struct wl_list *destination,
struct wl_list *source,
struct wl_client *client)
{
struct wl_resource *resource, *tmp;
wl_resource_for_each_safe (resource, tmp, source)
{
if (wl_resource_get_client (resource) == client)
{
wl_list_remove (wl_resource_get_link (resource));
wl_list_insert (destination, wl_resource_get_link (resource));
}
}
}
void void
meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard, meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
MetaWaylandSurface *surface) MetaWaylandSurface *surface)
@ -512,16 +522,6 @@ meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard)
keyboard->grab = &keyboard->default_grab; keyboard->grab = &keyboard->default_grab;
} }
void
meta_wayland_keyboard_release (MetaWaylandKeyboard *keyboard)
{
meta_wayland_xkb_info_destroy (&keyboard->xkb_info);
xkb_context_unref (keyboard->xkb_context);
/* XXX: What about keyboard->resource_list? */
wl_array_release (&keyboard->keys);
}
void void
meta_wayland_keyboard_set_keymap_names (MetaWaylandKeyboard *keyboard, meta_wayland_keyboard_set_keymap_names (MetaWaylandKeyboard *keyboard,
const char *rules, const char *rules,

View File

@ -105,18 +105,13 @@ gboolean
meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard, meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
struct wl_display *display); struct wl_display *display);
typedef enum { void
META_WAYLAND_KEYBOARD_SKIP_XCLIENTS = 1, meta_wayland_keyboard_release (MetaWaylandKeyboard *keyboard);
} MetaWaylandKeyboardSetKeymapFlags;
void void
meta_wayland_keyboard_set_keymap_names (MetaWaylandKeyboard *keyboard, meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
const char *rules, const ClutterKeyEvent *event);
const char *model,
const char *layout,
const char *variant,
const char *options,
int flags);
gboolean gboolean
meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard, meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
const ClutterKeyEvent *event); const ClutterKeyEvent *event);
@ -132,12 +127,18 @@ meta_wayland_keyboard_start_grab (MetaWaylandKeyboard *device,
void void
meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard); meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard);
void typedef enum {
meta_wayland_keyboard_release (MetaWaylandKeyboard *keyboard); META_WAYLAND_KEYBOARD_SKIP_XCLIENTS = 1,
} MetaWaylandKeyboardSetKeymapFlags;
void void
meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard, meta_wayland_keyboard_set_keymap_names (MetaWaylandKeyboard *keyboard,
const ClutterKeyEvent *event); const char *rules,
const char *model,
const char *layout,
const char *variant,
const char *options,
int flags);
struct wl_client * struct wl_client *
meta_wayland_keyboard_get_focus_client (MetaWaylandKeyboard *keyboard); meta_wayland_keyboard_get_focus_client (MetaWaylandKeyboard *keyboard);