Skip to content
Open
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
21 changes: 20 additions & 1 deletion extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class MprisLabel extends PanelMenu.Button {
const EXTENSION_PLACE = this.settings.get_string('extension-place');
const REPOSITION_DELAY = this.settings.get_int('reposition-delay');

this.mouseSettings = new Gio.Settings({ schema: 'org.gnome.desktop.peripherals.mouse' });
this.touchpadSettings = new Gio.Settings({ schema: 'org.gnome.desktop.peripherals.touchpad' });

this.box = new St.BoxLayout({
x_align: Clutter.ActorAlign.FILL
});
Expand Down Expand Up @@ -172,7 +175,7 @@ class MprisLabel extends PanelMenu.Button {
return Clutter.EVENT_STOP

if (event.is_pointer_emulated())
return Clutter.EVENT_PROPAGATE;
return Clutter.EVENT_STOP;

let delta = 0;
const time_delta = Date.now() - this.last_scroll;
Expand All @@ -198,6 +201,22 @@ class MprisLabel extends PanelMenu.Button {
return Clutter.EVENT_PROPAGATE;
}

// If natural-scroll is enabled, the scroll event we get is inverted.
// We need to invert it back.
switch (event.get_source_device().get_device_type()) {
case Clutter.InputDeviceType.POINTER_DEVICE:
// mouse
if(this.mouseSettings.get_boolean('natural-scroll'))
delta = -delta;
break;

case Clutter.InputDeviceType.TOUCHPAD_DEVICE:
// touchpad
if(this.touchpadSettings.get_boolean('natural-scroll'))
delta = -delta;
break;
}

if(!delta == 0)
switch(SCROLL_ACTION) {
case "volume-controls":
Expand Down