1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +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:
dan
2001-04-27 23:41:17 +00:00
parent 649a7ac82c
commit 3bde6495a3
8 changed files with 287 additions and 167 deletions

View File

@@ -47,6 +47,12 @@ Changes since version 0.64.0:
a need to restart as until now). a need to restart as until now).
- Fixed a bug in the icon chooser dialog that made the selected icon look - Fixed a bug in the icon chooser dialog that made the selected icon look
wrong if it had alpha blending. wrong if it had alpha blending.
- 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. More in NEWS.
Changes since version 0.63.1: Changes since version 0.63.1:

45
NEWS
View File

@@ -10,6 +10,51 @@ Single AppIcon
Removed --single-appicon patch and replaced it with a application Removed --single-appicon patch and replaced it with a application
specific collapsing option. Check inspector panel and appicon menu. specific collapsing option. Check inspector panel and appicon menu.
New options to configure the workspace mouse actions
----------------------------------------------------
The following options were removed from the WindowMaker defaults configuration
file:
SelectWindowsMouseButton, WindowListMouseButton and ApplicationMenuMouseButton.
They were replaced with the following 3+1:
MouseLeftButtonAction, MouseMiddleButtonAction and MouseRightButtonAction plus
MouseWheelAction
In the old way because all gravitated around the workspace actions to which
specific mouse buttons could have been bound, it allowed one to specify in
the configuration file settings which would have led to weird situations
that also had undesirable results.
For example the same mouse button (for example left) could have been
assigned to all workspace actions: 'select windows', 'show window list menu'
and 'show applications menu' which of course were not only impossible to
accomplish while still having a properly working workspace, but they also
allowed one to specify some settings in the configuration file that were
never in fact translatable to proper workspace actions.
To void this kind of user interface inconsistency, the new options now
gravitate around the physical device (the mouse and its buttons) to which
specific workspace actions can be bound. This way, even if one assigns the
same action to all mouse buttons, that situation while gives redundant and
unpractical settings it will still translatable to proper workspace actions:
all buttons will execute the same action, but a button will execute only one
action at a time.
The new options take the following values:
all Mouse...ButtonAction can have one of the following values:
None, SelectWindows, OpenApplicationsMenu or OpenWindowListMenu
MouseWheelAction can be one of None or SwitchWorkspaces
If you had the default actions bound to mouse buttons before, then it will
work for you without any intervention in the configuration files.
Else you need to use WPrefs.app to bind the actions to the mouse buttons
again to your old settings. Also if you want to change the mouse wheel
behavior regarding workspaces you can now (use WPrefs.app to do this).
--- 0.64.0 --- 0.64.0

View File

