input: For serial generation get the display from the compositor
This removes the use of wl_client_get_display() where the client is derived from the focussed resource. This starts the removal of the assumption of a single resource on a client that would be notified about events on the focussed surface.
This commit is contained in:
committed by
Kristian Høgsberg
parent
4384a24a9e
commit
880ebc7ed9
+1
-4
@@ -155,11 +155,10 @@ binding_key(struct weston_keyboard_grab *grab,
|
|||||||
struct binding_keyboard_grab *b =
|
struct binding_keyboard_grab *b =
|
||||||
container_of(grab, struct binding_keyboard_grab, grab);
|
container_of(grab, struct binding_keyboard_grab, grab);
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
struct wl_client *client;
|
|
||||||
struct wl_display *display;
|
|
||||||
enum wl_keyboard_key_state state = state_w;
|
enum wl_keyboard_key_state state = state_w;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
struct weston_keyboard *keyboard = grab->keyboard;
|
struct weston_keyboard *keyboard = grab->keyboard;
|
||||||
|
struct wl_display *display = keyboard->seat->compositor->wl_display;
|
||||||
|
|
||||||
resource = grab->keyboard->focus_resource;
|
resource = grab->keyboard->focus_resource;
|
||||||
if (key == b->key) {
|
if (key == b->key) {
|
||||||
@@ -170,8 +169,6 @@ binding_key(struct weston_keyboard_grab *grab,
|
|||||||
free(b);
|
free(b);
|
||||||
}
|
}
|
||||||
} else if (resource) {
|
} else if (resource) {
|
||||||
client = wl_resource_get_client(resource);
|
|
||||||
display = wl_client_get_display(client);
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
wl_keyboard_send_key(resource, serial, time, key, state);
|
wl_keyboard_send_key(resource, serial, time, key, state);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -210,7 +210,7 @@ weston_drag_set_focus(struct weston_drag *drag, struct weston_surface *surface,
|
|||||||
{
|
{
|
||||||
struct weston_pointer *pointer = drag->grab.pointer;
|
struct weston_pointer *pointer = drag->grab.pointer;
|
||||||
struct wl_resource *resource, *offer = NULL;
|
struct wl_resource *resource, *offer = NULL;
|
||||||
struct wl_display *display;
|
struct wl_display *display = pointer->seat->compositor->wl_display;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
if (drag->focus_resource) {
|
if (drag->focus_resource) {
|
||||||
@@ -232,7 +232,6 @@ weston_drag_set_focus(struct weston_drag *drag, struct weston_surface *surface,
|
|||||||
if (!resource)
|
if (!resource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
display = wl_client_get_display(wl_resource_get_client(resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
|
|
||||||
if (drag->data_source)
|
if (drag->data_source)
|
||||||
|
|||||||
+6
-14
@@ -137,12 +137,11 @@ default_grab_button(struct weston_pointer_grab *grab,
|
|||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
enum wl_pointer_button_state state = state_w;
|
enum wl_pointer_button_state state = state_w;
|
||||||
struct wl_display *display;
|
struct wl_display *display = compositor->wl_display;
|
||||||
wl_fixed_t sx, sy;
|
wl_fixed_t sx, sy;
|
||||||
|
|
||||||
resource = pointer->focus_resource;
|
resource = pointer->focus_resource;
|
||||||
if (resource) {
|
if (resource) {
|
||||||
display = wl_client_get_display(wl_resource_get_client(resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
wl_pointer_send_button(resource, serial, time, button, state_w);
|
wl_pointer_send_button(resource, serial, time, button, state_w);
|
||||||
}
|
}
|
||||||
@@ -170,11 +169,10 @@ default_grab_touch_down(struct weston_touch_grab *grab, uint32_t time,
|
|||||||
int touch_id, wl_fixed_t sx, wl_fixed_t sy)
|
int touch_id, wl_fixed_t sx, wl_fixed_t sy)
|
||||||
{
|
{
|
||||||
struct weston_touch *touch = grab->touch;
|
struct weston_touch *touch = grab->touch;
|
||||||
struct wl_display *display;
|
struct wl_display *display = touch->seat->compositor->wl_display;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
if (touch->focus_resource && touch->focus) {
|
if (touch->focus_resource && touch->focus) {
|
||||||
display = wl_client_get_display(wl_resource_get_client(touch->focus_resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
wl_touch_send_down(touch->focus_resource, serial, time,
|
wl_touch_send_down(touch->focus_resource, serial, time,
|
||||||
touch->focus->resource,
|
touch->focus->resource,
|
||||||
@@ -187,11 +185,10 @@ default_grab_touch_up(struct weston_touch_grab *grab,
|
|||||||
uint32_t time, int touch_id)
|
uint32_t time, int touch_id)
|
||||||
{
|
{
|
||||||
struct weston_touch *touch = grab->touch;
|
struct weston_touch *touch = grab->touch;
|
||||||
struct wl_display *display;
|
struct wl_display *display = touch->seat->compositor->wl_display;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
if (touch->focus_resource) {
|
if (touch->focus_resource) {
|
||||||
display = wl_client_get_display(wl_resource_get_client(touch->focus_resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
wl_touch_send_up(touch->focus_resource, serial, time, touch_id);
|
wl_touch_send_up(touch->focus_resource, serial, time, touch_id);
|
||||||
}
|
}
|
||||||
@@ -221,12 +218,11 @@ default_grab_key(struct weston_keyboard_grab *grab,
|
|||||||
{
|
{
|
||||||
struct weston_keyboard *keyboard = grab->keyboard;
|
struct weston_keyboard *keyboard = grab->keyboard;
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
struct wl_display *display;
|
struct wl_display *display = keyboard->seat->compositor->wl_display;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
resource = keyboard->focus_resource;
|
resource = keyboard->focus_resource;
|
||||||
if (resource) {
|
if (resource) {
|
||||||
display = wl_client_get_display(wl_resource_get_client(resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
wl_keyboard_send_key(resource, serial, time, key, state);
|
wl_keyboard_send_key(resource, serial, time, key, state);
|
||||||
}
|
}
|
||||||
@@ -423,12 +419,11 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
|
|||||||
{
|
{
|
||||||
struct weston_keyboard *kbd = pointer->seat->keyboard;
|
struct weston_keyboard *kbd = pointer->seat->keyboard;
|
||||||
struct wl_resource *resource, *kr;
|
struct wl_resource *resource, *kr;
|
||||||
struct wl_display *display;
|
struct wl_display *display = pointer->seat->compositor->wl_display;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
resource = pointer->focus_resource;
|
resource = pointer->focus_resource;
|
||||||
if (resource && pointer->focus != surface) {
|
if (resource && pointer->focus != surface) {
|
||||||
display = wl_client_get_display(wl_resource_get_client(resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
wl_pointer_send_leave(resource, serial,
|
wl_pointer_send_leave(resource, serial,
|
||||||
pointer->focus->resource);
|
pointer->focus->resource);
|
||||||
@@ -440,7 +435,6 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
|
|||||||
if (resource &&
|
if (resource &&
|
||||||
(pointer->focus != surface ||
|
(pointer->focus != surface ||
|
||||||
pointer->focus_resource != resource)) {
|
pointer->focus_resource != resource)) {
|
||||||
display = wl_client_get_display(wl_resource_get_client(resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
if (kbd) {
|
if (kbd) {
|
||||||
kr = find_resource_for_surface(&kbd->resource_list,
|
kr = find_resource_for_surface(&kbd->resource_list,
|
||||||
@@ -471,12 +465,11 @@ weston_keyboard_set_focus(struct weston_keyboard *keyboard,
|
|||||||
struct weston_surface *surface)
|
struct weston_surface *surface)
|
||||||
{
|
{
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
struct wl_display *display;
|
struct wl_display *display = keyboard->seat->compositor->wl_display;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
if (keyboard->focus_resource && keyboard->focus != surface) {
|
if (keyboard->focus_resource && keyboard->focus != surface) {
|
||||||
resource = keyboard->focus_resource;
|
resource = keyboard->focus_resource;
|
||||||
display = wl_client_get_display(wl_resource_get_client(resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
wl_keyboard_send_leave(resource, serial,
|
wl_keyboard_send_leave(resource, serial,
|
||||||
keyboard->focus->resource);
|
keyboard->focus->resource);
|
||||||
@@ -488,7 +481,6 @@ weston_keyboard_set_focus(struct weston_keyboard *keyboard,
|
|||||||
if (resource &&
|
if (resource &&
|
||||||
(keyboard->focus != surface ||
|
(keyboard->focus != surface ||
|
||||||
keyboard->focus_resource != resource)) {
|
keyboard->focus_resource != resource)) {
|
||||||
display = wl_client_get_display(wl_resource_get_client(resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
wl_keyboard_send_modifiers(resource, serial,
|
wl_keyboard_send_modifiers(resource, serial,
|
||||||
keyboard->modifiers.mods_depressed,
|
keyboard->modifiers.mods_depressed,
|
||||||
|
|||||||
+3
-6
@@ -2056,13 +2056,12 @@ popup_grab_button(struct weston_pointer_grab *grab,
|
|||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
struct shell_seat *shseat =
|
struct shell_seat *shseat =
|
||||||
container_of(grab, struct shell_seat, popup_grab.grab);
|
container_of(grab, struct shell_seat, popup_grab.grab);
|
||||||
struct wl_display *display;
|
struct wl_display *display = shseat->seat->compositor->wl_display;
|
||||||
enum wl_pointer_button_state state = state_w;
|
enum wl_pointer_button_state state = state_w;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
resource = grab->pointer->focus_resource;
|
resource = grab->pointer->focus_resource;
|
||||||
if (resource) {
|
if (resource) {
|
||||||
display = wl_client_get_display(wl_resource_get_client(resource));
|
|
||||||
serial = wl_display_get_serial(display);
|
serial = wl_display_get_serial(display);
|
||||||
wl_pointer_send_button(resource, serial, time, button, state);
|
wl_pointer_send_button(resource, serial, time, button, state);
|
||||||
} else if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
|
} else if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
|
||||||
@@ -4125,8 +4124,9 @@ debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time,
|
|||||||
uint32_t key, uint32_t state)
|
uint32_t key, uint32_t state)
|
||||||
{
|
{
|
||||||
struct debug_binding_grab *db = (struct debug_binding_grab *) grab;
|
struct debug_binding_grab *db = (struct debug_binding_grab *) grab;
|
||||||
|
struct weston_compositor *ec = db->seat->compositor;
|
||||||
|
struct wl_display *display = ec->wl_display;
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
struct wl_display *display;
|
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
int send = 0, terminate = 0;
|
int send = 0, terminate = 0;
|
||||||
int check_binding = 1;
|
int check_binding = 1;
|
||||||
@@ -4161,8 +4161,6 @@ debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (check_binding) {
|
if (check_binding) {
|
||||||
struct weston_compositor *ec = db->seat->compositor;
|
|
||||||
|
|
||||||
if (weston_compositor_run_debug_binding(ec, db->seat, time,
|
if (weston_compositor_run_debug_binding(ec, db->seat, time,
|
||||||
key, state)) {
|
key, state)) {
|
||||||
/* We ran a binding so swallow the press and keep the
|
/* We ran a binding so swallow the press and keep the
|
||||||
@@ -4182,7 +4180,6 @@ debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time,
|
|||||||
resource = grab->keyboard->focus_resource;
|
resource = grab->keyboard->focus_resource;
|
||||||
|
|
||||||
if (resource) {
|
if (resource) {
|
||||||
display = wl_client_get_display(wl_resource_get_client(resource));
|
|
||||||
serial = wl_display_next_serial(display);
|
serial = wl_display_next_serial(display);
|
||||||
wl_keyboard_send_key(resource, serial, time, key, state);
|
wl_keyboard_send_key(resource, serial, time, key, state);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user