1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

wmaker: add support for more mouse buttons

This patch is adding support for back/forward mouse buttons
and the left/right wheel tilt buttons.
This commit is contained in:
David Maciejak
2014-08-27 16:17:10 +07:00
committed by Carlos R. Mafra
parent 1e06e1e29b
commit 2406256d48
4 changed files with 41 additions and 4 deletions

View File

@@ -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;

View File

@@ -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,

View File

@@ -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);
}
}

View File

@@ -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,