[mutter/wip/barriers-corruption] corruption test
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/barriers-corruption] corruption test
- Date: Wed, 6 Feb 2013 21:34:26 +0000 (UTC)
commit ab3b66832d5247a89a703bac7966b6547ea570e4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Jul 30 15:57:53 2012 -0300
corruption test
src/core/barrier.c | 10 ++++++++++
src/core/display-private.h | 9 +++++++++
src/core/display.c | 26 ++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/src/core/barrier.c b/src/core/barrier.c
index 69db69e..4180eb9 100644
--- a/src/core/barrier.c
+++ b/src/core/barrier.c
@@ -4,6 +4,7 @@
#include <glib-object.h>
+#include <X11/extensions/XInput2.h>
#include <X11/extensions/Xfixes.h>
#include <meta/util.h>
#include <meta/barrier.h>
@@ -157,6 +158,12 @@ meta_barrier_constructed (GObject *object)
priv->x2, priv->y2,
priv->directions, 0, NULL);
+ /* Take a ref that we'll release when the XID dies inside destroy(),
+ * so that the object stays alive and doesn't get GC'd. */
+ g_object_ref (barrier);
+
+ meta_display_register_x_barrier (priv->display, &priv->xbarrier, barrier);
+
G_OBJECT_CLASS (meta_barrier_parent_class)->constructed (object);
}
@@ -232,8 +239,11 @@ meta_barrier_destroy (MetaBarrier *barrier)
if (!meta_barrier_is_active (barrier))
return;
+ meta_display_unregister_x_barrier (priv->display, priv->xbarrier);
XFixesDestroyPointerBarrier (dpy, priv->xbarrier);
priv->xbarrier = 0;
+
+ g_object_unref (barrier);
}
static void
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 82bb2ea..0e06a25 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -39,6 +39,7 @@
#include <meta/display.h>
#include "keybindings-private.h"
#include <meta/prefs.h>
+#include <meta/barrier.h>
#ifdef HAVE_STARTUP_NOTIFICATION
#include <libsn/sn.h>
@@ -371,6 +372,14 @@ void meta_display_unregister_x_window (MetaDisplay *display,
void meta_display_notify_window_created (MetaDisplay *display,
MetaWindow *window);
+MetaBarrier* meta_display_lookup_x_barrier (MetaDisplay *display,
+ PointerBarrier xbarrier);
+void meta_display_register_x_barrier (MetaDisplay *display,
+ PointerBarrier *xbarrierp,
+ MetaBarrier *barrier);
+void meta_display_unregister_x_barrier (MetaDisplay *display,
+ PointerBarrier xbarrier);
+
GSList* meta_display_list_windows (MetaDisplay *display,
MetaListWindowsFlags flags);
diff --git a/src/core/display.c b/src/core/display.c
index c09b63e..c6c4750 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -3564,6 +3564,32 @@ meta_display_notify_window_created (MetaDisplay *display,
g_signal_emit (display, display_signals[WINDOW_CREATED], 0, window);
}
+MetaBarrier*
+meta_display_lookup_x_barrier (MetaDisplay *display,
+ PointerBarrier xbarrier)
+{
+ return g_hash_table_lookup (display->window_ids, &xbarrier);
+}
+
+void
+meta_display_register_x_barrier (MetaDisplay *display,
+ PointerBarrier *xbarrierp,
+ MetaBarrier *barrier)
+{
+ g_return_if_fail (g_hash_table_lookup (display->window_ids, xbarrierp) == NULL);
+
+ g_hash_table_insert (display->window_ids, xbarrierp, barrier);
+}
+
+void
+meta_display_unregister_x_barrier (MetaDisplay *display,
+ PointerBarrier xbarrier)
+{
+ g_return_if_fail (g_hash_table_lookup (display->window_ids, &xbarrier) != NULL);
+
+ g_hash_table_remove (display->window_ids, &xbarrier);
+}
+
/**
* meta_display_xwindow_is_a_no_focus_window:
* @display: A #MetaDisplay
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]