This patch is adding support for back/forward mouse buttons
and the left/right wheel tilt buttons.


---
 src/WindowMaker.h |  6 +++++-
 src/defaults.c    |  8 +++++++-
 src/event.c       | 13 +++++++++++--
 src/keybind.h     | 18 ++++++++++++++++++
 4 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 9689cba..5d850db 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -2,6 +2,7 @@
  *  Window Maker window manager
  *
  *  Copyright (c) 1997-2003 Alfredo K. Kojima
+ *  Copyright (c) 2014 Window Maker Team
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -388,7 +389,10 @@ extern struct WPreferences {
     signed char mouse_button1;       /* action for left mouse button */
     signed char mouse_button2;       /* action for middle mouse button */
     signed char mouse_button3;       /* action for right mouse button */
-    signed char mouse_wheel;       /* action for mouse wheel */
+    signed char mouse_button8;       /* action for 4th button aka
backward mouse button */
+    signed char mouse_button9;       /* action for 5th button aka
forward mouse button */
+    signed char mouse_wheel_scroll;  /* action for mouse wheel scroll */
+    signed char mouse_wheel_tilt;      /* action for mouse wheel tilt */

     /* balloon text */
     char window_balloon;
diff --git a/src/defaults.c b/src/defaults.c
index 332c0eb..2b938a3 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -359,8 +359,14 @@ WDefaultEntry optionList[] = {
     &wPreferences.mouse_button2, getEnum, NULL, NULL, NULL},
  {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions,
     &wPreferences.mouse_button3, getEnum, NULL, NULL, NULL},
+ {"MouseBackwardButtonAction", "None", seMouseButtonActions,
+    &wPreferences.mouse_button8, getEnum, NULL, NULL, NULL},
+ {"MouseForwardButtonAction", "None", seMouseButtonActions,
+    &wPreferences.mouse_button9, getEnum, NULL, NULL, NULL},
  {"MouseWheelAction", "None", seMouseWheelActions,
-    &wPreferences.mouse_wheel, getEnum, NULL, NULL, NULL},
+    &wPreferences.mouse_wheel_scroll, getEnum, NULL, NULL, NULL},
+ {"MouseWheelTiltAction", "None", seMouseWheelActions,
+    &wPreferences.mouse_wheel_tilt, getEnum, NULL, NULL, NULL},
  {"PixmapPath", DEF_PIXMAP_PATHS, NULL,
     &wPreferences.pixmap_path, getPathList, NULL, NULL, NULL},
  {"IconPath", DEF_ICON_PATHS, NULL,
diff --git a/src/event.c b/src/event.c
index 9757dad..9e41dc9 100644
--- a/src/event.c
+++ b/src/event.c
@@ -3,6 +3,7 @@
  *  Window Maker window manager
  *
  *  Copyright (c) 1997-2003 Alfredo K. Kojima
+ *  Copyright (c) 2014 Window Maker Team
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -751,10 +752,18 @@ static void handleButtonPress(XEvent * event)
  executeButtonAction(scr, event, wPreferences.mouse_button2);
  } else if (event->xbutton.button == Button3 &&
wPreferences.mouse_button3 != WA_NONE) {
  executeButtonAction(scr, event, wPreferences.mouse_button3);
- } else if (event->xbutton.button == Button4 &&
wPreferences.mouse_wheel != WA_NONE) {
+ } else if (event->xbutton.button == Button8 &&
wPreferences.mouse_button8 != WA_NONE) {
+ executeButtonAction(scr, event, wPreferences.mouse_button8);
+ }else if (event->xbutton.button == Button9 &&
wPreferences.mouse_button9 != WA_NONE) {
+ executeButtonAction(scr, event, wPreferences.mouse_button9);
+ } else if (event->xbutton.button == Button4 &&
wPreferences.mouse_wheel_scroll != WA_NONE) {
  wWorkspaceRelativeChange(scr, 1);
- } else if (event->xbutton.button == Button5 &&
wPreferences.mouse_wheel != WA_NONE) {
+ } else if (event->xbutton.button == Button5 &&
wPreferences.mouse_wheel_scroll != WA_NONE) {
  wWorkspaceRelativeChange(scr, -1);
+ } else if (event->xbutton.button == Button6 &&
wPreferences.mouse_wheel_tilt != WA_NONE) {
+ wWorkspaceRelativeChange(scr, -1);
+ } else if (event->xbutton.button == Button7 &&
wPreferences.mouse_wheel_tilt != WA_NONE) {
+ wWorkspaceRelativeChange(scr, 1);
  }
  }

diff --git a/src/keybind.h b/src/keybind.h
index 37ace18..11f0211 100644
--- a/src/keybind.h
+++ b/src/keybind.h
@@ -2,6 +2,7 @@
  *  Window Maker window manager
  *
  *  Copyright (c) 1997-2003 Alfredo K. Kojima
+ *  Copyright (c) 2014 Window Maker Team
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -21,6 +22,23 @@
 #ifndef WMKEYBIND_H
 #define WMKEYBIND_H

+/* <X11/X.h> doesn't define these, even though XFree supports them */
+#ifndef Button6
+#define Button6 6
+#endif
+
+#ifndef Button7
+#define Button7 7
+#endif
+
+#ifndef Button8
+#define Button8 8
+#endif
+
+#ifndef Button9
+#define Button9 9
+#endif
+
 enum {
  /* anywhere */
  WKBD_ROOTMENU,
--

Attachment: 0001-wmaker-add-support-for-more-mouse-buttons.patch
Description: Binary data

Reply via email to