Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented workspace switching by scrolling on and the edge of the … #249

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">If icons overflow the dock, only the &lt;i&gt;Show Applications&lt;/i&gt; icon is active.</property>
<property name="label" translatable="yes">If icons overflow the dock, only the edge of the dock and the &lt;i&gt;Show Applications&lt;/i&gt; icon are active.</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
<style>
Expand Down
37 changes: 36 additions & 1 deletion myDash.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,42 @@ const myDash = new Lang.Class({

// If scroll is not used because the icon is resized, let the scroll event propagate.
if (!this._dtdSettings.get_boolean('icon-size-fixed'))
return Clutter.EVENT_PROPAGATE;
return Clutter.EVENT_PROPAGATE;

let monitorIndex = this._dtdSettings.get_int('preferred-monitor');
let workArea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex);

// Event coordinates are relative to the stage but can be transformed
// as the actor will only receive events within his bounds.
let stage_x, stage_y, ok, event_x, event_y, actor_w, actor_h;
[stage_x, stage_y] = event.get_coords();
[ok, event_x, event_y] = actor.transform_stage_point(stage_x, stage_y);
[actor_w, actor_h] = actor.get_size();

// If there is no need to scroll, or if the scroll event is within a 1px
// margin from the relevant edge of the actor, let the event propagate.
switch( this._position ) {
case St.Side.LEFT:
if (workArea.height > this._container.height || actor.child.height < actor.height
|| event_x <= 1)
return Clutter.EVENT_PROPAGATE;
break;
case St.Side.RIGHT:
if (workArea.height > this._container.height || actor.child.height < actor.height
|| event_x >= actor_w - 2)
return Clutter.EVENT_PROPAGATE;
break;
case St.Side.TOP:
if (workArea.width > this._container.width || actor.child.width < actor.width
|| event_y <= 1)
return Clutter.EVENT_PROPAGATE;
break;
case St.Side.BOTTOM:
if (workArea.width > this._container.width || actor.child.width < actor.width
|| event_y >= actor_h - 2)
return Clutter.EVENT_PROPAGATE;
break;
}

// reset timeout to avid conflicts with the mousehover event
if (this._ensureAppIconVisibilityTimeoutId>0) {
Expand Down