This patch is adding atomic mouse actions to mouse buttons to: -focus on previous or next window -move to previous or next workspace
and adding wheel action to
-switch between windows
---
src/WindowMaker.h | 5 +++++
src/defaults.c | 5 +++++
src/event.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------
3 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 5d850db..53d2eaf 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -206,6 +206,11 @@ typedef enum {
#define WA_OPEN_APPMENU 2
#define WA_OPEN_WINLISTMENU 3
#define WA_SWITCH_WORKSPACES 4
+#define WA_MOVE_PREVWORKSPACE 5
+#define WA_MOVE_NEXTWORKSPACE 6
+#define WA_SWITCH_WINDOWS 7
+#define WA_MOVE_PREVWINDOW 8
+#define WA_MOVE_NEXTWINDOW 9
/* workspace display position */
#define WD_NONE 0
diff --git a/src/defaults.c b/src/defaults.c
index df7e919..72c8b6f 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -240,12 +240,17 @@ static WOptionEnumeration seMouseButtonActions[] = {
{"SelectWindows", WA_SELECT_WINDOWS, 0},
{"OpenApplicationsMenu", WA_OPEN_APPMENU, 0},
{"OpenWindowListMenu", WA_OPEN_WINLISTMENU, 0},
+ {"MoveToPrevWorkspace", WA_MOVE_PREVWORKSPACE, 0},
+ {"MoveToNextWorkspace", WA_MOVE_NEXTWORKSPACE, 0},
+ {"MoveToPrevWindow", WA_MOVE_PREVWINDOW, 0},
+ {"MoveToNextWindow", WA_MOVE_NEXTWINDOW, 0},
{NULL, 0, 0}
};
static WOptionEnumeration seMouseWheelActions[] = {
{"None", WA_NONE, 0},
{"SwitchWorkspaces", WA_SWITCH_WORKSPACES, 0},
+ {"SwitchWindows", WA_SWITCH_WINDOWS, 0},
{NULL, 0, 0}
};
diff --git a/src/event.c b/src/event.c
index 0ec1b77..55df69b 100644
--- a/src/event.c
+++ b/src/event.c
@@ -702,8 +702,35 @@ static void handleExpose(XEvent * event)
}
}
-static void executeButtonAction(WScreen * scr, XEvent * event, int action)
+static void executeWheelAction(WScreen *scr, XEvent *event, int action)
{
+ WWindow *wwin;
+ Bool next_direction = True;
+
+ if (event->xbutton.button == Button5 || event->xbutton.button == Button6)
+ next_direction = False;
+
+ switch (action) {
+ case WA_SWITCH_WORKSPACES:
+ if (next_direction)
+ wWorkspaceRelativeChange(scr, 1);
+ else
+ wWorkspaceRelativeChange(scr, -1);
+ break;
+ case WA_SWITCH_WINDOWS:
+ wwin = scr->focused_window;
+ if (next_direction)
+ wWindowFocusNext(wwin, True);
+ else
+ wWindowFocusPrev(wwin, True);
+ break;
+ }
+}
+
+static void executeButtonAction(WScreen *scr, XEvent *event, int action)
+{
+ WWindow *wwin;
+
switch (action) {
case WA_SELECT_WINDOWS:
wUnselectWindows(scr);
@@ -728,7 +755,19 @@ static void executeButtonAction(WScreen * scr,
XEvent * event, int action)
event->xbutton.window = scr->switch_menu->frame->core->window;
}
break;
- default:
+ case WA_MOVE_PREVWORKSPACE:
+ wWorkspaceRelativeChange(scr, -1);
+ break;
+ case WA_MOVE_NEXTWORKSPACE:
+ wWorkspaceRelativeChange(scr, 1);
+ break;
+ case WA_MOVE_PREVWINDOW:
+ wwin = scr->focused_window;
+ wWindowFocusPrev(wwin, True);
+ break;
+ case WA_MOVE_NEXTWINDOW:
+ wwin = scr->focused_window;
+ wWindowFocusNext(wwin, True);
break;
}
}
@@ -757,13 +796,13 @@ static void handleButtonPress(XEvent * event)
}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);
+ executeWheelAction(scr, event, wPreferences.mouse_wheel_scroll);
} else if (event->xbutton.button == Button5 &&
wPreferences.mouse_wheel_scroll != WA_NONE) {
- wWorkspaceRelativeChange(scr, -1);
+ executeWheelAction(scr, event, wPreferences.mouse_wheel_scroll);
} else if (event->xbutton.button == Button6 &&
wPreferences.mouse_wheel_tilt != WA_NONE) {
- wWorkspaceRelativeChange(scr, -1);
+ executeWheelAction(scr, event, wPreferences.mouse_wheel_tilt);
} else if (event->xbutton.button == Button7 &&
wPreferences.mouse_wheel_tilt != WA_NONE) {
- wWorkspaceRelativeChange(scr, 1);
+ executeWheelAction(scr, event, wPreferences.mouse_wheel_tilt);
}
}
--
1.8.3.2
0004-wmaker-add-new-button-and-wheel-mouse-actions.patch
Description: Binary data
