MetaWaylandPointer: Add 'focus-surface-changed' signal

Add a signal that is emitted when the pointer focus surface of the
pointer device changes. This will later be used by the pointer
constraints to maybe enable pointer constraints when a surface receives
pointer focus.

https://bugzilla.gnome.org/show_bug.cgi?id=771050
This commit is contained in:
Jonas Ådahl 2016-04-01 21:07:59 +08:00
parent 262b52da50
commit e6a20a025d

View File

@ -75,6 +75,14 @@
#define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int (10) #define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int (10)
enum {
FOCUS_SURFACE_CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE (MetaWaylandPointer, meta_wayland_pointer, G_TYPE_OBJECT); G_DEFINE_TYPE (MetaWaylandPointer, meta_wayland_pointer, G_TYPE_OBJECT);
static MetaWaylandPointerClient * static MetaWaylandPointerClient *
@ -843,6 +851,8 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
} }
meta_wayland_pointer_update_cursor_surface (pointer); meta_wayland_pointer_update_cursor_surface (pointer);
g_signal_emit (pointer, signals[FOCUS_SURFACE_CHANGED], 0);
} }
void void
@ -1206,4 +1216,10 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer)
static void static void
meta_wayland_pointer_class_init (MetaWaylandPointerClass *klass) meta_wayland_pointer_class_init (MetaWaylandPointerClass *klass)
{ {
signals[FOCUS_SURFACE_CHANGED] = g_signal_new ("focus-surface-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
} }