|
|
@ -1541,9 +1541,7 @@ get_shell_surface_type(struct weston_surface *surface) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
move_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
move_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data) |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, int32_t value, |
|
|
|
|
|
|
|
void *data) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_surface *surface = |
|
|
|
struct weston_surface *surface = |
|
|
|
(struct weston_surface *) seat->pointer->focus; |
|
|
|
(struct weston_surface *) seat->pointer->focus; |
|
|
@ -1570,9 +1568,7 @@ move_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
resize_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
resize_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data) |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, int32_t value, |
|
|
|
|
|
|
|
void *data) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_surface *surface = |
|
|
|
struct weston_surface *surface = |
|
|
|
(struct weston_surface *) seat->pointer->focus; |
|
|
|
(struct weston_surface *) seat->pointer->focus; |
|
|
@ -1620,8 +1616,7 @@ resize_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
surface_opacity_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
surface_opacity_binding(struct wl_seat *seat, uint32_t time, uint32_t axis, |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, |
|
|
|
|
|
|
|
int32_t value, void *data) |
|
|
|
int32_t value, void *data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
float step = 0.05; |
|
|
|
float step = 0.05; |
|
|
@ -1656,9 +1651,8 @@ surface_opacity_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
zoom_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
do_zoom(struct wl_seat *seat, uint32_t time, uint32_t key, uint32_t axis, |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, int32_t value, |
|
|
|
int32_t value) |
|
|
|
void *data) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_seat *ws = (struct weston_seat *) seat; |
|
|
|
struct weston_seat *ws = (struct weston_seat *) seat; |
|
|
|
struct weston_compositor *compositor = ws->compositor; |
|
|
|
struct weston_compositor *compositor = ws->compositor; |
|
|
@ -1670,9 +1664,9 @@ zoom_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
wl_fixed_to_double(seat->pointer->x), |
|
|
|
wl_fixed_to_double(seat->pointer->x), |
|
|
|
wl_fixed_to_double(seat->pointer->y), |
|
|
|
wl_fixed_to_double(seat->pointer->y), |
|
|
|
NULL)) { |
|
|
|
NULL)) { |
|
|
|
if (key == KEY_PAGEUP && value) |
|
|
|
if (key == KEY_PAGEUP) |
|
|
|
increment = output->zoom.increment; |
|
|
|
increment = output->zoom.increment; |
|
|
|
else if (key == KEY_PAGEDOWN && value) |
|
|
|
else if (key == KEY_PAGEDOWN) |
|
|
|
increment = -output->zoom.increment; |
|
|
|
increment = -output->zoom.increment; |
|
|
|
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) |
|
|
|
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) |
|
|
|
increment = output->zoom.increment * value; |
|
|
|
increment = output->zoom.increment * value; |
|
|
@ -1701,12 +1695,25 @@ zoom_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
terminate_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
zoom_axis_binding(struct wl_seat *seat, uint32_t time, uint32_t axis, |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, int32_t state, void *data) |
|
|
|
int32_t value, void *data) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
do_zoom(seat, time, 0, axis, value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
|
|
|
zoom_key_binding(struct wl_seat *seat, uint32_t time, uint32_t key, |
|
|
|
|
|
|
|
void *data) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
do_zoom(seat, time, key, 0, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
|
|
|
terminate_binding(struct wl_seat *seat, uint32_t time, uint32_t key, |
|
|
|
|
|
|
|
void *data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_compositor *compositor = data; |
|
|
|
struct weston_compositor *compositor = data; |
|
|
|
|
|
|
|
|
|
|
|
if (state) |
|
|
|
|
|
|
|
wl_display_terminate(compositor->wl_display); |
|
|
|
wl_display_terminate(compositor->wl_display); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1807,8 +1814,7 @@ static const struct wl_pointer_grab_interface rotate_grab_interface = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
rotate_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
rotate_binding(struct wl_seat *seat, uint32_t time, uint32_t button, |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, int32_t value, |
|
|
|
|
|
|
|
void *data) |
|
|
|
void *data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_surface *base_surface = |
|
|
|
struct weston_surface *base_surface = |
|
|
@ -1936,16 +1942,13 @@ is_black_surface (struct weston_surface *es, struct weston_surface **fs_surface) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
click_to_activate_binding(struct wl_seat *seat, |
|
|
|
click_to_activate_binding(struct wl_seat *seat, uint32_t time, uint32_t button, |
|
|
|
uint32_t time, uint32_t key, |
|
|
|
|
|
|
|
uint32_t button, uint32_t axis, int32_t state_w, |
|
|
|
|
|
|
|
void *data) |
|
|
|
void *data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_seat *ws = (struct weston_seat *) seat; |
|
|
|
struct weston_seat *ws = (struct weston_seat *) seat; |
|
|
|
struct desktop_shell *shell = data; |
|
|
|
struct desktop_shell *shell = data; |
|
|
|
struct weston_surface *focus; |
|
|
|
struct weston_surface *focus; |
|
|
|
struct weston_surface *upper; |
|
|
|
struct weston_surface *upper; |
|
|
|
enum wl_pointer_button_state state = state_w; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
focus = (struct weston_surface *) seat->pointer->focus; |
|
|
|
focus = (struct weston_surface *) seat->pointer->focus; |
|
|
|
if (!focus) |
|
|
|
if (!focus) |
|
|
@ -1954,8 +1957,7 @@ click_to_activate_binding(struct wl_seat *seat, |
|
|
|
if (is_black_surface(focus, &upper)) |
|
|
|
if (is_black_surface(focus, &upper)) |
|
|
|
focus = upper; |
|
|
|
focus = upper; |
|
|
|
|
|
|
|
|
|
|
|
if (state == WL_POINTER_BUTTON_STATE_PRESSED && |
|
|
|
if (seat->pointer->grab == &seat->pointer->default_grab) |
|
|
|
seat->pointer->grab == &seat->pointer->default_grab) |
|
|
|
|
|
|
|
activate(shell, focus, ws); |
|
|
|
activate(shell, focus, ws); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2511,9 +2513,8 @@ static const struct wl_keyboard_grab_interface switcher_grab = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
switcher_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
switcher_binding(struct wl_seat *seat, uint32_t time, uint32_t key, |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, |
|
|
|
void *data) |
|
|
|
int32_t value, void *data) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
struct desktop_shell *shell = data; |
|
|
|
struct desktop_shell *shell = data; |
|
|
|
struct switcher *switcher; |
|
|
|
struct switcher *switcher; |
|
|
@ -2531,8 +2532,8 @@ switcher_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
backlight_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
backlight_binding(struct wl_seat *seat, uint32_t time, uint32_t key, |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, int32_t state, void *data) |
|
|
|
void *data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_compositor *compositor = data; |
|
|
|
struct weston_compositor *compositor = data; |
|
|
|
struct weston_output *output; |
|
|
|
struct weston_output *output; |
|
|
@ -2564,9 +2565,8 @@ backlight_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
debug_repaint_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
debug_repaint_binding(struct wl_seat *seat, uint32_t time, uint32_t key, |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, |
|
|
|
void *data) |
|
|
|
int32_t value, void *data) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
struct desktop_shell *shell = data; |
|
|
|
struct desktop_shell *shell = data; |
|
|
|
struct weston_compositor *compositor = shell->compositor; |
|
|
|
struct weston_compositor *compositor = shell->compositor; |
|
|
@ -2599,21 +2599,18 @@ debug_repaint_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
force_kill_binding(struct wl_seat *seat, uint32_t time, |
|
|
|
force_kill_binding(struct wl_seat *seat, uint32_t time, uint32_t key, |
|
|
|
uint32_t key, uint32_t button, uint32_t axis, |
|
|
|
void *data) |
|
|
|
int32_t value, void *data) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wl_client *client; |
|
|
|
struct wl_client *client; |
|
|
|
pid_t pid; |
|
|
|
pid_t pid; |
|
|
|
uid_t uid; |
|
|
|
uid_t uid; |
|
|
|
gid_t gid; |
|
|
|
gid_t gid; |
|
|
|
|
|
|
|
|
|
|
|
if (value == 1) { |
|
|
|
|
|
|
|
client = seat->keyboard->focus->resource.client; |
|
|
|
client = seat->keyboard->focus->resource.client; |
|
|
|
wl_client_get_credentials(client, &pid, &uid, &gid); |
|
|
|
wl_client_get_credentials(client, &pid, &uid, &gid); |
|
|
|
|
|
|
|
|
|
|
|
kill(pid, SIGKILL); |
|
|
|
kill(pid, SIGKILL); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
@ -2638,44 +2635,44 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) |
|
|
|
uint32_t mod; |
|
|
|
uint32_t mod; |
|
|
|
|
|
|
|
|
|
|
|
/* fixed bindings */ |
|
|
|
/* fixed bindings */ |
|
|
|
weston_compositor_add_binding(ec, KEY_BACKSPACE, 0, 0, |
|
|
|
weston_compositor_add_key_binding(ec, KEY_BACKSPACE, |
|
|
|
MODIFIER_CTRL | MODIFIER_ALT, |
|
|
|
MODIFIER_CTRL | MODIFIER_ALT, |
|
|
|
terminate_binding, ec); |
|
|
|
terminate_binding, ec); |
|
|
|
weston_compositor_add_binding(ec, 0, BTN_LEFT, 0, 0, |
|
|
|
weston_compositor_add_button_binding(ec, BTN_LEFT, 0, |
|
|
|
click_to_activate_binding, shell); |
|
|
|
click_to_activate_binding, |
|
|
|
weston_compositor_add_binding(ec, 0, 0, |
|
|
|
shell); |
|
|
|
WL_POINTER_AXIS_VERTICAL_SCROLL, |
|
|
|
weston_compositor_add_axis_binding(ec, WL_POINTER_AXIS_VERTICAL_SCROLL, |
|
|
|
MODIFIER_SUPER | MODIFIER_ALT, |
|
|
|
MODIFIER_SUPER | MODIFIER_ALT, |
|
|
|
surface_opacity_binding, NULL); |
|
|
|
surface_opacity_binding, NULL); |
|
|
|
weston_compositor_add_binding(ec, 0, 0, |
|
|
|
weston_compositor_add_axis_binding(ec, WL_POINTER_AXIS_VERTICAL_SCROLL, |
|
|
|
WL_POINTER_AXIS_VERTICAL_SCROLL, |
|
|
|
MODIFIER_SUPER, zoom_axis_binding, |
|
|
|
MODIFIER_SUPER, zoom_binding, NULL); |
|
|
|
NULL); |
|
|
|
|
|
|
|
|
|
|
|
/* configurable bindings */ |
|
|
|
/* configurable bindings */ |
|
|
|
mod = shell->binding_modifier; |
|
|
|
mod = shell->binding_modifier; |
|
|
|
weston_compositor_add_binding(ec, KEY_PAGEUP, 0, 0, mod, |
|
|
|
weston_compositor_add_key_binding(ec, KEY_PAGEUP, mod, |
|
|
|
zoom_binding, NULL); |
|
|
|
zoom_key_binding, NULL); |
|
|
|
weston_compositor_add_binding(ec, KEY_PAGEDOWN, 0, 0, mod, |
|
|
|
weston_compositor_add_key_binding(ec, KEY_PAGEDOWN, mod, |
|
|
|
zoom_binding, NULL); |
|
|
|
zoom_key_binding, NULL); |
|
|
|
weston_compositor_add_binding(ec, 0, BTN_LEFT, 0, mod, |
|
|
|
weston_compositor_add_button_binding(ec, BTN_LEFT, mod, move_binding, |
|
|
|
move_binding, shell); |
|
|
|
shell); |
|
|
|
weston_compositor_add_binding(ec, 0, BTN_MIDDLE, 0, mod, |
|
|
|
weston_compositor_add_button_binding(ec, BTN_MIDDLE, mod, |
|
|
|
resize_binding, shell); |
|
|
|
resize_binding, shell); |
|
|
|
weston_compositor_add_binding(ec, 0, BTN_RIGHT, 0, mod, |
|
|
|
weston_compositor_add_button_binding(ec, BTN_RIGHT, mod, |
|
|
|
rotate_binding, NULL); |
|
|
|
rotate_binding, NULL); |
|
|
|
weston_compositor_add_binding(ec, KEY_TAB, 0, 0, mod, |
|
|
|
weston_compositor_add_key_binding(ec, KEY_TAB, mod, switcher_binding, |
|
|
|
switcher_binding, shell); |
|
|
|
shell); |
|
|
|
weston_compositor_add_binding(ec, KEY_F9, 0, 0, mod, |
|
|
|
weston_compositor_add_key_binding(ec, KEY_F9, mod, backlight_binding, |
|
|
|
backlight_binding, ec); |
|
|
|
ec); |
|
|
|
weston_compositor_add_binding(ec, KEY_BRIGHTNESSDOWN, 0, 0, 0, |
|
|
|
weston_compositor_add_key_binding(ec, KEY_BRIGHTNESSDOWN, 0, |
|
|
|
backlight_binding, ec); |
|
|
|
|
|
|
|
weston_compositor_add_binding(ec, KEY_F10, 0, 0, mod, |
|
|
|
|
|
|
|
backlight_binding, ec); |
|
|
|
backlight_binding, ec); |
|
|
|
weston_compositor_add_binding(ec, KEY_BRIGHTNESSUP, 0, 0, 0, |
|
|
|
weston_compositor_add_key_binding(ec, KEY_F10, mod, backlight_binding, |
|
|
|
|
|
|
|
ec); |
|
|
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_BRIGHTNESSUP, 0, |
|
|
|
backlight_binding, ec); |
|
|
|
backlight_binding, ec); |
|
|
|
weston_compositor_add_binding(ec, KEY_SPACE, 0, 0, mod, |
|
|
|
weston_compositor_add_key_binding(ec, KEY_SPACE, mod, |
|
|
|
debug_repaint_binding, shell); |
|
|
|
debug_repaint_binding, shell); |
|
|
|
weston_compositor_add_binding(ec, KEY_K, 0, 0, mod, |
|
|
|
weston_compositor_add_key_binding(ec, KEY_K, mod, |
|
|
|
force_kill_binding, shell); |
|
|
|
force_kill_binding, shell); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|