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

Adding option to use horizontal scroll as a gesture #153

Open
wants to merge 1 commit 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: 2 additions & 0 deletions chrome/content/firegestures/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ var FireGestures = {
switch (aGesture) {
case "wheel-up":
case "wheel-down":
case "wheel-left":
case "wheel-right":
case "rocker-left":
case "rocker-right":
case "keypress-ctrl":
Expand Down
28 changes: 28 additions & 0 deletions chrome/content/firegestures/prefs-generic.xul
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<preferences>
<preference id="pref:triggerbutton" name="extensions.firegestures.trigger_button" type="int" />
<preference id="pref:wheelgesture" name="extensions.firegestures.wheelgesture" type="bool" />
<preference id="pref:hwheelgesture" name="extensions.firegestures.hwheelgesture" type="bool" />
<preference id="pref:rockergesture" name="extensions.firegestures.rockergesture" type="bool" />
</preferences>
<groupbox uigroup="wheelgesture">
Expand Down Expand Up @@ -86,6 +87,33 @@
</rows>
</grid>
</groupbox>
<groupbox uigroup="hwheelgesture">
<!-- dummy -->
<checkbox id="hwheelgesture" hidden="true"
preference="pref:hwheelgesture"
onsyncfrompreference="PrefsUI.updateUIGroup('hwheelgesture');" />
<caption label="&hwheelgesture;" />
<grid>
<columns>
<column />
<column />
</columns>
<rows>
<row align="center">
<label value="&hwheelgesture.left;:" />
<menulist id="wheelgestureL" sizetopopup="none" oncommand="gShouldCommit = true;">
<menupopup />
</menulist>
</row>
<row align="center">
<label value="&hwheelgesture.right;:" />
<menulist id="wheelgestureR" sizetopopup="none" oncommand="gShouldCommit = true;">
<menupopup />
</menulist>
</row>
</rows>
</grid>
</groupbox>
<groupbox uigroup="rockergesture">
<!-- dummy -->
<checkbox id="rockergesture" hidden="true"
Expand Down
2 changes: 2 additions & 0 deletions chrome/content/firegestures/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const kFlagsCol = 4;
const kExtraArray1 = [
["wheelGestureU", "wheel-up" ],
["wheelGestureD", "wheel-down" ],
["wheelGestureL", "wheel-left" ],
["wheelGestureR", "wheel-right" ],
["rockerGestureL", "rocker-left" ],
["rockerGestureR", "rocker-right"],
["swipeGestureL", "swipe-left" ],
Expand Down
28 changes: 28 additions & 0 deletions chrome/content/firegestures/prefs.xul
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
<prefpane id="advancedPane" label="&advancedPane;" flex="1">
<preferences>
<preference id="pref:wheelgesture" name="extensions.firegestures.wheelgesture" type="bool" />
<preference id="pref:hwheelGesture" name="extensions.firegestures.hwheelGesture" type="bool" />
<preference id="pref:rockergesture" name="extensions.firegestures.rockergesture" type="bool" />
<preference id="pref:keypressgesture" name="extensions.firegestures.keypressgesture" type="bool" />
<preference id="pref:tabwheelgesture" name="extensions.firegestures.tabwheelgesture" type="bool" />
Expand Down Expand Up @@ -194,6 +195,33 @@
</rows>
</grid>
</groupbox>
<groupbox uigroup="hwheelGesture">
<caption>
<checkbox id="hwheelGesture" label="&hwheelGesture;"
preference="pref:hwheelGesture"
onsyncfrompreference="PrefsUI.updateUIGroup('hwheelGesture');" />
</caption>
<grid>
<columns>
<column />
<column />
</columns>
<rows>
<row align="center">
<label value="&hwheelGesture.left;:" />
<menulist id="wheelGestureL" sizetopopup="none" oncommand="gShouldCommit = true;">
<menupopup />
</menulist>
</row>
<row align="center">
<label value="&hwheelGesture.right;:" />
<menulist id="wheelGestureR" sizetopopup="none" oncommand="gShouldCommit = true;">
<menupopup />
</menulist>
</row>
</rows>
</grid>
</groupbox>
<groupbox uigroup="rockergesture">
<caption>
<checkbox id="rockergesture" label="&rockerGesture;"
Expand Down
3 changes: 3 additions & 0 deletions chrome/locale/en-US/firegestures/prefs.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<!ENTITY wheelGesture.down.left "Scroll down with holding left-button">
<!ENTITY wheelGesture.down.middle "Scroll down with holding middle-button">
<!ENTITY wheelGesture.down.right "Scroll down with holding right-button">
<!ENTITY hwheelGesture "Horizontal Wheel Gestures">
<!ENTITY hwheelGesture.left "Scroll Left">
<!ENTITY hwheelGesture.right "Scroll Right">
<!ENTITY rockerGesture "Rocker Gestures">
<!ENTITY rockerGesture.left "Left-click with holding right-button">
<!ENTITY rockerGesture.right "Right-click with holding left-button">
Expand Down
12 changes: 11 additions & 1 deletion components/xdGestureHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,14 @@ xdGestureHandler.prototype = {
this._swipeTimeout = getPref("swipe_timeout");
this._mouseGestureEnabled = getPref("mousegesture");
this._wheelGestureEnabled = getPref("wheelgesture");
this._hwheelGestureEnabled = getPref("hwheelgesture");
this._rockerGestureEnabled = getPref("rockergesture");
this._keypressGestureEnabled = getPref("keypressgesture");
this._swipeGestureEnabled = getPref("swipegesture");
// prefs for wheel gestures and rocker gestures
this._drawArea.removeEventListener("DOMMouseScroll", this, true);
this._drawArea.removeEventListener("click", this, true);
if (this._wheelGestureEnabled)
if (this._wheelGestureEnabled || this._hwheelGestureEnabled)
this._drawArea.addEventListener("DOMMouseScroll", this, true);
if (this._rockerGestureEnabled)
this._drawArea.addEventListener("click", this, true);
Expand Down Expand Up @@ -355,6 +356,15 @@ xdGestureHandler.prototype = {
// required to suppress page scroll if using SmoothWheel or Yet Another Smooth Scrolling
event.stopPropagation();
}
if (event.axis == 1) {
this._state = STATE_WHEEL;
this._invokeExtraGesture(event, event.detail < 0 ? "wheel-left" : "wheel-right");
// suppress page scroll
event.preventDefault();
// required to suppress page scroll if using SmoothWheel or Yet Another Smooth Scrolling
event.stopPropagation();
this._state = STATE_READY;
}
break;
case "click":
// this fixes the bug: performing rocker-left on a link causes visiting the link
Expand Down
1 change: 1 addition & 0 deletions defaults/preferences/firegestures-prefs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pref("extensions.firegestures.mousegesture", true);
pref("extensions.firegestures.wheelgesture", true);
pref("extensions.firegestures.hwheelgesture", false);
pref("extensions.firegestures.rockergesture", false);
pref("extensions.firegestures.keypressgesture", true);
pref("extensions.firegestures.tabwheelgesture", false);
Expand Down