mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
Implement server side move override
This commit is contained in:
parent
83fc061c9c
commit
5b75f1b218
2 changed files with 19 additions and 8 deletions
24
compositor.c
24
compositor.c
|
|
@ -783,9 +783,15 @@ notify_button(struct wlsc_input_device *device,
|
|||
device->grab = WLSC_DEVICE_GRAB_NONE;
|
||||
}
|
||||
|
||||
wl_surface_post_event(&surface->base, &device->base,
|
||||
WL_INPUT_DEVICE_BUTTON,
|
||||
time, button, state);
|
||||
if (state && button == BTN_LEFT &&
|
||||
device->grab == WLSC_DEVICE_GRAB_MOTION &&
|
||||
(device->modifier_state & MODIFIER_SUPER))
|
||||
shell_move(NULL, &compositor->shell,
|
||||
&surface->base, device, time);
|
||||
else
|
||||
wl_surface_post_event(&surface->base, &device->base,
|
||||
WL_INPUT_DEVICE_BUTTON,
|
||||
time, button, state);
|
||||
|
||||
wlsc_compositor_schedule_repaint(compositor);
|
||||
}
|
||||
|
|
@ -795,11 +801,10 @@ void
|
|||
notify_key(struct wlsc_input_device *device,
|
||||
uint32_t time, uint32_t key, uint32_t state)
|
||||
{
|
||||
struct wlsc_compositor *compositor = device->ec;
|
||||
uint32_t *k, *end;
|
||||
uint32_t modifier;
|
||||
|
||||
switch (key | compositor->modifier_state) {
|
||||
switch (key | device->modifier_state) {
|
||||
case KEY_BACKSPACE | MODIFIER_CTRL | MODIFIER_ALT:
|
||||
kill(0, SIGTERM);
|
||||
return;
|
||||
|
|
@ -816,15 +821,20 @@ notify_key(struct wlsc_input_device *device,
|
|||
modifier = MODIFIER_ALT;
|
||||
break;
|
||||
|
||||
case KEY_LEFTMETA:
|
||||
case KEY_RIGHTMETA:
|
||||
modifier = MODIFIER_SUPER;
|
||||
break;
|
||||
|
||||
default:
|
||||
modifier = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (state)
|
||||
compositor->modifier_state |= modifier;
|
||||
device->modifier_state |= modifier;
|
||||
else
|
||||
compositor->modifier_state &= ~modifier;
|
||||
device->modifier_state &= ~modifier;
|
||||
|
||||
end = device->keys.data + device->keys.size;
|
||||
for (k = device->keys.data; k < end; k++) {
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ struct wlsc_input_device {
|
|||
struct wlsc_surface *pointer_focus;
|
||||
struct wlsc_surface *keyboard_focus;
|
||||
struct wl_array keys;
|
||||
uint32_t modifier_state;
|
||||
|
||||
enum wlsc_grab_type grab;
|
||||
uint32_t grab_time;
|
||||
|
|
@ -121,7 +122,6 @@ struct wlsc_compositor {
|
|||
struct timespec previous_swap;
|
||||
uint32_t current_frame;
|
||||
|
||||
uint32_t modifier_state;
|
||||
uint32_t focus;
|
||||
|
||||
void (*present)(struct wlsc_compositor *c);
|
||||
|
|
@ -129,6 +129,7 @@ struct wlsc_compositor {
|
|||
|
||||
#define MODIFIER_CTRL (1 << 8)
|
||||
#define MODIFIER_ALT (1 << 9)
|
||||
#define MODIFIER_SUPER (1 << 10)
|
||||
|
||||
struct wlsc_vector {
|
||||
GLfloat f[4];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue