mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
wayland: Remove Gtk primary selection protocol
This has been replaced for primary selection protocol from wayland-protocols. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2184>
This commit is contained in:
parent
11bc19fbe8
commit
d4bdd8b56f
2
.gitignore
vendored
2
.gitignore
vendored
@ -52,8 +52,6 @@ src/meta-dbus-idle-monitor.[ch]
|
|||||||
src/meta-dbus-login1.[ch]
|
src/meta-dbus-login1.[ch]
|
||||||
src/meta-dbus-remote-desktop.[ch]
|
src/meta-dbus-remote-desktop.[ch]
|
||||||
src/meta-dbus-screen-cast.[ch]
|
src/meta-dbus-screen-cast.[ch]
|
||||||
src/gtk-primary-selection-protocol.c
|
|
||||||
src/gtk-primary-selection-server-protocol.h
|
|
||||||
src/gtk-shell-protocol.c
|
src/gtk-shell-protocol.c
|
||||||
src/gtk-shell-server-protocol.h
|
src/gtk-shell-server-protocol.h
|
||||||
src/pointer-gestures-unstable-v*-protocol.c
|
src/pointer-gestures-unstable-v*-protocol.c
|
||||||
|
@ -550,20 +550,14 @@ if have_wayland
|
|||||||
'wayland/meta-wayland-data-device.h',
|
'wayland/meta-wayland-data-device.h',
|
||||||
'wayland/meta-wayland-data-device-primary.c',
|
'wayland/meta-wayland-data-device-primary.c',
|
||||||
'wayland/meta-wayland-data-device-primary.h',
|
'wayland/meta-wayland-data-device-primary.h',
|
||||||
'wayland/meta-wayland-data-device-primary-legacy.c',
|
|
||||||
'wayland/meta-wayland-data-device-primary-legacy.h',
|
|
||||||
'wayland/meta-wayland-data-offer.c',
|
'wayland/meta-wayland-data-offer.c',
|
||||||
'wayland/meta-wayland-data-offer.h',
|
'wayland/meta-wayland-data-offer.h',
|
||||||
'wayland/meta-wayland-data-offer-primary.c',
|
'wayland/meta-wayland-data-offer-primary.c',
|
||||||
'wayland/meta-wayland-data-offer-primary.h',
|
'wayland/meta-wayland-data-offer-primary.h',
|
||||||
'wayland/meta-wayland-data-offer-primary-legacy.c',
|
|
||||||
'wayland/meta-wayland-data-offer-primary-legacy.h',
|
|
||||||
'wayland/meta-wayland-data-source.c',
|
'wayland/meta-wayland-data-source.c',
|
||||||
'wayland/meta-wayland-data-source.h',
|
'wayland/meta-wayland-data-source.h',
|
||||||
'wayland/meta-wayland-data-source-primary.c',
|
'wayland/meta-wayland-data-source-primary.c',
|
||||||
'wayland/meta-wayland-data-source-primary.h',
|
'wayland/meta-wayland-data-source-primary.h',
|
||||||
'wayland/meta-wayland-data-source-primary-legacy.c',
|
|
||||||
'wayland/meta-wayland-data-source-primary-legacy.h',
|
|
||||||
'wayland/meta-wayland-dma-buf.c',
|
'wayland/meta-wayland-dma-buf.c',
|
||||||
'wayland/meta-wayland-dma-buf.h',
|
'wayland/meta-wayland-dma-buf.h',
|
||||||
'wayland/meta-wayland-dnd-surface.c',
|
'wayland/meta-wayland-dnd-surface.c',
|
||||||
@ -906,7 +900,6 @@ if have_wayland
|
|||||||
# - protocol stability ('private', 'stable' or 'unstable')
|
# - protocol stability ('private', 'stable' or 'unstable')
|
||||||
# - protocol version (if stability is 'unstable')
|
# - protocol version (if stability is 'unstable')
|
||||||
wayland_protocols = [
|
wayland_protocols = [
|
||||||
['gtk-primary-selection', 'private', ],
|
|
||||||
['gtk-shell', 'private', ],
|
['gtk-shell', 'private', ],
|
||||||
['keyboard-shortcuts-inhibit', 'unstable', 'v1', ],
|
['keyboard-shortcuts-inhibit', 'unstable', 'v1', ],
|
||||||
['linux-dmabuf', 'unstable', 'v1', ],
|
['linux-dmabuf', 'unstable', 'v1', ],
|
||||||
|
@ -1,359 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2011 Kristian Høgsberg
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting documentation, and
|
|
||||||
* that the name of the copyright holders not be used in advertising or
|
|
||||||
* publicity pertaining to distribution of the software without specific,
|
|
||||||
* written prior permission. The copyright holders make no representations
|
|
||||||
* about the suitability of this software for any purpose. It is provided "as
|
|
||||||
* is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
||||||
* OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* The file is based on src/data-device.c from Weston */
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "wayland/meta-wayland-data-device-primary-legacy.h"
|
|
||||||
|
|
||||||
#include "compositor/meta-dnd-actor-private.h"
|
|
||||||
#include "meta/meta-selection-source-memory.h"
|
|
||||||
#include "wayland/meta-selection-source-wayland-private.h"
|
|
||||||
#include "wayland/meta-wayland-data-offer-primary-legacy.h"
|
|
||||||
#include "wayland/meta-wayland-data-source-primary-legacy.h"
|
|
||||||
#include "wayland/meta-wayland-dnd-surface.h"
|
|
||||||
#include "wayland/meta-wayland-pointer.h"
|
|
||||||
#include "wayland/meta-wayland-private.h"
|
|
||||||
#include "wayland/meta-wayland-seat.h"
|
|
||||||
|
|
||||||
#include "gtk-primary-selection-server-protocol.h"
|
|
||||||
|
|
||||||
static struct wl_resource * create_and_send_primary_offer (MetaWaylandDataDevicePrimaryLegacy *data_device,
|
|
||||||
struct wl_resource *target);
|
|
||||||
|
|
||||||
static void
|
|
||||||
move_resources (struct wl_list *destination,
|
|
||||||
struct wl_list *source)
|
|
||||||
{
|
|
||||||
wl_list_insert_list (destination, source);
|
|
||||||
wl_list_init (source);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
move_resources_for_client (struct wl_list *destination,
|
|
||||||
struct wl_list *source,
|
|
||||||
struct wl_client *client)
|
|
||||||
{
|
|
||||||
struct wl_resource *resource, *tmp;
|
|
||||||
wl_resource_for_each_safe (resource, tmp, source)
|
|
||||||
{
|
|
||||||
if (wl_resource_get_client (resource) == client)
|
|
||||||
{
|
|
||||||
wl_list_remove (wl_resource_get_link (resource));
|
|
||||||
wl_list_insert (destination, wl_resource_get_link (resource));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
unbind_resource (struct wl_resource *resource)
|
|
||||||
{
|
|
||||||
wl_list_remove (wl_resource_get_link (resource));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
default_destructor (struct wl_client *client,
|
|
||||||
struct wl_resource *resource)
|
|
||||||
{
|
|
||||||
wl_resource_destroy (resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_selection_source (MetaWaylandDataDevicePrimaryLegacy *data_device,
|
|
||||||
MetaSelectionSource *selection_source)
|
|
||||||
|
|
||||||
{
|
|
||||||
MetaDisplay *display = meta_get_display ();
|
|
||||||
|
|
||||||
meta_selection_set_owner (meta_display_get_selection (display),
|
|
||||||
META_SELECTION_PRIMARY,
|
|
||||||
selection_source);
|
|
||||||
g_set_object (&data_device->owner, selection_source);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
unset_selection_source (MetaWaylandDataDevicePrimaryLegacy *data_device)
|
|
||||||
{
|
|
||||||
MetaDisplay *display = meta_get_display ();
|
|
||||||
|
|
||||||
if (!data_device->owner)
|
|
||||||
return;
|
|
||||||
|
|
||||||
meta_selection_unset_owner (meta_display_get_selection (display),
|
|
||||||
META_SELECTION_PRIMARY,
|
|
||||||
data_device->owner);
|
|
||||||
g_clear_object (&data_device->owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
primary_source_destroyed (gpointer data,
|
|
||||||
GObject *object_was_here)
|
|
||||||
{
|
|
||||||
MetaWaylandDataDevicePrimaryLegacy *data_device = data;
|
|
||||||
|
|
||||||
data_device->data_source = NULL;
|
|
||||||
unset_selection_source (data_device);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_wayland_data_device_primary_legacy_set_selection (MetaWaylandDataDevicePrimaryLegacy *data_device,
|
|
||||||
MetaWaylandDataSource *source,
|
|
||||||
uint32_t serial)
|
|
||||||
{
|
|
||||||
MetaWaylandSeat *seat = wl_container_of (data_device, seat, primary_legacy_data_device);
|
|
||||||
MetaSelectionSource *selection_source;
|
|
||||||
|
|
||||||
g_assert (!source || META_IS_WAYLAND_DATA_SOURCE_PRIMARY_LEGACY (source));
|
|
||||||
|
|
||||||
if (data_device->data_source &&
|
|
||||||
data_device->serial - serial < UINT32_MAX / 2)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (data_device->data_source)
|
|
||||||
{
|
|
||||||
g_object_weak_unref (G_OBJECT (data_device->data_source),
|
|
||||||
primary_source_destroyed,
|
|
||||||
data_device);
|
|
||||||
}
|
|
||||||
|
|
||||||
data_device->data_source = source;
|
|
||||||
data_device->serial = serial;
|
|
||||||
|
|
||||||
if (source)
|
|
||||||
{
|
|
||||||
meta_wayland_data_source_set_seat (source, seat);
|
|
||||||
g_object_weak_ref (G_OBJECT (source),
|
|
||||||
primary_source_destroyed,
|
|
||||||
data_device);
|
|
||||||
|
|
||||||
selection_source = meta_selection_source_wayland_new (source);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
selection_source = g_object_new (META_TYPE_SELECTION_SOURCE_MEMORY, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
set_selection_source (data_device, selection_source);
|
|
||||||
g_object_unref (selection_source);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
primary_device_set_selection (struct wl_client *client,
|
|
||||||
struct wl_resource *resource,
|
|
||||||
struct wl_resource *source_resource,
|
|
||||||
uint32_t serial)
|
|
||||||
{
|
|
||||||
MetaWaylandDataDevicePrimaryLegacy *data_device = wl_resource_get_user_data (resource);
|
|
||||||
MetaWaylandSeat *seat = wl_container_of (data_device, seat, primary_legacy_data_device);
|
|
||||||
MetaWaylandDataSource *source = NULL;
|
|
||||||
|
|
||||||
if (source_resource)
|
|
||||||
source = wl_resource_get_user_data (source_resource);
|
|
||||||
|
|
||||||
if (wl_resource_get_client (resource) !=
|
|
||||||
meta_wayland_keyboard_get_focus_client (seat->keyboard))
|
|
||||||
{
|
|
||||||
if (source)
|
|
||||||
meta_wayland_data_source_cancel (source);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_wayland_data_device_primary_legacy_set_selection (data_device, source, serial);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct gtk_primary_selection_device_interface primary_device_interface = {
|
|
||||||
primary_device_set_selection,
|
|
||||||
default_destructor,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
owner_changed_cb (MetaSelection *selection,
|
|
||||||
MetaSelectionType selection_type,
|
|
||||||
MetaSelectionSource *new_owner,
|
|
||||||
MetaWaylandDataDevicePrimaryLegacy *data_device)
|
|
||||||
{
|
|
||||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
|
||||||
MetaWaylandSeat *seat = compositor->seat;
|
|
||||||
struct wl_resource *data_device_resource;
|
|
||||||
struct wl_client *focus_client;
|
|
||||||
|
|
||||||
focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
|
|
||||||
if (!focus_client)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (selection_type == META_SELECTION_PRIMARY)
|
|
||||||
{
|
|
||||||
wl_resource_for_each (data_device_resource, &data_device->focus_resource_list)
|
|
||||||
{
|
|
||||||
struct wl_resource *offer = NULL;
|
|
||||||
|
|
||||||
if (new_owner)
|
|
||||||
{
|
|
||||||
offer = create_and_send_primary_offer (data_device,
|
|
||||||
data_device_resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_primary_selection_device_send_selection (data_device_resource,
|
|
||||||
offer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ensure_owners_changed_handler_connected (MetaWaylandDataDevicePrimaryLegacy *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 ()),
|
|
||||||
"owner-changed",
|
|
||||||
G_CALLBACK (owner_changed_cb), data_device);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
primary_device_manager_create_source (struct wl_client *client,
|
|
||||||
struct wl_resource *manager_resource,
|
|
||||||
guint32 id)
|
|
||||||
{
|
|
||||||
struct wl_resource *source_resource;
|
|
||||||
|
|
||||||
source_resource =
|
|
||||||
wl_resource_create (client, >k_primary_selection_source_interface,
|
|
||||||
wl_resource_get_version (manager_resource),
|
|
||||||
id);
|
|
||||||
meta_wayland_data_source_primary_legacy_new (source_resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
primary_device_manager_get_device (struct wl_client *client,
|
|
||||||
struct wl_resource *manager_resource,
|
|
||||||
guint32 id,
|
|
||||||
struct wl_resource *seat_resource)
|
|
||||||
{
|
|
||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
|
||||||
struct wl_resource *cr;
|
|
||||||
|
|
||||||
cr = wl_resource_create (client, >k_primary_selection_device_interface,
|
|
||||||
wl_resource_get_version (manager_resource), id);
|
|
||||||
wl_resource_set_implementation (cr, &primary_device_interface,
|
|
||||||
&seat->primary_legacy_data_device, unbind_resource);
|
|
||||||
wl_list_insert (&seat->primary_legacy_data_device.resource_list,
|
|
||||||
wl_resource_get_link (cr));
|
|
||||||
|
|
||||||
ensure_owners_changed_handler_connected (&seat->primary_legacy_data_device);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct gtk_primary_selection_device_manager_interface primary_manager_interface = {
|
|
||||||
primary_device_manager_create_source,
|
|
||||||
primary_device_manager_get_device,
|
|
||||||
default_destructor,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
bind_primary_manager (struct wl_client *client,
|
|
||||||
void *data,
|
|
||||||
uint32_t version,
|
|
||||||
uint32_t id)
|
|
||||||
{
|
|
||||||
struct wl_resource *resource;
|
|
||||||
|
|
||||||
resource = wl_resource_create (client, >k_primary_selection_device_manager_interface,
|
|
||||||
version, id);
|
|
||||||
wl_resource_set_implementation (resource, &primary_manager_interface, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
meta_wayland_data_device_primary_legacy_manager_init (MetaWaylandCompositor *compositor)
|
|
||||||
{
|
|
||||||
if (wl_global_create (compositor->wayland_display,
|
|
||||||
>k_primary_selection_device_manager_interface,
|
|
||||||
META_GTK_PRIMARY_SELECTION_VERSION,
|
|
||||||
NULL, bind_primary_manager) == NULL)
|
|
||||||
g_error ("Could not create data_device");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
meta_wayland_data_device_primary_legacy_init (MetaWaylandDataDevicePrimaryLegacy *data_device)
|
|
||||||
{
|
|
||||||
wl_list_init (&data_device->resource_list);
|
|
||||||
wl_list_init (&data_device->focus_resource_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct wl_resource *
|
|
||||||
create_and_send_primary_offer (MetaWaylandDataDevicePrimaryLegacy *data_device,
|
|
||||||
struct wl_resource *target)
|
|
||||||
{
|
|
||||||
MetaWaylandDataOffer *offer;
|
|
||||||
MetaDisplay *display = meta_get_display ();
|
|
||||||
struct wl_resource *resource;
|
|
||||||
GList *mimetypes, *l;
|
|
||||||
|
|
||||||
mimetypes = meta_selection_get_mimetypes (meta_display_get_selection (display),
|
|
||||||
META_SELECTION_PRIMARY);
|
|
||||||
if (!mimetypes)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
offer = meta_wayland_data_offer_primary_legacy_new (target);
|
|
||||||
resource = meta_wayland_data_offer_get_resource (offer);
|
|
||||||
|
|
||||||
gtk_primary_selection_device_send_data_offer (target, resource);
|
|
||||||
|
|
||||||
for (l = mimetypes; l; l = l->next)
|
|
||||||
gtk_primary_selection_offer_send_offer (resource, l->data);
|
|
||||||
|
|
||||||
g_list_free_full (mimetypes, g_free);
|
|
||||||
|
|
||||||
return resource;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
meta_wayland_data_device_primary_legacy_set_keyboard_focus (MetaWaylandDataDevicePrimaryLegacy *data_device)
|
|
||||||
{
|
|
||||||
MetaWaylandSeat *seat = wl_container_of (data_device, seat, primary_legacy_data_device);
|
|
||||||
struct wl_client *focus_client;
|
|
||||||
struct wl_resource *data_device_resource;
|
|
||||||
|
|
||||||
focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
|
|
||||||
|
|
||||||
if (focus_client == data_device->focus_client)
|
|
||||||
return;
|
|
||||||
|
|
||||||
data_device->focus_client = focus_client;
|
|
||||||
move_resources (&data_device->resource_list,
|
|
||||||
&data_device->focus_resource_list);
|
|
||||||
|
|
||||||
if (!focus_client)
|
|
||||||
return;
|
|
||||||
|
|
||||||
move_resources_for_client (&data_device->focus_resource_list,
|
|
||||||
&data_device->resource_list,
|
|
||||||
focus_client);
|
|
||||||
|
|
||||||
wl_resource_for_each (data_device_resource, &data_device->focus_resource_list)
|
|
||||||
{
|
|
||||||
struct wl_resource *offer;
|
|
||||||
offer = create_and_send_primary_offer (data_device, data_device_resource);
|
|
||||||
gtk_primary_selection_device_send_selection (data_device_resource, offer);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2008 Kristian Høgsberg
|
|
||||||
* 2020 Red Hat Inc.
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting documentation, and
|
|
||||||
* that the name of the copyright holders not be used in advertising or
|
|
||||||
* publicity pertaining to distribution of the software without specific,
|
|
||||||
* written prior permission. The copyright holders make no representations
|
|
||||||
* about the suitability of this software for any purpose. It is provided "as
|
|
||||||
* is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
||||||
* OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef META_WAYLAND_DATA_DEVICE_PRIMARY_LEGACY_H
|
|
||||||
#define META_WAYLAND_DATA_DEVICE_PRIMARY_LEGACY_H
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <wayland-server.h>
|
|
||||||
|
|
||||||
#include "clutter/clutter.h"
|
|
||||||
#include "meta/meta-selection-source.h"
|
|
||||||
#include "wayland/meta-wayland-data-offer.h"
|
|
||||||
#include "wayland/meta-wayland-data-source.h"
|
|
||||||
#include "wayland/meta-wayland-types.h"
|
|
||||||
|
|
||||||
struct _MetaWaylandDataDevicePrimaryLegacy
|
|
||||||
{
|
|
||||||
uint32_t serial;
|
|
||||||
MetaWaylandDataSource *data_source;
|
|
||||||
struct wl_list resource_list;
|
|
||||||
struct wl_list focus_resource_list;
|
|
||||||
struct wl_client *focus_client;
|
|
||||||
|
|
||||||
guint selection_owner_signal_id;
|
|
||||||
|
|
||||||
MetaSelectionSource *owner;
|
|
||||||
};
|
|
||||||
|
|
||||||
void meta_wayland_data_device_primary_legacy_manager_init (MetaWaylandCompositor *compositor);
|
|
||||||
|
|
||||||
void meta_wayland_data_device_primary_legacy_init (MetaWaylandDataDevicePrimaryLegacy *data_device);
|
|
||||||
|
|
||||||
void meta_wayland_data_device_primary_legacy_set_keyboard_focus (MetaWaylandDataDevicePrimaryLegacy *data_device);
|
|
||||||
|
|
||||||
#endif /* META_WAYLAND_DATA_DEVICE_PRIMARY_LEGACY_H */
|
|
@ -1,139 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2011 Kristian Høgsberg
|
|
||||||
* 2020 Red Hat Inc.
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting documentation, and
|
|
||||||
* that the name of the copyright holders not be used in advertising or
|
|
||||||
* publicity pertaining to distribution of the software without specific,
|
|
||||||
* written prior permission. The copyright holders make no representations
|
|
||||||
* about the suitability of this software for any purpose. It is provided "as
|
|
||||||
* is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
||||||
* OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "meta-wayland-data-offer-primary-legacy.h"
|
|
||||||
|
|
||||||
#include <gio/gunixoutputstream.h>
|
|
||||||
#include <glib-unix.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "core/display-private.h"
|
|
||||||
#include "gtk-primary-selection-server-protocol.h"
|
|
||||||
#include "wayland/meta-wayland-data-offer.h"
|
|
||||||
|
|
||||||
static void
|
|
||||||
transfer_cb (MetaSelection *selection,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GOutputStream *stream)
|
|
||||||
{
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
if (!meta_selection_transfer_finish (selection, res, &error))
|
|
||||||
{
|
|
||||||
g_warning ("Could not fetch selection data: %s", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_output_stream_close (stream, NULL, NULL);
|
|
||||||
g_object_unref (stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
primary_offer_receive (struct wl_client *client,
|
|
||||||
struct wl_resource *resource,
|
|
||||||
const char *mime_type,
|
|
||||||
int32_t fd)
|
|
||||||
{
|
|
||||||
MetaDisplay *display = meta_get_display ();
|
|
||||||
GOutputStream *stream;
|
|
||||||
GList *mime_types;
|
|
||||||
gboolean found;
|
|
||||||
|
|
||||||
mime_types = meta_selection_get_mimetypes (meta_display_get_selection (display),
|
|
||||||
META_SELECTION_PRIMARY);
|
|
||||||
found = g_list_find_custom (mime_types, mime_type, (GCompareFunc) g_strcmp0) != NULL;
|
|
||||||
g_list_free_full (mime_types, g_free);
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
close (fd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
stream = g_unix_output_stream_new (fd, TRUE);
|
|
||||||
meta_selection_transfer_async (meta_display_get_selection (display),
|
|
||||||
META_SELECTION_PRIMARY,
|
|
||||||
mime_type,
|
|
||||||
-1,
|
|
||||||
stream,
|
|
||||||
NULL,
|
|
||||||
(GAsyncReadyCallback) transfer_cb,
|
|
||||||
stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
primary_offer_destroy (struct wl_client *client,
|
|
||||||
struct wl_resource *resource)
|
|
||||||
{
|
|
||||||
wl_resource_destroy (resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct gtk_primary_selection_offer_interface primary_offer_interface = {
|
|
||||||
primary_offer_receive,
|
|
||||||
primary_offer_destroy,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
destroy_primary_offer (struct wl_resource *resource)
|
|
||||||
{
|
|
||||||
MetaWaylandDataOffer *offer = wl_resource_get_user_data (resource);
|
|
||||||
|
|
||||||
if (offer->source)
|
|
||||||
{
|
|
||||||
if (offer == meta_wayland_data_source_get_current_offer (offer->source))
|
|
||||||
{
|
|
||||||
meta_wayland_data_source_cancel (offer->source);
|
|
||||||
meta_wayland_data_source_set_current_offer (offer->source, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (offer->source),
|
|
||||||
(gpointer *)&offer->source);
|
|
||||||
offer->source = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_display_sync_wayland_input_focus (meta_get_display ());
|
|
||||||
g_free (offer);
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaWaylandDataOffer *
|
|
||||||
meta_wayland_data_offer_primary_legacy_new (struct wl_resource *target)
|
|
||||||
{
|
|
||||||
MetaWaylandDataOffer *offer;
|
|
||||||
|
|
||||||
offer = g_new0 (MetaWaylandDataOffer, 1);
|
|
||||||
offer->selection_type = META_SELECTION_PRIMARY;
|
|
||||||
offer->resource = wl_resource_create (wl_resource_get_client (target),
|
|
||||||
>k_primary_selection_offer_interface,
|
|
||||||
wl_resource_get_version (target), 0);
|
|
||||||
wl_resource_set_implementation (offer->resource,
|
|
||||||
&primary_offer_interface,
|
|
||||||
offer,
|
|
||||||
destroy_primary_offer);
|
|
||||||
return offer;
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2011 Kristian Høgsberg
|
|
||||||
* 2020 Red Hat Inc.
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting documentation, and
|
|
||||||
* that the name of the copyright holders not be used in advertising or
|
|
||||||
* publicity pertaining to distribution of the software without specific,
|
|
||||||
* written prior permission. The copyright holders make no representations
|
|
||||||
* about the suitability of this software for any purpose. It is provided "as
|
|
||||||
* is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
||||||
* OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef META_WAYLAND_DATA_OFFER_PRIMARY_LEGACY_H
|
|
||||||
#define META_WAYLAND_DATA_OFFER_PRIMARY_LEGACY_H
|
|
||||||
|
|
||||||
#include "meta-wayland-data-offer.h"
|
|
||||||
|
|
||||||
MetaWaylandDataOffer * meta_wayland_data_offer_primary_legacy_new (struct wl_resource *target);
|
|
||||||
|
|
||||||
#endif /* META_WAYLAND_DATA_OFFER_PRIMARY_LEGACY_H */
|
|
@ -1,117 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2011 Kristian Høgsberg
|
|
||||||
* 2020 Red Hat Inc.
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting documentation, and
|
|
||||||
* that the name of the copyright holders not be used in advertising or
|
|
||||||
* publicity pertaining to distribution of the software without specific,
|
|
||||||
* written prior permission. The copyright holders make no representations
|
|
||||||
* about the suitability of this software for any purpose. It is provided "as
|
|
||||||
* is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
||||||
* OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "gtk-primary-selection-server-protocol.h"
|
|
||||||
#include "wayland/meta-wayland-data-source-primary-legacy.h"
|
|
||||||
|
|
||||||
typedef struct _MetaWaylandDataSourcePrimaryLegacy
|
|
||||||
{
|
|
||||||
MetaWaylandDataSource parent;
|
|
||||||
} MetaWaylandDataSourcePrimaryLegacy;
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaWaylandDataSourcePrimaryLegacy, meta_wayland_data_source_primary_legacy,
|
|
||||||
META_TYPE_WAYLAND_DATA_SOURCE);
|
|
||||||
|
|
||||||
static void
|
|
||||||
primary_source_offer (struct wl_client *client,
|
|
||||||
struct wl_resource *resource,
|
|
||||||
const char *type)
|
|
||||||
{
|
|
||||||
MetaWaylandDataSource *source = wl_resource_get_user_data (resource);
|
|
||||||
|
|
||||||
if (!meta_wayland_data_source_add_mime_type (source, type))
|
|
||||||
wl_resource_post_no_memory (resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
primary_source_destroy (struct wl_client *client,
|
|
||||||
struct wl_resource *resource)
|
|
||||||
{
|
|
||||||
wl_resource_destroy (resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct gtk_primary_selection_source_interface primary_source_interface = {
|
|
||||||
primary_source_offer,
|
|
||||||
primary_source_destroy,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
destroy_primary_source (struct wl_resource *resource)
|
|
||||||
{
|
|
||||||
MetaWaylandDataSource *source = wl_resource_get_user_data (resource);
|
|
||||||
|
|
||||||
meta_wayland_data_source_set_resource (source, NULL);
|
|
||||||
g_object_unref (source);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_wayland_data_source_primary_legacy_send (MetaWaylandDataSource *source,
|
|
||||||
const gchar *mime_type,
|
|
||||||
gint fd)
|
|
||||||
{
|
|
||||||
struct wl_resource *resource = meta_wayland_data_source_get_resource (source);
|
|
||||||
|
|
||||||
gtk_primary_selection_source_send_send (resource, mime_type, fd);
|
|
||||||
close (fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_wayland_data_source_primary_legacy_cancel (MetaWaylandDataSource *source)
|
|
||||||
{
|
|
||||||
struct wl_resource *resource = meta_wayland_data_source_get_resource (source);
|
|
||||||
|
|
||||||
if (resource)
|
|
||||||
gtk_primary_selection_source_send_cancelled (resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_wayland_data_source_primary_legacy_init (MetaWaylandDataSourcePrimaryLegacy *source_primary)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_wayland_data_source_primary_legacy_class_init (MetaWaylandDataSourcePrimaryLegacyClass *klass)
|
|
||||||
{
|
|
||||||
MetaWaylandDataSourceClass *data_source_class =
|
|
||||||
META_WAYLAND_DATA_SOURCE_CLASS (klass);
|
|
||||||
|
|
||||||
data_source_class->send = meta_wayland_data_source_primary_legacy_send;
|
|
||||||
data_source_class->cancel = meta_wayland_data_source_primary_legacy_cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaWaylandDataSource *
|
|
||||||
meta_wayland_data_source_primary_legacy_new (struct wl_resource *resource)
|
|
||||||
{
|
|
||||||
MetaWaylandDataSource *source_primary =
|
|
||||||
g_object_new (META_TYPE_WAYLAND_DATA_SOURCE_PRIMARY_LEGACY, NULL);
|
|
||||||
|
|
||||||
meta_wayland_data_source_set_resource (source_primary, resource);
|
|
||||||
wl_resource_set_implementation (resource, &primary_source_interface,
|
|
||||||
source_primary, destroy_primary_source);
|
|
||||||
|
|
||||||
return source_primary;
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2011 Kristian Høgsberg
|
|
||||||
* 2020 Red Hat Inc.
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting documentation, and
|
|
||||||
* that the name of the copyright holders not be used in advertising or
|
|
||||||
* publicity pertaining to distribution of the software without specific,
|
|
||||||
* written prior permission. The copyright holders make no representations
|
|
||||||
* about the suitability of this software for any purpose. It is provided "as
|
|
||||||
* is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
||||||
* OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef META_WAYLAND_DATA_SOURCE_PRIMARY_LEGACY_H
|
|
||||||
#define META_WAYLAND_DATA_SOURCE_PRIMARY_LEGACY_H
|
|
||||||
|
|
||||||
#include "meta-wayland-data-source.h"
|
|
||||||
|
|
||||||
#define META_TYPE_WAYLAND_DATA_SOURCE_PRIMARY_LEGACY (meta_wayland_data_source_primary_legacy_get_type ())
|
|
||||||
G_DECLARE_FINAL_TYPE (MetaWaylandDataSourcePrimaryLegacy,
|
|
||||||
meta_wayland_data_source_primary_legacy,
|
|
||||||
META, WAYLAND_DATA_SOURCE_PRIMARY_LEGACY,
|
|
||||||
MetaWaylandDataSource);
|
|
||||||
|
|
||||||
MetaWaylandDataSource * meta_wayland_data_source_primary_legacy_new (struct wl_resource *resource);
|
|
||||||
|
|
||||||
#endif /* META_WAYLAND_DATA_SOURCE_PRIMARY_LEGACY_H */
|
|
@ -24,7 +24,6 @@
|
|||||||
#include "wayland/meta-wayland-seat.h"
|
#include "wayland/meta-wayland-seat.h"
|
||||||
|
|
||||||
#include "wayland/meta-wayland-data-device.h"
|
#include "wayland/meta-wayland-data-device.h"
|
||||||
#include "wayland/meta-wayland-data-device-primary-legacy.h"
|
|
||||||
#include "wayland/meta-wayland-private.h"
|
#include "wayland/meta-wayland-private.h"
|
||||||
#include "wayland/meta-wayland-tablet-seat.h"
|
#include "wayland/meta-wayland-tablet-seat.h"
|
||||||
#include "wayland/meta-wayland-versions.h"
|
#include "wayland/meta-wayland-versions.h"
|
||||||
@ -225,7 +224,6 @@ meta_wayland_seat_new (MetaWaylandCompositor *compositor,
|
|||||||
|
|
||||||
meta_wayland_data_device_init (&seat->data_device);
|
meta_wayland_data_device_init (&seat->data_device);
|
||||||
meta_wayland_data_device_primary_init (&seat->primary_data_device);
|
meta_wayland_data_device_primary_init (&seat->primary_data_device);
|
||||||
meta_wayland_data_device_primary_legacy_init (&seat->primary_legacy_data_device);
|
|
||||||
|
|
||||||
clutter_seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
clutter_seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||||
meta_wayland_seat_update_capabilities (seat, clutter_seat);
|
meta_wayland_seat_update_capabilities (seat, clutter_seat);
|
||||||
@ -423,7 +421,6 @@ meta_wayland_seat_set_input_focus (MetaWaylandSeat *seat,
|
|||||||
meta_wayland_keyboard_set_focus (seat->keyboard, surface);
|
meta_wayland_keyboard_set_focus (seat->keyboard, surface);
|
||||||
meta_wayland_data_device_set_keyboard_focus (&seat->data_device);
|
meta_wayland_data_device_set_keyboard_focus (&seat->data_device);
|
||||||
meta_wayland_data_device_primary_set_keyboard_focus (&seat->primary_data_device);
|
meta_wayland_data_device_primary_set_keyboard_focus (&seat->primary_data_device);
|
||||||
meta_wayland_data_device_primary_legacy_set_keyboard_focus (&seat->primary_legacy_data_device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tablet_seat = meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager, seat);
|
tablet_seat = meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager, seat);
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
#include "wayland/meta-wayland-data-device.h"
|
#include "wayland/meta-wayland-data-device.h"
|
||||||
#include "wayland/meta-wayland-data-device-primary.h"
|
#include "wayland/meta-wayland-data-device-primary.h"
|
||||||
#include "wayland/meta-wayland-data-device-primary-legacy.h"
|
|
||||||
#include "wayland/meta-wayland-input-device.h"
|
#include "wayland/meta-wayland-input-device.h"
|
||||||
#include "wayland/meta-wayland-keyboard.h"
|
#include "wayland/meta-wayland-keyboard.h"
|
||||||
#include "wayland/meta-wayland-pointer.h"
|
#include "wayland/meta-wayland-pointer.h"
|
||||||
@ -47,7 +46,6 @@ struct _MetaWaylandSeat
|
|||||||
|
|
||||||
MetaWaylandDataDevice data_device;
|
MetaWaylandDataDevice data_device;
|
||||||
MetaWaylandDataDevicePrimary primary_data_device;
|
MetaWaylandDataDevicePrimary primary_data_device;
|
||||||
MetaWaylandDataDevicePrimaryLegacy primary_legacy_data_device;
|
|
||||||
|
|
||||||
MetaWaylandTextInput *text_input;
|
MetaWaylandTextInput *text_input;
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ typedef struct _MetaWaylandDragDestFuncs MetaWaylandDragDestFuncs;
|
|||||||
typedef struct _MetaWaylandDataOffer MetaWaylandDataOffer;
|
typedef struct _MetaWaylandDataOffer MetaWaylandDataOffer;
|
||||||
typedef struct _MetaWaylandDataDevice MetaWaylandDataDevice;
|
typedef struct _MetaWaylandDataDevice MetaWaylandDataDevice;
|
||||||
typedef struct _MetaWaylandDataDevicePrimary MetaWaylandDataDevicePrimary;
|
typedef struct _MetaWaylandDataDevicePrimary MetaWaylandDataDevicePrimary;
|
||||||
typedef struct _MetaWaylandDataDevicePrimaryLegacy MetaWaylandDataDevicePrimaryLegacy;
|
|
||||||
|
|
||||||
typedef struct _MetaWaylandTabletManager MetaWaylandTabletManager;
|
typedef struct _MetaWaylandTabletManager MetaWaylandTabletManager;
|
||||||
typedef struct _MetaWaylandTabletSeat MetaWaylandTabletSeat;
|
typedef struct _MetaWaylandTabletSeat MetaWaylandTabletSeat;
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
#define META_ZWP_XWAYLAND_KEYBOARD_GRAB_V1_VERSION 1
|
#define META_ZWP_XWAYLAND_KEYBOARD_GRAB_V1_VERSION 1
|
||||||
#define META_ZWP_TEXT_INPUT_V3_VERSION 1
|
#define META_ZWP_TEXT_INPUT_V3_VERSION 1
|
||||||
#define META_WP_VIEWPORTER_VERSION 1
|
#define META_WP_VIEWPORTER_VERSION 1
|
||||||
#define META_GTK_PRIMARY_SELECTION_VERSION 1
|
|
||||||
#define META_ZWP_PRIMARY_SELECTION_V1_VERSION 1
|
#define META_ZWP_PRIMARY_SELECTION_V1_VERSION 1
|
||||||
#define META_WP_PRESENTATION_VERSION 1
|
#define META_WP_PRESENTATION_VERSION 1
|
||||||
#define META_XDG_ACTIVATION_V1_VERSION 1
|
#define META_XDG_ACTIVATION_V1_VERSION 1
|
||||||
|
@ -606,7 +606,6 @@ meta_wayland_compositor_new (MetaContext *context)
|
|||||||
meta_wayland_outputs_init (compositor);
|
meta_wayland_outputs_init (compositor);
|
||||||
meta_wayland_data_device_manager_init (compositor);
|
meta_wayland_data_device_manager_init (compositor);
|
||||||
meta_wayland_data_device_primary_manager_init (compositor);
|
meta_wayland_data_device_primary_manager_init (compositor);
|
||||||
meta_wayland_data_device_primary_legacy_manager_init (compositor);
|
|
||||||
meta_wayland_subsurfaces_init (compositor);
|
meta_wayland_subsurfaces_init (compositor);
|
||||||
meta_wayland_shell_init (compositor);
|
meta_wayland_shell_init (compositor);
|
||||||
meta_wayland_pointer_gestures_init (compositor);
|
meta_wayland_pointer_gestures_init (compositor);
|
||||||
|
@ -1,225 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<protocol name="gtk_primary_selection">
|
|
||||||
<copyright>
|
|
||||||
Copyright © 2015, 2016 Red Hat
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
copy of this software and associated documentation files (the "Software"),
|
|
||||||
to deal in the Software without restriction, including without limitation
|
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice (including the next
|
|
||||||
paragraph) shall be included in all copies or substantial portions of the
|
|
||||||
Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
</copyright>
|
|
||||||
|
|
||||||
<description summary="Primary selection protocol">
|
|
||||||
This protocol provides the ability to have a primary selection device to
|
|
||||||
match that of the X server. This primary selection is a shortcut to the
|
|
||||||
common clipboard selection, where text just needs to be selected in order
|
|
||||||
to allow copying it elsewhere. The de facto way to perform this action
|
|
||||||
is the middle mouse button, although it is not limited to this one.
|
|
||||||
|
|
||||||
Clients wishing to honor primary selection should create a primary
|
|
||||||
selection source and set it as the selection through
|
|
||||||
wp_primary_selection_device.set_selection whenever the text selection
|
|
||||||
changes. In order to minimize calls in pointer-driven text selection,
|
|
||||||
it should happen only once after the operation finished. Similarly,
|
|
||||||
a NULL source should be set when text is unselected.
|
|
||||||
|
|
||||||
wp_primary_selection_offer objects are first announced through the
|
|
||||||
wp_primary_selection_device.data_offer event. Immediately after this event,
|
|
||||||
the primary data offer will emit wp_primary_selection_offer.offer events
|
|
||||||
to let know of the mime types being offered.
|
|
||||||
|
|
||||||
When the primary selection changes, the client with the keyboard focus
|
|
||||||
will receive wp_primary_selection_device.selection events. Only the client
|
|
||||||
with the keyboard focus will receive such events with a non-NULL
|
|
||||||
wp_primary_selection_offer. Across keyboard focus changes, previously
|
|
||||||
focused clients will receive wp_primary_selection_device.events with a
|
|
||||||
NULL wp_primary_selection_offer.
|
|
||||||
|
|
||||||
In order to request the primary selection data, the client must pass
|
|
||||||
a recent serial pertaining to the press event that is triggering the
|
|
||||||
operation, if the compositor deems the serial valid and recent, the
|
|
||||||
wp_primary_selection_source.send event will happen in the other end
|
|
||||||
to let the transfer begin. The client owning the primary selection
|
|
||||||
should write the requested data, and close the file descriptor
|
|
||||||
immediately.
|
|
||||||
|
|
||||||
If the primary selection owner client disappeared during the transfer,
|
|
||||||
the client reading the data will receive a
|
|
||||||
wp_primary_selection_device.selection event with a NULL
|
|
||||||
wp_primary_selection_offer, the client should take this as a hint
|
|
||||||
to finish the reads related to the no longer existing offer.
|
|
||||||
|
|
||||||
The primary selection owner should be checking for errors during
|
|
||||||
writes, merely cancelling the ongoing transfer if any happened.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<interface name="gtk_primary_selection_device_manager" version="1">
|
|
||||||
<description summary="X primary selection emulation">
|
|
||||||
The primary selection device manager is a singleton global object that
|
|
||||||
provides access to the primary selection. It allows to create
|
|
||||||
wp_primary_selection_source objects, as well as retrieving the per-seat
|
|
||||||
wp_primary_selection_device objects.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<request name="create_source">
|
|
||||||
<description summary="create a new primary selection source">
|
|
||||||
Create a new primary selection source.
|
|
||||||
</description>
|
|
||||||
<arg name="id" type="new_id" interface="gtk_primary_selection_source"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="get_device">
|
|
||||||
<description summary="create a new primary selection device">
|
|
||||||
Create a new data device for a given seat.
|
|
||||||
</description>
|
|
||||||
<arg name="id" type="new_id" interface="gtk_primary_selection_device"/>
|
|
||||||
<arg name="seat" type="object" interface="wl_seat"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="destroy" type="destructor">
|
|
||||||
<description summary="destroy the primary selection device manager">
|
|
||||||
Destroy the primary selection device manager.
|
|
||||||
</description>
|
|
||||||
</request>
|
|
||||||
</interface>
|
|
||||||
|
|
||||||
<interface name="gtk_primary_selection_device" version="1">
|
|
||||||
<request name="set_selection">
|
|
||||||
<description summary="set the primary selection">
|
|
||||||
Replaces the current selection. The previous owner of the primary selection
|
|
||||||
will receive a wp_primary_selection_source.cancelled event.
|
|
||||||
|
|
||||||
To unset the selection, set the source to NULL.
|
|
||||||
</description>
|
|
||||||
<arg name="source" type="object" interface="gtk_primary_selection_source" allow-null="true"/>
|
|
||||||
<arg name="serial" type="uint" summary="serial of the event that triggered this request"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<event name="data_offer">
|
|
||||||
<description summary="introduce a new wp_primary_selection_offer">
|
|
||||||
Introduces a new wp_primary_selection_offer object that may be used
|
|
||||||
to receive the current primary selection. Immediately following this
|
|
||||||
event, the new wp_primary_selection_offer object will send
|
|
||||||
wp_primary_selection_offer.offer events to describe the offered mime
|
|
||||||
types.
|
|
||||||
</description>
|
|
||||||
<arg name="offer" type="new_id" interface="gtk_primary_selection_offer"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="selection">
|
|
||||||
<description summary="advertise a new primary selection">
|
|
||||||
The wp_primary_selection_device.selection event is sent to notify the
|
|
||||||
client of a new primary selection. This event is sent after the
|
|
||||||
wp_primary_selection.data_offer event introducing this object, and after
|
|
||||||
the offer has announced its mimetypes through
|
|
||||||
wp_primary_selection_offer.offer.
|
|
||||||
|
|
||||||
The data_offer is valid until a new offer or NULL is received
|
|
||||||
or until the client loses keyboard focus. The client must destroy the
|
|
||||||
previous selection data_offer, if any, upon receiving this event.
|
|
||||||
</description>
|
|
||||||
<arg name="id" type="object" interface="gtk_primary_selection_offer" allow-null="true"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<request name="destroy" type="destructor">
|
|
||||||
<description summary="destroy the primary selection device">
|
|
||||||
Destroy the primary selection device.
|
|
||||||
</description>
|
|
||||||
</request>
|
|
||||||
</interface>
|
|
||||||
|
|
||||||
<interface name="gtk_primary_selection_offer" version="1">
|
|
||||||
<description summary="offer to transfer primary selection contents">
|
|
||||||
A wp_primary_selection_offer represents an offer to transfer the contents
|
|
||||||
of the primary selection clipboard to the client. Similar to
|
|
||||||
wl_data_offer, the offer also describes the mime types that the source
|
|
||||||
will transferthat the
|
|
||||||
data can be converted to and provides the mechanisms for transferring the
|
|
||||||
data directly to the client.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<request name="receive">
|
|
||||||
<description summary="request that the data is transferred">
|
|
||||||
To transfer the contents of the primary selection clipboard, the client
|
|
||||||
issues this request and indicates the mime type that it wants to
|
|
||||||
receive. The transfer happens through the passed file descriptor
|
|
||||||
(typically created with the pipe system call). The source client writes
|
|
||||||
the data in the mime type representation requested and then closes the
|
|
||||||
file descriptor.
|
|
||||||
|
|
||||||
The receiving client reads from the read end of the pipe until EOF and
|
|
||||||
closes its end, at which point the transfer is complete.
|
|
||||||
</description>
|
|
||||||
<arg name="mime_type" type="string"/>
|
|
||||||
<arg name="fd" type="fd"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="destroy" type="destructor">
|
|
||||||
<description summary="destroy the primary selection offer">
|
|
||||||
Destroy the primary selection offer.
|
|
||||||
</description>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<event name="offer">
|
|
||||||
<description summary="advertise offered mime type">
|
|
||||||
Sent immediately after creating announcing the wp_primary_selection_offer
|
|
||||||
through wp_primary_selection_device.data_offer. One event is sent per
|
|
||||||
offered mime type.
|
|
||||||
</description>
|
|
||||||
<arg name="mime_type" type="string"/>
|
|
||||||
</event>
|
|
||||||
</interface>
|
|
||||||
|
|
||||||
<interface name="gtk_primary_selection_source" version="1">
|
|
||||||
<description summary="offer to replace the contents of the primary selection">
|
|
||||||
The source side of a wp_primary_selection_offer, it provides a way to
|
|
||||||
describe the offered data and respond to requests to transfer the
|
|
||||||
requested contents of the primary selection clipboard.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<request name="offer">
|
|
||||||
<description summary="add an offered mime type">
|
|
||||||
This request adds a mime type to the set of mime types advertised to
|
|
||||||
targets. Can be called several times to offer multiple types.
|
|
||||||
</description>
|
|
||||||
<arg name="mime_type" type="string"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="destroy" type="destructor">
|
|
||||||
<description summary="destroy the primary selection source">
|
|
||||||
Destroy the primary selection source.
|
|
||||||
</description>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<event name="send">
|
|
||||||
<description summary="send the primary selection contents">
|
|
||||||
Request for the current primary selection contents from the client.
|
|
||||||
Send the specified mime type over the passed file descriptor, then
|
|
||||||
close it.
|
|
||||||
</description>
|
|
||||||
<arg name="mime_type" type="string"/>
|
|
||||||
<arg name="fd" type="fd"/>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="cancelled">
|
|
||||||
<description summary="request for primary selection contents was canceled">
|
|
||||||
This primary selection source is no longer valid. The client should
|
|
||||||
clean up and destroy this primary selection source.
|
|
||||||
</description>
|
|
||||||
</event>
|
|
||||||
</interface>
|
|
||||||
</protocol>
|
|
Loading…
Reference in New Issue
Block a user