Skip to content

Commit

Permalink
Disable gesture on overview
Browse files Browse the repository at this point in the history
  • Loading branch information
amarullz committed Oct 11, 2023
1 parent 0a67464 commit e0a6e79
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 24 deletions.
57 changes: 51 additions & 6 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,48 @@ const WindowClassBlacklist = [

// Indicator All
class WGSArrowClass extends St.Widget {
constructor(style_class) {
super({ style_class: 'gie-circle ' + style_class });
constructor() {
super({ style_class: 'wgs-widget-indicator' });
this._arrow_icon = new St.Icon({
icon_name: 'go-previous-symbolic',
style_class: 'gie-arrow-icon'
style_class: 'wgs-widget-indicator-icon'
});
this.set_clip_to_allocation(true);
this.add_child(this._arrow_icon);
this.set_size(
32, 32
64, 64
);
this.set_pivot_point(0.5, 0.5);
}

viewShow() {
this.opacity = 0;
this.scale_x = 0;
this.scale_y = 0;
this.show();
this.ease({
opacity: 255,
scale_x: 1,
scale_y: 1,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: 500
});
}

viewHide() {
this.ease({
opacity: 0,
scale_x: 0,
scale_y: 0,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: 500,
onStopped: () => {
this.hide();
this.opacity = 0;
this.scale_x = 0;
this.scale_y = 0;
}
});
}
}

Expand All @@ -80,10 +111,9 @@ class Manager {
// Init Arrow
_initArrow() {
const WGSArrow = GObject.registerClass(WGSArrowClass);
this._myArrow = new WGSArrow('gie-inner-circle');
this._myArrow = new WGSArrow();
this._myArrow.hide();
Main.layoutManager.uiGroup.add_child(this._myArrow);
// this._myArrow.show();
this._myArrow.set_position(
200, 200
);
Expand Down Expand Up @@ -289,6 +319,11 @@ class Manager {
return this._settings.get_boolean("pinch-enable");
}

// Is On Overview
_isOnOverview() {
return Main.overview._shown;
}

// Check edge flags
_isEdge(edge) {
return ((this._edgeAction & edge) == edge);
Expand Down Expand Up @@ -450,6 +485,11 @@ class Manager {

// On touch gesture started
_touchStarted() {
// Stop if it was on overview
if (this._isOnOverview()) {
return Clutter.EVENT_STOP;
}

// Get current mouse position
let [pointerX, pointerY, pointerZ] = global.get_pointer();

Expand Down Expand Up @@ -593,6 +633,9 @@ class Manager {

// On touch gesture updated no targetWindow
_touchUpdateNoWindow() {
if (this._isOnOverview()) {
return Clutter.EVENT_STOP;
}
let threshold = this._gestureThreshold();
let absX = Math.abs(this._movePos.x);
let absY = Math.abs(this._movePos.y);
Expand Down Expand Up @@ -1260,6 +1303,7 @@ class Manager {

// End Pinch
_pinchEnd() {
this._myArrow.viewHide();
this.clearInterval(this._pinch.interval);
this._pinch.interval = 0;

Expand Down Expand Up @@ -1290,6 +1334,7 @@ class Manager {
this._pinch.begin = true;
this._pinch.canceled = false;
this._pinch.action = 0;
this._myArrow.viewShow();
return Clutter.EVENT_STOP;

case Clutter.TouchpadGesturePhase.UPDATE:
Expand Down
27 changes: 9 additions & 18 deletions src/stylesheet.css
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
.gie-circle {
border-radius: 5px;
.wgs-widget-indicator-icon {
color: #000;
margin: 10px;
width: 24px;
height: 24px;
}

.gie-inner-circle {
border: solid 2px #396bd7;
color: #396bd7;
background-color: #ffffff;
}

.gie-arrow-icon {
color: #396bd7;
margin: 10px 10px;
/* (50+2 - 32)/2 */
icon-size: 32px;
}

.gie-outer-circle {
background-color: rgba(68, 120, 175, 0.5);
border: solid 2px;
.wgs-widget-indicator {
border-radius: 8px;
border: 4px solid #357;
background-color: rgba(255, 255, 255, .5);
}

1 comment on commit e0a6e79

@amarullz
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve issue on overview. #10

Please sign in to comment.