mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-07 14:24:14 +01:00
- Removed the following 3 options from configuration: SelectWindowsMouseButton,
WindowListMouseButton and ApplicationMenuMouseButton. - Added 4 options to the configuration file for binding workspace actions to mouse buttons: MouseLeftButtonAction, MouseMiddleButtonAction, MouseRightButtonAction and MouseWheelAction. They replace the above 3 removed options, but use a different semantic. - mouse wheel action is runtime configurable now. Read details about this in NEWS.
This commit is contained in:
@@ -217,6 +217,12 @@ typedef enum {
|
||||
#define MS_SINGLE_TEXTURE 1
|
||||
#define MS_FLAT 2
|
||||
|
||||
/* workspace actions */
|
||||
#define WA_NONE 0
|
||||
#define WA_SELECT_WINDOWS 1
|
||||
#define WA_OPEN_APPMENU 2
|
||||
#define WA_OPEN_WINLISTMENU 3
|
||||
#define WA_SWITCH_WORKSPACES 4
|
||||
|
||||
/* workspace display position */
|
||||
#define WD_NONE 0
|
||||
@@ -431,9 +437,10 @@ typedef struct WPreferences {
|
||||
char superfluous; /* Use superfluous things */
|
||||
|
||||
/* root window mouse bindings */
|
||||
signed char select_button; /* button for window selection */
|
||||
signed char windowl_button; /* button for window list menu */
|
||||
signed char menu_button; /* button for app menu */
|
||||
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 */
|
||||
|
||||
/* balloon text */
|
||||
char window_balloon;
|
||||
|
||||
@@ -262,13 +262,17 @@ static WOptionEnumeration seSpeeds[] = {
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
static WOptionEnumeration seMouseButtons[] = {
|
||||
{"None", -1, 0},
|
||||
{"Left", Button1, 0}, {"Button1", Button1, 1},
|
||||
{"Middle", Button2, 0}, {"Button2", Button2, 1},
|
||||
{"Right", Button3, 0}, {"Button3", Button3, 1},
|
||||
{"Button4", Button4, 0},
|
||||
{"Button5", Button5, 0},
|
||||
static WOptionEnumeration seMouseButtonActions[] = {
|
||||
{"None", WA_NONE, 0},
|
||||
{"SelectWindows", WA_SELECT_WINDOWS, 0},
|
||||
{"OpenApplicationsMenu", WA_OPEN_APPMENU, 0},
|
||||
{"OpenWindowListMenu", WA_OPEN_WINLISTMENU, 0},
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
static WOptionEnumeration seMouseWheelActions[] = {
|
||||
{"None", WA_NONE, 0},
|
||||
{"SwitchWorkspaces", WA_SWITCH_WORKSPACES, 0},
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
@@ -389,14 +393,17 @@ WDefaultEntry optionList[] = {
|
||||
{"IconificationStyle", "Zoom", seIconificationStyles,
|
||||
&wPreferences.iconification_style, getEnum, NULL
|
||||
},
|
||||
{"SelectWindowsMouseButton", "Left", seMouseButtons,
|
||||
&wPreferences.select_button, getEnum, NULL
|
||||
{"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions,
|
||||
&wPreferences.mouse_button1, getEnum, NULL
|
||||
},
|
||||
{"WindowListMouseButton", "Middle", seMouseButtons,
|
||||
&wPreferences.windowl_button, getEnum, NULL
|
||||
{"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions,
|
||||
&wPreferences.mouse_button2, getEnum, NULL
|
||||
},
|
||||
{"ApplicationMenuMouseButton", "Right", seMouseButtons,
|
||||
&wPreferences.menu_button, getEnum, NULL
|
||||
{"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions,
|
||||
&wPreferences.mouse_button3, getEnum, NULL
|
||||
},
|
||||
{"MouseWheelAction", "None", seMouseWheelActions,
|
||||
&wPreferences.mouse_wheel, getEnum, NULL
|
||||
},
|
||||
{"PixmapPath", DEF_PIXMAP_PATHS, NULL,
|
||||
&wPreferences.pixmap_path, getPathList, NULL
|
||||
|
||||
74
src/event.c
74
src/event.c
@@ -590,6 +590,39 @@ handleExpose(XEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
executeButtonAction(WScreen *scr, XEvent *event, int action)
|
||||
{
|
||||
switch(action) {
|
||||
case WA_SELECT_WINDOWS:
|
||||
wUnselectWindows(scr);
|
||||
wSelectWindows(scr, event);
|
||||
break;
|
||||
case WA_OPEN_APPMENU:
|
||||
OpenRootMenu(scr, event->xbutton.x_root, event->xbutton.y_root, False);
|
||||
/* ugly hack */
|
||||
if (scr->root_menu) {
|
||||
if (scr->root_menu->brother->flags.mapped)
|
||||
event->xbutton.window = scr->root_menu->brother->frame->core->window;
|
||||
else
|
||||
event->xbutton.window = scr->root_menu->frame->core->window;
|
||||
}
|
||||
break;
|
||||
case WA_OPEN_WINLISTMENU:
|
||||
OpenSwitchMenu(scr, event->xbutton.x_root, event->xbutton.y_root, False);
|
||||
if (scr->switch_menu) {
|
||||
if (scr->switch_menu->brother->flags.mapped)
|
||||
event->xbutton.window = scr->switch_menu->brother->frame->core->window;
|
||||
else
|
||||
event->xbutton.window = scr->switch_menu->frame->core->window;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* bindable */
|
||||
static void
|
||||
handleButtonPress(XEvent *event)
|
||||
@@ -609,33 +642,22 @@ handleButtonPress(XEvent *event)
|
||||
|
||||
#ifndef LITE
|
||||
if (event->xbutton.window==scr->root_win) {
|
||||
if (event->xbutton.button==wPreferences.menu_button) {
|
||||
OpenRootMenu(scr, event->xbutton.x_root,
|
||||
event->xbutton.y_root, False);
|
||||
/* ugly hack */
|
||||
if (scr->root_menu) {
|
||||
if (scr->root_menu->brother->flags.mapped)
|
||||
event->xbutton.window = scr->root_menu->brother->frame->core->window;
|
||||
else
|
||||
event->xbutton.window = scr->root_menu->frame->core->window;
|
||||
}
|
||||
} else if (event->xbutton.button==wPreferences.windowl_button) {
|
||||
OpenSwitchMenu(scr, event->xbutton.x_root,
|
||||
event->xbutton.y_root, False);
|
||||
if (scr->switch_menu) {
|
||||
if (scr->switch_menu->brother->flags.mapped)
|
||||
event->xbutton.window = scr->switch_menu->brother->frame->core->window;
|
||||
else
|
||||
event->xbutton.window = scr->switch_menu->frame->core->window;
|
||||
}
|
||||
} else if (event->xbutton.button==wPreferences.select_button) {
|
||||
wUnselectWindows(scr);
|
||||
wSelectWindows(scr, event);
|
||||
} else if (event->xbutton.button==Button5) {
|
||||
wWorkspaceRelativeChange(scr, -1);
|
||||
} else if (event->xbutton.button==Button4) {
|
||||
if (event->xbutton.button==Button1 &&
|
||||
wPreferences.mouse_button1!=WA_NONE) {
|
||||
executeButtonAction(scr, event, wPreferences.mouse_button1);
|
||||
} else if (event->xbutton.button==Button2 &&
|
||||
wPreferences.mouse_button2!=WA_NONE) {
|
||||
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) {
|
||||
wWorkspaceRelativeChange(scr, 1);
|
||||
}
|
||||
} else if (event->xbutton.button==Button5 &&
|
||||
wPreferences.mouse_wheel!=WA_NONE) {
|
||||
wWorkspaceRelativeChange(scr, -1);
|
||||
}
|
||||
#ifdef GNOME_STUFF
|
||||
else if (wGNOMEProxyizeButtonEvent(scr, event))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user