Commit 8134e067 authored by Scott Moreau's avatar Scott Moreau Committed by Kristian Høgsberg
Browse files

server: Rename wl_grab_interface.

In order to separate pointer and keyboard grabs, we need to
introduce a keyboard grab interface but first we must rename
some generic types to denote which device is holding the grab.

Type renames:

wl_grab_interface -> wl_pointer_grab_interface
wl_grab -> wl_pointer_grab
wl_input_device_start_grab -> wl_input_device_start_pointer_grab
wl_input_device_end_grab -> wl_input_device_end_pointer_grab
parent 8503cd68
......@@ -179,7 +179,7 @@ destroy_drag_focus(struct wl_listener *listener,
}
static void
drag_grab_focus(struct wl_grab *grab, uint32_t time,
drag_grab_focus(struct wl_pointer_grab *grab, uint32_t time,
struct wl_surface *surface, int32_t x, int32_t y)
{
struct wl_input_device *device =
......@@ -215,7 +215,7 @@ drag_grab_focus(struct wl_grab *grab, uint32_t time,
}
static void
drag_grab_motion(struct wl_grab *grab,
drag_grab_motion(struct wl_pointer_grab *grab,
uint32_t time, int32_t x, int32_t y)
{
struct wl_input_device *device =
......@@ -227,7 +227,7 @@ drag_grab_motion(struct wl_grab *grab,
}
static void
drag_grab_button(struct wl_grab *grab,
drag_grab_button(struct wl_pointer_grab *grab,
uint32_t time, int32_t button, int32_t state)
{
struct wl_input_device *device =
......@@ -239,7 +239,7 @@ drag_grab_button(struct wl_grab *grab,
WL_DATA_DEVICE_DROP);
if (device->button_count == 0 && state == 0) {
wl_input_device_end_grab(device, time);
wl_input_device_end_pointer_grab(device, time);
if (device->drag_surface) {
struct wl_resource *surface_resource =
......@@ -257,7 +257,7 @@ drag_grab_button(struct wl_grab *grab,
}
}
static const struct wl_grab_interface drag_grab_interface = {
static const struct wl_pointer_grab_interface drag_grab_interface = {
drag_grab_focus,
drag_grab_motion,
drag_grab_button,
......@@ -282,7 +282,7 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
if (icon_resource)
device->drag_surface = icon_resource->data;
wl_input_device_start_grab(device, &device->drag_grab, time);
wl_input_device_start_pointer_grab(device, &device->drag_grab, time);
}
static void
......
......@@ -435,7 +435,7 @@ lose_keyboard_focus(struct wl_listener *listener,
}
static void
default_grab_focus(struct wl_grab *grab, uint32_t time,
default_grab_focus(struct wl_pointer_grab *grab, uint32_t time,
struct wl_surface *surface, int32_t x, int32_t y)
{
struct wl_input_device *device = grab->input_device;
......@@ -447,7 +447,7 @@ default_grab_focus(struct wl_grab *grab, uint32_t time,
}
static void
default_grab_motion(struct wl_grab *grab,
default_grab_motion(struct wl_pointer_grab *grab,
uint32_t time, int32_t x, int32_t y)
{
struct wl_resource *resource;
......@@ -459,7 +459,7 @@ default_grab_motion(struct wl_grab *grab,
}
static void
default_grab_button(struct wl_grab *grab,
default_grab_button(struct wl_pointer_grab *grab,
uint32_t time, int32_t button, int32_t state)
{
struct wl_input_device *device = grab->input_device;
......@@ -477,7 +477,8 @@ default_grab_button(struct wl_grab *grab,
device->current_y);
}
static const struct wl_grab_interface default_grab_interface = {
static const struct wl_pointer_grab_interface
default_pointer_grab_interface = {
default_grab_focus,
default_grab_motion,
default_grab_button
......@@ -492,9 +493,9 @@ wl_input_device_init(struct wl_input_device *device)
device->pointer_focus_listener.func = lose_pointer_focus;
device->keyboard_focus_listener.func = lose_keyboard_focus;
device->default_grab.interface = &default_grab_interface;
device->default_grab.input_device = device;
device->grab = &device->default_grab;
device->default_pointer_grab.interface = &default_pointer_grab_interface;
device->default_pointer_grab.input_device = device;
device->pointer_grab = &device->default_pointer_grab;
wl_list_init(&device->drag_resource_list);
device->selection_data_source = NULL;
......@@ -566,7 +567,7 @@ wl_input_device_set_pointer_focus(struct wl_input_device *device,
device->pointer_focus_resource = resource;
device->pointer_focus = surface;
device->pointer_focus_time = time;
device->default_grab.focus = surface;
device->default_pointer_grab.focus = surface;
}
WL_EXPORT void
......@@ -603,28 +604,28 @@ wl_input_device_set_keyboard_focus(struct wl_input_device *device,
}
WL_EXPORT void
wl_input_device_start_grab(struct wl_input_device *device,
struct wl_grab *grab, uint32_t time)
wl_input_device_start_pointer_grab(struct wl_input_device *device,
struct wl_pointer_grab *grab, uint32_t time)
{
const struct wl_grab_interface *interface;
const struct wl_pointer_grab_interface *interface;
device->grab = grab;
interface = device->grab->interface;
device->pointer_grab = grab;
interface = device->pointer_grab->interface;
grab->input_device = device;
if (device->current)
interface->focus(device->grab, time, device->current,
interface->focus(device->pointer_grab, time, device->current,
device->current_x, device->current_y);
}
WL_EXPORT void
wl_input_device_end_grab(struct wl_input_device *device, uint32_t time)
wl_input_device_end_pointer_grab(struct wl_input_device *device, uint32_t time)
{
const struct wl_grab_interface *interface;
const struct wl_pointer_grab_interface *interface;
device->grab = &device->default_grab;
interface = device->grab->interface;
interface->focus(device->grab, time, device->current,
device->pointer_grab = &device->default_pointer_grab;
interface = device->pointer_grab->interface;
interface->focus(device->pointer_grab, time, device->current,
device->current_x, device->current_y);
}
......
......@@ -147,18 +147,18 @@ struct wl_surface {
struct wl_resource resource;
};
struct wl_grab;
struct wl_grab_interface {
void (*focus)(struct wl_grab *grab, uint32_t time,
struct wl_pointer_grab;
struct wl_pointer_grab_interface {
void (*focus)(struct wl_pointer_grab *grab, uint32_t time,
struct wl_surface *surface, int32_t x, int32_t y);
void (*motion)(struct wl_grab *grab,
void (*motion)(struct wl_pointer_grab *grab,
uint32_t time, int32_t x, int32_t y);
void (*button)(struct wl_grab *grab,
void (*button)(struct wl_pointer_grab *grab,
uint32_t time, int32_t button, int32_t state);
};
struct wl_grab {
const struct wl_grab_interface *interface;
struct wl_pointer_grab {
const struct wl_pointer_grab_interface *interface;
struct wl_input_device *input_device;
struct wl_surface *focus;
int32_t x, y;
......@@ -200,8 +200,8 @@ struct wl_input_device {
struct wl_surface *current;
int32_t current_x, current_y;
struct wl_grab *grab;
struct wl_grab default_grab;
struct wl_pointer_grab *pointer_grab;
struct wl_pointer_grab default_pointer_grab;
uint32_t button_count;
uint32_t grab_time;
int32_t grab_x, grab_y;
......@@ -213,7 +213,7 @@ struct wl_input_device {
struct wl_surface *drag_focus;
struct wl_resource *drag_focus_resource;
struct wl_listener drag_focus_listener;
struct wl_grab drag_grab;
struct wl_pointer_grab drag_grab;
struct wl_surface *drag_surface;
struct wl_data_source *selection_data_source;
......@@ -283,10 +283,10 @@ int
wl_data_device_manager_init(struct wl_display *display);
void
wl_input_device_end_grab(struct wl_input_device *device, uint32_t time);
wl_input_device_start_pointer_grab(struct wl_input_device *device,
struct wl_pointer_grab *grab, uint32_t time);
void
wl_input_device_start_grab(struct wl_input_device *device,
struct wl_grab *grab, uint32_t time);
wl_input_device_end_pointer_grab(struct wl_input_device *device, uint32_t time);
void
wl_input_device_set_selection(struct wl_input_device *device,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment