mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 10:30:47 -05:00
display: Move finishing of touch sequence to the backend
We need to manipulate an X11 grab when a touch sequence ends; move that logic to where it belongs - in the X11 backend. https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
This commit is contained in:
parent
ef2f5f07f0
commit
2301cde8f7
@ -49,6 +49,14 @@
|
|||||||
#define DEFAULT_XKB_RULES_FILE "evdev"
|
#define DEFAULT_XKB_RULES_FILE "evdev"
|
||||||
#define DEFAULT_XKB_MODEL "pc105+inet"
|
#define DEFAULT_XKB_MODEL "pc105+inet"
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
META_SEQUENCE_NONE,
|
||||||
|
META_SEQUENCE_ACCEPTED,
|
||||||
|
META_SEQUENCE_REJECTED,
|
||||||
|
META_SEQUENCE_PENDING_END
|
||||||
|
} MetaSequenceState;
|
||||||
|
|
||||||
struct _MetaBackendClass
|
struct _MetaBackendClass
|
||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
@ -71,6 +79,10 @@ struct _MetaBackendClass
|
|||||||
int device_id,
|
int device_id,
|
||||||
uint32_t timestamp);
|
uint32_t timestamp);
|
||||||
|
|
||||||
|
void (* finish_touch_sequence) (MetaBackend *backend,
|
||||||
|
ClutterEventSequence *sequence,
|
||||||
|
MetaSequenceState state);
|
||||||
|
|
||||||
void (* warp_pointer) (MetaBackend *backend,
|
void (* warp_pointer) (MetaBackend *backend,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
int y);
|
||||||
@ -135,6 +147,10 @@ gboolean meta_backend_ungrab_device (MetaBackend *backend,
|
|||||||
int device_id,
|
int device_id,
|
||||||
uint32_t timestamp);
|
uint32_t timestamp);
|
||||||
|
|
||||||
|
void meta_backend_finish_touch_sequence (MetaBackend *backend,
|
||||||
|
ClutterEventSequence *sequence,
|
||||||
|
MetaSequenceState state);
|
||||||
|
|
||||||
void meta_backend_warp_pointer (MetaBackend *backend,
|
void meta_backend_warp_pointer (MetaBackend *backend,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
int y);
|
||||||
|
@ -1059,6 +1059,20 @@ meta_backend_ungrab_device (MetaBackend *backend,
|
|||||||
return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id, timestamp);
|
return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_backend_finish_touch_sequence: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
meta_backend_finish_touch_sequence (MetaBackend *backend,
|
||||||
|
ClutterEventSequence *sequence,
|
||||||
|
MetaSequenceState state)
|
||||||
|
{
|
||||||
|
if (META_BACKEND_GET_CLASS (backend)->finish_touch_sequence)
|
||||||
|
META_BACKEND_GET_CLASS (backend)->finish_touch_sequence (backend,
|
||||||
|
sequence,
|
||||||
|
state);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_backend_warp_pointer: (skip)
|
* meta_backend_warp_pointer: (skip)
|
||||||
*/
|
*/
|
||||||
|
@ -590,6 +590,28 @@ meta_backend_x11_ungrab_device (MetaBackend *backend,
|
|||||||
return (ret == Success);
|
return (ret == Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_backend_x11_finish_touch_sequence (MetaBackend *backend,
|
||||||
|
ClutterEventSequence *sequence,
|
||||||
|
MetaSequenceState state)
|
||||||
|
{
|
||||||
|
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
|
||||||
|
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
||||||
|
int event_mode;
|
||||||
|
|
||||||
|
if (state == META_SEQUENCE_ACCEPTED)
|
||||||
|
event_mode = XIAcceptTouch;
|
||||||
|
else if (state == META_SEQUENCE_REJECTED)
|
||||||
|
event_mode = XIRejectTouch;
|
||||||
|
else
|
||||||
|
g_return_if_reached ();
|
||||||
|
|
||||||
|
XIAllowTouchEvents (priv->xdisplay,
|
||||||
|
META_VIRTUAL_CORE_POINTER_ID,
|
||||||
|
meta_x11_event_sequence_get_touch_detail (sequence),
|
||||||
|
DefaultRootWindow (priv->xdisplay), event_mode);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_backend_x11_warp_pointer (MetaBackend *backend,
|
meta_backend_x11_warp_pointer (MetaBackend *backend,
|
||||||
int x,
|
int x,
|
||||||
@ -781,6 +803,7 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass)
|
|||||||
backend_class->post_init = meta_backend_x11_post_init;
|
backend_class->post_init = meta_backend_x11_post_init;
|
||||||
backend_class->grab_device = meta_backend_x11_grab_device;
|
backend_class->grab_device = meta_backend_x11_grab_device;
|
||||||
backend_class->ungrab_device = meta_backend_x11_ungrab_device;
|
backend_class->ungrab_device = meta_backend_x11_ungrab_device;
|
||||||
|
backend_class->finish_touch_sequence = meta_backend_x11_finish_touch_sequence;
|
||||||
backend_class->warp_pointer = meta_backend_x11_warp_pointer;
|
backend_class->warp_pointer = meta_backend_x11_warp_pointer;
|
||||||
backend_class->get_current_logical_monitor = meta_backend_x11_get_current_logical_monitor;
|
backend_class->get_current_logical_monitor = meta_backend_x11_get_current_logical_monitor;
|
||||||
backend_class->get_keymap = meta_backend_x11_get_keymap;
|
backend_class->get_keymap = meta_backend_x11_get_keymap;
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <X11/extensions/Xdamage.h>
|
#include <X11/extensions/Xdamage.h>
|
||||||
#include <X11/extensions/Xfixes.h>
|
#include <X11/extensions/Xfixes.h>
|
||||||
|
|
||||||
|
#include "backends/meta-backend-private.h"
|
||||||
#include "backends/meta-cursor-sprite-xcursor.h"
|
#include "backends/meta-cursor-sprite-xcursor.h"
|
||||||
#include "backends/meta-cursor-tracker-private.h"
|
#include "backends/meta-cursor-tracker-private.h"
|
||||||
#include "backends/meta-idle-monitor-dbus.h"
|
#include "backends/meta-idle-monitor-dbus.h"
|
||||||
@ -622,27 +623,23 @@ gesture_tracker_state_changed (MetaGestureTracker *tracker,
|
|||||||
MetaSequenceState state,
|
MetaSequenceState state,
|
||||||
MetaDisplay *display)
|
MetaDisplay *display)
|
||||||
{
|
{
|
||||||
if (meta_is_wayland_compositor ())
|
switch (state)
|
||||||
{
|
{
|
||||||
if (state == META_SEQUENCE_ACCEPTED)
|
case META_SEQUENCE_NONE:
|
||||||
meta_display_cancel_touch (display);
|
case META_SEQUENCE_PENDING_END:
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
|
|
||||||
int event_mode;
|
|
||||||
|
|
||||||
if (state == META_SEQUENCE_ACCEPTED)
|
|
||||||
event_mode = XIAcceptTouch;
|
|
||||||
else if (state == META_SEQUENCE_REJECTED)
|
|
||||||
event_mode = XIRejectTouch;
|
|
||||||
else
|
|
||||||
return;
|
return;
|
||||||
|
case META_SEQUENCE_ACCEPTED:
|
||||||
|
meta_display_cancel_touch (display);
|
||||||
|
|
||||||
XIAllowTouchEvents (meta_backend_x11_get_xdisplay (backend),
|
/* Intentional fall-through */
|
||||||
META_VIRTUAL_CORE_POINTER_ID,
|
case META_SEQUENCE_REJECTED:
|
||||||
meta_x11_event_sequence_get_touch_detail (sequence),
|
{
|
||||||
DefaultRootWindow (display->x11_display->xdisplay), event_mode);
|
MetaBackend *backend;
|
||||||
|
|
||||||
|
backend = meta_get_backend ();
|
||||||
|
meta_backend_finish_touch_sequence (backend, sequence, state);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include "backends/meta-backend-private.h"
|
||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
#include "meta/window.h"
|
#include "meta/window.h"
|
||||||
|
|
||||||
@ -39,14 +40,6 @@
|
|||||||
typedef struct _MetaGestureTracker MetaGestureTracker;
|
typedef struct _MetaGestureTracker MetaGestureTracker;
|
||||||
typedef struct _MetaGestureTrackerClass MetaGestureTrackerClass;
|
typedef struct _MetaGestureTrackerClass MetaGestureTrackerClass;
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
META_SEQUENCE_NONE,
|
|
||||||
META_SEQUENCE_ACCEPTED,
|
|
||||||
META_SEQUENCE_REJECTED,
|
|
||||||
META_SEQUENCE_PENDING_END
|
|
||||||
} MetaSequenceState;
|
|
||||||
|
|
||||||
struct _MetaGestureTracker
|
struct _MetaGestureTracker
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
|
Loading…
Reference in New Issue
Block a user