forked from AuroraMiddleware/gtk
wayland: Reshuffle some internals
Make find_grab_input_seat return a GdkWaylandSeat instead of a struct wl_seat, so we can use it and avoid calling gdk_display_get_default_seat when we need to get a serial later.
This commit is contained in:
parent
6fbf13965c
commit
aae7816557
@ -5032,27 +5032,25 @@ _gdk_wayland_device_get_implicit_grab_serial (GdkWaylandDevice *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
_gdk_wayland_seat_get_last_implicit_grab_serial (GdkSeat *seat,
|
_gdk_wayland_seat_get_last_implicit_grab_serial (GdkWaylandSeat *seat,
|
||||||
GdkEventSequence **sequence)
|
GdkEventSequence **sequence)
|
||||||
{
|
{
|
||||||
GdkWaylandSeat *wayland_seat;
|
|
||||||
GdkWaylandTouchData *touch;
|
GdkWaylandTouchData *touch;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
GList *l;
|
GList *l;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
wayland_seat = GDK_WAYLAND_SEAT (seat);
|
g_hash_table_iter_init (&iter, seat->touches);
|
||||||
g_hash_table_iter_init (&iter, wayland_seat->touches);
|
|
||||||
|
|
||||||
if (sequence)
|
if (sequence)
|
||||||
*sequence = NULL;
|
*sequence = NULL;
|
||||||
|
|
||||||
serial = wayland_seat->keyboard_key_serial;
|
serial = seat->keyboard_key_serial;
|
||||||
|
|
||||||
if (wayland_seat->pointer_info.press_serial > serial)
|
if (seat->pointer_info.press_serial > serial)
|
||||||
serial = wayland_seat->pointer_info.press_serial;
|
serial = seat->pointer_info.press_serial;
|
||||||
|
|
||||||
for (l = wayland_seat->tablets; l; l = l->next)
|
for (l = seat->tablets; l; l = l->next)
|
||||||
{
|
{
|
||||||
GdkWaylandTabletData *tablet = l->data;
|
GdkWaylandTabletData *tablet = l->data;
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <gdk/gdkcursor.h>
|
#include <gdk/gdkcursor.h>
|
||||||
#include <gdk/wayland/gdkwayland.h>
|
#include <gdk/wayland/gdkwayland.h>
|
||||||
#include <gdk/wayland/gdkdisplay-wayland.h>
|
#include <gdk/wayland/gdkdisplay-wayland.h>
|
||||||
|
#include <gdk/wayland/gdkseat-wayland.h>
|
||||||
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ void _gdk_wayland_display_remove_seat (GdkWaylandDisplay *displa
|
|||||||
GdkKeymap *_gdk_wayland_device_get_keymap (GdkDevice *device);
|
GdkKeymap *_gdk_wayland_device_get_keymap (GdkDevice *device);
|
||||||
uint32_t _gdk_wayland_device_get_implicit_grab_serial(GdkWaylandDevice *device,
|
uint32_t _gdk_wayland_device_get_implicit_grab_serial(GdkWaylandDevice *device,
|
||||||
const GdkEvent *event);
|
const GdkEvent *event);
|
||||||
uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkSeat *seat,
|
uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkWaylandSeat *seat,
|
||||||
GdkEventSequence **seqence);
|
GdkEventSequence **seqence);
|
||||||
struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_device);
|
struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_device);
|
||||||
void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
|
void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "gdkdeviceprivate.h"
|
#include "gdkdeviceprivate.h"
|
||||||
#include "gdkprivate-wayland.h"
|
#include "gdkprivate-wayland.h"
|
||||||
#include "gdkmonitor-wayland.h"
|
#include "gdkmonitor-wayland.h"
|
||||||
|
#include "gdkseat-wayland.h"
|
||||||
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -2185,14 +2186,12 @@ create_simple_positioner (GdkSurface *surface,
|
|||||||
static void
|
static void
|
||||||
gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
||||||
GdkSurface *parent,
|
GdkSurface *parent,
|
||||||
struct wl_seat *seat)
|
GdkWaylandSeat *grab_input_seat)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||||
GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
|
GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
|
||||||
GdkSurfaceImplWayland *parent_impl = GDK_SURFACE_IMPL_WAYLAND (parent->impl);
|
GdkSurfaceImplWayland *parent_impl = GDK_SURFACE_IMPL_WAYLAND (parent->impl);
|
||||||
gpointer positioner;
|
gpointer positioner;
|
||||||
GdkSeat *gdk_seat;
|
|
||||||
guint32 serial;
|
|
||||||
|
|
||||||
if (!impl->display_server.wl_surface)
|
if (!impl->display_server.wl_surface)
|
||||||
return;
|
return;
|
||||||
@ -2264,10 +2263,13 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
|||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seat)
|
if (grab_input_seat)
|
||||||
{
|
{
|
||||||
gdk_seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
|
struct wl_seat *seat;
|
||||||
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (gdk_seat, NULL);
|
guint32 serial;
|
||||||
|
|
||||||
|
seat = gdk_wayland_seat_get_wl_seat (GDK_SEAT (grab_input_seat));
|
||||||
|
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (grab_input_seat, NULL);
|
||||||
|
|
||||||
switch (display->shell_variant)
|
switch (display->shell_variant)
|
||||||
{
|
{
|
||||||
@ -2288,7 +2290,7 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
|||||||
display->current_popups = g_list_append (display->current_popups, surface);
|
display->current_popups = g_list_append (display->current_popups, surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wl_seat *
|
static GdkWaylandSeat *
|
||||||
find_grab_input_seat (GdkSurface *surface,
|
find_grab_input_seat (GdkSurface *surface,
|
||||||
GdkSurface *transient_for)
|
GdkSurface *transient_for)
|
||||||
{
|
{
|
||||||
@ -2301,7 +2303,7 @@ find_grab_input_seat (GdkSurface *surface,
|
|||||||
* grab before showing the popup surface.
|
* grab before showing the popup surface.
|
||||||
*/
|
*/
|
||||||
if (impl->grab_input_seat)
|
if (impl->grab_input_seat)
|
||||||
return gdk_wayland_seat_get_wl_seat (impl->grab_input_seat);
|
return GDK_WAYLAND_SEAT (impl->grab_input_seat);
|
||||||
|
|
||||||
/* HACK: GtkMenu grabs a special surface known as the "grab transfer surface"
|
/* HACK: GtkMenu grabs a special surface known as the "grab transfer surface"
|
||||||
* and then transfers the grab over to the correct surface later. Look for
|
* and then transfers the grab over to the correct surface later. Look for
|
||||||
@ -2314,7 +2316,7 @@ find_grab_input_seat (GdkSurface *surface,
|
|||||||
{
|
{
|
||||||
tmp_impl = GDK_SURFACE_IMPL_WAYLAND (attached_grab_surface->impl);
|
tmp_impl = GDK_SURFACE_IMPL_WAYLAND (attached_grab_surface->impl);
|
||||||
if (tmp_impl->grab_input_seat)
|
if (tmp_impl->grab_input_seat)
|
||||||
return gdk_wayland_seat_get_wl_seat (tmp_impl->grab_input_seat);
|
return GDK_WAYLAND_SEAT (tmp_impl->grab_input_seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (transient_for)
|
while (transient_for)
|
||||||
@ -2322,7 +2324,7 @@ find_grab_input_seat (GdkSurface *surface,
|
|||||||
tmp_impl = GDK_SURFACE_IMPL_WAYLAND (transient_for->impl);
|
tmp_impl = GDK_SURFACE_IMPL_WAYLAND (transient_for->impl);
|
||||||
|
|
||||||
if (tmp_impl->grab_input_seat)
|
if (tmp_impl->grab_input_seat)
|
||||||
return gdk_wayland_seat_get_wl_seat (tmp_impl->grab_input_seat);
|
return GDK_WAYLAND_SEAT (tmp_impl->grab_input_seat);
|
||||||
|
|
||||||
transient_for = tmp_impl->transient_for;
|
transient_for = tmp_impl->transient_for;
|
||||||
}
|
}
|
||||||
@ -2418,7 +2420,7 @@ gdk_wayland_surface_map (GdkSurface *surface)
|
|||||||
if (should_map_as_popup (surface))
|
if (should_map_as_popup (surface))
|
||||||
{
|
{
|
||||||
gboolean create_fallback = FALSE;
|
gboolean create_fallback = FALSE;
|
||||||
struct wl_seat *grab_input_seat;
|
GdkWaylandSeat *grab_input_seat;
|
||||||
|
|
||||||
/* Popup menus can appear without a transient parent, which means they
|
/* Popup menus can appear without a transient parent, which means they
|
||||||
* cannot be positioned properly on Wayland. This attempts to guess the
|
* cannot be positioned properly on Wayland. This attempts to guess the
|
||||||
@ -3581,7 +3583,7 @@ gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
|
|||||||
if (!is_realized_toplevel (surface))
|
if (!is_realized_toplevel (surface))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (gdk_device_get_seat (device),
|
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (gdk_device_get_seat (device)),
|
||||||
&sequence);
|
&sequence);
|
||||||
|
|
||||||
switch (display_wayland->shell_variant)
|
switch (display_wayland->shell_variant)
|
||||||
@ -3632,7 +3634,7 @@ gdk_wayland_surface_begin_move_drag (GdkSurface *surface,
|
|||||||
if (!is_realized_toplevel (surface))
|
if (!is_realized_toplevel (surface))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (gdk_device_get_seat (device),
|
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (gdk_device_get_seat (device)),
|
||||||
&sequence);
|
&sequence);
|
||||||
switch (display_wayland->shell_variant)
|
switch (display_wayland->shell_variant)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user