[mutter/wip/barriers-try-2: 8/8] barrier: Add support for releasing a barrier
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/barriers-try-2: 8/8] barrier: Add support for releasing a barrier
- Date: Mon, 26 Nov 2012 01:40:39 +0000 (UTC)
commit 834d9ea7c4f2772e5a3b32cb84a887cf7b59368c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Nov 25 19:38:25 2012 -0500
barrier: Add support for releasing a barrier
This gives us the option to temporarily disable barriers for future
cases of e.g. window tiling.
src/core/barrier.c | 22 ++++++++++++++++++++++
src/core/display.c | 1 +
src/core/screen.c | 1 +
src/meta/barrier.h | 3 +++
4 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/core/barrier.c b/src/core/barrier.c
index b1c0c3d..2308107 100644
--- a/src/core/barrier.c
+++ b/src/core/barrier.c
@@ -143,6 +143,26 @@ meta_barrier_is_active (MetaBarrier *barrier)
return barrier->priv->barrier > 0;
}
+/**
+ * meta_barrier_release:
+ * @barrier: The barrier to release
+ * @event_id: The event ID to release the pointer for
+ *
+ * Pointer barriers provide a feature where they can
+ * be temporarily released so that the pointer goes through
+ * them for the current event ID. Release this pointer barrier
+ * with an event ID retrieved from a #MetaBarrierHitEvent to
+ * release this barrier.
+ */
+void
+meta_barrier_release (MetaBarrier *barrier,
+ guint event_id)
+{
+ MetaBarrierPrivate *priv = barrier->priv;
+ XIBarrierReleasePointer (priv->display->xdisplay,
+ priv->barrier, event_id);
+}
+
static void
meta_barrier_activate (MetaBarrier *barrier)
{
@@ -292,6 +312,8 @@ meta_barrier_hit (MetaBarrier *barrier,
event->raw_dx = xevent->raw_dx;
event->raw_dy = xevent->raw_dy;
+ event->blocked = (xevent->evtype == XI_BarrierHitNotify);
+
g_signal_emit (barrier, obj_signals[HIT], 0, event);
}
diff --git a/src/core/display.c b/src/core/display.c
index ee00408..ac000c1 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -2405,6 +2405,7 @@ event_callback (XEvent *event,
}
break;
case XI_BarrierHitNotify:
+ case XI_BarrierPointerReleasedNotify:
if (meta_display_process_barrier_event (display, (XIBarrierNotifyEvent *) xev))
filter_out_event = bypass_compositor = TRUE;
break;
diff --git a/src/core/screen.c b/src/core/screen.c
index 6608a31..93dac57 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -752,6 +752,7 @@ meta_screen_new (MetaDisplay *display,
XISetMask (mask.mask, XI_FocusOut);
XISetMask (mask.mask, XI_Motion);
XISetMask (mask.mask, XI_BarrierHitNotify);
+ XISetMask (mask.mask, XI_BarrierPointerReleasedNotify);
XISelectEvents (xdisplay, xroot, &mask, 1);
event_mask = (SubstructureRedirectMask | SubstructureNotifyMask |
diff --git a/src/meta/barrier.h b/src/meta/barrier.h
index 97aae20..2dd6a83 100644
--- a/src/meta/barrier.h
+++ b/src/meta/barrier.h
@@ -36,6 +36,8 @@ GType meta_barrier_get_type (void) G_GNUC_CONST;
gboolean meta_barrier_is_active (MetaBarrier *barrier);
void meta_barrier_destroy (MetaBarrier *barrier);
+void meta_barrier_release (MetaBarrier *barrier,
+ guint event_id);
/* Keep in sync with XFixes */
typedef enum {
@@ -56,6 +58,7 @@ typedef struct {
double dy;
double raw_dx;
double raw_dy;
+ gboolean blocked;
} MetaBarrierHitEvent;
#define META_TYPE_BARRIER_HIT_EVENT (meta_barrier_hit_event_get_type ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]