2015-11-26 18:47:38 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 2015 Red Hat
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Author: Carlos Garnacho <carlosg@gnome.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include "gdkdisplay.h"
|
|
|
|
#include "gdkdevice.h"
|
2020-07-28 14:51:41 +00:00
|
|
|
#include "gdkdevicetoolprivate.h"
|
2015-11-26 18:47:38 +00:00
|
|
|
#include "gdkseatprivate.h"
|
|
|
|
#include "gdkdeviceprivate.h"
|
|
|
|
#include "gdkintl.h"
|
|
|
|
|
2017-12-26 19:39:24 +00:00
|
|
|
/**
|
|
|
|
* GdkSeat:
|
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* The `GdkSeat` object represents a collection of input devices
|
|
|
|
* that belong to a user.
|
2017-12-26 19:39:24 +00:00
|
|
|
*/
|
|
|
|
|
2015-11-26 18:47:38 +00:00
|
|
|
typedef struct _GdkSeatPrivate GdkSeatPrivate;
|
|
|
|
|
|
|
|
struct _GdkSeatPrivate
|
|
|
|
{
|
|
|
|
GdkDisplay *display;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
DEVICE_ADDED,
|
|
|
|
DEVICE_REMOVED,
|
2016-01-29 12:06:02 +00:00
|
|
|
TOOL_ADDED,
|
|
|
|
TOOL_REMOVED,
|
2015-11-26 18:47:38 +00:00
|
|
|
N_SIGNALS
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PROP_0,
|
|
|
|
PROP_DISPLAY,
|
|
|
|
N_PROPS
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint signals[N_SIGNALS] = { 0 };
|
|
|
|
static GParamSpec *props[N_PROPS] = { NULL };
|
|
|
|
|
|
|
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkSeat, gdk_seat, G_TYPE_OBJECT)
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_seat_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GdkSeatPrivate *priv = gdk_seat_get_instance_private (GDK_SEAT (object));
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_DISPLAY:
|
|
|
|
priv->display = g_value_get_object (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_seat_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GdkSeatPrivate *priv = gdk_seat_get_instance_private (GDK_SEAT (object));
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_DISPLAY:
|
|
|
|
g_value_set_object (value, priv->display);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_seat_class_init (GdkSeatClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->set_property = gdk_seat_set_property;
|
|
|
|
object_class->get_property = gdk_seat_get_property;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GdkSeat::device-added:
|
|
|
|
* @seat: the object on which the signal is emitted
|
2021-02-21 05:13:57 +00:00
|
|
|
* @device: the newly added `GdkDevice`.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Emitted when a new input device is related to this seat.
|
2015-11-26 18:47:38 +00:00
|
|
|
*/
|
|
|
|
signals [DEVICE_ADDED] =
|
2015-12-25 13:23:20 +00:00
|
|
|
g_signal_new (g_intern_static_string ("device-added"),
|
2015-11-26 18:47:38 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GdkSeatClass, device_added),
|
|
|
|
NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
NULL,
|
2015-11-26 18:47:38 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GDK_TYPE_DEVICE);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GdkSeat::device-removed:
|
|
|
|
* @seat: the object on which the signal is emitted
|
2021-02-21 05:13:57 +00:00
|
|
|
* @device: the just removed `GdkDevice`.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Emitted when an input device is removed (e.g. unplugged).
|
2015-11-26 18:47:38 +00:00
|
|
|
*/
|
|
|
|
signals [DEVICE_REMOVED] =
|
2015-12-25 13:23:20 +00:00
|
|
|
g_signal_new (g_intern_static_string ("device-removed"),
|
2015-11-26 18:47:38 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GdkSeatClass, device_removed),
|
|
|
|
NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
NULL,
|
2015-11-26 18:47:38 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GDK_TYPE_DEVICE);
|
|
|
|
|
2016-01-29 12:06:02 +00:00
|
|
|
/**
|
|
|
|
* GdkSeat::tool-added:
|
|
|
|
* @seat: the object on which the signal is emitted
|
2021-02-21 05:13:57 +00:00
|
|
|
* @tool: the new `GdkDeviceTool` known to the seat
|
2016-01-29 12:06:02 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Emitted whenever a new tool is made known to the seat.
|
|
|
|
*
|
|
|
|
* The tool may later be assigned to a device (i.e. on
|
|
|
|
* proximity with a tablet). The device will emit the
|
2021-05-27 00:18:23 +00:00
|
|
|
* [signal@Gdk.Device::tool-changed] signal accordingly.
|
2016-01-29 12:06:02 +00:00
|
|
|
*
|
|
|
|
* A same tool may be used by several devices.
|
|
|
|
*/
|
|
|
|
signals [TOOL_ADDED] =
|
|
|
|
g_signal_new (g_intern_static_string ("tool-added"),
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
NULL,
|
2016-01-29 12:06:02 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GDK_TYPE_DEVICE_TOOL);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GdkSeat::tool-removed:
|
|
|
|
* @seat: the object on which the signal is emitted
|
2021-02-21 05:13:57 +00:00
|
|
|
* @tool: the just removed `GdkDeviceTool`
|
2016-01-29 12:06:02 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Emitted whenever a tool is no longer known to this @seat.
|
2016-01-29 12:06:02 +00:00
|
|
|
*/
|
|
|
|
signals [TOOL_REMOVED] =
|
|
|
|
g_signal_new (g_intern_static_string ("tool-removed"),
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0, NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
NULL,
|
2016-01-29 12:06:02 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GDK_TYPE_DEVICE_TOOL);
|
|
|
|
|
2015-11-26 18:47:38 +00:00
|
|
|
/**
|
2021-02-25 01:06:01 +00:00
|
|
|
* GdkSeat:display: (attributes org.gtk.Property.get=gdk_seat_get_display)
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* `GdkDisplay` of this seat.
|
2015-11-26 18:47:38 +00:00
|
|
|
*/
|
|
|
|
props[PROP_DISPLAY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
g_param_spec_object ("display", NULL, NULL,
|
2015-11-26 18:47:38 +00:00
|
|
|
GDK_TYPE_DISPLAY,
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY |
|
|
|
|
G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
g_object_class_install_properties (object_class, N_PROPS, props);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_seat_init (GdkSeat *seat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_seat_get_capabilities:
|
2021-02-21 05:13:57 +00:00
|
|
|
* @seat: a `GdkSeat`
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Returns the capabilities this `GdkSeat` currently has.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
|
|
|
* Returns: the seat capabilities
|
2021-02-21 05:13:57 +00:00
|
|
|
*/
|
2015-11-26 18:47:38 +00:00
|
|
|
GdkSeatCapabilities
|
|
|
|
gdk_seat_get_capabilities (GdkSeat *seat)
|
|
|
|
{
|
|
|
|
GdkSeatClass *seat_class;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SEAT (seat), GDK_SEAT_CAPABILITY_NONE);
|
|
|
|
|
|
|
|
seat_class = GDK_SEAT_GET_CLASS (seat);
|
|
|
|
return seat_class->get_capabilities (seat);
|
|
|
|
}
|
|
|
|
|
2020-08-14 00:59:04 +00:00
|
|
|
/*
|
2015-11-26 18:47:38 +00:00
|
|
|
* gdk_seat_grab:
|
2021-02-21 05:13:57 +00:00
|
|
|
* @seat: a `GdkSeat`
|
|
|
|
* @surface: the `GdkSurface` which will own the grab
|
2015-11-26 18:47:38 +00:00
|
|
|
* @capabilities: capabilities that will be grabbed
|
|
|
|
* @owner_events: if %FALSE then all device events are reported with respect to
|
2021-02-21 05:13:57 +00:00
|
|
|
* @surface and are only reported if selected by @event_mask. If %TRUE then
|
|
|
|
* pointer events for this application are reported as normal, but pointer
|
|
|
|
* events outside this application are reported with respect to @surface and
|
|
|
|
* only if selected by @event_mask. In either mode, unreported events are
|
|
|
|
* discarded.
|
|
|
|
* @cursor: (nullable): the cursor to display while the grab is active.
|
|
|
|
* If this is %NULL then the normal cursors are used for @surface and
|
|
|
|
* its descendants, and the cursor for @surface is used elsewhere.
|
2015-11-26 18:47:38 +00:00
|
|
|
* @event: (nullable): the event that is triggering the grab, or %NULL if none
|
2021-02-21 05:13:57 +00:00
|
|
|
* is available.
|
|
|
|
* @prepare_func: (nullable) (scope call): function to prepare the surface
|
|
|
|
* to be grabbed, it can be %NULL if @surface is visible before this call.
|
2020-01-13 01:11:15 +00:00
|
|
|
* @prepare_func_data: (closure): user data to pass to @prepare_func
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
|
|
|
* Grabs the seat so that all events corresponding to the given @capabilities
|
2021-02-21 05:13:57 +00:00
|
|
|
* are passed to this application.
|
|
|
|
*
|
|
|
|
* The grab remains in place until the seat is ungrabbed with
|
|
|
|
* [method@Gdk.Seat.ungrab], or the surface becomes hidden. This overrides
|
|
|
|
* any previous grab on the seat by this client.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
|
|
|
* As a rule of thumb, if a grab is desired over %GDK_SEAT_CAPABILITY_POINTER,
|
|
|
|
* all other "pointing" capabilities (eg. %GDK_SEAT_CAPABILITY_TOUCH) should
|
|
|
|
* be grabbed too, so the user is able to interact with all of those while
|
|
|
|
* the grab holds, you should thus use %GDK_SEAT_CAPABILITY_ALL_POINTING most
|
|
|
|
* commonly.
|
|
|
|
*
|
|
|
|
* Grabs are used for operations which need complete control over the
|
2019-02-24 18:32:24 +00:00
|
|
|
* events corresponding to the given capabilities. For example in GTK this
|
2015-11-26 18:47:38 +00:00
|
|
|
* is used for Drag and Drop operations, popup menus and such.
|
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Note that if the event mask of a `GdkSurface` has selected both button press
|
2015-11-26 18:47:38 +00:00
|
|
|
* and button release events, or touch begin and touch end, then a press event
|
|
|
|
* will cause an automatic grab until the button is released, equivalent to a
|
2021-02-21 05:13:57 +00:00
|
|
|
* grab on the surface with @owner_events set to %TRUE. This is done because
|
|
|
|
* most applications expect to receive paired press and release events.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
|
|
|
* If you set up anything at the time you take the grab that needs to be
|
2021-02-21 05:13:57 +00:00
|
|
|
* cleaned up when the grab ends, you should handle the `GdkEventGrabBroken`
|
2015-11-26 18:47:38 +00:00
|
|
|
* events that are emitted when the grab ends unvoluntarily.
|
|
|
|
*
|
|
|
|
* Returns: %GDK_GRAB_SUCCESS if the grab was successful.
|
2021-02-21 05:13:57 +00:00
|
|
|
*/
|
2015-11-26 18:47:38 +00:00
|
|
|
GdkGrabStatus
|
|
|
|
gdk_seat_grab (GdkSeat *seat,
|
2018-03-20 14:14:10 +00:00
|
|
|
GdkSurface *surface,
|
2015-11-26 18:47:38 +00:00
|
|
|
GdkSeatCapabilities capabilities,
|
|
|
|
gboolean owner_events,
|
|
|
|
GdkCursor *cursor,
|
2020-02-16 16:09:02 +00:00
|
|
|
GdkEvent *event,
|
2015-11-26 18:47:38 +00:00
|
|
|
GdkSeatGrabPrepareFunc prepare_func,
|
|
|
|
gpointer prepare_func_data)
|
|
|
|
{
|
|
|
|
GdkSeatClass *seat_class;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SEAT (seat), GDK_GRAB_FAILED);
|
2018-03-20 14:14:10 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_GRAB_FAILED);
|
2019-05-01 20:46:02 +00:00
|
|
|
g_return_val_if_fail (gdk_surface_get_display (surface) == gdk_seat_get_display (seat), GDK_GRAB_FAILED);
|
2015-11-26 18:47:38 +00:00
|
|
|
|
|
|
|
capabilities &= GDK_SEAT_CAPABILITY_ALL;
|
|
|
|
g_return_val_if_fail (capabilities != GDK_SEAT_CAPABILITY_NONE, GDK_GRAB_FAILED);
|
|
|
|
|
|
|
|
seat_class = GDK_SEAT_GET_CLASS (seat);
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
return seat_class->grab (seat, surface, capabilities, owner_events, cursor,
|
2015-11-26 18:47:38 +00:00
|
|
|
event, prepare_func, prepare_func_data);
|
|
|
|
}
|
|
|
|
|
2020-08-14 00:59:04 +00:00
|
|
|
/*
|
2015-11-26 18:47:38 +00:00
|
|
|
* gdk_seat_ungrab:
|
2021-02-21 05:13:57 +00:00
|
|
|
* @seat: a `GdkSeat`
|
|
|
|
*
|
|
|
|
* Releases a grab.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* See [method@Gdk.Seat.grab] for more information.
|
|
|
|
*/
|
2015-11-26 18:47:38 +00:00
|
|
|
void
|
|
|
|
gdk_seat_ungrab (GdkSeat *seat)
|
|
|
|
{
|
|
|
|
GdkSeatClass *seat_class;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_SEAT (seat));
|
|
|
|
|
|
|
|
seat_class = GDK_SEAT_GET_CLASS (seat);
|
2016-01-12 07:51:26 +00:00
|
|
|
seat_class->ungrab (seat);
|
2015-11-26 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-30 15:52:28 +00:00
|
|
|
* gdk_seat_get_devices:
|
2021-05-20 03:39:18 +00:00
|
|
|
* @seat: a `GdkSeat`
|
2015-11-26 18:47:38 +00:00
|
|
|
* @capabilities: capabilities to get devices for
|
|
|
|
*
|
2020-07-30 15:52:28 +00:00
|
|
|
* Returns the devices that match the given capabilities.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Returns: (transfer container) (element-type GdkDevice): A list
|
|
|
|
* of `GdkDevices`. The list must be freed with g_list_free(),
|
|
|
|
* the elements are owned by GTK and must not be freed.
|
|
|
|
*/
|
2015-11-26 18:47:38 +00:00
|
|
|
GList *
|
2020-07-30 15:52:28 +00:00
|
|
|
gdk_seat_get_devices (GdkSeat *seat,
|
|
|
|
GdkSeatCapabilities capabilities)
|
2015-11-26 18:47:38 +00:00
|
|
|
{
|
|
|
|
GdkSeatClass *seat_class;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
|
|
|
|
|
|
|
seat_class = GDK_SEAT_GET_CLASS (seat);
|
2020-07-30 15:52:28 +00:00
|
|
|
return seat_class->get_devices (seat, capabilities);
|
2015-11-26 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_seat_get_pointer:
|
2021-02-21 05:13:57 +00:00
|
|
|
* @seat: a `GdkSeat`
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2020-08-14 00:59:04 +00:00
|
|
|
* Returns the device that routes pointer events.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Returns: (transfer none) (nullable): a `GdkDevice` with pointer
|
|
|
|
* capabilities. This object is owned by GTK and must not be freed.
|
|
|
|
*/
|
2015-11-26 18:47:38 +00:00
|
|
|
GdkDevice *
|
|
|
|
gdk_seat_get_pointer (GdkSeat *seat)
|
|
|
|
{
|
|
|
|
GdkSeatClass *seat_class;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
|
|
|
|
|
|
|
seat_class = GDK_SEAT_GET_CLASS (seat);
|
2020-06-18 18:22:20 +00:00
|
|
|
return seat_class->get_logical_device (seat, GDK_SEAT_CAPABILITY_POINTER);
|
2015-11-26 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_seat_get_keyboard:
|
2021-02-21 05:13:57 +00:00
|
|
|
* @seat: a `GdkSeat`
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2020-08-14 00:59:04 +00:00
|
|
|
* Returns the device that routes keyboard events.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Returns: (transfer none) (nullable): a `GdkDevice` with keyboard
|
|
|
|
* capabilities. This object is owned by GTK and must not be freed.
|
|
|
|
*/
|
2015-11-26 18:47:38 +00:00
|
|
|
GdkDevice *
|
|
|
|
gdk_seat_get_keyboard (GdkSeat *seat)
|
|
|
|
{
|
|
|
|
GdkSeatClass *seat_class;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
|
|
|
|
|
|
|
seat_class = GDK_SEAT_GET_CLASS (seat);
|
2020-06-18 18:22:20 +00:00
|
|
|
return seat_class->get_logical_device (seat, GDK_SEAT_CAPABILITY_KEYBOARD);
|
2015-11-26 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_seat_device_added (GdkSeat *seat,
|
|
|
|
GdkDevice *device)
|
|
|
|
{
|
|
|
|
gdk_device_set_seat (device, seat);
|
|
|
|
g_signal_emit (seat, signals[DEVICE_ADDED], 0, device);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_seat_device_removed (GdkSeat *seat,
|
|
|
|
GdkDevice *device)
|
|
|
|
{
|
|
|
|
gdk_device_set_seat (device, NULL);
|
|
|
|
g_signal_emit (seat, signals[DEVICE_REMOVED], 0, device);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-02-25 01:06:01 +00:00
|
|
|
* gdk_seat_get_display: (attributes org.gtk.Method.get_property=display)
|
2021-02-21 05:13:57 +00:00
|
|
|
* @seat: a `GdkSeat`
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Returns the `GdkDisplay` this seat belongs to.
|
2015-11-26 18:47:38 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Returns: (transfer none): a `GdkDisplay`. This object
|
|
|
|
* is owned by GTK and must not be freed.
|
|
|
|
*/
|
2015-11-26 18:47:38 +00:00
|
|
|
GdkDisplay *
|
|
|
|
gdk_seat_get_display (GdkSeat *seat)
|
|
|
|
{
|
|
|
|
GdkSeatPrivate *priv = gdk_seat_get_instance_private (seat);
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
|
|
|
|
|
|
|
return priv->display;
|
|
|
|
}
|
2016-01-29 12:06:02 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gdk_seat_tool_added (GdkSeat *seat,
|
|
|
|
GdkDeviceTool *tool)
|
|
|
|
{
|
|
|
|
g_signal_emit (seat, signals[TOOL_ADDED], 0, tool);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_seat_tool_removed (GdkSeat *seat,
|
|
|
|
GdkDeviceTool *tool)
|
|
|
|
{
|
|
|
|
g_signal_emit (seat, signals[TOOL_REMOVED], 0, tool);
|
|
|
|
}
|
|
|
|
|
|
|
|
GdkDeviceTool *
|
2021-01-07 11:27:26 +00:00
|
|
|
gdk_seat_get_tool (GdkSeat *seat,
|
|
|
|
guint64 serial,
|
|
|
|
guint64 hw_id,
|
|
|
|
GdkDeviceToolType type)
|
2020-07-28 14:51:41 +00:00
|
|
|
{
|
|
|
|
GdkDeviceTool *match = NULL;
|
|
|
|
GList *tools, *l;
|
|
|
|
|
|
|
|
tools = gdk_seat_get_tools (seat);
|
|
|
|
|
|
|
|
for (l = tools; l; l = l->next)
|
|
|
|
{
|
|
|
|
GdkDeviceTool *tool = l->data;
|
|
|
|
|
2021-01-07 11:27:26 +00:00
|
|
|
if (tool->serial == serial && tool->hw_id == hw_id && tool->type == type)
|
2020-07-28 14:51:41 +00:00
|
|
|
{
|
|
|
|
match = tool;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (tools);
|
|
|
|
|
|
|
|
return match;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_seat_get_tools:
|
2021-02-21 05:13:57 +00:00
|
|
|
* @seat: a `GdkSeat`
|
2020-07-28 14:51:41 +00:00
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* Returns all `GdkDeviceTools` that are known to the application.
|
2020-07-28 14:51:41 +00:00
|
|
|
*
|
2020-08-14 00:59:04 +00:00
|
|
|
* Returns: (transfer container) (element-type Gdk.DeviceTool):
|
2021-02-21 05:13:57 +00:00
|
|
|
* A list of tools. Free with g_list_free().
|
|
|
|
*/
|
2020-07-28 14:51:41 +00:00
|
|
|
GList *
|
|
|
|
gdk_seat_get_tools (GdkSeat *seat)
|
2016-01-29 12:06:02 +00:00
|
|
|
{
|
|
|
|
GdkSeatClass *seat_class;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
|
|
|
|
|
|
|
seat_class = GDK_SEAT_GET_CLASS (seat);
|
2020-07-28 14:51:41 +00:00
|
|
|
return seat_class->get_tools (seat);
|
2016-01-29 12:06:02 +00:00
|
|
|
}
|