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);
}
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
default_grab_modifiers (MetaWaylandKeyboardGrab *grab, uint32_t serial,
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);
}
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
update_pressed_keys (MetaWaylandKeyboard *keyboard,
uint32_t evdev_code,
@ -429,6 +416,29 @@ meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
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
meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
MetaWaylandSurface *surface)
@ -512,16 +522,6 @@ meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard)
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
meta_wayland_keyboard_set_keymap_names (MetaWaylandKeyboard *keyboard,
const char *rules,

View File

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