Move grab definitions to wayland-util.h

These tokens really are part of the protocol and we need to extend the
scanner to generate them.
dev
Kristian Høgsberg 14 years ago
parent 5753188e16
commit f1ef15cb45
  1. 26
      compositor/compositor.c
  2. 17
      compositor/compositor.h
  3. 17
      wayland/wayland-util.h

@ -578,17 +578,17 @@ resize_grab_motion(struct wl_grab *grab,
struct wl_surface *surface = device->pointer_focus; struct wl_surface *surface = device->pointer_focus;
int32_t width, height; int32_t width, height;
if (resize->edges & WLSC_DEVICE_GRAB_RESIZE_LEFT) { if (resize->edges & WL_GRAB_RESIZE_LEFT) {
width = device->grab_x - x + resize->width; width = device->grab_x - x + resize->width;
} else if (resize->edges & WLSC_DEVICE_GRAB_RESIZE_RIGHT) { } else if (resize->edges & WL_GRAB_RESIZE_RIGHT) {
width = x - device->grab_x + resize->width; width = x - device->grab_x + resize->width;
} else { } else {
width = resize->width; width = resize->width;
} }
if (resize->edges & WLSC_DEVICE_GRAB_RESIZE_TOP) { if (resize->edges & WL_GRAB_RESIZE_TOP) {
height = device->grab_y - y + resize->height; height = device->grab_y - y + resize->height;
} else if (resize->edges & WLSC_DEVICE_GRAB_RESIZE_BOTTOM) { } else if (resize->edges & WL_GRAB_RESIZE_BOTTOM) {
height = y - device->grab_y + resize->height; height = y - device->grab_y + resize->height;
} else { } else {
height = resize->height; height = resize->height;
@ -645,28 +645,28 @@ shell_resize(struct wl_client *client, struct wl_shell *shell,
return; return;
switch (edges) { switch (edges) {
case WLSC_DEVICE_GRAB_RESIZE_TOP: case WL_GRAB_RESIZE_TOP:
pointer = WLSC_POINTER_TOP; pointer = WLSC_POINTER_TOP;
break; break;
case WLSC_DEVICE_GRAB_RESIZE_BOTTOM: case WL_GRAB_RESIZE_BOTTOM:
pointer = WLSC_POINTER_BOTTOM; pointer = WLSC_POINTER_BOTTOM;
break; break;
case WLSC_DEVICE_GRAB_RESIZE_LEFT: case WL_GRAB_RESIZE_LEFT:
pointer = WLSC_POINTER_LEFT; pointer = WLSC_POINTER_LEFT;
break; break;
case WLSC_DEVICE_GRAB_RESIZE_TOP_LEFT: case WL_GRAB_RESIZE_TOP_LEFT:
pointer = WLSC_POINTER_TOP_LEFT; pointer = WLSC_POINTER_TOP_LEFT;
break; break;
case WLSC_DEVICE_GRAB_RESIZE_BOTTOM_LEFT: case WL_GRAB_RESIZE_BOTTOM_LEFT:
pointer = WLSC_POINTER_BOTTOM_LEFT; pointer = WLSC_POINTER_BOTTOM_LEFT;
break; break;
case WLSC_DEVICE_GRAB_RESIZE_RIGHT: case WL_GRAB_RESIZE_RIGHT:
pointer = WLSC_POINTER_RIGHT; pointer = WLSC_POINTER_RIGHT;
break; break;
case WLSC_DEVICE_GRAB_RESIZE_TOP_RIGHT: case WL_GRAB_RESIZE_TOP_RIGHT:
pointer = WLSC_POINTER_TOP_RIGHT; pointer = WLSC_POINTER_TOP_RIGHT;
break; break;
case WLSC_DEVICE_GRAB_RESIZE_BOTTOM_RIGHT: case WL_GRAB_RESIZE_BOTTOM_RIGHT:
pointer = WLSC_POINTER_BOTTOM_RIGHT; pointer = WLSC_POINTER_BOTTOM_RIGHT;
break; break;
} }
@ -917,7 +917,7 @@ notify_button(struct wl_input_device *device,
shell_resize(NULL, shell_resize(NULL,
(struct wl_shell *) &compositor->shell, (struct wl_shell *) &compositor->shell,
&surface->surface, device, time, &surface->surface, device, time,
WLSC_DEVICE_GRAB_RESIZE_BOTTOM_RIGHT); WL_GRAB_RESIZE_BOTTOM_RIGHT);
device->grab->interface->button(device->grab, time, button, state); device->grab->interface->button(device->grab, time, button, state);

@ -50,23 +50,6 @@ struct wlsc_output {
int32_t x, y, width, height; int32_t x, y, width, height;
}; };
/* These should be part of the protocol */
enum wlsc_grab_type {
WLSC_DEVICE_GRAB_NONE = 0,
WLSC_DEVICE_GRAB_RESIZE_TOP = 1,
WLSC_DEVICE_GRAB_RESIZE_BOTTOM = 2,
WLSC_DEVICE_GRAB_RESIZE_LEFT = 4,
WLSC_DEVICE_GRAB_RESIZE_TOP_LEFT = 5,
WLSC_DEVICE_GRAB_RESIZE_BOTTOM_LEFT = 6,
WLSC_DEVICE_GRAB_RESIZE_RIGHT = 8,
WLSC_DEVICE_GRAB_RESIZE_TOP_RIGHT = 9,
WLSC_DEVICE_GRAB_RESIZE_BOTTOM_RIGHT = 10,
WLSC_DEVICE_GRAB_RESIZE_MASK = 15,
WLSC_DEVICE_GRAB_MOVE = 16,
WLSC_DEVICE_GRAB_MOTION = 17,
WLSC_DEVICE_GRAB_DRAG = 18
};
enum wlsc_pointer_type { enum wlsc_pointer_type {
WLSC_POINTER_BOTTOM_LEFT, WLSC_POINTER_BOTTOM_LEFT,
WLSC_POINTER_BOTTOM_RIGHT, WLSC_POINTER_BOTTOM_RIGHT,

@ -149,6 +149,23 @@ void wl_array_init(struct wl_array *array);
void wl_array_release(struct wl_array *array); void wl_array_release(struct wl_array *array);
void *wl_array_add(struct wl_array *array, int size); void *wl_array_add(struct wl_array *array, int size);
/* FIXME: These should be part of the protocol document */
enum wl_grab_type {
WL_GRAB_NONE = 0,
WL_GRAB_RESIZE_TOP = 1,
WL_GRAB_RESIZE_BOTTOM = 2,
WL_GRAB_RESIZE_LEFT = 4,
WL_GRAB_RESIZE_TOP_LEFT = 5,
WL_GRAB_RESIZE_BOTTOM_LEFT = 6,
WL_GRAB_RESIZE_RIGHT = 8,
WL_GRAB_RESIZE_TOP_RIGHT = 9,
WL_GRAB_RESIZE_BOTTOM_RIGHT = 10,
WL_GRAB_RESIZE_MASK = 15,
WL_GRAB_MOVE = 16,
WL_GRAB_MOTION = 17,
WL_GRAB_DRAG = 18
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

Loading…
Cancel
Save