@@ -63,12 +63,14 @@ typedef struct _Panel {
DoubleTest *tester; DoubleTest *tester;
WMFrame *menuF; WMFrame *menuF;
WMLabel *listL; WMLabel *button1L;
WMLabel *appL; WMLabel *button2L;
WMLabel *selL; WMLabel *button3L;
WMPopUpButton *listP; WMLabel *wheelL;
WMPopUpButton *appP; WMPopUpButton *button1P;
WMPopUpButton *selP; WMPopUpButton *button2P;
WMPopUpButton *button3P;
WMPopUpButton *wheelP;
WMButton *disaB; WMButton *disaB;
@@ -97,7 +99,9 @@ typedef struct _Panel {
static char *modifierNames[8]; static char *modifierNames[8];
static char *buttonNames[6]; static char *buttonActions[4];
static char *wheelActions[2];
#define DELAY(i) ((i)*75+170) #define DELAY(i) ((i)*75+170)
@@ -194,32 +198,37 @@ doubleClick(WMWidget *w, void *data)
int int
getbutton(char *str) getButtonAction(char *str)
{ {
if (!str) if (!str)
return -2; return -2;
if (strcasecmp(str, "none")==0) if (strcasecmp(str, "None")==0)
return 0; return 0;
else if (strcasecmp(str, "left")==0) else if (strcasecmp(str, "OpenApplicationsMenu")==0)
return 1; return 1;
else if (strcasecmp(str, "middle")==0) else if (strcasecmp(str, "OpenWindowListMenu")==0)
return 2; return 2;
else if (strcasecmp(str, "right")==0) else if (strcasecmp(str, "SelectWindows")==0)
return 3; return 3;
else if (strcasecmp(str, "button1")==0) else
return -1;
}
getWheelAction(char *str)
{
if (!str)
return -2;
if (strcasecmp(str, "None")==0)
return 0;
else if (strcasecmp(str, "SwitchWorkspaces")==0)
return 1; return 1;
else if (strcasecmp(str, "button2")==0) else
return 2;
else if (strcasecmp(str, "button3")==0)
return 3;
else if (strcasecmp(str, "button4")==0)
return 4;
else if (strcasecmp(str, "button5")==0) {
return 5;
} else {
return -1; return -1;
}
} }
@@ -240,52 +249,58 @@ showData(_Panel *panel)
{ {
char *str; char *str;
int i; int i;
int a=-1, b=-1, c=-1; int a=-1, b=-1, c=-1, w=-1;
float accel; float accel;
char buffer[32]; char buffer[32];
Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->parent)); Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->parent));
str = GetStringForKey("SelectWindowsMouseButton"); str = GetStringForKey("MouseLeftButtonAction");
if (str) { i = getButtonAction(str);
i = getbutton(str); if (i<0) {
if (i==-1) { a = 3;
a = 1; if (i==-1) {
wwarning(_("bad value %s for option %s"),str, "SelectWindowsMouseButton"); wwarning(_("bad value %s for option %s"), str, "MouseLeftButtonAction");
} else if (i>=0) { }
a = i;
}
} else { } else {
a = 0; a = i;
} }
WMSetPopUpButtonSelectedItem(panel->selP, a); WMSetPopUpButtonSelectedItem(panel->button1P, a);
str = GetStringForKey("WindowListMouseButton"); str = GetStringForKey("MouseMiddleButtonAction");
if (str) { i = getButtonAction(str);
i = getbutton(str); if (i<0) {
if (i==-1) { b = 2;
b = 2; if (i==-1) {
wwarning(_("bad value %s for option %s"), str, "WindowListMouseButton"); wwarning(_("bad value %s for option %s"), str, "MouseMiddleButtonAction");
} else if (i>=0) { }
b = i;
}
} else { } else {
b = 0; b = i;
} }
WMSetPopUpButtonSelectedItem(panel->listP, b); WMSetPopUpButtonSelectedItem(panel->button2P, b);
str = GetStringForKey("ApplicationMenuMouseButton"); str = GetStringForKey("MouseRightButtonAction");
if (str) { i = getButtonAction(str);
i = getbutton(str); if (i<0) {
if (i==-1) { c = 1;
c = 3; if (i==-1) {
wwarning(_("bad value %s for option %s"), str, "ApplicationMenuMouseButton"); wwarning(_("bad value %s for option %s"), str, "MouseRightButtonAction");
} else if (i>=0) { }
c = i;
}
} else { } else {
c = 0; c = i;
} }
WMSetPopUpButtonSelectedItem(panel->appP, c); WMSetPopUpButtonSelectedItem(panel->button3P, c);
str = GetStringForKey("MouseWheelAction");
i = getWheelAction(str);
if (i<0) {
w = 0;
if (i==-1) {
wwarning(_("bad value %s for option %s"), str, "MouseWheelAction");
}
} else {
w = i;
}
WMSetPopUpButtonSelectedItem(panel->wheelP, w);
WMSetButtonSelected(panel->disaB, GetBoolForKey("DisableWSMouseActions")); WMSetButtonSelected(panel->disaB, GetBoolForKey("DisableWSMouseActions"));
@@ -458,7 +473,7 @@ createPanel(Panel *p)
/**************** Mouse Speed ****************/ /**************** Mouse Speed ****************/
panel->speedF = WMCreateFrame(panel->box); panel->speedF = WMCreateFrame(panel->box);
WMResizeWidget(panel->speedF, 245, 100); WMResizeWidget(panel->speedF, 245, 100);
WMMoveWidget(panel->speedF, 15, 15); WMMoveWidget(panel->speedF, 15, 5);
WMSetFrameTitle(panel->speedF, _("Mouse Speed")); WMSetFrameTitle(panel->speedF, _("Mouse Speed"));
panel->speedL = WMCreateLabel(panel->speedF); panel->speedL = WMCreateLabel(panel->speedF);
@@ -515,8 +530,8 @@ createPanel(Panel *p)
/***************** Doubleclick Delay ****************/ /***************** Doubleclick Delay ****************/
panel->ddelaF = WMCreateFrame(panel->box); panel->ddelaF = WMCreateFrame(panel->box);
WMResizeWidget(panel->ddelaF, 245, 95); WMResizeWidget(panel->ddelaF, 245, 105);
WMMoveWidget(panel->ddelaF, 15, 125); WMMoveWidget(panel->ddelaF, 15, 115);
WMSetFrameTitle(panel->ddelaF, _("Double-Click Delay")); WMSetFrameTitle(panel->ddelaF, _("Double-Click Delay"));
buf1 = wmalloc(strlen(DELAY_ICON)+2); buf1 = wmalloc(strlen(DELAY_ICON)+2);
@@ -526,7 +541,7 @@ createPanel(Panel *p)
panel->ddelaB[i] = WMCreateCustomButton(panel->ddelaF, panel->ddelaB[i] = WMCreateCustomButton(panel->ddelaF,
WBBStateChangeMask); WBBStateChangeMask);
WMResizeWidget(panel->ddelaB[i], 25, 25); WMResizeWidget(panel->ddelaB[i], 25, 25);
WMMoveWidget(panel->ddelaB[i], 30+(40*i), 20); WMMoveWidget(panel->ddelaB[i], 30+(40*i), 25);
WMSetButtonBordered(panel->ddelaB[i], False); WMSetButtonBordered(panel->ddelaB[i], False);
WMSetButtonImagePosition(panel->ddelaB[i], WIPImageOnly); WMSetButtonImagePosition(panel->ddelaB[i], WIPImageOnly);
WMSetButtonAction(panel->ddelaB[i], doubleClick, panel); WMSetButtonAction(panel->ddelaB[i], doubleClick, panel);
@@ -563,15 +578,15 @@ createPanel(Panel *p)
panel->tester = CreateDoubleTest(panel->ddelaF, _("Test")); panel->tester = CreateDoubleTest(panel->ddelaF, _("Test"));
WMResizeWidget(panel->tester, 84, 29); WMResizeWidget(panel->tester, 84, 29);
WMMoveWidget(panel->tester, 35, 55); WMMoveWidget(panel->tester, 35, 60);
panel->ddelaT = WMCreateTextField(panel->ddelaF); panel->ddelaT = WMCreateTextField(panel->ddelaF);
WMResizeWidget(panel->ddelaT, 40, 20); WMResizeWidget(panel->ddelaT, 40, 20);
WMMoveWidget(panel->ddelaT, 140, 60); WMMoveWidget(panel->ddelaT, 140, 65);
panel->ddelaL = WMCreateLabel(panel->ddelaF); panel->ddelaL = WMCreateLabel(panel->ddelaF);
WMResizeWidget(panel->ddelaL, 40, 16); WMResizeWidget(panel->ddelaL, 40, 16);
WMMoveWidget(panel->ddelaL, 185, 65); WMMoveWidget(panel->ddelaL, 185, 70);
{ {
WMFont *font; WMFont *font;
WMColor *color; WMColor *color;
@@ -586,62 +601,74 @@ createPanel(Panel *p)
WMSetLabelText(panel->ddelaL, _("msec")); WMSetLabelText(panel->ddelaL, _("msec"));
WMMapSubwidgets(panel->ddelaF); WMMapSubwidgets(panel->ddelaF);
/* ************** Workspace Action Buttons **************** */ /* ************** Workspace Action Buttons **************** */
panel->menuF = WMCreateFrame(panel->box); panel->menuF = WMCreateFrame(panel->box);
WMResizeWidget(panel->menuF, 240, 145); WMResizeWidget(panel->menuF, 240, 160);
WMMoveWidget(panel->menuF, 270, 15); WMMoveWidget(panel->menuF, 270, 5);
WMSetFrameTitle(panel->menuF, _("Workspace Mouse Actions")); WMSetFrameTitle(panel->menuF, _("Workspace Mouse Actions"));
panel->disaB = WMCreateSwitchButton(panel->menuF); panel->disaB = WMCreateSwitchButton(panel->menuF);
WMResizeWidget(panel->disaB, 205, 18); WMResizeWidget(panel->disaB, 205, 18);
WMMoveWidget(panel->disaB, 10, 20); WMMoveWidget(panel->disaB, 10, 18);
WMSetButtonText(panel->disaB, _("Disable mouse actions")); WMSetButtonText(panel->disaB, _("Disable mouse actions"));
panel->button1L = WMCreateLabel(panel->menuF);
panel->appL = WMCreateLabel(panel->menuF); WMResizeWidget(panel->button1L, 87, 20);
WMResizeWidget(panel->appL, 125, 16); WMMoveWidget(panel->button1L, 5, 45);
WMMoveWidget(panel->appL, 5, 45); WMSetLabelTextAlignment(panel->button1L, WARight);
WMSetLabelTextAlignment(panel->appL, WARight); WMSetLabelText(panel->button1L, _("Left Button"));
WMSetLabelText(panel->appL, _("Applications menu"));
panel->appP = WMCreatePopUpButton(panel->menuF); panel->button1P = WMCreatePopUpButton(panel->menuF);
WMResizeWidget(panel->appP, 95, 20); WMResizeWidget(panel->button1P, 135, 20);
WMMoveWidget(panel->appP, 135, 45); WMMoveWidget(panel->button1P, 95, 45);
panel->listL = WMCreateLabel(panel->menuF); panel->button2L = WMCreateLabel(panel->menuF);
WMResizeWidget(panel->listL, 125, 16); WMResizeWidget(panel->button2L, 87, 20);
WMMoveWidget(panel->listL, 5, 80); WMMoveWidget(panel->button2L, 5, 73);
WMSetLabelTextAlignment(panel->listL, WARight); WMSetLabelTextAlignment(panel->button2L, WARight);
WMSetLabelText(panel->listL, _("Window list menu")); WMSetLabelText(panel->button2L, _("Middle Button"));
panel->listP = WMCreatePopUpButton(panel->menuF); panel->button2P = WMCreatePopUpButton(panel->menuF);
WMResizeWidget(panel->listP, 95, 20); WMResizeWidget(panel->button2P, 135, 20);
WMMoveWidget(panel->listP, 135, 80); WMMoveWidget(panel->button2P, 95, 73);
panel->button3L = WMCreateLabel(panel->menuF);
panel->selL = WMCreateLabel(panel->menuF); WMResizeWidget(panel->button3L, 87, 20);
WMResizeWidget(panel->selL, 125, 16); WMMoveWidget(panel->button3L, 5, 101);
WMMoveWidget(panel->selL, 5, 115); WMSetLabelTextAlignment(panel->button3L, WARight);
WMSetLabelTextAlignment(panel->selL, WARight); WMSetLabelText(panel->button3L, _("Right Button"));
WMSetLabelText(panel->selL, _("Select windows"));
panel->selP = WMCreatePopUpButton(panel->menuF); panel->button3P = WMCreatePopUpButton(panel->menuF);
WMResizeWidget(panel->selP, 95, 20); WMResizeWidget(panel->button3P, 135, 20);
WMMoveWidget(panel->selP, 135, 115); WMMoveWidget(panel->button3P, 95, 101);
for (i = 0; i < sizeof(buttonNames)/sizeof(char*); i++) { panel->wheelL = WMCreateLabel(panel->menuF);
WMAddPopUpButtonItem(panel->appP, buttonNames[i]); WMResizeWidget(panel->wheelL, 87, 20);
WMAddPopUpButtonItem(panel->selP, buttonNames[i]); WMMoveWidget(panel->wheelL, 5, 129);
WMAddPopUpButtonItem(panel->listP, buttonNames[i]); WMSetLabelTextAlignment(panel->wheelL, WARight);
WMSetLabelText(panel->wheelL, _("Mouse Wheel"));
panel->wheelP = WMCreatePopUpButton(panel->menuF);
WMResizeWidget(panel->wheelP, 135, 20);
WMMoveWidget(panel->wheelP, 95, 129);
for (i = 0; i < sizeof(buttonActions)/sizeof(char*); i++) {
WMAddPopUpButtonItem(panel->button1P, buttonActions[i]);
WMAddPopUpButtonItem(panel->button2P, buttonActions[i]);
WMAddPopUpButtonItem(panel->button3P, buttonActions[i]);
} }
for (i = 0; i < sizeof(wheelActions)/sizeof(char*); i++) {
WMAddPopUpButtonItem(panel->wheelP, wheelActions[i]);
}
WMMapSubwidgets(panel->menuF); WMMapSubwidgets(panel->menuF);
/* ************** Grab Modifier **************** */ /* ************** Grab Modifier **************** */
panel->grabF = WMCreateFrame(panel->box); panel->grabF = WMCreateFrame(panel->box);
WMResizeWidget(panel->grabF, 240, 55); WMResizeWidget(panel->grabF, 240, 50);
WMMoveWidget(panel->grabF, 270, 165); WMMoveWidget(panel->grabF, 270, 170);
WMSetFrameTitle(panel->grabF, _("Mouse Grab Modifier")); WMSetFrameTitle(panel->grabF, _("Mouse Grab Modifier"));
WMSetBalloonTextForView(_("Keyboard modifier to use for actions that\n" WMSetBalloonTextForView(_("Keyboard modifier to use for actions that\n"
@@ -651,7 +678,7 @@ createPanel(Panel *p)
panel->grabP = WMCreatePopUpButton(panel->grabF); panel->grabP = WMCreatePopUpButton(panel->grabF);
WMResizeWidget(panel->grabP, 160, 20); WMResizeWidget(panel->grabP, 160, 20);
WMMoveWidget(panel->grabP, 40, 25); WMMoveWidget(panel->grabP, 40, 20);
fillModifierPopUp(panel->grabP); fillModifierPopUp(panel->grabP);
@@ -746,7 +773,8 @@ storeData(_Panel *panel)
char buffer[64]; char buffer[64];
int i; int i;
char *tmp, *p; char *tmp, *p;
static char *button[6] = {"None", "left", "middle", "right", "Button4", "Button5"}; static char *button[4] = {"None", "OpenApplicationsMenu", "OpenWindowListMenu", "SelectWindows"};
static char *wheel[2] = {"None", "SwitchWorkspaces"};
WMUserDefaults *udb = WMGetStandardUserDefaults(); WMUserDefaults *udb = WMGetStandardUserDefaults();
if (!WMGetUDBoolForKey(udb, "NoXSetStuff")) { if (!WMGetUDBoolForKey(udb, "NoXSetStuff")) {
@@ -769,14 +797,17 @@ storeData(_Panel *panel)
SetBoolForKey(WMGetButtonSelected(panel->disaB), "DisableWSMouseActions"); SetBoolForKey(WMGetButtonSelected(panel->disaB), "DisableWSMouseActions");
i = WMGetPopUpButtonSelectedItem(panel->appP); i = WMGetPopUpButtonSelectedItem(panel->button1P);
SetStringForKey(button[i], "ApplicationMenuMouseButton"); SetStringForKey(button[i], "MouseLeftButtonAction");
i = WMGetPopUpButtonSelectedItem(panel->listP); i = WMGetPopUpButtonSelectedItem(panel->button2P);
SetStringForKey(button[i], "WindowListMouseButton"); SetStringForKey(button[i], "MouseMiddleButtonAction");
i = WMGetPopUpButtonSelectedItem(panel->selP); i = WMGetPopUpButtonSelectedItem(panel->button3P);
SetStringForKey(button[i], "SelectWindowsMouseButton"); SetStringForKey(button[i], "MouseRightButtonAction");
i = WMGetPopUpButtonSelectedItem(panel->wheelP);
SetStringForKey(wheel[i], "MouseWheelAction");
tmp = WMGetPopUpButtonItem(panel->grabP, tmp = WMGetPopUpButtonItem(panel->grabP,
WMGetPopUpButtonSelectedItem(panel->grabP)); WMGetPopUpButtonSelectedItem(panel->grabP));
@@ -803,14 +834,15 @@ InitMouseSettings(WMScreen *scr, WMWidget *parent)
modifierNames[5] = wstrdup(_("Mod3")); modifierNames[5] = wstrdup(_("Mod3"));
modifierNames[6] = wstrdup(_("Mod4")); modifierNames[6] = wstrdup(_("Mod4"));
modifierNames[7] = wstrdup(_("Mod5")); modifierNames[7] = wstrdup(_("Mod5"));
buttonNames[0] = wstrdup(_("None")); buttonActions[0] = wstrdup(_("None"));
buttonNames[1] = wstrdup(_("Btn1 (left)")); buttonActions[1] = wstrdup(_("Applications Menu"));
buttonNames[2] = wstrdup(_("Btn2 (middle)")); buttonActions[2] = wstrdup(_("Window List Menu"));
buttonNames[3] = wstrdup(_("Btn3 (right)")); buttonActions[3] = wstrdup(_("Select Windows"));
buttonNames[4] = wstrdup(_("Btn4"));
buttonNames[5] = wstrdup(_("Btn5")); wheelActions[0] = wstrdup(_("None"));
wheelActions[1] = wstrdup(_("Switch Workspaces"));
panel = wmalloc(sizeof(_Panel)); panel = wmalloc(sizeof(_Panel));
memset(panel, 0, sizeof(_Panel)); memset(panel, 0, sizeof(_Panel));

View File

@@ -270,10 +270,10 @@ createPanel(Panel *p)
WMAddPopUpButtonItem(panel->posP, _("Center")); WMAddPopUpButtonItem(panel->posP, _("Center"));
WMAddPopUpButtonItem(panel->posP, _("Top")); WMAddPopUpButtonItem(panel->posP, _("Top"));
WMAddPopUpButtonItem(panel->posP, _("Bottom")); WMAddPopUpButtonItem(panel->posP, _("Bottom"));
WMAddPopUpButtonItem(panel->posP, _("Top/left")); WMAddPopUpButtonItem(panel->posP, _("Top/Left"));
WMAddPopUpButtonItem(panel->posP, _("Top/right")); WMAddPopUpButtonItem(panel->posP, _("Top/Right"));
WMAddPopUpButtonItem(panel->posP, _("Bottom/left")); WMAddPopUpButtonItem(panel->posP, _("Bottom/Left"));
WMAddPopUpButtonItem(panel->posP, _("Bottom/right")); WMAddPopUpButtonItem(panel->posP, _("Bottom/Right"));
WMMapSubwidgets(panel->navF); WMMapSubwidgets(panel->navF);

View File

@@ -31,9 +31,10 @@
IconSize = 64; IconSize = 64;
FocusMode = manual; FocusMode = manual;
DisableWSMouseActions = NO; DisableWSMouseActions = NO;
SelectWindowsMouseButton = left; MouseLeftButtonAction = SelectWindows;
WindowListMouseButton = middle; MouseMiddleButtonAction = OpenWindowListMenu;
ApplicationMenuMouseButton = right; MouseRightButtonAction = OpenApplicationsMenu;
MouseWheelAction = None;
ColormapSize = 4; ColormapSize = 4;
DisableDithering = NO; DisableDithering = NO;
ModifierKey = Mod1; ModifierKey = Mod1;

View File

@@ -217,6 +217,12 @@ typedef enum {
#define MS_SINGLE_TEXTURE 1 #define MS_SINGLE_TEXTURE 1
#define MS_FLAT 2 #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 */ /* workspace display position */
#define WD_NONE 0 #define WD_NONE 0
@@ -431,9 +437,10 @@ typedef struct WPreferences {
char superfluous; /* Use superfluous things */ char superfluous; /* Use superfluous things */
/* root window mouse bindings */ /* root window mouse bindings */
signed char select_button; /* button for window selection */ signed char mouse_button1; /* action for left mouse button */
signed char windowl_button; /* button for window list menu */ signed char mouse_button2; /* action for middle mouse button */
signed char menu_button; /* button for app menu */ signed char mouse_button3; /* action for right mouse button */
signed char mouse_wheel; /* action for mouse wheel */
/* balloon text */ /* balloon text */
char window_balloon; char window_balloon;

View File

@@ -262,13 +262,17 @@ static WOptionEnumeration seSpeeds[] = {
{NULL, 0, 0} {NULL, 0, 0}
}; };
static WOptionEnumeration seMouseButtons[] = { static WOptionEnumeration seMouseButtonActions[] = {
{"None", -1, 0}, {"None", WA_NONE, 0},
{"Left", Button1, 0}, {"Button1", Button1, 1}, {"SelectWindows", WA_SELECT_WINDOWS, 0},
{"Middle", Button2, 0}, {"Button2", Button2, 1}, {"OpenApplicationsMenu", WA_OPEN_APPMENU, 0},
{"Right", Button3, 0}, {"Button3", Button3, 1}, {"OpenWindowListMenu", WA_OPEN_WINLISTMENU, 0},
{"Button4", Button4, 0}, {NULL, 0, 0}
{"Button5", Button5, 0}, };
static WOptionEnumeration seMouseWheelActions[] = {
{"None", WA_NONE, 0},
{"SwitchWorkspaces", WA_SWITCH_WORKSPACES, 0},
{NULL, 0, 0} {NULL, 0, 0}
}; };
@@ -389,14 +393,17 @@ WDefaultEntry optionList[] = {
{"IconificationStyle", "Zoom", seIconificationStyles, {"IconificationStyle", "Zoom", seIconificationStyles,
&wPreferences.iconification_style, getEnum, NULL &wPreferences.iconification_style, getEnum, NULL
}, },
{"SelectWindowsMouseButton", "Left", seMouseButtons, {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions,
&wPreferences.select_button, getEnum, NULL &wPreferences.mouse_button1, getEnum, NULL
}, },
{"WindowListMouseButton", "Middle", seMouseButtons, {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions,
&wPreferences.windowl_button, getEnum, NULL &wPreferences.mouse_button2, getEnum, NULL
}, },
{"ApplicationMenuMouseButton", "Right", seMouseButtons, {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions,
&wPreferences.menu_button, getEnum, NULL &wPreferences.mouse_button3, getEnum, NULL
},
{"MouseWheelAction", "None", seMouseWheelActions,
&wPreferences.mouse_wheel, getEnum, NULL
}, },
{"PixmapPath", DEF_PIXMAP_PATHS, NULL, {"PixmapPath", DEF_PIXMAP_PATHS, NULL,
&wPreferences.pixmap_path, getPathList, NULL &wPreferences.pixmap_path, getPathList, NULL

View File

@@ -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 */ /* bindable */
static void static void
handleButtonPress(XEvent *event) handleButtonPress(XEvent *event)
@@ -609,33 +642,22 @@ handleButtonPress(XEvent *event)
#ifndef LITE #ifndef LITE
if (event->xbutton.window==scr->root_win) { if (event->xbutton.window==scr->root_win) {
if (event->xbutton.button==wPreferences.menu_button) { if (event->xbutton.button==Button1 &&
OpenRootMenu(scr, event->xbutton.x_root, wPreferences.mouse_button1!=WA_NONE) {
event->xbutton.y_root, False); executeButtonAction(scr, event, wPreferences.mouse_button1);
/* ugly hack */ } else if (event->xbutton.button==Button2 &&
if (scr->root_menu) { wPreferences.mouse_button2!=WA_NONE) {
if (scr->root_menu->brother->flags.mapped) executeButtonAction(scr, event, wPreferences.mouse_button2);
event->xbutton.window = scr->root_menu->brother->frame->core->window; } else if (event->xbutton.button==Button3 &&
else wPreferences.mouse_button3!=WA_NONE) {
event->xbutton.window = scr->root_menu->frame->core->window; executeButtonAction(scr, event, wPreferences.mouse_button3);
} } else if (event->xbutton.button==Button4 &&
} else if (event->xbutton.button==wPreferences.windowl_button) { wPreferences.mouse_wheel!=WA_NONE) {
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) {
wWorkspaceRelativeChange(scr, 1); wWorkspaceRelativeChange(scr, 1);
} } else if (event->xbutton.button==Button5 &&
wPreferences.mouse_wheel!=WA_NONE) {
wWorkspaceRelativeChange(scr, -1);
}
#ifdef GNOME_STUFF #ifdef GNOME_STUFF
else if (wGNOMEProxyizeButtonEvent(scr, event)) else if (wGNOMEProxyizeButtonEvent(scr, event))
return; return;