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

dev
Kristian Høgsberg 13 years ago
parent f47d8fe88c
commit e1a850e5b0
  1. 32
      compositor/compositor.c
  2. 33
      compositor/shell.c

@ -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 static void
update_modifier_state(struct wlsc_input_device *device, update_modifier_state(struct wlsc_input_device *device,
uint32_t key, uint32_t state) 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; ec->fade.animation.frame = fade_frame;
wl_list_init(&ec->fade.animation.link); 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); screenshooter_create(ec);
wlsc_data_device_manager_init(ec); wlsc_data_device_manager_init(ec);

@ -798,6 +798,16 @@ resize_binding(struct wl_input_device *device, uint32_t time,
time, edges); 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 static void
activate(struct wlsc_shell *base, struct wlsc_surface *es, activate(struct wlsc_shell *base, struct wlsc_surface *es,
struct wlsc_input_device *device, uint32_t time) 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 static void
lock(struct wlsc_shell *base) lock(struct wlsc_shell *base)
{ {
@ -1258,6 +1283,14 @@ shell_init(struct wlsc_compositor *ec)
move_binding, shell); move_binding, shell);
wlsc_compositor_add_binding(ec, 0, BTN_MIDDLE, MODIFIER_SUPER, wlsc_compositor_add_binding(ec, 0, BTN_MIDDLE, MODIFIER_SUPER,
resize_binding, shell); 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; ec->shell = &shell->shell;

Loading…
Cancel
Save