[gnome-shell/wip/pressure: 2/14] layout: Port to the new mutter-based barrier wrappers
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/pressure: 2/14] layout: Port to the new mutter-based barrier wrappers
- Date: Mon, 30 Jul 2012 23:49:06 +0000 (UTC)
commit 805b1e8816d42d1e7d88ca5787d0dc0907479bb4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Jul 30 14:02:33 2012 -0300
layout: Port to the new mutter-based barrier wrappers
... and remove our old ones.
https://bugzilla.gnome.org/show_bug.cgi?id=677215
configure.ac | 8 --------
js/ui/layout.js | 48 ++++++++++++++++++++++++++----------------------
src/shell-global.c | 48 ------------------------------------------------
src/shell-global.h | 9 ---------
4 files changed, 26 insertions(+), 87 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6c453d5..37fabcb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,14 +108,6 @@ PKG_CHECK_MODULES(BROWSER_PLUGIN, gio-2.0 >= $GIO_MIN_VERSION json-glib-1.0 >= 0
GOBJECT_INTROSPECTION_CHECK([$GOBJECT_INTROSPECTION_MIN_VERSION])
-saved_CFLAGS=$CFLAGS
-saved_LIBS=$LIBS
-CFLAGS=$GNOME_SHELL_CFLAGS
-LIBS=$GNOME_SHELL_LIBS
-AC_CHECK_FUNCS(JS_NewGlobalObject XFixesCreatePointerBarrier)
-CFLAGS=$saved_CFLAGS
-LIBS=$saved_LIBS
-
PKG_CHECK_MODULES(GNOME_SHELL_JS, gio-2.0 gjs-internals-1.0 >= $GJS_MIN_VERSION)
PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-3.0 libcroco-0.6 >= 0.6.2 x11)
PKG_CHECK_MODULES(TRAY, gtk+-3.0)
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 5f58ff9..9c436b5 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -26,9 +26,9 @@ const LayoutManager = new Lang.Class({
this.primaryMonitor = null;
this.primaryIndex = -1;
this._hotCorners = [];
- this._leftPanelBarrier = 0;
- this._rightPanelBarrier = 0;
- this._trayBarrier = 0;
+ this._leftPanelBarrier = null;
+ this._rightPanelBarrier = null;
+ this._trayBarrier = null;
this._chrome = new Chrome(this);
@@ -70,7 +70,6 @@ const LayoutManager = new Lang.Class({
// yet when the LayoutManager was constructed.
init: function() {
this._chrome.init();
-
this._startupAnimation();
},
@@ -179,23 +178,27 @@ const LayoutManager = new Lang.Class({
_updatePanelBarriers: function() {
if (this._leftPanelBarrier)
- global.destroy_pointer_barrier(this._leftPanelBarrier);
+ this._leftPanelBarrier.deactivate();
if (this._rightPanelBarrier)
- global.destroy_pointer_barrier(this._rightPanelBarrier);
+ this._rightPanelBarrier.deactivate();
if (this.panelBox.height) {
let primary = this.primaryMonitor;
- this._leftPanelBarrier =
- global.create_pointer_barrier(primary.x, primary.y,
- primary.x, primary.y + this.panelBox.height,
- 1 /* BarrierPositiveX */);
- this._rightPanelBarrier =
- global.create_pointer_barrier(primary.x + primary.width, primary.y,
- primary.x + primary.width, primary.y + this.panelBox.height,
- 4 /* BarrierNegativeX */);
+
+ this._leftPanelBarrier = new Meta.Barrier({ display: global.display,
+ x1: primary.x, y1: primary.y,
+ x2: primary.x, y2: primary.y + this.panelBox.height,
+ directions: Meta.BarrierDirection.POSITIVE_X });
+ this._rightPanelBarrier = new Meta.Barrier({ display: global.display,
+ x1: primary.x + primary.width, y1: primary.y,
+ x2: primary.x + primary.width, y2: primary.y + this.panelBox.height,
+ directions: Meta.BarrierDirection.NEGATIVE_X });
+
+ this._leftPanelBarrier.activate();
+ this._rightPanelBarrier.activate();
} else {
- this._leftPanelBarrier = 0;
- this._rightPanelBarrier = 0;
+ this._leftPanelBarrier = null;
+ this._rightPanelBarrier = null;
}
},
@@ -203,15 +206,16 @@ const LayoutManager = new Lang.Class({
let monitor = this.bottomMonitor;
if (this._trayBarrier)
- global.destroy_pointer_barrier(this._trayBarrier);
+ this._trayBarrier.deactivate();
if (Main.messageTray) {
- this._trayBarrier =
- global.create_pointer_barrier(monitor.x + monitor.width, monitor.y + monitor.height - Main.messageTray.actor.height,
- monitor.x + monitor.width, monitor.y + monitor.height,
- 4 /* BarrierNegativeX */);
+ this._trayBarrier = new Meta.Barrier({ display: global.display,
+ x1: monitor.x + monitor.width, y1: monitor.y + monitor.height - Main.messageTray.actor.height,
+ x2: monitor.x + monitor.width, y2: monitor.y + monitor.height,
+ directions: Meta.BarrierDirection.NEGATIVE_X });
+ this._trayBarrier.activate();
} else {
- this._trayBarrier = 0;
+ this._trayBarrier = null;
}
},
diff --git a/src/shell-global.c b/src/shell-global.c
index 28127ab..e57ceec 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -1007,54 +1007,6 @@ shell_global_end_modal (ShellGlobal *global,
meta_plugin_end_modal (global->plugin, timestamp);
}
-/**
- * shell_global_create_pointer_barrier:
- * @global: a #ShellGlobal
- * @x1: left X coordinate
- * @y1: top Y coordinate
- * @x2: right X coordinate
- * @y2: bottom Y coordinate
- * @directions: The directions we're allowed to pass through
- *
- * If supported by X creates a pointer barrier.
- *
- * Return value: value you can pass to shell_global_destroy_pointer_barrier()
- */
-guint32
-shell_global_create_pointer_barrier (ShellGlobal *global,
- int x1, int y1, int x2, int y2,
- int directions)
-{
-#if HAVE_XFIXESCREATEPOINTERBARRIER
- return (guint32)
- XFixesCreatePointerBarrier (global->xdisplay,
- DefaultRootWindow (global->xdisplay),
- x1, y1,
- x2, y2,
- directions,
- 0, NULL);
-#else
- return 0;
-#endif
-}
-
-/**
- * shell_global_destroy_pointer_barrier:
- * @global: a #ShellGlobal
- * @barrier: a pointer barrier
- *
- * Destroys the @barrier created by shell_global_create_pointer_barrier().
- */
-void
-shell_global_destroy_pointer_barrier (ShellGlobal *global, guint32 barrier)
-{
-#if HAVE_XFIXESCREATEPOINTERBARRIER
- g_return_if_fail (barrier > 0);
-
- XFixesDestroyPointerBarrier (global->xdisplay, (PointerBarrier)barrier);
-#endif
-}
-
/* Code to close all file descriptors before we exec; copied from gspawn.c in GLib.
*
* Authors: Padraig O'Briain, Matthias Clasen, Lennart Poettering
diff --git a/src/shell-global.h b/src/shell-global.h
index b731838..f7000a4 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -70,15 +70,6 @@ void shell_global_set_cursor (ShellGlobal *global,
ShellCursor type);
void shell_global_unset_cursor (ShellGlobal *global);
-guint32 shell_global_create_pointer_barrier (ShellGlobal *global,
- int x1,
- int y1,
- int x2,
- int y2,
- int directions);
-void shell_global_destroy_pointer_barrier (ShellGlobal *global,
- guint32 barrier);
-
void shell_global_get_pointer (ShellGlobal *global,
int *x,
int *y,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]