|
|
@ -77,7 +77,7 @@ static const struct wl_grab_interface move_grab_interface = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
shell_move(struct wl_client *client, struct wl_shell *shell, |
|
|
|
shell_move(struct wl_client *client, struct wl_resource *resource, |
|
|
|
struct wl_surface *surface, |
|
|
|
struct wl_surface *surface, |
|
|
|
struct wl_input_device *device, uint32_t time) |
|
|
|
struct wl_input_device *device, uint32_t time) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -112,6 +112,7 @@ struct wlsc_resize_grab { |
|
|
|
int32_t dx, dy, width, height; |
|
|
|
int32_t dx, dy, width, height; |
|
|
|
struct wlsc_surface *surface; |
|
|
|
struct wlsc_surface *surface; |
|
|
|
struct wl_shell *shell; |
|
|
|
struct wl_shell *shell; |
|
|
|
|
|
|
|
struct wl_resource resource; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
@ -139,7 +140,7 @@ resize_grab_motion(struct wl_grab *grab, |
|
|
|
height = resize->height; |
|
|
|
height = resize->height; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wl_client_post_event(surface->client, &resize->shell->object, |
|
|
|
wl_resource_post_event(&resize->resource, |
|
|
|
WL_SHELL_CONFIGURE, time, resize->edges, |
|
|
|
WL_SHELL_CONFIGURE, time, resize->edges, |
|
|
|
surface, width, height); |
|
|
|
surface, width, height); |
|
|
|
} |
|
|
|
} |
|
|
@ -171,10 +172,11 @@ static const struct wl_grab_interface resize_grab_interface = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
shell_resize(struct wl_client *client, struct wl_shell *shell, |
|
|
|
shell_resize(struct wl_client *client, struct wl_resource *resource, |
|
|
|
struct wl_surface *surface, |
|
|
|
struct wl_surface *surface, |
|
|
|
struct wl_input_device *device, uint32_t time, uint32_t edges) |
|
|
|
struct wl_input_device *device, uint32_t time, uint32_t edges) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
struct wl_shell *shell = resource->data; |
|
|
|
struct wlsc_input_device *wd = (struct wlsc_input_device *) device; |
|
|
|
struct wlsc_input_device *wd = (struct wlsc_input_device *) device; |
|
|
|
struct wlsc_resize_grab *resize; |
|
|
|
struct wlsc_resize_grab *resize; |
|
|
|
enum wlsc_pointer_type pointer = WLSC_POINTER_LEFT_PTR; |
|
|
|
enum wlsc_pointer_type pointer = WLSC_POINTER_LEFT_PTR; |
|
|
@ -197,6 +199,9 @@ shell_resize(struct wl_client *client, struct wl_shell *shell, |
|
|
|
resize->surface = es; |
|
|
|
resize->surface = es; |
|
|
|
resize->shell = shell; |
|
|
|
resize->shell = shell; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resize->resource.object = resource->object; |
|
|
|
|
|
|
|
resize->resource.client = client; |
|
|
|
|
|
|
|
|
|
|
|
if (edges == 0 || edges > 15 || |
|
|
|
if (edges == 0 || edges > 15 || |
|
|
|
(edges & 3) == 3 || (edges & 12) == 12) |
|
|
|
(edges & 3) == 3 || (edges & 12) == 12) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -238,7 +243,7 @@ shell_resize(struct wl_client *client, struct wl_shell *shell, |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
shell_set_toplevel(struct wl_client *client, |
|
|
|
shell_set_toplevel(struct wl_client *client, |
|
|
|
struct wl_shell *wl_shell, |
|
|
|
struct wl_resource *resource, |
|
|
|
struct wl_surface *surface) |
|
|
|
struct wl_surface *surface) |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
@ -263,7 +268,7 @@ shell_set_toplevel(struct wl_client *client, |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
shell_set_transient(struct wl_client *client, |
|
|
|
shell_set_transient(struct wl_client *client, |
|
|
|
struct wl_shell *wl_shell, |
|
|
|
struct wl_resource *resource, |
|
|
|
struct wl_surface *surface, |
|
|
|
struct wl_surface *surface, |
|
|
|
struct wl_surface *parent, |
|
|
|
struct wl_surface *parent, |
|
|
|
int x, int y, uint32_t flags) |
|
|
|
int x, int y, uint32_t flags) |
|
|
@ -283,7 +288,7 @@ shell_set_transient(struct wl_client *client, |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
shell_set_fullscreen(struct wl_client *client, |
|
|
|
shell_set_fullscreen(struct wl_client *client, |
|
|
|
struct wl_shell *wl_shell, |
|
|
|
struct wl_resource *resource, |
|
|
|
struct wl_surface *surface) |
|
|
|
struct wl_surface *surface) |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
@ -306,7 +311,7 @@ shell_set_fullscreen(struct wl_client *client, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
destroy_drag(struct wl_resource *resource, struct wl_client *client) |
|
|
|
destroy_drag(struct wl_resource *resource) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wl_drag *drag = |
|
|
|
struct wl_drag *drag = |
|
|
|
container_of(resource, struct wl_drag, resource); |
|
|
|
container_of(resource, struct wl_drag, resource); |
|
|
@ -331,28 +336,27 @@ wl_drag_set_pointer_focus(struct wl_drag *drag, |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (drag->drag_focus && |
|
|
|
if (drag->drag_focus && |
|
|
|
(!surface || drag->drag_focus->client != surface->client)) |
|
|
|
(!surface || |
|
|
|
wl_client_post_event(drag->drag_focus->client, |
|
|
|
drag->drag_focus->resource.client != surface->resource.client)) |
|
|
|
&drag->drag_offer.object, |
|
|
|
wl_resource_post_event(&drag->drag_offer.resource, |
|
|
|
WL_DRAG_OFFER_POINTER_FOCUS, |
|
|
|
WL_DRAG_OFFER_POINTER_FOCUS, |
|
|
|
time, NULL, 0, 0, 0, 0); |
|
|
|
time, NULL, 0, 0, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
if (surface && |
|
|
|
if (surface && |
|
|
|
(!drag->drag_focus || |
|
|
|
(!drag->drag_focus || |
|
|
|
drag->drag_focus->client != surface->client)) { |
|
|
|
drag->drag_focus->resource.client != surface->resource.client)) { |
|
|
|
wl_client_post_global(surface->client, |
|
|
|
wl_client_post_global(surface->resource.client, |
|
|
|
&drag->drag_offer.object); |
|
|
|
&drag->drag_offer.resource.object); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drag->drag_offer.resource.client = surface->resource.client; |
|
|
|
end = drag->types.data + drag->types.size; |
|
|
|
end = drag->types.data + drag->types.size; |
|
|
|
for (p = drag->types.data; p < end; p++) |
|
|
|
for (p = drag->types.data; p < end; p++) |
|
|
|
wl_client_post_event(surface->client, |
|
|
|
wl_resource_post_event(&drag->drag_offer.resource, |
|
|
|
&drag->drag_offer.object, |
|
|
|
|
|
|
|
WL_DRAG_OFFER_OFFER, *p); |
|
|
|
WL_DRAG_OFFER_OFFER, *p); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (surface) { |
|
|
|
if (surface) { |
|
|
|
wl_client_post_event(surface->client, |
|
|
|
wl_resource_post_event(&drag->drag_offer.resource, |
|
|
|
&drag->drag_offer.object, |
|
|
|
|
|
|
|
WL_DRAG_OFFER_POINTER_FOCUS, |
|
|
|
WL_DRAG_OFFER_POINTER_FOCUS, |
|
|
|
time, surface, |
|
|
|
time, surface, |
|
|
|
x, y, sx, sy); |
|
|
|
x, y, sx, sy); |
|
|
@ -370,9 +374,10 @@ wl_drag_set_pointer_focus(struct wl_drag *drag, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
drag_offer_accept(struct wl_client *client, |
|
|
|
drag_offer_accept(struct wl_client *client, struct wl_resource *resource, |
|
|
|
struct wl_drag_offer *offer, uint32_t time, const char *type) |
|
|
|
uint32_t time, const char *type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
struct wl_drag_offer *offer = resource->data; |
|
|
|
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer); |
|
|
|
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer); |
|
|
|
char **p, **end; |
|
|
|
char **p, **end; |
|
|
|
|
|
|
|
|
|
|
@ -391,28 +396,27 @@ drag_offer_accept(struct wl_client *client, |
|
|
|
if (type && strcmp(*p, type) == 0) |
|
|
|
if (type && strcmp(*p, type) == 0) |
|
|
|
drag->type = *p; |
|
|
|
drag->type = *p; |
|
|
|
|
|
|
|
|
|
|
|
wl_client_post_event(drag->source->client, &drag->resource.object, |
|
|
|
wl_resource_post_event(&drag->resource, WL_DRAG_TARGET, drag->type); |
|
|
|
WL_DRAG_TARGET, drag->type); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
drag_offer_receive(struct wl_client *client, |
|
|
|
drag_offer_receive(struct wl_client *client, |
|
|
|
struct wl_drag_offer *offer, int fd) |
|
|
|
struct wl_resource *resource, int fd) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
struct wl_drag_offer *offer = resource->data; |
|
|
|
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer); |
|
|
|
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer); |
|
|
|
|
|
|
|
|
|
|
|
wl_client_post_event(drag->source->client, &drag->resource.object, |
|
|
|
wl_resource_post_event(&drag->resource, WL_DRAG_FINISH, fd); |
|
|
|
WL_DRAG_FINISH, fd); |
|
|
|
|
|
|
|
close(fd); |
|
|
|
close(fd); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
drag_offer_reject(struct wl_client *client, struct wl_drag_offer *offer) |
|
|
|
drag_offer_reject(struct wl_client *client, struct wl_resource *resource) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
struct wl_drag_offer *offer = resource->data; |
|
|
|
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer); |
|
|
|
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer); |
|
|
|
|
|
|
|
|
|
|
|
wl_client_post_event(drag->source->client, &drag->resource.object, |
|
|
|
wl_resource_post_event(&drag->resource, WL_DRAG_REJECT); |
|
|
|
WL_DRAG_REJECT); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static const struct wl_drag_offer_interface drag_offer_interface = { |
|
|
|
static const struct wl_drag_offer_interface drag_offer_interface = { |
|
|
@ -422,8 +426,10 @@ static const struct wl_drag_offer_interface drag_offer_interface = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
drag_offer(struct wl_client *client, struct wl_drag *drag, const char *type) |
|
|
|
drag_offer(struct wl_client *client, |
|
|
|
|
|
|
|
struct wl_resource *resource, const char *type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
struct wl_drag *drag = resource->data; |
|
|
|
char **p; |
|
|
|
char **p; |
|
|
|
|
|
|
|
|
|
|
|
p = wl_array_add(&drag->types, sizeof *p); |
|
|
|
p = wl_array_add(&drag->types, sizeof *p); |
|
|
@ -444,8 +450,7 @@ drag_grab_motion(struct wl_grab *grab, |
|
|
|
es = pick_surface(grab->input_device, &sx, &sy); |
|
|
|
es = pick_surface(grab->input_device, &sx, &sy); |
|
|
|
wl_drag_set_pointer_focus(drag, &es->surface, time, x, y, sx, sy); |
|
|
|
wl_drag_set_pointer_focus(drag, &es->surface, time, x, y, sx, sy); |
|
|
|
if (es) |
|
|
|
if (es) |
|
|
|
wl_client_post_event(es->surface.client, |
|
|
|
wl_resource_post_event(&drag->drag_offer.resource, |
|
|
|
&drag->drag_offer.object, |
|
|
|
|
|
|
|
WL_DRAG_OFFER_MOTION, |
|
|
|
WL_DRAG_OFFER_MOTION, |
|
|
|
time, x, y, sx, sy); |
|
|
|
time, x, y, sx, sy); |
|
|
|
} |
|
|
|
} |
|
|
@ -465,8 +470,7 @@ drag_grab_end(struct wl_grab *grab, uint32_t time) |
|
|
|
int32_t sx, sy; |
|
|
|
int32_t sx, sy; |
|
|
|
|
|
|
|
|
|
|
|
if (drag->target) |
|
|
|
if (drag->target) |
|
|
|
wl_client_post_event(drag->target, |
|
|
|
wl_resource_post_event(&drag->drag_offer.resource, |
|
|
|
&drag->drag_offer.object, |
|
|
|
|
|
|
|
WL_DRAG_OFFER_DROP); |
|
|
|
WL_DRAG_OFFER_DROP); |
|
|
|
|
|
|
|
|
|
|
|
wl_drag_set_pointer_focus(drag, NULL, time, 0, 0, 0, 0); |
|
|
|
wl_drag_set_pointer_focus(drag, NULL, time, 0, 0, 0, 0); |
|
|
@ -485,10 +489,11 @@ static const struct wl_grab_interface drag_grab_interface = { |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
drag_activate(struct wl_client *client, |
|
|
|
drag_activate(struct wl_client *client, |
|
|
|
struct wl_drag *drag, |
|
|
|
struct wl_resource *resource, |
|
|
|
struct wl_surface *surface, |
|
|
|
struct wl_surface *surface, |
|
|
|
struct wl_input_device *device, uint32_t time) |
|
|
|
struct wl_input_device *device, uint32_t time) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
struct wl_drag *drag = resource->data; |
|
|
|
struct wl_display *display = wl_client_get_display (client); |
|
|
|
struct wl_display *display = wl_client_get_display (client); |
|
|
|
struct wlsc_surface *target; |
|
|
|
struct wlsc_surface *target; |
|
|
|
int32_t sx, sy; |
|
|
|
int32_t sx, sy; |
|
|
@ -501,11 +506,11 @@ drag_activate(struct wl_client *client, |
|
|
|
|
|
|
|
|
|
|
|
drag->source = surface; |
|
|
|
drag->source = surface; |
|
|
|
|
|
|
|
|
|
|
|
drag->drag_offer.object.interface = &wl_drag_offer_interface; |
|
|
|
drag->drag_offer.resource.object.interface = &wl_drag_offer_interface; |
|
|
|
drag->drag_offer.object.implementation = |
|
|
|
drag->drag_offer.resource.object.implementation = |
|
|
|
(void (**)(void)) &drag_offer_interface; |
|
|
|
(void (**)(void)) &drag_offer_interface; |
|
|
|
|
|
|
|
|
|
|
|
wl_display_add_object(display, &drag->drag_offer.object); |
|
|
|
wl_display_add_object(display, &drag->drag_offer.resource.object); |
|
|
|
|
|
|
|
|
|
|
|
target = pick_surface(device, &sx, &sy); |
|
|
|
target = pick_surface(device, &sx, &sy); |
|
|
|
wl_input_device_set_pointer_focus(device, NULL, time, 0, 0, 0, 0); |
|
|
|
wl_input_device_set_pointer_focus(device, NULL, time, 0, 0, 0, 0); |
|
|
@ -514,10 +519,9 @@ drag_activate(struct wl_client *client, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
drag_destroy(struct wl_client *client, struct wl_drag *drag) |
|
|
|
drag_destroy(struct wl_client *client, struct wl_resource *resource) |
|
|
|
{ |
|
|
|
{ |
|
|
|
wl_resource_destroy(&drag->resource, client, |
|
|
|
wl_resource_destroy(resource, wlsc_compositor_get_time()); |
|
|
|
wlsc_compositor_get_time()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static const struct wl_drag_interface drag_interface = { |
|
|
|
static const struct wl_drag_interface drag_interface = { |
|
|
@ -540,7 +544,7 @@ drag_handle_surface_destroy(struct wl_listener *listener, |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
shell_create_drag(struct wl_client *client, |
|
|
|
shell_create_drag(struct wl_client *client, |
|
|
|
struct wl_shell *shell, uint32_t id) |
|
|
|
struct wl_resource *resource, uint32_t id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wl_drag *drag; |
|
|
|
struct wl_drag *drag; |
|
|
|
|
|
|
|
|
|
|
@ -575,27 +579,25 @@ wlsc_selection_set_focus(struct wlsc_shell *shell, |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (selection->selection_focus != NULL) |
|
|
|
if (selection->selection_focus != NULL) |
|
|
|
wl_client_post_event(selection->selection_focus->client, |
|
|
|
wl_resource_post_event(&selection->selection_offer.resource, |
|
|
|
&selection->selection_offer.object, |
|
|
|
|
|
|
|
WL_SELECTION_OFFER_KEYBOARD_FOCUS, |
|
|
|
WL_SELECTION_OFFER_KEYBOARD_FOCUS, |
|
|
|
NULL); |
|
|
|
NULL); |
|
|
|
|
|
|
|
|
|
|
|
if (surface) { |
|
|
|
if (surface) { |
|
|
|
wl_client_post_global(surface->client, |
|
|
|
wl_client_post_global(surface->resource.client, |
|
|
|
&selection->selection_offer.object); |
|
|
|
&selection->selection_offer.resource.object); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selection->selection_offer.resource.client = surface->resource.client; |
|
|
|
end = selection->types.data + selection->types.size; |
|
|
|
end = selection->types.data + selection->types.size; |
|
|
|
for (p = selection->types.data; p < end; p++) |
|
|
|
for (p = selection->types.data; p < end; p++) |
|
|
|
wl_client_post_event(surface->client, |
|
|
|
wl_resource_post_event(&selection->selection_offer.resource, |
|
|
|
&selection->selection_offer.object, |
|
|
|
|
|
|
|
WL_SELECTION_OFFER_OFFER, *p); |
|
|
|
WL_SELECTION_OFFER_OFFER, *p); |
|
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&selection->selection_focus_listener.link); |
|
|
|
wl_list_remove(&selection->selection_focus_listener.link); |
|
|
|
wl_list_insert(surface->resource.destroy_listener_list.prev, |
|
|
|
wl_list_insert(surface->resource.destroy_listener_list.prev, |
|
|
|
&selection->selection_focus_listener.link); |
|
|
|
&selection->selection_focus_listener.link); |
|
|
|
|
|
|
|
|
|
|
|
wl_client_post_event(surface->client, |
|
|
|
wl_resource_post_event(&selection->selection_offer.resource, |
|
|
|
&selection->selection_offer.object, |
|
|
|
|
|
|
|
WL_SELECTION_OFFER_KEYBOARD_FOCUS, |
|
|
|
WL_SELECTION_OFFER_KEYBOARD_FOCUS, |
|
|
|
selection->input_device); |
|
|
|
selection->input_device); |
|
|
|
} |
|
|
|
} |
|
|
@ -610,14 +612,14 @@ wlsc_selection_set_focus(struct wlsc_shell *shell, |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
selection_offer_receive(struct wl_client *client, |
|
|
|
selection_offer_receive(struct wl_client *client, |
|
|
|
struct wl_selection_offer *offer, |
|
|
|
struct wl_resource *resource, |
|
|
|
const char *mime_type, int fd) |
|
|
|
const char *mime_type, int fd) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
struct wl_selection_offer *offer = resource->data; |
|
|
|
struct wl_selection *selection = |
|
|
|
struct wl_selection *selection = |
|
|
|
container_of(offer, struct wl_selection, selection_offer); |
|
|
|
container_of(offer, struct wl_selection, selection_offer); |
|
|
|
|
|
|
|
|
|
|
|
wl_client_post_event(selection->client, |
|
|
|
wl_resource_post_event(&selection->resource, |
|
|
|
&selection->resource.object, |
|
|
|
|
|
|
|
WL_SELECTION_SEND, mime_type, fd); |
|
|
|
WL_SELECTION_SEND, mime_type, fd); |
|
|
|
close(fd); |
|
|
|
close(fd); |
|
|
|
} |
|
|
|
} |
|
|
@ -628,8 +630,9 @@ static const struct wl_selection_offer_interface selection_offer_interface = { |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
selection_offer(struct wl_client *client, |
|
|
|
selection_offer(struct wl_client *client, |
|
|
|
struct wl_selection *selection, const char *type) |
|
|
|
struct wl_resource *resource, const char *type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
struct wl_selection *selection = resource->data; |
|
|
|
char **p; |
|
|
|
char **p; |
|
|
|
|
|
|
|
|
|
|
|
p = wl_array_add(&selection->types, sizeof *p); |
|
|
|
p = wl_array_add(&selection->types, sizeof *p); |
|
|
@ -641,9 +644,10 @@ selection_offer(struct wl_client *client, |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
selection_activate(struct wl_client *client, |
|
|
|
selection_activate(struct wl_client *client, |
|
|
|
struct wl_selection *selection, |
|
|
|
struct wl_resource *resource, |
|
|
|
struct wl_input_device *device, uint32_t time) |
|
|
|
struct wl_input_device *device, uint32_t time) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
struct wl_selection *selection = resource->data; |
|
|
|
struct wlsc_input_device *wd = (struct wlsc_input_device *) device; |
|
|
|
struct wlsc_input_device *wd = (struct wlsc_input_device *) device; |
|
|
|
struct wl_display *display = wl_client_get_display (client); |
|
|
|
struct wl_display *display = wl_client_get_display (client); |
|
|
|
struct wlsc_compositor *compositor = |
|
|
|
struct wlsc_compositor *compositor = |
|
|
@ -651,16 +655,16 @@ selection_activate(struct wl_client *client, |
|
|
|
|
|
|
|
|
|
|
|
selection->input_device = device; |
|
|
|
selection->input_device = device; |
|
|
|
|
|
|
|
|
|
|
|
selection->selection_offer.object.interface = |
|
|
|
selection->selection_offer.resource.object.interface = |
|
|
|
&wl_selection_offer_interface; |
|
|
|
&wl_selection_offer_interface; |
|
|
|
selection->selection_offer.object.implementation = |
|
|
|
selection->selection_offer.resource.object.implementation = |
|
|
|
(void (**)(void)) &selection_offer_interface; |
|
|
|
(void (**)(void)) &selection_offer_interface; |
|
|
|
|
|
|
|
|
|
|
|
wl_display_add_object(display, &selection->selection_offer.object); |
|
|
|
wl_display_add_object(display, |
|
|
|
|
|
|
|
&selection->selection_offer.resource.object); |
|
|
|
|
|
|
|
|
|
|
|
if (wd->selection) { |
|
|
|
if (wd->selection) { |
|
|
|
wl_client_post_event(wd->selection->client, |
|
|
|
wl_resource_post_event(&wd->selection->resource, |
|
|
|
&wd->selection->resource.object, |
|
|
|
|
|
|
|
WL_SELECTION_CANCELLED); |
|
|
|
WL_SELECTION_CANCELLED); |
|
|
|
} |
|
|
|
} |
|
|
|
wd->selection = selection; |
|
|
|
wd->selection = selection; |
|
|
@ -670,10 +674,9 @@ selection_activate(struct wl_client *client, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
selection_destroy(struct wl_client *client, struct wl_selection *selection) |
|
|
|
selection_destroy(struct wl_client *client, struct wl_resource *resource) |
|
|
|
{ |
|
|
|
{ |
|
|
|
wl_resource_destroy(&selection->resource, client, |
|
|
|
wl_resource_destroy(resource, wlsc_compositor_get_time()); |
|
|
|
wlsc_compositor_get_time()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static const struct wl_selection_interface selection_interface = { |
|
|
|
static const struct wl_selection_interface selection_interface = { |
|
|
@ -683,7 +686,7 @@ static const struct wl_selection_interface selection_interface = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
destroy_selection(struct wl_resource *resource, struct wl_client *client) |
|
|
|
destroy_selection(struct wl_resource *resource) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wl_selection *selection = |
|
|
|
struct wl_selection *selection = |
|
|
|
container_of(resource, struct wl_selection, resource); |
|
|
|
container_of(resource, struct wl_selection, resource); |
|
|
@ -711,7 +714,7 @@ selection_handle_surface_destroy(struct wl_listener *listener, |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
shell_create_selection(struct wl_client *client, |
|
|
|
shell_create_selection(struct wl_client *client, |
|
|
|
struct wl_shell *shell, uint32_t id) |
|
|
|
struct wl_resource *resource, uint32_t id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wl_selection *selection; |
|
|
|
struct wl_selection *selection; |
|
|
|
|
|
|
|
|
|
|
@ -752,21 +755,19 @@ static void |
|
|
|
move_binding(struct wl_input_device *device, uint32_t time, |
|
|
|
move_binding(struct wl_input_device *device, uint32_t time, |
|
|
|
uint32_t key, uint32_t button, uint32_t state, void *data) |
|
|
|
uint32_t key, uint32_t button, uint32_t state, void *data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wl_shell *shell = data; |
|
|
|
|
|
|
|
struct wlsc_surface *surface = |
|
|
|
struct wlsc_surface *surface = |
|
|
|
(struct wlsc_surface *) device->pointer_focus; |
|
|
|
(struct wlsc_surface *) device->pointer_focus; |
|
|
|
|
|
|
|
|
|
|
|
if (surface == NULL) |
|
|
|
if (surface == NULL) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
shell_move(NULL, shell, &surface->surface, device, time); |
|
|
|
shell_move(NULL, NULL, &surface->surface, device, time); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
resize_binding(struct wl_input_device *device, uint32_t time, |
|
|
|
resize_binding(struct wl_input_device *device, uint32_t time, |
|
|
|
uint32_t key, uint32_t button, uint32_t state, void *data) |
|
|
|
uint32_t key, uint32_t button, uint32_t state, void *data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wl_shell *shell = data; |
|
|
|
|
|
|
|
struct wlsc_surface *surface = |
|
|
|
struct wlsc_surface *surface = |
|
|
|
(struct wlsc_surface *) device->pointer_focus; |
|
|
|
(struct wlsc_surface *) device->pointer_focus; |
|
|
|
uint32_t edges = 0; |
|
|
|
uint32_t edges = 0; |
|
|
@ -792,7 +793,7 @@ resize_binding(struct wl_input_device *device, uint32_t time, |
|
|
|
else |
|
|
|
else |
|
|
|
edges |= WL_SHELL_RESIZE_BOTTOM; |
|
|
|
edges |= WL_SHELL_RESIZE_BOTTOM; |
|
|
|
|
|
|
|
|
|
|
|
shell_resize(NULL, shell, &surface->surface, device, time, edges); |
|
|
|
shell_resize(NULL, NULL, &surface->surface, device, time, edges); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|