Implement server side move override

dev
Kristian Høgsberg 14 years ago
parent 83fc061c9c
commit 5b75f1b218
  1. 18
      compositor.c
  2. 3
      compositor.h

@ -783,6 +783,12 @@ notify_button(struct wlsc_input_device *device,
device->grab = WLSC_DEVICE_GRAB_NONE; device->grab = WLSC_DEVICE_GRAB_NONE;
} }
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_surface_post_event(&surface->base, &device->base,
WL_INPUT_DEVICE_BUTTON, WL_INPUT_DEVICE_BUTTON,
time, button, state); time, button, state);
@ -795,11 +801,10 @@ void
notify_key(struct wlsc_input_device *device, notify_key(struct wlsc_input_device *device,
uint32_t time, uint32_t key, uint32_t state) uint32_t time, uint32_t key, uint32_t state)
{ {
struct wlsc_compositor *compositor = device->ec;
uint32_t *k, *end; uint32_t *k, *end;
uint32_t modifier; uint32_t modifier;
switch (key | compositor->modifier_state) { switch (key | device->modifier_state) {
case KEY_BACKSPACE | MODIFIER_CTRL | MODIFIER_ALT: case KEY_BACKSPACE | MODIFIER_CTRL | MODIFIER_ALT:
kill(0, SIGTERM); kill(0, SIGTERM);
return; return;
@ -816,15 +821,20 @@ notify_key(struct wlsc_input_device *device,
modifier = MODIFIER_ALT; modifier = MODIFIER_ALT;
break; break;
case KEY_LEFTMETA:
case KEY_RIGHTMETA:
modifier = MODIFIER_SUPER;
break;
default: default:
modifier = 0; modifier = 0;
break; break;
} }
if (state) if (state)
compositor->modifier_state |= modifier; device->modifier_state |= modifier;
else else
compositor->modifier_state &= ~modifier; device->modifier_state &= ~modifier;
end = device->keys.data + device->keys.size; end = device->keys.data + device->keys.size;
for (k = device->keys.data; k < end; k++) { for (k = device->keys.data; k < end; k++) {

@ -82,6 +82,7 @@ struct wlsc_input_device {
struct wlsc_surface *pointer_focus; struct wlsc_surface *pointer_focus;
struct wlsc_surface *keyboard_focus; struct wlsc_surface *keyboard_focus;
struct wl_array keys; struct wl_array keys;
uint32_t modifier_state;
enum wlsc_grab_type grab; enum wlsc_grab_type grab;
uint32_t grab_time; uint32_t grab_time;
@ -121,7 +122,6 @@ struct wlsc_compositor {
struct timespec previous_swap; struct timespec previous_swap;
uint32_t current_frame; uint32_t current_frame;
uint32_t modifier_state;
uint32_t focus; uint32_t focus;
void (*present)(struct wlsc_compositor *c); void (*present)(struct wlsc_compositor *c);
@ -129,6 +129,7 @@ struct wlsc_compositor {
#define MODIFIER_CTRL (1 << 8) #define MODIFIER_CTRL (1 << 8)
#define MODIFIER_ALT (1 << 9) #define MODIFIER_ALT (1 << 9)
#define MODIFIER_SUPER (1 << 10)
struct wlsc_vector { struct wlsc_vector {
GLfloat f[4]; GLfloat f[4];

Loading…
Cancel
Save