Add pointer barriers to panel and message tray
If you have XFixes 5 (and corresponding xserver support) then we add barriers on the panel and in the message tray corner so that its easy to reach the corners even when there are monitors to the sides of the primary monitor. https://bugzilla.gnome.org/show_bug.cgi?id=622655
This commit is contained in:
parent
fd3f2289c3
commit
1518dc9b60
@ -1030,6 +1030,7 @@ MessageTray.prototype = {
|
||||
this._clickedSummaryItemAllocationChangedId = 0;
|
||||
this._expandedSummaryItem = null;
|
||||
this._summaryItemTitleWidth = 0;
|
||||
this._pointerBarrier = 0;
|
||||
|
||||
// To simplify the summary item animation code, we pretend
|
||||
// that there's an invisible SummaryItem to the left of the
|
||||
@ -1119,6 +1120,15 @@ MessageTray.prototype = {
|
||||
this._notificationBin.width = primary.width;
|
||||
this._summaryBin.x = 0;
|
||||
this._summaryBin.width = primary.width;
|
||||
|
||||
if (this._pointerBarrier)
|
||||
global.destroy_pointer_barrier(this._pointerBarrier);
|
||||
this._pointerBarrier =
|
||||
global.create_pointer_barrier(primary.x + primary.width, primary.y + primary.height - this.actor.height,
|
||||
primary.x + primary.width, primary.y + primary.height,
|
||||
4 /* BarrierNegativeX */);
|
||||
|
||||
|
||||
},
|
||||
|
||||
contains: function(source) {
|
||||
|
@ -789,6 +789,8 @@ Panel.prototype = {
|
||||
this.actor.remove_style_class_name('in-overview');
|
||||
}));
|
||||
|
||||
this._leftPointerBarrier = 0;
|
||||
this._rightPointerBarrier = 0;
|
||||
this._menus = new PopupMenu.PopupMenuManager(this);
|
||||
|
||||
this._leftBox = new St.BoxLayout({ name: 'panelLeft' });
|
||||
@ -1051,6 +1053,20 @@ Panel.prototype = {
|
||||
this.actor.set_position(primary.x, primary.y);
|
||||
this.actor.set_size(primary.width, -1);
|
||||
|
||||
if (this._leftPointerBarrier)
|
||||
global.destroy_pointer_barrier(this._leftPointerBarrier);
|
||||
if (this._rightPointerBarrier)
|
||||
global.destroy_pointer_barrier(this._rightPointerBarrier);
|
||||
|
||||
this._leftPointerBarrier =
|
||||
global.create_pointer_barrier(primary.x, primary.y,
|
||||
primary.x, primary.y + this.actor.height,
|
||||
1 /* BarrierPositiveX */);
|
||||
this._rightPointerBarrier =
|
||||
global.create_pointer_barrier(primary.x + primary.width, primary.y,
|
||||
primary.x + primary.width, primary.y + this.actor.height,
|
||||
4 /* BarrierNegativeX */);
|
||||
|
||||
this._leftCorner.relayout();
|
||||
this._rightCorner.relayout();
|
||||
},
|
||||
|
@ -884,6 +884,61 @@ shell_global_display_is_grabbed (ShellGlobal *global)
|
||||
return meta_display_get_grab_op (display) != META_GRAB_OP_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 XFIXES_MAJOR >= 5
|
||||
Display *xdpy;
|
||||
|
||||
xdpy = meta_plugin_get_xdisplay (global->plugin);
|
||||
|
||||
return (guint32)
|
||||
XFixesCreatePointerBarrier (xdpy, DefaultRootWindow(xdpy),
|
||||
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 XFIXES_MAJOR >= 5
|
||||
Display *xdpy;
|
||||
|
||||
g_return_if_fail (barrier > 0);
|
||||
|
||||
xdpy = meta_plugin_get_xdisplay (global->plugin);
|
||||
XFixesDestroyPointerBarrier (xdpy, (PointerBarrier)barrier);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* shell_global_add_extension_importer:
|
||||
* @target_object_script: JavaScript code evaluating to a target object
|
||||
|
@ -103,6 +103,12 @@ MetaRectangle *shell_global_get_primary_monitor (ShellGlobal *global);
|
||||
int shell_global_get_primary_monitor_index (ShellGlobal *global);
|
||||
MetaRectangle *shell_global_get_focus_monitor (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,
|
||||
|
Loading…
Reference in New Issue
Block a user