mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-12 11:50:21 +00:00
GdkDevice: Add GdkSeat property and getter
https://bugzilla.gnome.org/show_bug.cgi?id=759309
This commit is contained in:
parent
0472c088a1
commit
d24f63e9ce
@ -732,6 +732,7 @@ gdk_device_get_has_cursor
|
||||
gdk_device_get_n_axes
|
||||
gdk_device_get_n_keys
|
||||
gdk_device_warp
|
||||
gdk_device_get_seat
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_device_grab
|
||||
|
@ -90,6 +90,7 @@ enum {
|
||||
PROP_N_AXES,
|
||||
PROP_VENDOR_ID,
|
||||
PROP_PRODUCT_ID,
|
||||
PROP_SEAT,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@ -271,6 +272,21 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:seat:
|
||||
*
|
||||
* #GdkSeat of this device.
|
||||
*
|
||||
* Since: 3.20
|
||||
*/
|
||||
device_props[PROP_SEAT] =
|
||||
g_param_spec_object ("seat",
|
||||
P_("Seat"),
|
||||
P_("Seat"),
|
||||
GDK_TYPE_SEAT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, device_props);
|
||||
|
||||
/**
|
||||
@ -381,6 +397,9 @@ gdk_device_set_property (GObject *object,
|
||||
case PROP_PRODUCT_ID:
|
||||
device->product_id = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_SEAT:
|
||||
device->seat = g_value_get_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -430,6 +449,9 @@ gdk_device_get_property (GObject *object,
|
||||
case PROP_PRODUCT_ID:
|
||||
g_value_set_string (value, device->product_id);
|
||||
break;
|
||||
case PROP_SEAT:
|
||||
g_value_set_object (value, device->seat);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1880,3 +1902,36 @@ gdk_device_get_product_id (GdkDevice *device)
|
||||
|
||||
return device->product_id;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_device_set_seat (GdkDevice *device,
|
||||
GdkSeat *seat)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
g_return_if_fail (!seat || GDK_IS_SEAT (seat));
|
||||
|
||||
if (device->seat == seat)
|
||||
return;
|
||||
|
||||
device->seat = seat;
|
||||
g_object_notify (G_OBJECT (device), "seat");
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_seat:
|
||||
* @device: A #GdkDevice
|
||||
*
|
||||
* Returns the #GdkSeat the device belongs to.
|
||||
*
|
||||
* Returns: (transfer none): A #GdkSeat. This memory is owned by GTK+ and
|
||||
* must not be freed.
|
||||
*
|
||||
* Since: 3.20
|
||||
**/
|
||||
GdkSeat *
|
||||
gdk_device_get_seat (GdkDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
|
||||
|
||||
return device->seat;
|
||||
}
|
||||
|
@ -279,6 +279,9 @@ const gchar *gdk_device_get_vendor_id (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
const gchar *gdk_device_get_product_id (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_3_20
|
||||
GdkSeat *gdk_device_get_seat (GdkDevice *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_H__ */
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "gdkdevice.h"
|
||||
#include "gdkdevicemanager.h"
|
||||
#include "gdkevents.h"
|
||||
#include "gdkseat.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -59,6 +60,8 @@ struct _GdkDevice
|
||||
|
||||
gchar *vendor_id;
|
||||
gchar *product_id;
|
||||
|
||||
GdkSeat *seat;
|
||||
};
|
||||
|
||||
struct _GdkDeviceClass
|
||||
@ -176,6 +179,9 @@ GdkWindow * _gdk_device_window_at_position (GdkDevice *device,
|
||||
GdkModifierType *mask,
|
||||
gboolean get_toplevel);
|
||||
|
||||
void gdk_device_set_seat (GdkDevice *device,
|
||||
GdkSeat *seat);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_PRIVATE_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user