gdk/wayland: Stop storing the last serial in GdkWaylandDisplay

This is not used anymore, so we can drop the serial being stored
here.
This commit is contained in:
Carlos Garnacho 2022-07-18 12:50:39 +02:00
parent 5a34b7ecc6
commit 95cf34ab4c
4 changed files with 2 additions and 68 deletions

View File

@ -1514,8 +1514,6 @@ pointer_handle_enter (void *data,
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface))) if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
return; return;
_gdk_wayland_display_update_serial (display_wayland, serial);
seat->pointer_info.focus = wl_surface_get_user_data (surface); seat->pointer_info.focus = wl_surface_get_user_data (surface);
g_object_ref (seat->pointer_info.focus); g_object_ref (seat->pointer_info.focus);
@ -1566,7 +1564,6 @@ pointer_handle_leave (void *data,
if (!seat->pointer_info.focus) if (!seat->pointer_info.focus)
return; return;
_gdk_wayland_display_update_serial (display_wayland, serial);
grab = _gdk_display_get_last_device_grab (seat->display, grab = _gdk_display_get_last_device_grab (seat->display,
seat->logical_pointer); seat->logical_pointer);
@ -1666,8 +1663,6 @@ pointer_handle_button (void *data,
if (!seat->pointer_info.focus) if (!seat->pointer_info.focus)
return; return;
_gdk_wayland_display_update_serial (display, serial);
switch (button) switch (button)
{ {
case BTN_LEFT: case BTN_LEFT:
@ -1986,7 +1981,6 @@ keyboard_handle_enter (void *data,
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkEvent *event; GdkEvent *event;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
if (!surface) if (!surface)
return; return;
@ -1994,8 +1988,6 @@ keyboard_handle_enter (void *data,
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface))) if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
return; return;
_gdk_wayland_display_update_serial (display, serial);
seat->keyboard_focus = wl_surface_get_user_data (surface); seat->keyboard_focus = wl_surface_get_user_data (surface);
g_object_ref (seat->keyboard_focus); g_object_ref (seat->keyboard_focus);
seat->repeat_key = 0; seat->repeat_key = 0;
@ -2021,7 +2013,6 @@ keyboard_handle_leave (void *data,
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkEvent *event; GdkEvent *event;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
if (!seat->keyboard_focus) if (!seat->keyboard_focus)
return; return;
@ -2032,8 +2023,6 @@ keyboard_handle_leave (void *data,
*/ */
stop_key_repeat (seat); stop_key_repeat (seat);
_gdk_wayland_display_update_serial (display, serial);
event = gdk_focus_event_new (seat->keyboard_focus, event = gdk_focus_event_new (seat->keyboard_focus,
seat->logical_keyboard, seat->logical_keyboard,
FALSE); FALSE);
@ -2272,7 +2261,6 @@ keyboard_handle_key (void *data,
uint32_t state_w) uint32_t state_w)
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
if (!seat->keyboard_focus) if (!seat->keyboard_focus)
return; return;
@ -2280,7 +2268,6 @@ keyboard_handle_key (void *data,
seat->keyboard_time = time; seat->keyboard_time = time;
seat->keyboard_key_serial = serial; seat->keyboard_key_serial = serial;
seat->repeat_count = 0; seat->repeat_count = 0;
_gdk_wayland_display_update_serial (display, serial);
deliver_key_event (data, time, key + 8, state_w, FALSE); deliver_key_event (data, time, key + 8, state_w, FALSE);
} }
@ -2470,12 +2457,9 @@ touch_handle_down (void *data,
wl_fixed_t y) wl_fixed_t y)
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkWaylandTouchData *touch; GdkWaylandTouchData *touch;
GdkEvent *event; GdkEvent *event;
_gdk_wayland_display_update_serial (display, serial);
if (!wl_surface) if (!wl_surface)
return; return;
@ -2519,12 +2503,9 @@ touch_handle_up (void *data,
int32_t id) int32_t id)
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkWaylandTouchData *touch; GdkWaylandTouchData *touch;
GdkEvent *event; GdkEvent *event;
_gdk_wayland_display_update_serial (display, serial);
touch = gdk_wayland_seat_get_touch (seat, id); touch = gdk_wayland_seat_get_touch (seat, id);
if (!touch) if (!touch)
return; return;
@ -2704,9 +2685,6 @@ gesture_swipe_begin (void *data,
uint32_t fingers) uint32_t fingers)
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
_gdk_wayland_display_update_serial (display, serial);
emit_gesture_swipe_event (seat, emit_gesture_swipe_event (seat,
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN, GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
@ -2739,11 +2717,8 @@ gesture_swipe_end (void *data,
int32_t cancelled) int32_t cancelled)
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkTouchpadGesturePhase phase; GdkTouchpadGesturePhase phase;
_gdk_wayland_display_update_serial (display, serial);
phase = (cancelled) ? phase = (cancelled) ?
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL : GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
GDK_TOUCHPAD_GESTURE_PHASE_END; GDK_TOUCHPAD_GESTURE_PHASE_END;
@ -2806,9 +2781,7 @@ gesture_pinch_begin (void *data,
uint32_t fingers) uint32_t fingers)
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
_gdk_wayland_display_update_serial (display, serial);
emit_gesture_pinch_event (seat, emit_gesture_pinch_event (seat,
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN, GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
time, fingers, 0, 0, 1, 0); time, fingers, 0, 0, 1, 0);
@ -2843,11 +2816,8 @@ gesture_pinch_end (void *data,
int32_t cancelled) int32_t cancelled)
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkTouchpadGesturePhase phase; GdkTouchpadGesturePhase phase;
_gdk_wayland_display_update_serial (display, serial);
phase = (cancelled) ? phase = (cancelled) ?
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL : GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
GDK_TOUCHPAD_GESTURE_PHASE_END; GDK_TOUCHPAD_GESTURE_PHASE_END;
@ -2901,9 +2871,6 @@ gesture_hold_begin (void *data,
uint32_t fingers) uint32_t fingers)
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
_gdk_wayland_display_update_serial (display, serial);
emit_gesture_hold_event (seat, emit_gesture_hold_event (seat,
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN, GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
@ -2919,11 +2886,8 @@ gesture_hold_end (void *data,
int32_t cancelled) int32_t cancelled)
{ {
GdkWaylandSeat *seat = data; GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkTouchpadGesturePhase phase; GdkTouchpadGesturePhase phase;
_gdk_wayland_display_update_serial (display, serial);
phase = (cancelled) ? phase = (cancelled) ?
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL : GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
GDK_TOUCHPAD_GESTURE_PHASE_END; GDK_TOUCHPAD_GESTURE_PHASE_END;
@ -3630,8 +3594,6 @@ tablet_tool_handle_proximity_in (void *data,
{ {
GdkWaylandTabletToolData *tool = data; GdkWaylandTabletToolData *tool = data;
GdkWaylandTabletData *tablet = zwp_tablet_v2_get_user_data (wp_tablet); GdkWaylandTabletData *tablet = zwp_tablet_v2_get_user_data (wp_tablet);
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
GdkSurface *surface; GdkSurface *surface;
GdkEvent *event; GdkEvent *event;
@ -3648,7 +3610,6 @@ tablet_tool_handle_proximity_in (void *data,
tool->current_tablet = tablet; tool->current_tablet = tablet;
tablet->current_tool = tool; tablet->current_tool = tool;
_gdk_wayland_display_update_serial (display_wayland, serial);
tablet->pointer_info.enter_serial = serial; tablet->pointer_info.enter_serial = serial;
tablet->pointer_info.focus = g_object_ref (surface); tablet->pointer_info.focus = g_object_ref (surface);
@ -3669,9 +3630,9 @@ tablet_tool_handle_proximity_in (void *data,
gdk_wayland_surface_get_wl_output (surface)); gdk_wayland_surface_get_wl_output (surface));
pointer_surface_update_scale (tablet->logical_device); pointer_surface_update_scale (tablet->logical_device);
GDK_SEAT_NOTE (seat, EVENTS, GDK_SEAT_NOTE (tablet->seat, EVENTS,
g_message ("proximity in, seat %p surface %p tool %d", g_message ("proximity in, seat %p surface %p tool %d",
seat, tablet->pointer_info.focus, tablet->seat, tablet->pointer_info.focus,
gdk_device_tool_get_tool_type (tool->tool))); gdk_device_tool_get_tool_type (tool->tool)));
} }
@ -3748,13 +3709,10 @@ tablet_tool_handle_down (void *data,
{ {
GdkWaylandTabletToolData *tool = data; GdkWaylandTabletToolData *tool = data;
GdkWaylandTabletData *tablet = tool->current_tablet; GdkWaylandTabletData *tablet = tool->current_tablet;
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tool->seat);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
if (!tablet || !tablet->pointer_info.focus) if (!tablet || !tablet->pointer_info.focus)
return; return;
_gdk_wayland_display_update_serial (display_wayland, serial);
tablet->pointer_info.press_serial = serial; tablet->pointer_info.press_serial = serial;
tablet_create_button_event_frame (tablet, GDK_BUTTON_PRESS, GDK_BUTTON_PRIMARY); tablet_create_button_event_frame (tablet, GDK_BUTTON_PRESS, GDK_BUTTON_PRIMARY);

View File

@ -145,10 +145,6 @@ zxdg_shell_v6_ping (void *data,
struct zxdg_shell_v6 *xdg_shell, struct zxdg_shell_v6 *xdg_shell,
uint32_t serial) uint32_t serial)
{ {
GdkWaylandDisplay *display_wayland = data;
_gdk_wayland_display_update_serial (display_wayland, serial);
GDK_DISPLAY_NOTE (GDK_DISPLAY (data), EVENTS, GDK_DISPLAY_NOTE (GDK_DISPLAY (data), EVENTS,
g_message ("ping, shell %p, serial %u\n", xdg_shell, serial)); g_message ("ping, shell %p, serial %u\n", xdg_shell, serial));
@ -1124,19 +1120,6 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
} }
guint32
_gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland)
{
return display_wayland->serial;
}
void
_gdk_wayland_display_update_serial (GdkWaylandDisplay *display_wayland,
guint32 serial)
{
display_wayland->serial = serial;
}
/** /**
* gdk_wayland_display_get_wl_display: (skip) * gdk_wayland_display_get_wl_display: (skip)
* @display: (type GdkWaylandDisplay): a `GdkDisplay` * @display: (type GdkWaylandDisplay): a `GdkDisplay`

View File

@ -84,9 +84,6 @@ struct _GdkWaylandDisplay
/* Startup notification */ /* Startup notification */
char *startup_notification_id; char *startup_notification_id;
/* Most recent serial */
guint32 serial;
uint32_t xdg_wm_base_id; uint32_t xdg_wm_base_id;
int xdg_wm_base_version; int xdg_wm_base_version;
uint32_t zxdg_shell_v6_id; uint32_t zxdg_shell_v6_id;

View File

@ -170,10 +170,6 @@ GdkMonitor *gdk_wayland_display_get_monitor_for_output (GdkDisplay *displa
void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface, void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
GdkSeat *seat); GdkSeat *seat);
guint32 _gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland);
void _gdk_wayland_display_update_serial (GdkWaylandDisplay *display_wayland,
guint32 serial);
cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display, cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
int width, int width,
int height, int height,