mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
wayland: Setup and use ownership chains
As elsewhere, make sure objects that need to have a ownership up to the context, and use this ownership chain to find relevant components, such as the backend or the Wayland compositor object instance. wayland/data-device: Hook up data devices to seats They are tied to a seat - make that connection in struct fields too, so that related objects can get to the context via it. wayland: Don't get Wayland compositor via singleton getter This means via the ownership chain or equivalent. xwayland: Hook up manager to Wayland compositor Same applies to the drag-n-drop struct. xwayland: Make X11 event handling compositor instance aware This avoids finding it via singletons in the callee. xwayland: Don't get Wayland compositor from singleton xwayland: Pass manager when handling dnd event window/xwayland: Don't get Wayland compositor from singleton xwayland/grab-keyboard: Don't get backend from singleton xwayland: Don't get backend from singleton wayland: Always get the backend from the context This means traveling up the ownership chain or equivalent when necessary. wayland: Hook up data devices, offers and sources to the compositor This allows tying them to a context without going through any singletons. wayland: Don't get display from singleton xwayland: Don't get display from singleton tablet: Don't get display from singleton Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
This commit is contained in:
parent
dd2beae6a8
commit
2731f0cda4
@ -73,6 +73,16 @@ struct _MetaPadActionMapper
|
||||
|
||||
G_DEFINE_TYPE (MetaPadActionMapper, meta_pad_action_mapper, G_TYPE_OBJECT)
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_mapper (MetaPadActionMapper *mapper)
|
||||
{
|
||||
MetaBackend *backend =
|
||||
meta_monitor_manager_get_backend (mapper->monitor_manager);
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_pad_action_mapper_finalize (GObject *object)
|
||||
{
|
||||
@ -436,7 +446,7 @@ meta_pad_action_mapper_cycle_tablet_output (MetaPadActionMapper *mapper,
|
||||
}
|
||||
|
||||
g_settings_set_strv (info->settings, "output", edid);
|
||||
meta_display_show_tablet_mapping_notification (meta_get_display (),
|
||||
meta_display_show_tablet_mapping_notification (display_from_mapper (mapper),
|
||||
device, pretty_name);
|
||||
}
|
||||
|
||||
@ -558,7 +568,7 @@ meta_pad_action_mapper_handle_button (MetaPadActionMapper *mapper,
|
||||
if (wacom_device)
|
||||
pretty_name = libwacom_get_name (wacom_device);
|
||||
#endif
|
||||
meta_display_notify_pad_group_switch (meta_get_display (), pad,
|
||||
meta_display_notify_pad_group_switch (display_from_mapper (mapper), pad,
|
||||
pretty_name, group, mode, n_modes);
|
||||
info->group_modes[group] = mode;
|
||||
}
|
||||
@ -573,7 +583,7 @@ meta_pad_action_mapper_handle_button (MetaPadActionMapper *mapper,
|
||||
return TRUE;
|
||||
case G_DESKTOP_PAD_BUTTON_ACTION_HELP:
|
||||
if (is_press)
|
||||
meta_display_request_pad_osd (meta_get_display (), pad, FALSE);
|
||||
meta_display_request_pad_osd (display_from_mapper (mapper), pad, FALSE);
|
||||
return TRUE;
|
||||
case G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING:
|
||||
settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON,
|
||||
|
@ -34,7 +34,8 @@ META_EXPORT
|
||||
G_DECLARE_FINAL_TYPE (MetaWaylandClient, meta_wayland_client, META, WAYLAND_CLIENT, GObject)
|
||||
|
||||
META_EXPORT
|
||||
MetaWaylandClient *meta_wayland_client_new (GSubprocessLauncher *launcher,
|
||||
MetaWaylandClient *meta_wayland_client_new (MetaContext *context,
|
||||
GSubprocessLauncher *launcher,
|
||||
GError **error);
|
||||
|
||||
META_EXPORT
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "wayland/meta-wayland-pointer.h"
|
||||
#include "wayland/meta-wayland-seat.h"
|
||||
#include "wayland/meta-wayland-surface.h"
|
||||
#include "wayland/meta-wayland.h"
|
||||
|
||||
typedef struct _MetaPointerConfinementWaylandPrivate MetaPointerConfinementWaylandPrivate;
|
||||
|
||||
@ -68,6 +69,18 @@ G_DEFINE_TYPE_WITH_PRIVATE (MetaPointerConfinementWayland,
|
||||
meta_pointer_confinement_wayland,
|
||||
G_TYPE_OBJECT)
|
||||
|
||||
static MetaBackend *
|
||||
backend_from_confinement (MetaPointerConfinementWayland *confinement)
|
||||
{
|
||||
MetaPointerConfinementWaylandPrivate *priv =
|
||||
meta_pointer_confinement_wayland_get_instance_private (confinement);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_pointer_constraint_get_compositor (priv->constraint);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_backend (context);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_pointer_confinement_wayland_update (MetaPointerConfinementWayland *self)
|
||||
{
|
||||
@ -75,7 +88,8 @@ meta_pointer_confinement_wayland_update (MetaPointerConfinementWayland *self)
|
||||
|
||||
constraint =
|
||||
META_POINTER_CONFINEMENT_WAYLAND_GET_CLASS (self)->create_constraint (self);
|
||||
meta_backend_set_client_pointer_constraint (meta_get_backend (), constraint);
|
||||
meta_backend_set_client_pointer_constraint (backend_from_confinement (self),
|
||||
constraint);
|
||||
g_object_unref (constraint);
|
||||
}
|
||||
|
||||
@ -134,6 +148,7 @@ meta_pointer_confinement_wayland_disable (MetaPointerConfinementWayland *confine
|
||||
MetaWaylandPointerConstraint *constraint;
|
||||
MetaWaylandSurface *surface;
|
||||
MetaWindow *window;
|
||||
MetaBackend *backend;
|
||||
|
||||
priv = meta_pointer_confinement_wayland_get_instance_private (confinement);
|
||||
constraint = priv->constraint;
|
||||
@ -151,7 +166,8 @@ meta_pointer_confinement_wayland_disable (MetaPointerConfinementWayland *confine
|
||||
confinement);
|
||||
}
|
||||
|
||||
meta_backend_set_client_pointer_constraint (meta_get_backend (), NULL);
|
||||
backend = backend_from_confinement (confinement);
|
||||
meta_backend_set_client_pointer_constraint (backend, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -52,7 +52,11 @@ G_DEFINE_TYPE (MetaPointerLockWayland, meta_pointer_lock_wayland,
|
||||
static MetaPointerConstraint *
|
||||
meta_pointer_lock_wayland_create_constraint (MetaPointerConfinementWayland *confinement)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaPointerLockWayland *lock_wayland = META_POINTER_LOCK_WAYLAND (confinement);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_pointer_constraint_get_compositor (lock_wayland->constraint);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
ClutterInputDevice *pointer = clutter_seat_get_pointer (seat);
|
||||
|
@ -329,7 +329,11 @@ meta_wayland_actor_surface_is_on_logical_monitor (MetaWaylandSurfaceRole *surfac
|
||||
{
|
||||
MetaWaylandActorSurfacePrivate *priv =
|
||||
meta_wayland_actor_surface_get_instance_private (META_WAYLAND_ACTOR_SURFACE (surface_role));
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (surface->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (priv->actor);
|
||||
MetaRectangle logical_monitor_layout;
|
||||
|
@ -170,8 +170,10 @@ meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
|
||||
|
||||
if (meta_wayland_compositor_is_egl_display_bound (buffer->compositor))
|
||||
{
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
EGLint format;
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend =
|
||||
meta_backend_get_clutter_backend (backend);
|
||||
@ -289,11 +291,14 @@ shm_format_to_cogl_pixel_format (enum wl_shm_format shm_format,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
shm_buffer_get_cogl_pixel_format (struct wl_shm_buffer *shm_buffer,
|
||||
shm_buffer_get_cogl_pixel_format (MetaWaylandBuffer *buffer,
|
||||
struct wl_shm_buffer *shm_buffer,
|
||||
CoglPixelFormat *format_out,
|
||||
CoglTextureComponents *components_out)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context =
|
||||
clutter_backend_get_cogl_context (clutter_backend);
|
||||
@ -343,7 +348,9 @@ shm_buffer_attach (MetaWaylandBuffer *buffer,
|
||||
CoglTexture **texture,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
struct wl_shm_buffer *shm_buffer;
|
||||
@ -358,7 +365,8 @@ shm_buffer_attach (MetaWaylandBuffer *buffer,
|
||||
stride = wl_shm_buffer_get_stride (shm_buffer);
|
||||
width = wl_shm_buffer_get_width (shm_buffer);
|
||||
height = wl_shm_buffer_get_height (shm_buffer);
|
||||
if (!shm_buffer_get_cogl_pixel_format (shm_buffer, &format, &components))
|
||||
if (!shm_buffer_get_cogl_pixel_format (buffer, shm_buffer,
|
||||
&format, &components))
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Invalid shm pixel format");
|
||||
@ -433,7 +441,9 @@ egl_image_buffer_attach (MetaWaylandBuffer *buffer,
|
||||
CoglTexture **texture,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
@ -661,7 +671,7 @@ process_shm_buffer_damage (MetaWaylandBuffer *buffer,
|
||||
|
||||
shm_buffer = wl_shm_buffer_get (buffer->resource);
|
||||
|
||||
shm_buffer_get_cogl_pixel_format (shm_buffer, &format, NULL);
|
||||
shm_buffer_get_cogl_pixel_format (buffer, shm_buffer, &format, NULL);
|
||||
g_return_val_if_fail (cogl_pixel_format_get_n_planes (format) == 1, FALSE);
|
||||
|
||||
wl_shm_buffer_begin_access (shm_buffer);
|
||||
@ -738,7 +748,9 @@ try_acquire_egl_image_scanout (MetaWaylandBuffer *buffer,
|
||||
CoglOnscreen *onscreen)
|
||||
{
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
|
||||
MetaGpuKms *gpu_kms;
|
||||
@ -871,7 +883,8 @@ meta_wayland_buffer_class_init (MetaWaylandBufferClass *klass)
|
||||
void
|
||||
meta_wayland_init_shm (MetaWaylandCompositor *compositor)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context =
|
||||
clutter_backend_get_cogl_context (clutter_backend);
|
||||
|
@ -47,6 +47,7 @@ struct _MetaWaylandClient
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
MetaContext *context;
|
||||
GSubprocessLauncher *launcher;
|
||||
GSubprocess *subprocess;
|
||||
GCancellable *died_cancellable;
|
||||
@ -104,6 +105,7 @@ child_setup (gpointer user_data)
|
||||
|
||||
/**
|
||||
* meta_wayland_client_new:
|
||||
* @context: (not nullable): a #MetaContext
|
||||
* @launcher: (not nullable): a GSubprocessLauncher to use to launch the subprocess
|
||||
* @error: (nullable): Error
|
||||
*
|
||||
@ -114,7 +116,8 @@ child_setup (gpointer user_data)
|
||||
* g_object_unref().
|
||||
*/
|
||||
MetaWaylandClient *
|
||||
meta_wayland_client_new (GSubprocessLauncher *launcher,
|
||||
meta_wayland_client_new (MetaContext *context,
|
||||
GSubprocessLauncher *launcher,
|
||||
GError **error)
|
||||
{
|
||||
MetaWaylandClient *client;
|
||||
@ -140,6 +143,7 @@ meta_wayland_client_new (GSubprocessLauncher *launcher,
|
||||
}
|
||||
|
||||
client = g_object_new (META_TYPE_WAYLAND_CLIENT, NULL);
|
||||
client->context = context;
|
||||
client->launcher = g_object_ref (launcher);
|
||||
return client;
|
||||
}
|
||||
@ -203,7 +207,7 @@ meta_wayland_client_spawnv (MetaWaylandClient *client,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
compositor = meta_context_get_wayland_compositor (client->context);
|
||||
g_subprocess_launcher_take_fd (client->launcher, client_fd[1], 3);
|
||||
g_subprocess_launcher_setenv (client->launcher, "WAYLAND_SOCKET", "3", TRUE);
|
||||
g_subprocess_launcher_set_child_setup (client->launcher,
|
||||
|
@ -91,7 +91,13 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
|
||||
|
||||
if (!meta_xwayland_is_xwayland_surface (surface))
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaWaylandSurfaceRole *surface_role =
|
||||
META_WAYLAND_SURFACE_ROLE (cursor_surface);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (surface->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
@ -342,8 +348,12 @@ on_cursor_painted (MetaCursorRenderer *renderer,
|
||||
MetaWaylandCursorSurfacePrivate *priv =
|
||||
meta_wayland_cursor_surface_get_instance_private (cursor_surface);
|
||||
guint32 time = (guint32) (g_get_monotonic_time () / 1000);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context = meta_backend_get_context (backend);
|
||||
MetaWaylandSurfaceRole *surface_role =
|
||||
META_WAYLAND_SURFACE_ROLE (cursor_surface);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (surface->compositor);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "wayland/meta-wayland-data-device-primary.h"
|
||||
|
||||
#include "core/meta-selection-private.h"
|
||||
#include "compositor/meta-dnd-actor-private.h"
|
||||
#include "meta/meta-selection-source-memory.h"
|
||||
#include "wayland/meta-selection-source-wayland-private.h"
|
||||
@ -41,6 +42,16 @@
|
||||
static struct wl_resource * create_and_send_primary_offer (MetaWaylandDataDevicePrimary *data_device,
|
||||
struct wl_resource *target);
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_data_device (MetaWaylandDataDevicePrimary *data_device)
|
||||
{
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (data_device->seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static void
|
||||
move_resources (struct wl_list *destination,
|
||||
struct wl_list *source)
|
||||
@ -83,7 +94,7 @@ set_selection_source (MetaWaylandDataDevicePrimary *data_device,
|
||||
MetaSelectionSource *selection_source)
|
||||
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_data_device (data_device);
|
||||
|
||||
meta_selection_set_owner (meta_display_get_selection (display),
|
||||
META_SELECTION_PRIMARY,
|
||||
@ -94,7 +105,7 @@ set_selection_source (MetaWaylandDataDevicePrimary *data_device,
|
||||
static void
|
||||
unset_selection_source (MetaWaylandDataDevicePrimary *data_device)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_data_device (data_device);
|
||||
|
||||
if (!data_device->owner)
|
||||
return;
|
||||
@ -192,7 +203,10 @@ owner_changed_cb (MetaSelection *selection,
|
||||
MetaSelectionSource *new_owner,
|
||||
MetaWaylandDataDevicePrimary *data_device)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDisplay *display = meta_selection_get_display (selection);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
MetaWaylandSeat *seat = compositor->seat;
|
||||
struct wl_resource *data_device_resource;
|
||||
struct wl_client *focus_client;
|
||||
@ -222,11 +236,13 @@ owner_changed_cb (MetaSelection *selection,
|
||||
static void
|
||||
ensure_owners_changed_handler_connected (MetaWaylandDataDevicePrimary *data_device)
|
||||
{
|
||||
MetaDisplay *display = display_from_data_device (data_device);
|
||||
|
||||
if (data_device->selection_owner_signal_id != 0)
|
||||
return;
|
||||
|
||||
data_device->selection_owner_signal_id =
|
||||
g_signal_connect (meta_display_get_selection (meta_get_display ()),
|
||||
g_signal_connect (meta_display_get_selection (display),
|
||||
"owner-changed",
|
||||
G_CALLBACK (owner_changed_cb), data_device);
|
||||
}
|
||||
@ -293,8 +309,10 @@ meta_wayland_data_device_primary_manager_init (MetaWaylandCompositor *compositor
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_data_device_primary_init (MetaWaylandDataDevicePrimary *data_device)
|
||||
meta_wayland_data_device_primary_init (MetaWaylandDataDevicePrimary *data_device,
|
||||
MetaWaylandSeat *seat)
|
||||
{
|
||||
data_device->seat = seat;
|
||||
wl_list_init (&data_device->resource_list);
|
||||
wl_list_init (&data_device->focus_resource_list);
|
||||
}
|
||||
@ -303,8 +321,11 @@ static struct wl_resource *
|
||||
create_and_send_primary_offer (MetaWaylandDataDevicePrimary *data_device,
|
||||
struct wl_resource *target)
|
||||
{
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (data_device->seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaWaylandDataOffer *offer;
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
struct wl_resource *resource;
|
||||
GList *mimetypes, *l;
|
||||
|
||||
@ -313,7 +334,7 @@ create_and_send_primary_offer (MetaWaylandDataDevicePrimary *data_device,
|
||||
if (!mimetypes)
|
||||
return NULL;
|
||||
|
||||
offer = meta_wayland_data_offer_primary_new (target);
|
||||
offer = meta_wayland_data_offer_primary_new (compositor, target);
|
||||
resource = meta_wayland_data_offer_get_resource (offer);
|
||||
|
||||
zwp_primary_selection_device_v1_send_data_offer (target, resource);
|
||||
|
@ -35,6 +35,8 @@
|
||||
|
||||
struct _MetaWaylandDataDevicePrimary
|
||||
{
|
||||
MetaWaylandSeat *seat;
|
||||
|
||||
uint32_t serial;
|
||||
MetaWaylandDataSource *data_source;
|
||||
struct wl_list resource_list;
|
||||
@ -48,7 +50,8 @@ struct _MetaWaylandDataDevicePrimary
|
||||
|
||||
void meta_wayland_data_device_primary_manager_init (MetaWaylandCompositor *compositor);
|
||||
|
||||
void meta_wayland_data_device_primary_init (MetaWaylandDataDevicePrimary *data_device);
|
||||
void meta_wayland_data_device_primary_init (MetaWaylandDataDevicePrimary *data_device,
|
||||
MetaWaylandSeat *seat);
|
||||
|
||||
void meta_wayland_data_device_primary_set_keyboard_focus (MetaWaylandDataDevicePrimary *data_device);
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "compositor/meta-dnd-actor-private.h"
|
||||
#include "core/meta-selection-private.h"
|
||||
#include "meta/meta-selection-source-memory.h"
|
||||
#include "wayland/meta-selection-source-wayland-private.h"
|
||||
#include "wayland/meta-wayland-dnd-surface.h"
|
||||
@ -53,6 +54,16 @@ drag_grab_data_source_destroyed (gpointer data, GObject *where_the_object_was);
|
||||
static struct wl_resource * create_and_send_clipboard_offer (MetaWaylandDataDevice *data_device,
|
||||
struct wl_resource *target);
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_data_device (MetaWaylandDataDevice *data_device)
|
||||
{
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (data_device->seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static void
|
||||
move_resources (struct wl_list *destination,
|
||||
struct wl_list *source)
|
||||
@ -94,12 +105,16 @@ static struct wl_resource *
|
||||
create_and_send_dnd_offer (MetaWaylandDataSource *source,
|
||||
struct wl_resource *target)
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
MetaWaylandDataOffer *offer;
|
||||
struct wl_array *mime_types;
|
||||
struct wl_resource *resource;
|
||||
char **p;
|
||||
|
||||
offer = meta_wayland_data_offer_new (META_SELECTION_DND, source, target);
|
||||
compositor = meta_wayland_data_source_get_compositor (source);
|
||||
offer = meta_wayland_data_offer_new (compositor,
|
||||
META_SELECTION_DND,
|
||||
source, target);
|
||||
resource = meta_wayland_data_offer_get_resource (offer);
|
||||
|
||||
wl_data_device_send_data_offer (target, resource);
|
||||
@ -150,7 +165,7 @@ set_selection_source (MetaWaylandDataDevice *data_device,
|
||||
MetaSelectionSource *selection_source)
|
||||
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_data_device (data_device);
|
||||
|
||||
meta_selection_set_owner (meta_display_get_selection (display),
|
||||
selection_type, selection_source);
|
||||
@ -161,7 +176,7 @@ static void
|
||||
unset_selection_source (MetaWaylandDataDevice *data_device,
|
||||
MetaSelectionType selection_type)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_data_device (data_device);
|
||||
|
||||
if (!data_device->owners[selection_type])
|
||||
return;
|
||||
@ -354,6 +369,8 @@ drag_grab_motion (MetaWaylandPointerGrab *grab,
|
||||
static void
|
||||
data_device_end_drag_grab (MetaWaylandDragGrab *drag_grab)
|
||||
{
|
||||
MetaWaylandDataDevice *data_device = &drag_grab->seat->data_device;
|
||||
|
||||
meta_wayland_drag_grab_set_source (drag_grab, NULL);
|
||||
meta_wayland_drag_grab_set_focus (drag_grab, NULL);
|
||||
|
||||
@ -382,9 +399,11 @@ data_device_end_drag_grab (MetaWaylandDragGrab *drag_grab)
|
||||
*/
|
||||
if (drag_grab->generic.pointer->grab == (MetaWaylandPointerGrab *) drag_grab)
|
||||
{
|
||||
MetaDisplay *display = display_from_data_device (data_device);
|
||||
|
||||
meta_wayland_pointer_end_grab (drag_grab->generic.pointer);
|
||||
meta_wayland_keyboard_end_grab (drag_grab->keyboard_grab.keyboard);
|
||||
meta_display_sync_wayland_input_focus (meta_get_display ());
|
||||
meta_display_sync_wayland_input_focus (display);
|
||||
}
|
||||
|
||||
g_free (drag_grab);
|
||||
@ -975,11 +994,12 @@ create_data_source (struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
uint32_t id)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = wl_resource_get_user_data (resource);
|
||||
struct wl_resource *source_resource;
|
||||
|
||||
source_resource = wl_resource_create (client, &wl_data_source_interface,
|
||||
wl_resource_get_version (resource), id);
|
||||
meta_wayland_data_source_new (source_resource);
|
||||
meta_wayland_data_source_new (compositor, source_resource);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -988,7 +1008,10 @@ owner_changed_cb (MetaSelection *selection,
|
||||
MetaSelectionSource *new_owner,
|
||||
MetaWaylandDataDevice *data_device)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDisplay *display = meta_selection_get_display (selection);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
MetaWaylandSeat *seat = compositor->seat;
|
||||
struct wl_resource *data_device_resource;
|
||||
struct wl_client *focus_client;
|
||||
@ -1018,11 +1041,14 @@ owner_changed_cb (MetaSelection *selection,
|
||||
static void
|
||||
ensure_owners_changed_handler_connected (MetaWaylandDataDevice *data_device)
|
||||
{
|
||||
MetaDisplay *display;
|
||||
|
||||
if (data_device->selection_owner_signal_id != 0)
|
||||
return;
|
||||
|
||||
display = display_from_data_device (data_device);
|
||||
data_device->selection_owner_signal_id =
|
||||
g_signal_connect (meta_display_get_selection (meta_get_display ()),
|
||||
g_signal_connect (meta_display_get_selection (display),
|
||||
"owner-changed",
|
||||
G_CALLBACK (owner_changed_cb), data_device);
|
||||
}
|
||||
@ -1066,11 +1092,13 @@ bind_manager (struct wl_client *client,
|
||||
uint32_t version,
|
||||
uint32_t id)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = data;
|
||||
struct wl_resource *resource;
|
||||
|
||||
resource = wl_resource_create (client, &wl_data_device_manager_interface,
|
||||
version, id);
|
||||
wl_resource_set_implementation (resource, &manager_interface, NULL, NULL);
|
||||
wl_resource_set_implementation (resource, &manager_interface,
|
||||
compositor, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1079,23 +1107,34 @@ meta_wayland_data_device_manager_init (MetaWaylandCompositor *compositor)
|
||||
if (wl_global_create (compositor->wayland_display,
|
||||
&wl_data_device_manager_interface,
|
||||
META_WL_DATA_DEVICE_MANAGER_VERSION,
|
||||
NULL, bind_manager) == NULL)
|
||||
compositor, bind_manager) == NULL)
|
||||
g_error ("Could not create data_device");
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_data_device_init (MetaWaylandDataDevice *data_device)
|
||||
meta_wayland_data_device_init (MetaWaylandDataDevice *data_device,
|
||||
MetaWaylandSeat *seat)
|
||||
{
|
||||
data_device->seat = seat;
|
||||
wl_list_init (&data_device->resource_list);
|
||||
wl_list_init (&data_device->focus_resource_list);
|
||||
}
|
||||
|
||||
MetaWaylandSeat *
|
||||
meta_wayland_data_device_get_seat (MetaWaylandDataDevice *data_device)
|
||||
{
|
||||
return data_device->seat;
|
||||
}
|
||||
|
||||
static struct wl_resource *
|
||||
create_and_send_clipboard_offer (MetaWaylandDataDevice *data_device,
|
||||
struct wl_resource *target)
|
||||
{
|
||||
MetaWaylandDataOffer *offer;
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (data_device->seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
struct wl_resource *resource;
|
||||
GList *mimetypes, *l;
|
||||
|
||||
@ -1104,7 +1143,9 @@ create_and_send_clipboard_offer (MetaWaylandDataDevice *data_device,
|
||||
if (!mimetypes)
|
||||
return NULL;
|
||||
|
||||
offer = meta_wayland_data_offer_new (META_SELECTION_CLIPBOARD, NULL, target);
|
||||
offer = meta_wayland_data_offer_new (compositor,
|
||||
META_SELECTION_CLIPBOARD,
|
||||
NULL, target);
|
||||
resource = meta_wayland_data_offer_get_resource (offer);
|
||||
|
||||
wl_data_device_send_data_offer (target, resource);
|
||||
|
@ -37,6 +37,8 @@ typedef struct _MetaWaylandDataSourceFuncs MetaWaylandDataSourceFuncs;
|
||||
|
||||
struct _MetaWaylandDataDevice
|
||||
{
|
||||
MetaWaylandSeat *seat;
|
||||
|
||||
uint32_t selection_serial;
|
||||
MetaWaylandDataSource *selection_data_source;
|
||||
MetaWaylandDataSource *dnd_data_source;
|
||||
@ -52,7 +54,10 @@ struct _MetaWaylandDataDevice
|
||||
|
||||
void meta_wayland_data_device_manager_init (MetaWaylandCompositor *compositor);
|
||||
|
||||
void meta_wayland_data_device_init (MetaWaylandDataDevice *data_device);
|
||||
void meta_wayland_data_device_init (MetaWaylandDataDevice *data_device,
|
||||
MetaWaylandSeat *seat);
|
||||
|
||||
MetaWaylandSeat * meta_wayland_data_device_get_seat (MetaWaylandDataDevice *data_device);
|
||||
|
||||
void meta_wayland_data_device_set_keyboard_focus (MetaWaylandDataDevice *data_device);
|
||||
|
||||
|
@ -36,6 +36,16 @@
|
||||
#include "core/display-private.h"
|
||||
#include "primary-selection-unstable-v1-server-protocol.h"
|
||||
#include "wayland/meta-wayland-data-offer.h"
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_offer (MetaWaylandDataOffer *offer)
|
||||
{
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (offer->compositor);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static void
|
||||
transfer_cb (MetaSelection *selection,
|
||||
@ -60,7 +70,8 @@ primary_offer_receive (struct wl_client *client,
|
||||
const char *mime_type,
|
||||
int32_t fd)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaWaylandDataOffer *offer = wl_resource_get_user_data (resource);
|
||||
MetaDisplay *display = display_from_offer (offer);
|
||||
GOutputStream *stream;
|
||||
GList *mime_types;
|
||||
gboolean found;
|
||||
@ -117,16 +128,18 @@ destroy_primary_offer (struct wl_resource *resource)
|
||||
offer->source = NULL;
|
||||
}
|
||||
|
||||
meta_display_sync_wayland_input_focus (meta_get_display ());
|
||||
meta_display_sync_wayland_input_focus (display_from_offer (offer));
|
||||
g_free (offer);
|
||||
}
|
||||
|
||||
MetaWaylandDataOffer *
|
||||
meta_wayland_data_offer_primary_new (struct wl_resource *target)
|
||||
meta_wayland_data_offer_primary_new (MetaWaylandCompositor *compositor,
|
||||
struct wl_resource *target)
|
||||
{
|
||||
MetaWaylandDataOffer *offer;
|
||||
|
||||
offer = g_new0 (MetaWaylandDataOffer, 1);
|
||||
offer->compositor = compositor;
|
||||
offer->selection_type = META_SELECTION_PRIMARY;
|
||||
offer->resource = wl_resource_create (wl_resource_get_client (target),
|
||||
&zwp_primary_selection_offer_v1_interface,
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "meta-wayland-data-offer.h"
|
||||
|
||||
MetaWaylandDataOffer * meta_wayland_data_offer_primary_new (struct wl_resource *target);
|
||||
MetaWaylandDataOffer * meta_wayland_data_offer_primary_new (MetaWaylandCompositor *compositor,
|
||||
struct wl_resource *target);
|
||||
|
||||
#endif /* META_WAYLAND_DATA_OFFER_PRIMARY_H */
|
||||
|
@ -41,6 +41,15 @@
|
||||
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE | \
|
||||
WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK)
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_offer (MetaWaylandDataOffer *offer)
|
||||
{
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (offer->compositor);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static void
|
||||
data_offer_accept (struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
@ -85,7 +94,7 @@ data_offer_receive (struct wl_client *client, struct wl_resource *resource,
|
||||
const char *mime_type, int32_t fd)
|
||||
{
|
||||
MetaWaylandDataOffer *offer = wl_resource_get_user_data (resource);
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_offer (offer);
|
||||
MetaSelectionType selection_type;
|
||||
GList *mime_types;
|
||||
gboolean found;
|
||||
@ -228,18 +237,20 @@ destroy_data_offer (struct wl_resource *resource)
|
||||
offer->source = NULL;
|
||||
}
|
||||
|
||||
meta_display_sync_wayland_input_focus (meta_get_display ());
|
||||
meta_display_sync_wayland_input_focus (display_from_offer (offer));
|
||||
g_free (offer);
|
||||
}
|
||||
|
||||
MetaWaylandDataOffer *
|
||||
meta_wayland_data_offer_new (MetaSelectionType selection_type,
|
||||
meta_wayland_data_offer_new (MetaWaylandCompositor *compositor,
|
||||
MetaSelectionType selection_type,
|
||||
MetaWaylandDataSource *source,
|
||||
struct wl_resource *target)
|
||||
{
|
||||
MetaWaylandDataOffer *offer;
|
||||
|
||||
offer = g_new0 (MetaWaylandDataOffer, 1);
|
||||
offer->compositor = compositor;
|
||||
offer->selection_type = selection_type;
|
||||
offer->resource = wl_resource_create (wl_resource_get_client (target),
|
||||
&wl_data_offer_interface,
|
||||
|
@ -29,6 +29,8 @@
|
||||
|
||||
struct _MetaWaylandDataOffer
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
|
||||
struct wl_resource *resource;
|
||||
MetaWaylandDataSource *source;
|
||||
struct wl_listener source_destroy_listener;
|
||||
@ -39,7 +41,8 @@ struct _MetaWaylandDataOffer
|
||||
MetaSelectionType selection_type;
|
||||
};
|
||||
|
||||
MetaWaylandDataOffer * meta_wayland_data_offer_new (MetaSelectionType selection_type,
|
||||
MetaWaylandDataOffer * meta_wayland_data_offer_new (MetaWaylandCompositor *compositor,
|
||||
MetaSelectionType selection_type,
|
||||
MetaWaylandDataSource *source,
|
||||
struct wl_resource *resource);
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
typedef struct _MetaWaylandDataSourcePrivate
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
|
||||
struct wl_resource *resource;
|
||||
MetaWaylandDataOffer *offer;
|
||||
struct wl_array mime_types;
|
||||
@ -240,13 +242,15 @@ destroy_data_source (struct wl_resource *resource)
|
||||
}
|
||||
|
||||
MetaWaylandDataSource *
|
||||
meta_wayland_data_source_new (struct wl_resource *resource)
|
||||
meta_wayland_data_source_new (MetaWaylandCompositor *compositor,
|
||||
struct wl_resource *resource)
|
||||
{
|
||||
MetaWaylandDataSource *source =
|
||||
g_object_new (META_TYPE_WAYLAND_DATA_SOURCE, NULL);
|
||||
MetaWaylandDataSourcePrivate *priv =
|
||||
meta_wayland_data_source_get_instance_private (source);
|
||||
|
||||
priv->compositor = compositor;
|
||||
meta_wayland_data_source_set_resource (source, resource);
|
||||
wl_resource_set_implementation (resource, &data_source_interface,
|
||||
source, destroy_data_source);
|
||||
@ -521,3 +525,12 @@ meta_wayland_data_source_has_mime_type (MetaWaylandDataSource *source,
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MetaWaylandCompositor *
|
||||
meta_wayland_data_source_get_compositor (MetaWaylandDataSource *source)
|
||||
{
|
||||
MetaWaylandDataSourcePrivate *priv =
|
||||
meta_wayland_data_source_get_instance_private (source);
|
||||
|
||||
return priv->compositor;
|
||||
}
|
||||
|
@ -54,7 +54,10 @@ struct _MetaWaylandDataSourceClass
|
||||
void (* drag_finished) (MetaWaylandDataSource *source);
|
||||
};
|
||||
|
||||
MetaWaylandDataSource * meta_wayland_data_source_new (struct wl_resource *resource);
|
||||
MetaWaylandDataSource * meta_wayland_data_source_new (MetaWaylandCompositor *compositor,
|
||||
struct wl_resource *resource);
|
||||
|
||||
MetaWaylandCompositor * meta_wayland_data_source_get_compositor (MetaWaylandDataSource *source);
|
||||
|
||||
struct wl_resource * meta_wayland_data_source_get_resource (MetaWaylandDataSource *source);
|
||||
void meta_wayland_data_source_set_resource (MetaWaylandDataSource *source,
|
||||
|
@ -707,7 +707,9 @@ MetaWaylandDmaBufBuffer *
|
||||
meta_wayland_dma_buf_fds_for_wayland_buffer (MetaWaylandBuffer *buffer)
|
||||
{
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
|
||||
MetaGpuKms *gpu_kms;
|
||||
|
@ -72,7 +72,13 @@ dnd_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
static MetaLogicalMonitor *
|
||||
dnd_surface_find_logical_monitor (MetaWaylandActorSurface *actor_surface)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaWaylandSurfaceRole *surface_role =
|
||||
META_WAYLAND_SURFACE_ROLE (actor_surface);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (surface->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaCursorTracker *cursor_tracker =
|
||||
meta_backend_get_cursor_tracker (backend);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
|
@ -149,7 +149,9 @@ MetaWaylandEglStream *
|
||||
meta_wayland_egl_stream_new (MetaWaylandBuffer *buffer,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
@ -193,12 +195,14 @@ alloc_egl_stream_texture (CoglTexture2D *texture,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaWaylandEglStream *stream = user_data;
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (stream->buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
MetaWaylandEglStream *stream = user_data;
|
||||
|
||||
return meta_egl_stream_consumer_gl_texture_external (egl, egl_display,
|
||||
stream->egl_stream,
|
||||
@ -209,7 +213,9 @@ CoglTexture2D *
|
||||
meta_wayland_egl_stream_create_texture (MetaWaylandEglStream *stream,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (stream->buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
@ -265,7 +271,9 @@ gboolean
|
||||
meta_wayland_egl_stream_attach (MetaWaylandEglStream *stream,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (stream->buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
@ -316,7 +324,9 @@ meta_wayland_egl_stream_create_snippet (MetaWaylandEglStream *stream)
|
||||
gboolean
|
||||
meta_wayland_is_egl_stream_buffer (MetaWaylandBuffer *buffer)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
@ -341,7 +351,9 @@ static void
|
||||
meta_wayland_egl_stream_finalize (GObject *object)
|
||||
{
|
||||
MetaWaylandEglStream *stream = META_WAYLAND_EGL_STREAM (object);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (stream->buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
|
@ -512,7 +512,10 @@ gtk_shell_system_bell (struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
struct wl_resource *gtk_surface_resource)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaWaylandGtkShell *gtk_shell = wl_resource_get_user_data (resource);
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (gtk_shell->compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
|
||||
if (gtk_surface_resource)
|
||||
{
|
||||
@ -538,7 +541,10 @@ gtk_shell_notify_launch (struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
const char *startup_id)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaWaylandGtkShell *gtk_shell = wl_resource_get_user_data (resource);
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (gtk_shell->compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaStartupSequence *sequence;
|
||||
uint64_t timestamp;
|
||||
|
||||
|
@ -64,6 +64,17 @@ G_DEFINE_TYPE (MetaWaylandKeyboard, meta_wayland_keyboard,
|
||||
static void meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard);
|
||||
static void notify_modifiers (MetaWaylandKeyboard *keyboard);
|
||||
|
||||
static MetaBackend *
|
||||
backend_from_keyboard (MetaWaylandKeyboard *keyboard)
|
||||
{
|
||||
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (keyboard);
|
||||
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_backend (context);
|
||||
}
|
||||
|
||||
static void
|
||||
unbind_resource (struct wl_resource *resource)
|
||||
{
|
||||
@ -281,9 +292,10 @@ add_vmod (xkb_mod_mask_t mask,
|
||||
}
|
||||
|
||||
static xkb_mod_mask_t
|
||||
add_virtual_mods (xkb_mod_mask_t mask)
|
||||
add_virtual_mods (MetaDisplay *display,
|
||||
xkb_mod_mask_t mask)
|
||||
{
|
||||
MetaKeyBindingManager *keys = &(meta_get_display ()->key_binding_manager);
|
||||
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
||||
xkb_mod_mask_t added;
|
||||
guint i;
|
||||
/* Order is important here: if multiple vmods share the same real
|
||||
@ -309,12 +321,20 @@ keyboard_send_modifiers (MetaWaylandKeyboard *keyboard,
|
||||
struct wl_resource *resource,
|
||||
uint32_t serial)
|
||||
{
|
||||
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (keyboard);
|
||||
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
struct xkb_state *state = keyboard->xkb_info.state;
|
||||
xkb_mod_mask_t depressed, latched, locked;
|
||||
|
||||
depressed = add_virtual_mods (xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED));
|
||||
latched = add_virtual_mods (xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED));
|
||||
locked = add_virtual_mods (xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED));
|
||||
depressed = add_virtual_mods (display,
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED));
|
||||
latched = add_virtual_mods (display,
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED));
|
||||
locked = add_virtual_mods (display,
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED));
|
||||
|
||||
wl_keyboard_send_modifiers (resource, serial, depressed, latched, locked,
|
||||
xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE));
|
||||
@ -353,7 +373,7 @@ meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
|
||||
{
|
||||
MetaWaylandXkbInfo *xkb_info = &keyboard->xkb_info;
|
||||
xkb_mod_mask_t latched, locked, numlock;
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = backend_from_keyboard (keyboard);
|
||||
xkb_layout_index_t layout_idx;
|
||||
ClutterKeymap *keymap;
|
||||
ClutterSeat *seat;
|
||||
@ -510,7 +530,7 @@ static const MetaWaylandKeyboardGrabInterface default_keyboard_grab_interface =
|
||||
void
|
||||
meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = backend_from_keyboard (keyboard);
|
||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||
|
||||
keyboard->settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard");
|
||||
@ -543,7 +563,7 @@ meta_wayland_xkb_info_destroy (MetaWaylandXkbInfo *xkb_info)
|
||||
void
|
||||
meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = backend_from_keyboard (keyboard);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (backend, on_keymap_changed, keyboard);
|
||||
g_signal_handlers_disconnect_by_func (backend, on_keymap_layout_group_changed, keyboard);
|
||||
|
@ -728,13 +728,16 @@ meta_wayland_outputs_finalize (MetaWaylandCompositor *compositor)
|
||||
void
|
||||
meta_wayland_outputs_init (MetaWaylandCompositor *compositor)
|
||||
{
|
||||
MetaMonitorManager *monitors;
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
|
||||
monitors = meta_monitor_manager_get ();
|
||||
g_signal_connect (monitors, "monitors-changed-internal",
|
||||
g_signal_connect (monitor_manager, "monitors-changed-internal",
|
||||
G_CALLBACK (on_monitors_changed), compositor);
|
||||
|
||||
compositor->outputs = meta_wayland_compositor_update_outputs (compositor, monitors);
|
||||
compositor->outputs =
|
||||
meta_wayland_compositor_update_outputs (compositor, monitor_manager);
|
||||
|
||||
wl_global_create (compositor->wayland_display,
|
||||
&zxdg_output_manager_v1_interface,
|
||||
|
@ -126,9 +126,11 @@ appears_focused_changed (MetaWindow *window,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaWaylandCompositor *wayland_compositor;
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *wayland_compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
|
||||
wayland_compositor = meta_wayland_compositor_get_default ();
|
||||
meta_wayland_pointer_constraint_maybe_remove_for_seat (wayland_compositor->seat,
|
||||
window);
|
||||
|
||||
@ -477,7 +479,7 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
|
||||
|
||||
if (meta_xwayland_is_xwayland_surface (constraint->surface))
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
|
||||
/*
|
||||
* We need to handle Xwayland surfaces differently in order to allow
|
||||
@ -645,6 +647,12 @@ meta_wayland_pointer_constraint_get_surface (MetaWaylandPointerConstraint *const
|
||||
return constraint->surface;
|
||||
}
|
||||
|
||||
MetaWaylandCompositor *
|
||||
meta_wayland_pointer_constraint_get_compositor (MetaWaylandPointerConstraint *constraint)
|
||||
{
|
||||
return constraint->surface->compositor;
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_constraint_resource_destroyed (struct wl_resource *resource)
|
||||
{
|
||||
|
@ -44,4 +44,6 @@ cairo_region_t * meta_wayland_pointer_constraint_calculate_effective_region (Met
|
||||
|
||||
MetaWaylandSurface * meta_wayland_pointer_constraint_get_surface (MetaWaylandPointerConstraint *constraint);
|
||||
|
||||
MetaWaylandCompositor * meta_wayland_pointer_constraint_get_compositor (MetaWaylandPointerConstraint *constraint);
|
||||
|
||||
#endif /* META_WAYLAND_POINTER_CONSTRAINTS_H */
|
||||
|
@ -94,6 +94,28 @@ meta_wayland_pointer_reset_grab (MetaWaylandPointer *pointer);
|
||||
static void
|
||||
meta_wayland_pointer_cancel_grab (MetaWaylandPointer *pointer);
|
||||
|
||||
static MetaBackend *
|
||||
backend_from_pointer (MetaWaylandPointer *pointer)
|
||||
{
|
||||
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (pointer);
|
||||
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_backend (context);
|
||||
}
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_pointer (MetaWaylandPointer *pointer)
|
||||
{
|
||||
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (pointer);
|
||||
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static MetaWaylandPointerClient *
|
||||
meta_wayland_pointer_client_new (void)
|
||||
{
|
||||
@ -287,8 +309,8 @@ surface_get_effective_window (MetaWaylandSurface *surface)
|
||||
static void
|
||||
sync_focus_surface (MetaWaylandPointer *pointer)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDisplay *display = display_from_pointer (pointer);
|
||||
MetaBackend *backend = backend_from_pointer (pointer);
|
||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||
ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
@ -461,8 +483,8 @@ default_grab_focus (MetaWaylandPointerGrab *grab,
|
||||
{
|
||||
MetaWaylandPointer *pointer = grab->pointer;
|
||||
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDisplay *display = display_from_pointer (pointer);
|
||||
MetaBackend *backend = backend_from_pointer (pointer);
|
||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||
ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
@ -542,7 +564,7 @@ meta_wayland_pointer_on_cursor_changed (MetaCursorTracker *cursor_tracker,
|
||||
void
|
||||
meta_wayland_pointer_enable (MetaWaylandPointer *pointer)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = backend_from_pointer (pointer);
|
||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||
ClutterSeat *clutter_seat;
|
||||
|
||||
@ -570,7 +592,7 @@ meta_wayland_pointer_enable (MetaWaylandPointer *pointer)
|
||||
void
|
||||
meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = backend_from_pointer (pointer);
|
||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||
ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
@ -1017,7 +1039,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
|
||||
MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (pointer);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = backend_from_pointer (pointer);
|
||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||
ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
@ -1181,7 +1203,7 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
|
||||
wl_fixed_t *sx,
|
||||
wl_fixed_t *sy)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = backend_from_pointer (pointer);
|
||||
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||
float xf = 0.0f, yf = 0.0f;
|
||||
graphene_point_t pos;
|
||||
@ -1196,7 +1218,7 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
|
||||
void
|
||||
meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = backend_from_pointer (pointer);
|
||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||
|
||||
if (pointer->current)
|
||||
@ -1302,7 +1324,7 @@ pointer_set_cursor (struct wl_client *client,
|
||||
clutter_backend_get_default_seat (clutter_backend);
|
||||
ClutterInputDevice *device = clutter_seat_get_pointer (clutter_seat);
|
||||
MetaCursorRenderer *cursor_renderer =
|
||||
meta_backend_get_cursor_renderer_for_device (meta_get_backend (),
|
||||
meta_backend_get_cursor_renderer_for_device (backend_from_pointer (pointer),
|
||||
device);
|
||||
MetaWaylandCursorSurface *cursor_surface;
|
||||
MetaCursorSprite *cursor_sprite;
|
||||
@ -1490,7 +1512,10 @@ meta_wayland_relative_pointer_init (MetaWaylandCompositor *compositor)
|
||||
* so lets just advertise the extension when the native backend is used.
|
||||
*/
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
if (!META_IS_BACKEND_NATIVE (meta_get_backend ()))
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
|
||||
if (!META_IS_BACKEND_NATIVE (backend))
|
||||
return;
|
||||
#else
|
||||
return;
|
||||
|
@ -206,6 +206,12 @@ meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab,
|
||||
void
|
||||
meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab)
|
||||
{
|
||||
MetaWaylandInputDevice *input_device =
|
||||
META_WAYLAND_INPUT_DEVICE (grab->generic.pointer);
|
||||
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaWaylandPopup *popup, *tmp;
|
||||
|
||||
g_assert (grab->generic.interface == &popup_grab_interface);
|
||||
@ -216,11 +222,8 @@ meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab)
|
||||
meta_wayland_popup_destroy (popup);
|
||||
}
|
||||
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
meta_display_end_grab_op (display,
|
||||
meta_display_get_current_time_roundtrip (display));
|
||||
}
|
||||
meta_display_end_grab_op (display,
|
||||
meta_display_get_current_time_roundtrip (display));
|
||||
|
||||
meta_wayland_pointer_end_grab (grab->generic.pointer);
|
||||
}
|
||||
|
@ -158,12 +158,15 @@ meta_wayland_seat_set_capabilities (MetaWaylandSeat *seat,
|
||||
|
||||
if (CAPABILITY_ENABLED (prev_flags, flags, WL_SEAT_CAPABILITY_KEYBOARD))
|
||||
{
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display;
|
||||
|
||||
meta_wayland_keyboard_enable (seat->keyboard);
|
||||
display = meta_get_display ();
|
||||
|
||||
/* Post-initialization, ensure the input focus is in sync */
|
||||
display = meta_context_get_display (context);
|
||||
if (display)
|
||||
meta_display_sync_wayland_input_focus (display);
|
||||
}
|
||||
@ -204,9 +207,12 @@ static MetaWaylandSeat *
|
||||
meta_wayland_seat_new (MetaWaylandCompositor *compositor,
|
||||
struct wl_display *display)
|
||||
{
|
||||
MetaWaylandSeat *seat = g_new0 (MetaWaylandSeat, 1);
|
||||
MetaWaylandSeat *seat;
|
||||
ClutterSeat *clutter_seat;
|
||||
|
||||
seat = g_new0 (MetaWaylandSeat, 1);
|
||||
seat->compositor = compositor;
|
||||
|
||||
wl_list_init (&seat->base_resource_list);
|
||||
seat->wl_display = display;
|
||||
|
||||
@ -222,8 +228,8 @@ meta_wayland_seat_new (MetaWaylandCompositor *compositor,
|
||||
|
||||
seat->text_input = meta_wayland_text_input_new (seat);
|
||||
|
||||
meta_wayland_data_device_init (&seat->data_device);
|
||||
meta_wayland_data_device_primary_init (&seat->primary_data_device);
|
||||
meta_wayland_data_device_init (&seat->data_device, seat);
|
||||
meta_wayland_data_device_primary_init (&seat->primary_data_device, seat);
|
||||
|
||||
clutter_seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||
meta_wayland_seat_update_capabilities (seat, clutter_seat);
|
||||
@ -410,8 +416,8 @@ void
|
||||
meta_wayland_seat_set_input_focus (MetaWaylandSeat *seat,
|
||||
MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaWaylandTabletSeat *tablet_seat;
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
|
||||
if (meta_wayland_seat_has_keyboard (seat))
|
||||
{
|
||||
@ -438,7 +444,7 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
|
||||
MetaWaylandTabletSeat *tablet_seat;
|
||||
GList *tools, *l;
|
||||
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
compositor = meta_wayland_seat_get_compositor (seat);
|
||||
tablet_seat = meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager, seat);
|
||||
tools = g_hash_table_get_values (tablet_seat->tools);
|
||||
|
||||
@ -495,7 +501,7 @@ meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
|
||||
MetaWaylandCompositor *compositor;
|
||||
MetaWaylandTabletSeat *tablet_seat;
|
||||
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
compositor = meta_wayland_seat_get_compositor (seat);
|
||||
tablet_seat =
|
||||
meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager, seat);
|
||||
|
||||
@ -522,3 +528,9 @@ meta_wayland_seat_has_touch (MetaWaylandSeat *seat)
|
||||
{
|
||||
return (seat->capabilities & WL_SEAT_CAPABILITY_TOUCH) != 0;
|
||||
}
|
||||
|
||||
MetaWaylandCompositor *
|
||||
meta_wayland_seat_get_compositor (MetaWaylandSeat *seat)
|
||||
{
|
||||
return seat->compositor;
|
||||
}
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
struct _MetaWaylandSeat
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
|
||||
struct wl_list base_resource_list;
|
||||
struct wl_display *wl_display;
|
||||
|
||||
@ -80,4 +82,6 @@ gboolean meta_wayland_seat_has_pointer (MetaWaylandSeat *seat);
|
||||
|
||||
gboolean meta_wayland_seat_has_touch (MetaWaylandSeat *seat);
|
||||
|
||||
MetaWaylandCompositor * meta_wayland_seat_get_compositor (MetaWaylandSeat *seat);
|
||||
|
||||
#endif /* META_WAYLAND_SEAT_H */
|
||||
|
@ -111,7 +111,9 @@ meta_wayland_single_pixel_buffer_attach (MetaWaylandBuffer *buffer,
|
||||
CoglTexture **texture,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (buffer->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context =
|
||||
clutter_backend_get_cogl_context (clutter_backend);
|
||||
|
@ -1624,7 +1624,7 @@ void
|
||||
meta_wayland_surface_drag_dest_focus_in (MetaWaylandSurface *surface,
|
||||
MetaWaylandDataOffer *offer)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandCompositor *compositor = surface->compositor;
|
||||
MetaWaylandDataDevice *data_device = &compositor->seat->data_device;
|
||||
|
||||
surface->dnd.funcs->focus_in (data_device, surface, offer);
|
||||
@ -1634,7 +1634,7 @@ void
|
||||
meta_wayland_surface_drag_dest_motion (MetaWaylandSurface *surface,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandCompositor *compositor = surface->compositor;
|
||||
MetaWaylandDataDevice *data_device = &compositor->seat->data_device;
|
||||
|
||||
surface->dnd.funcs->motion (data_device, surface, event);
|
||||
@ -1643,7 +1643,7 @@ meta_wayland_surface_drag_dest_motion (MetaWaylandSurface *surface,
|
||||
void
|
||||
meta_wayland_surface_drag_dest_focus_out (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandCompositor *compositor = surface->compositor;
|
||||
MetaWaylandDataDevice *data_device = &compositor->seat->data_device;
|
||||
|
||||
surface->dnd.funcs->focus_out (data_device, surface);
|
||||
@ -1652,7 +1652,7 @@ meta_wayland_surface_drag_dest_focus_out (MetaWaylandSurface *surface)
|
||||
void
|
||||
meta_wayland_surface_drag_dest_drop (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandCompositor *compositor = surface->compositor;
|
||||
MetaWaylandDataDevice *data_device = &compositor->seat->data_device;
|
||||
|
||||
surface->dnd.funcs->drop (data_device, surface);
|
||||
@ -1661,7 +1661,7 @@ meta_wayland_surface_drag_dest_drop (MetaWaylandSurface *surface)
|
||||
void
|
||||
meta_wayland_surface_drag_dest_update (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandCompositor *compositor = surface->compositor;
|
||||
MetaWaylandDataDevice *data_device = &compositor->seat->data_device;
|
||||
|
||||
surface->dnd.funcs->update (data_device, surface);
|
||||
|
@ -40,6 +40,16 @@
|
||||
|
||||
#include "tablet-unstable-v2-server-protocol.h"
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_pad (MetaWaylandTabletPad *pad)
|
||||
{
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (pad->tablet_seat->seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static void
|
||||
unbind_resource (struct wl_resource *resource)
|
||||
{
|
||||
@ -202,7 +212,7 @@ tablet_pad_set_feedback (struct wl_client *client,
|
||||
if (!group || group->mode_switch_serial != serial)
|
||||
return;
|
||||
|
||||
mapper = meta_get_display ()->pad_action_mapper;
|
||||
mapper = display_from_pad (pad)->pad_action_mapper;
|
||||
|
||||
if (meta_pad_action_mapper_is_button_grabbed (mapper, pad->device, button))
|
||||
return;
|
||||
@ -323,7 +333,7 @@ meta_wayland_tablet_pad_handle_event_action (MetaWaylandTabletPad *pad,
|
||||
ClutterInputDevice *device;
|
||||
|
||||
device = clutter_event_get_source_device (event);
|
||||
mapper = meta_get_display ()->pad_action_mapper;
|
||||
mapper = display_from_pad (pad)->pad_action_mapper;
|
||||
|
||||
if (meta_pad_action_mapper_is_button_grabbed (mapper, device,
|
||||
event->pad_button.button))
|
||||
|
@ -40,6 +40,26 @@
|
||||
|
||||
#define TABLET_AXIS_MAX 65535
|
||||
|
||||
static MetaBackend *
|
||||
backend_from_tool (MetaWaylandTabletTool *tool)
|
||||
{
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (tool->seat->seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_backend (context);
|
||||
}
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_tool (MetaWaylandTabletTool *tool)
|
||||
{
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (tool->seat->seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static void
|
||||
unbind_resource (struct wl_resource *resource)
|
||||
{
|
||||
@ -354,7 +374,7 @@ tool_cursor_prepare_at (MetaCursorSpriteXcursor *sprite_xcursor,
|
||||
int y,
|
||||
MetaWaylandTabletTool *tool)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackend *backend = backend_from_tool (tool);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
@ -385,7 +405,10 @@ meta_wayland_tablet_tool_new (MetaWaylandTabletSeat *seat,
|
||||
ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *device_tool)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (seat->seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||
MetaWaylandTabletTool *tool;
|
||||
|
||||
@ -552,8 +575,8 @@ static void
|
||||
sync_focus_surface (MetaWaylandTabletTool *tool,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDisplay *display = display_from_tool (tool);
|
||||
MetaBackend *backend = backend_from_tool (tool);
|
||||
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||
|
||||
if (clutter_stage_get_grab_actor (stage))
|
||||
@ -842,7 +865,7 @@ meta_wayland_tablet_tool_update (MetaWaylandTabletTool *tool,
|
||||
MetaCursorRenderer *renderer;
|
||||
|
||||
renderer =
|
||||
meta_backend_get_cursor_renderer_for_device (meta_get_backend (),
|
||||
meta_backend_get_cursor_renderer_for_device (backend_from_tool (tool),
|
||||
clutter_event_get_source_device (event));
|
||||
g_set_object (&tool->cursor_renderer, renderer);
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ enum
|
||||
|
||||
typedef struct _MetaWaylandXdgShellClient
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
struct wl_resource *resource;
|
||||
GList *surfaces;
|
||||
GList *surface_constructors;
|
||||
@ -181,6 +182,15 @@ surface_from_xdg_toplevel_resource (struct wl_resource *resource)
|
||||
return surface_from_xdg_surface_resource (resource);
|
||||
}
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_surface (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (surface->compositor);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static MetaWaylandXdgPopup *
|
||||
meta_wayland_xdg_popup_from_surface (MetaWaylandSurface *surface)
|
||||
{
|
||||
@ -909,7 +919,7 @@ meta_wayland_xdg_toplevel_reset (MetaWaylandXdgSurface *xdg_surface)
|
||||
meta_wayland_shell_surface_destroy_window (shell_surface);
|
||||
|
||||
meta_wayland_actor_surface_reset_actor (META_WAYLAND_ACTOR_SURFACE (surface_role));
|
||||
window = meta_window_wayland_new (meta_get_display (), surface);
|
||||
window = meta_window_wayland_new (display_from_surface (surface), surface);
|
||||
meta_wayland_shell_surface_set_window (shell_surface, window);
|
||||
|
||||
xdg_surface_class->reset (xdg_surface);
|
||||
@ -1064,7 +1074,7 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
|
||||
MetaWaylandSurface *parent_surface;
|
||||
MetaWaylandSeat *seat;
|
||||
uint32_t serial;
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaDisplay *display = display_from_surface (surface);
|
||||
MetaWindow *window;
|
||||
MetaWindow *parent_window;
|
||||
MetaPlacementRule placement_rule;
|
||||
@ -1972,7 +1982,7 @@ xdg_surface_constructor_get_toplevel (struct wl_client *client,
|
||||
xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_toplevel);
|
||||
meta_wayland_xdg_surface_constructor_finalize (constructor, xdg_surface);
|
||||
|
||||
window = meta_window_wayland_new (meta_get_display (), surface);
|
||||
window = meta_window_wayland_new (display_from_surface (surface), surface);
|
||||
shell_surface = META_WAYLAND_SHELL_SURFACE (xdg_surface);
|
||||
meta_wayland_shell_surface_set_window (shell_surface, window);
|
||||
}
|
||||
@ -2490,7 +2500,11 @@ xdg_wm_base_pong (struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
uint32_t serial)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaWaylandXdgShellClient *shell_client =
|
||||
wl_resource_get_user_data (resource);
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (shell_client->compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
|
||||
meta_display_pong_for_serial (display, serial);
|
||||
}
|
||||
@ -2541,10 +2555,12 @@ bind_xdg_wm_base (struct wl_client *client,
|
||||
uint32_t version,
|
||||
uint32_t id)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = data;
|
||||
MetaWaylandXdgShellClient *shell_client;
|
||||
|
||||
shell_client = g_new0 (MetaWaylandXdgShellClient, 1);
|
||||
|
||||
shell_client->compositor = compositor;
|
||||
shell_client->resource = wl_resource_create (client,
|
||||
&xdg_wm_base_interface,
|
||||
version, id);
|
||||
|
@ -535,7 +535,8 @@ meta_wayland_init_egl (MetaWaylandCompositor *compositor)
|
||||
{
|
||||
MetaWaylandCompositorPrivate *priv =
|
||||
meta_wayland_compositor_get_instance_private (compositor);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context =
|
||||
@ -802,7 +803,10 @@ static void
|
||||
on_scheduled_association_unmanaged (MetaWindow *window,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
|
||||
meta_wayland_compositor_remove_surface_association (compositor,
|
||||
GPOINTER_TO_INT (user_data));
|
||||
@ -856,3 +860,11 @@ meta_wayland_compositor_get_context (MetaWaylandCompositor *compositor)
|
||||
{
|
||||
return compositor->context;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_compositor_handle_xwayland_xevent (MetaWaylandCompositor *compositor,
|
||||
XEvent *xevent)
|
||||
{
|
||||
return meta_xwayland_manager_handle_xevent (&compositor->xwayland_manager,
|
||||
xevent);
|
||||
}
|
||||
|
@ -99,7 +99,10 @@ void meta_wayland_compositor_notify_surface_id (MetaWaylandCo
|
||||
META_EXPORT_TEST
|
||||
MetaXWaylandManager * meta_wayland_compositor_get_xwayland_manager (MetaWaylandCompositor *compositor);
|
||||
|
||||
META_EXPORT_TEST
|
||||
MetaContext * meta_wayland_compositor_get_context (MetaWaylandCompositor *compositor);
|
||||
|
||||
#endif
|
||||
gboolean meta_wayland_compositor_handle_xwayland_xevent (MetaWaylandCompositor *compositor,
|
||||
XEvent *event);
|
||||
|
||||
#endif
|
||||
|
@ -507,7 +507,9 @@ static void
|
||||
meta_window_wayland_update_main_monitor (MetaWindow *window,
|
||||
MetaWindowUpdateMonitorFlags flags)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
|
||||
@ -719,7 +721,10 @@ static void
|
||||
meta_window_wayland_force_restore_shortcuts (MetaWindow *window,
|
||||
ClutterInputDevice *source)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
|
||||
meta_wayland_compositor_restore_shortcuts (compositor, source);
|
||||
}
|
||||
@ -728,7 +733,10 @@ static gboolean
|
||||
meta_window_wayland_shortcuts_inhibited (MetaWindow *window,
|
||||
ClutterInputDevice *source)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
|
||||
return meta_wayland_compositor_is_shortcuts_inhibited (compositor, source);
|
||||
}
|
||||
|
@ -154,7 +154,10 @@ static void
|
||||
meta_window_xwayland_force_restore_shortcuts (MetaWindow *window,
|
||||
ClutterInputDevice *source)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
|
||||
meta_wayland_compositor_restore_shortcuts (compositor, source);
|
||||
}
|
||||
@ -163,7 +166,10 @@ static gboolean
|
||||
meta_window_xwayland_shortcuts_inhibited (MetaWindow *window,
|
||||
ClutterInputDevice *source)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
|
||||
return meta_wayland_compositor_is_shortcuts_inhibited (compositor, source);
|
||||
}
|
||||
|
@ -55,6 +55,8 @@ struct _MetaWaylandDataSourceXWayland
|
||||
|
||||
struct _MetaXWaylandDnd
|
||||
{
|
||||
MetaXWaylandManager *manager;
|
||||
|
||||
Window owner;
|
||||
Time client_message_timestamp;
|
||||
MetaWaylandDataSource *source; /* owned by MetaWaylandDataDevice */
|
||||
@ -108,6 +110,24 @@ Atom xdnd_atoms[N_DND_ATOMS];
|
||||
G_DEFINE_TYPE (MetaWaylandDataSourceXWayland, meta_wayland_data_source_xwayland,
|
||||
META_TYPE_WAYLAND_DATA_SOURCE);
|
||||
|
||||
static MetaDisplay *
|
||||
display_from_compositor (MetaWaylandCompositor *compositor)
|
||||
{
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
|
||||
return meta_context_get_display (context);
|
||||
}
|
||||
|
||||
static MetaX11Display *
|
||||
x11_display_from_dnd (MetaXWaylandDnd *dnd)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = dnd->manager->compositor;
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
|
||||
return meta_display_get_x11_display (display);
|
||||
}
|
||||
|
||||
/* XDND helpers */
|
||||
static Atom
|
||||
action_to_atom (uint32_t action)
|
||||
@ -224,8 +244,8 @@ static void
|
||||
xdnd_send_enter (MetaXWaylandDnd *dnd,
|
||||
Window dest)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaWaylandCompositor *compositor = dnd->manager->compositor;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
Display *xdisplay = x11_display->xdisplay;
|
||||
MetaWaylandDataSource *data_source;
|
||||
XEvent xev = { 0 };
|
||||
@ -287,7 +307,7 @@ static void
|
||||
xdnd_send_leave (MetaXWaylandDnd *dnd,
|
||||
Window dest)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
Display *xdisplay = x11_display->xdisplay;
|
||||
XEvent xev = { 0 };
|
||||
|
||||
@ -309,9 +329,9 @@ xdnd_send_position (MetaXWaylandDnd *dnd,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandCompositor *compositor = dnd->manager->compositor;
|
||||
MetaWaylandDataSource *source = compositor->seat->data_device.dnd_data_source;
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
Display *xdisplay = x11_display->xdisplay;
|
||||
uint32_t action = 0, user_action, actions;
|
||||
XEvent xev = { 0 };
|
||||
@ -347,7 +367,7 @@ xdnd_send_drop (MetaXWaylandDnd *dnd,
|
||||
Window dest,
|
||||
uint32_t time)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
Display *xdisplay = x11_display->xdisplay;
|
||||
XEvent xev = { 0 };
|
||||
|
||||
@ -371,7 +391,7 @@ xdnd_send_finished (MetaXWaylandDnd *dnd,
|
||||
Window dest,
|
||||
gboolean accepted)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
Display *xdisplay = x11_display->xdisplay;
|
||||
MetaWaylandDataSource *source = dnd->source;
|
||||
uint32_t action = 0;
|
||||
@ -403,7 +423,7 @@ xdnd_send_status (MetaXWaylandDnd *dnd,
|
||||
Window dest,
|
||||
uint32_t action)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
||||
XEvent xev = { 0 };
|
||||
|
||||
@ -430,11 +450,12 @@ static void
|
||||
meta_xwayland_end_dnd_grab (MetaWaylandDataDevice *data_device,
|
||||
gboolean success)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandSeat *seat = meta_wayland_data_device_get_seat (data_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
||||
MetaWaylandDragGrab *drag_grab = compositor->seat->data_device.current_grab;
|
||||
MetaXWaylandDnd *dnd = manager->dnd;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
|
||||
if (drag_grab)
|
||||
{
|
||||
@ -469,7 +490,10 @@ meta_x11_source_send (MetaWaylandDataSource *source,
|
||||
const gchar *mime_type,
|
||||
gint fd)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_data_source_get_compositor (source);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
GOutputStream *stream;
|
||||
|
||||
stream = g_unix_output_stream_new (fd, TRUE);
|
||||
@ -533,7 +557,7 @@ meta_x11_source_drag_finished (MetaWaylandDataSource *source)
|
||||
MetaWaylandDataSourceXWayland *source_xwayland =
|
||||
META_WAYLAND_DATA_SOURCE_XWAYLAND (source);
|
||||
MetaXWaylandDnd *dnd = source_xwayland->dnd;
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
uint32_t action = meta_wayland_data_source_get_current_action (source);
|
||||
|
||||
if (action == WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
|
||||
@ -587,7 +611,8 @@ meta_x11_drag_dest_focus_in (MetaWaylandDataDevice *data_device,
|
||||
MetaWaylandSurface *surface,
|
||||
MetaWaylandDataOffer *offer)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandSeat *seat = meta_wayland_data_device_get_seat (data_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
|
||||
dnd->dnd_dest = meta_wayland_surface_get_window (surface)->xwindow;
|
||||
@ -598,7 +623,8 @@ static void
|
||||
meta_x11_drag_dest_focus_out (MetaWaylandDataDevice *data_device,
|
||||
MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandSeat *seat = meta_wayland_data_device_get_seat (data_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
|
||||
xdnd_send_leave (dnd, dnd->dnd_dest);
|
||||
@ -610,7 +636,8 @@ meta_x11_drag_dest_motion (MetaWaylandDataDevice *data_device,
|
||||
MetaWaylandSurface *surface,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandSeat *seat = meta_wayland_data_device_get_seat (data_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
guint32 time;
|
||||
gfloat x, y;
|
||||
@ -624,20 +651,22 @@ static void
|
||||
meta_x11_drag_dest_drop (MetaWaylandDataDevice *data_device,
|
||||
MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandSeat *seat = meta_wayland_data_device_get_seat (data_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
MetaDisplay *display = display_from_compositor (compositor);
|
||||
|
||||
xdnd_send_drop (dnd, dnd->dnd_dest,
|
||||
meta_display_get_current_time_roundtrip (meta_get_display ()));
|
||||
meta_display_get_current_time_roundtrip (display));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_x11_drag_dest_update (MetaWaylandDataDevice *data_device,
|
||||
MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandSeat *seat = meta_wayland_data_device_get_seat (data_device);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
MetaWaylandSeat *seat = compositor->seat;
|
||||
graphene_point_t pos;
|
||||
|
||||
clutter_seat_query_state (clutter_input_device_get_seat (seat->pointer->device),
|
||||
@ -720,7 +749,8 @@ static MetaWaylandSurface *
|
||||
pick_drop_surface (MetaWaylandCompositor *compositor,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
|
||||
MetaWorkspace *workspace = workspace_manager->active_workspace;
|
||||
MetaWindow *focus_window = NULL;
|
||||
@ -738,9 +768,9 @@ repick_drop_surface (MetaWaylandCompositor *compositor,
|
||||
MetaWaylandDragGrab *drag_grab,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
|
||||
MetaWaylandSurface *focus = NULL;
|
||||
MetaWindow *focus_window;
|
||||
|
||||
@ -791,9 +821,9 @@ static void
|
||||
drag_xgrab_motion (MetaWaylandPointerGrab *grab,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (grab->pointer);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
MetaWaylandSeat *seat = compositor->seat;
|
||||
|
||||
repick_drop_surface (compositor,
|
||||
(MetaWaylandDragGrab *) grab,
|
||||
@ -807,8 +837,8 @@ static void
|
||||
drag_xgrab_button (MetaWaylandPointerGrab *grab,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandSeat *seat = compositor->seat;
|
||||
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (grab->pointer);
|
||||
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
|
||||
MetaWaylandDataSource *data_source;
|
||||
|
||||
meta_wayland_pointer_send_button (seat->pointer, event);
|
||||
@ -834,7 +864,7 @@ meta_xwayland_dnd_handle_client_message (MetaWaylandCompositor *compositor,
|
||||
XClientMessageEvent *event = (XClientMessageEvent *) xevent;
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
MetaWaylandSeat *seat = compositor->seat;
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
|
||||
/* Source side messages */
|
||||
if (event->window == x11_display->selection.xwindow)
|
||||
@ -977,7 +1007,7 @@ meta_xwayland_dnd_handle_xfixes_selection_notify (MetaWaylandCompositor *composi
|
||||
XFixesSelectionNotifyEvent *event = (XFixesSelectionNotifyEvent *) xevent;
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
MetaWaylandDataDevice *data_device = &compositor->seat->data_device;
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
MetaWaylandSurface *focus;
|
||||
|
||||
if (event->selection != xdnd_atoms[ATOM_DND_SELECTION])
|
||||
@ -1009,11 +1039,10 @@ meta_xwayland_dnd_handle_xfixes_selection_notify (MetaWaylandCompositor *composi
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_xwayland_dnd_handle_event (XEvent *xevent)
|
||||
meta_xwayland_dnd_handle_xevent (MetaXWaylandManager *manager,
|
||||
XEvent *xevent)
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandCompositor *compositor = manager->compositor;
|
||||
|
||||
if (!compositor->xwayland_manager.dnd)
|
||||
return FALSE;
|
||||
@ -1024,7 +1053,8 @@ meta_xwayland_dnd_handle_event (XEvent *xevent)
|
||||
return meta_xwayland_dnd_handle_client_message (compositor, xevent);
|
||||
default:
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaDisplay *display = display_from_compositor (compositor);
|
||||
MetaX11Display *x11_display = meta_display_get_x11_display (display);
|
||||
|
||||
if (xevent->type - x11_display->xfixes_event_base == XFixesSelectionNotify)
|
||||
return meta_xwayland_dnd_handle_xfixes_selection_notify (compositor, xevent);
|
||||
@ -1037,7 +1067,10 @@ meta_xwayland_dnd_handle_event (XEvent *xevent)
|
||||
void
|
||||
meta_xwayland_init_dnd (MetaX11Display *x11_display)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDisplay *display = meta_x11_display_get_display (x11_display);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
||||
|
||||
MetaXWaylandDnd *dnd = manager->dnd;
|
||||
@ -1052,6 +1085,7 @@ meta_xwayland_init_dnd (MetaX11Display *x11_display)
|
||||
xdnd_atoms[i] = gdk_x11_get_xatom_by_name (atom_names[i]);
|
||||
|
||||
create_dnd_windows (dnd, x11_display);
|
||||
dnd->manager = manager;
|
||||
dnd->current_dnd_window = 0;
|
||||
}
|
||||
|
||||
|
@ -87,9 +87,14 @@ meta_xwayland_keyboard_grab_end (MetaXwaylandKeyboardActiveGrab *active_grab)
|
||||
|
||||
if (seat->keyboard->grab->interface->key == meta_xwayland_keyboard_grab_key)
|
||||
{
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_seat_get_compositor (active_grab->seat);
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
|
||||
meta_wayland_keyboard_end_grab (active_grab->keyboard_grab.keyboard);
|
||||
meta_wayland_keyboard_set_focus (active_grab->keyboard_grab.keyboard, NULL);
|
||||
meta_display_sync_wayland_input_focus (meta_get_display ());
|
||||
meta_display_sync_wayland_input_focus (display);
|
||||
}
|
||||
|
||||
if (!active_grab->surface)
|
||||
@ -193,14 +198,14 @@ application_is_in_pattern_array (MetaWindow *window,
|
||||
static gboolean
|
||||
meta_xwayland_grab_is_granted (MetaWindow *window)
|
||||
{
|
||||
MetaBackend *backend;
|
||||
MetaSettings *settings;
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaSettings *settings = meta_backend_get_settings (backend);
|
||||
GPtrArray *allow_list;
|
||||
GPtrArray *deny_list;
|
||||
gboolean may_grab;
|
||||
|
||||
backend = meta_get_backend ();
|
||||
settings = meta_backend_get_settings (backend);
|
||||
|
||||
/* Check whether the window is in the deny list */
|
||||
meta_settings_get_xwayland_grab_patterns (settings, &allow_list, &deny_list);
|
||||
@ -223,16 +228,15 @@ meta_xwayland_grab_is_granted (MetaWindow *window)
|
||||
static gboolean
|
||||
meta_xwayland_grab_should_lock_focus (MetaWindow *window)
|
||||
{
|
||||
MetaBackend *backend;
|
||||
MetaSettings *settings;
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaSettings *settings = meta_backend_get_settings (backend);
|
||||
|
||||
/* Lock focus applies to O-R windows which never receive keyboard focus otherwise */
|
||||
if (!window->override_redirect)
|
||||
return FALSE;
|
||||
|
||||
backend = meta_get_backend ();
|
||||
settings = meta_backend_get_settings (backend);
|
||||
|
||||
return meta_settings_are_xwayland_grabs_allowed (settings);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,8 @@ meta_xwayland_handle_xevent (XEvent *event);
|
||||
void meta_xwayland_init_dnd (MetaX11Display *x11_display);
|
||||
void meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager,
|
||||
MetaX11Display *x11_display);
|
||||
gboolean meta_xwayland_dnd_handle_event (XEvent *xevent);
|
||||
gboolean meta_xwayland_dnd_handle_xevent (MetaXWaylandManager *manger,
|
||||
XEvent *xevent);
|
||||
|
||||
const MetaWaylandDragDestFuncs * meta_xwayland_selection_get_drag_dest_funcs (void);
|
||||
|
||||
@ -60,4 +61,7 @@ gboolean meta_xwayland_start_xserver_finish (MetaXWaylandManager *manager,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean meta_xwayland_manager_handle_xevent (MetaXWaylandManager *manager,
|
||||
XEvent *xevent);
|
||||
|
||||
#endif /* META_XWAYLAND_PRIVATE_H */
|
||||
|
@ -71,6 +71,16 @@ static void meta_xwayland_stop_xserver (MetaXWaylandManager *manager);
|
||||
static void
|
||||
meta_xwayland_set_primary_output (MetaX11Display *x11_display);
|
||||
|
||||
static MetaMonitorManager *
|
||||
monitor_manager_from_x11_display (MetaX11Display *x11_display)
|
||||
{
|
||||
MetaDisplay *display = meta_x11_display_get_display (x11_display);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
|
||||
return meta_backend_get_monitor_manager (backend);
|
||||
}
|
||||
|
||||
void
|
||||
meta_xwayland_associate_window_with_surface (MetaWindow *window,
|
||||
MetaWaylandSurface *surface)
|
||||
@ -118,7 +128,10 @@ void
|
||||
meta_xwayland_handle_wl_surface_id (MetaWindow *window,
|
||||
guint32 surface_id)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
||||
|
||||
if (!associate_window_with_surface_id (manager, window, surface_id))
|
||||
@ -134,7 +147,7 @@ meta_xwayland_handle_wl_surface_id (MetaWindow *window,
|
||||
gboolean
|
||||
meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaWaylandCompositor *compositor = surface->compositor;
|
||||
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
||||
|
||||
return surface->resource != NULL &&
|
||||
@ -399,9 +412,11 @@ xserver_died (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
MetaXWaylandManager *manager = user_data;
|
||||
MetaWaylandCompositor *compositor = manager->compositor;
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
GSubprocess *proc = G_SUBPROCESS (source);
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
g_autoptr (GError) error = NULL;
|
||||
MetaX11DisplayPolicy x11_display_policy;
|
||||
|
||||
@ -413,7 +428,6 @@ xserver_died (GObject *source,
|
||||
g_warning ("Failed to finish waiting for Xwayland: %s", error->message);
|
||||
}
|
||||
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
x11_display_policy =
|
||||
meta_context_get_x11_display_policy (compositor->context);
|
||||
if (!g_subprocess_get_successful (proc))
|
||||
@ -446,7 +460,9 @@ xserver_died (GObject *source,
|
||||
static void
|
||||
meta_xwayland_terminate (MetaXWaylandManager *manager)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (manager->compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
|
||||
meta_display_shutdown_x11 (display);
|
||||
meta_xwayland_stop_xserver (manager);
|
||||
@ -777,20 +793,20 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = manager->compositor;
|
||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
int xwayland_client_fd[2];
|
||||
int displayfd[2];
|
||||
g_autoptr(GSubprocessLauncher) launcher = NULL;
|
||||
GSubprocessFlags flags;
|
||||
GError *error = NULL;
|
||||
g_autoptr (GTask) task = NULL;
|
||||
MetaBackend *backend;
|
||||
MetaSettings *settings;
|
||||
const char *args[32];
|
||||
int xwayland_disable_extensions;
|
||||
int i, j;
|
||||
#ifdef HAVE_XWAYLAND_TERMINATE_DELAY
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_wayland_compositor_get_default ();
|
||||
MetaX11DisplayPolicy x11_display_policy =
|
||||
meta_context_get_x11_display_policy (compositor->context);
|
||||
#endif
|
||||
@ -838,7 +854,6 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
|
||||
flags |= G_SUBPROCESS_FLAGS_STDERR_SILENCE;
|
||||
}
|
||||
|
||||
backend = meta_get_backend ();
|
||||
settings = meta_backend_get_settings (backend);
|
||||
xwayland_disable_extensions =
|
||||
meta_settings_get_xwayland_disable_extensions (settings);
|
||||
@ -931,7 +946,7 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
|
||||
|
||||
manager->xserver_died_cancellable = g_cancellable_new ();
|
||||
g_subprocess_wait_async (manager->proc, manager->xserver_died_cancellable,
|
||||
xserver_died, NULL);
|
||||
xserver_died, manager);
|
||||
g_unix_fd_add (displayfd[0], G_IO_IN, on_displayfd_ready,
|
||||
g_steal_pointer (&task));
|
||||
manager->client = wl_client_create (manager->wayland_display,
|
||||
@ -955,7 +970,9 @@ xdisplay_connection_activity_cb (gint fd,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaXWaylandManager *manager = user_data;
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (manager->compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
|
||||
meta_display_init_x11 (display, NULL,
|
||||
(GAsyncReadyCallback) on_init_x11_cb, NULL);
|
||||
@ -1042,9 +1059,13 @@ meta_xwayland_init (MetaXWaylandManager *manager,
|
||||
}
|
||||
|
||||
static void
|
||||
monitors_changed_cb (MetaMonitorManager *monitor_manager)
|
||||
monitors_changed_cb (MetaMonitorManager *monitor_manager,
|
||||
MetaXWaylandManager *manager)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (manager->compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaX11Display *x11_display = display->x11_display;
|
||||
|
||||
meta_xwayland_set_primary_output (x11_display);
|
||||
}
|
||||
@ -1054,18 +1075,21 @@ on_x11_display_closing (MetaDisplay *display,
|
||||
MetaXWaylandManager *manager)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_display_get_x11_display (display);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
monitor_manager_from_x11_display (x11_display);
|
||||
|
||||
meta_xwayland_shutdown_dnd (manager, x11_display);
|
||||
g_signal_handlers_disconnect_by_func (meta_monitor_manager_get (),
|
||||
g_signal_handlers_disconnect_by_func (monitor_manager,
|
||||
monitors_changed_cb,
|
||||
NULL);
|
||||
manager);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_xwayland_init_xrandr (MetaXWaylandManager *manager,
|
||||
MetaX11Display *x11_display)
|
||||
{
|
||||
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
||||
MetaMonitorManager *monitor_manager =
|
||||
monitor_manager_from_x11_display (x11_display);
|
||||
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
|
||||
|
||||
manager->has_xrandr = XRRQueryExtension (xdisplay,
|
||||
@ -1079,7 +1103,7 @@ meta_xwayland_init_xrandr (MetaXWaylandManager *manager,
|
||||
RRCrtcChangeNotifyMask | RROutputChangeNotifyMask);
|
||||
|
||||
g_signal_connect (monitor_manager, "monitors-changed",
|
||||
G_CALLBACK (monitors_changed_cb), NULL);
|
||||
G_CALLBACK (monitors_changed_cb), manager);
|
||||
|
||||
meta_xwayland_set_primary_output (x11_display);
|
||||
}
|
||||
@ -1129,7 +1153,9 @@ meta_xwayland_connection_release (MetaXWaylandConnection *connection)
|
||||
void
|
||||
meta_xwayland_shutdown (MetaXWaylandManager *manager)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (manager->compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaX11Display *x11_display;
|
||||
char path[256];
|
||||
|
||||
@ -1175,12 +1201,12 @@ static void
|
||||
meta_xwayland_set_primary_output (MetaX11Display *x11_display)
|
||||
{
|
||||
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
monitor_manager_from_x11_display (x11_display);
|
||||
XRRScreenResources *resources;
|
||||
MetaMonitorManager *monitor_manager;
|
||||
MetaLogicalMonitor *primary_monitor;
|
||||
int i;
|
||||
|
||||
monitor_manager = meta_monitor_manager_get ();
|
||||
primary_monitor =
|
||||
meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
|
||||
|
||||
@ -1232,17 +1258,18 @@ meta_xwayland_set_primary_output (MetaX11Display *x11_display)
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_xwayland_handle_xevent (XEvent *event)
|
||||
meta_xwayland_manager_handle_xevent (MetaXWaylandManager *manager,
|
||||
XEvent *event)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
||||
|
||||
if (meta_xwayland_dnd_handle_event (event))
|
||||
if (meta_xwayland_dnd_handle_xevent (manager, event))
|
||||
return TRUE;
|
||||
|
||||
if (manager->has_xrandr && event->type == manager->rr_event_base + RRNotify)
|
||||
{
|
||||
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (manager->compositor);
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
MetaX11Display *x11_display = meta_display_get_x11_display (display);
|
||||
|
||||
meta_xwayland_set_primary_output (x11_display);
|
||||
return TRUE;
|
||||
|
@ -1882,11 +1882,15 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
|
||||
XEvent *event)
|
||||
{
|
||||
MetaDisplay *display = x11_display->display;
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
Window modified;
|
||||
gboolean bypass_compositor = FALSE, bypass_gtk = FALSE;
|
||||
XIEvent *input_event;
|
||||
MetaCursorTracker *cursor_tracker;
|
||||
#ifdef HAVE_WAYLAND
|
||||
MetaWaylandCompositor *wayland_compositor;
|
||||
#endif
|
||||
|
||||
COGL_TRACE_BEGIN (MetaX11DisplayHandleXevent,
|
||||
"X11Display (handle X11 event)");
|
||||
@ -1902,8 +1906,9 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
if (meta_is_wayland_compositor () &&
|
||||
meta_xwayland_handle_xevent (event))
|
||||
wayland_compositor = meta_context_get_wayland_compositor (context);
|
||||
if (wayland_compositor &&
|
||||
meta_wayland_compositor_handle_xwayland_xevent (wayland_compositor, event))
|
||||
{
|
||||
bypass_gtk = bypass_compositor = TRUE;
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user