Skip to content

Commit e2b86b2

Browse files
JoseExpositotintou
authored andcommitted
hot corners: Pressure corner to trigger
In order to avoid accidental triggers, don't trigger the hot corner until a given threshold is reached. Fix #1100
1 parent 2eb419e commit e2b86b2

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/HotCorners/HotCorner.vala

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public class Gala.HotCorner : Object {
3434
public const string POSITION_BOTTOM_RIGHT = "hotcorner-bottomright";
3535
private const int BARRIER_SIZE = 30;
3636

37+
/**
38+
* In order to avoid accidental triggers, don't trigger the hot corner until
39+
* this threshold is reached.
40+
*/
41+
private const int TRIGGER_PRESSURE_THRESHOLD = 50;
42+
3743
/**
3844
* When the mouse pointer pressures the barrier without activating the hot corner,
3945
* release it when this threshold is reached.
@@ -135,14 +141,17 @@ public class Gala.HotCorner : Object {
135141
barrier.pressure_x += event.dx;
136142
barrier.pressure_y += event.dy;
137143

138-
if (!triggered && vertical_barrier.is_hit && horizontal_barrier.is_hit) {
139-
trigger_hot_corner ();
140-
}
141-
142144
var pressure = (barrier == vertical_barrier) ?
143145
barrier.pressure_x.abs () :
144146
barrier.pressure_y.abs ();
145147

148+
if (!triggered && vertical_barrier.is_hit && horizontal_barrier.is_hit) {
149+
if (pressure.abs () > TRIGGER_PRESSURE_THRESHOLD) {
150+
trigger_hot_corner ();
151+
pressure = 0;
152+
}
153+
}
154+
146155
if (!triggered && pressure.abs () > RELEASE_PRESSURE_THRESHOLD) {
147156
barrier.release (event);
148157
}

0 commit comments

Comments
 (0)