compositor: Move click-to-focus and ctrl-alt-bs bindings to shell.c

This commit is contained in:
Kristian Høgsberg 2011-12-19 15:18:05 -05:00
parent f47d8fe88c
commit e1a850e5b0
2 changed files with 33 additions and 32 deletions

View File

@ -1297,31 +1297,6 @@ notify_button(struct wl_input_device *device,
}
}
static void
terminate_binding(struct wl_input_device *device, uint32_t time,
uint32_t key, uint32_t button, uint32_t state, void *data)
{
struct wlsc_compositor *compositor = data;
if (state)
wl_display_terminate(compositor->wl_display);
}
static void
click_to_activate_binding(struct wl_input_device *device,
uint32_t time, uint32_t key,
uint32_t button, uint32_t state, void *data)
{
struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
struct wlsc_compositor *compositor = data;
struct wlsc_surface *focus;
focus = (struct wlsc_surface *) device->pointer_focus;
if (state && focus && device->grab == NULL)
compositor->shell->activate(compositor->shell,
focus, wd, time);
}
static void
update_modifier_state(struct wlsc_input_device *device,
uint32_t key, uint32_t state)
@ -1862,13 +1837,6 @@ wlsc_compositor_init(struct wlsc_compositor *ec, struct wl_display *display)
ec->fade.animation.frame = fade_frame;
wl_list_init(&ec->fade.animation.link);
wlsc_compositor_add_binding(ec, KEY_BACKSPACE, 0,
MODIFIER_CTRL | MODIFIER_ALT,
terminate_binding, ec);
wlsc_compositor_add_binding(ec, 0, BTN_LEFT, 0,
click_to_activate_binding, ec);
screenshooter_create(ec);
wlsc_data_device_manager_init(ec);

View File

@ -798,6 +798,16 @@ resize_binding(struct wl_input_device *device, uint32_t time,
time, edges);
}
static void
terminate_binding(struct wl_input_device *device, uint32_t time,
uint32_t key, uint32_t button, uint32_t state, void *data)
{
struct wlsc_compositor *compositor = data;
if (state)
wl_display_terminate(compositor->wl_display);
}
static void
activate(struct wlsc_shell *base, struct wlsc_surface *es,
struct wlsc_input_device *device, uint32_t time)
@ -840,6 +850,21 @@ activate(struct wlsc_shell *base, struct wlsc_surface *es,
}
}
static void
click_to_activate_binding(struct wl_input_device *device,
uint32_t time, uint32_t key,
uint32_t button, uint32_t state, void *data)
{
struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
struct wlsc_compositor *compositor = data;
struct wlsc_surface *focus;
focus = (struct wlsc_surface *) device->pointer_focus;
if (state && focus && device->grab == NULL)
compositor->shell->activate(compositor->shell,
focus, wd, time);
}
static void
lock(struct wlsc_shell *base)
{
@ -1258,6 +1283,14 @@ shell_init(struct wlsc_compositor *ec)
move_binding, shell);
wlsc_compositor_add_binding(ec, 0, BTN_MIDDLE, MODIFIER_SUPER,
resize_binding, shell);
wlsc_compositor_add_binding(ec, KEY_BACKSPACE, 0,
MODIFIER_CTRL | MODIFIER_ALT,
terminate_binding, ec);
wlsc_compositor_add_binding(ec, 0, BTN_LEFT, 0,
click_to_activate_binding, ec);
ec->shell = &shell->shell;