diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c index d2d33028..d3731ae4 100644 --- a/WPrefs.app/Expert.c +++ b/WPrefs.app/Expert.c @@ -130,6 +130,8 @@ static struct expert_option { { N_("Keep dock on primary head."), /* default: */ False, OPTION_WMAKER, "KeepDockOnPrimaryHead"}, + { N_("Allow windows to take focus using mouse wheel."), + /* default: */ False, OPTION_WMAKER, "MouseWheelFocus"}, }; diff --git a/src/WindowMaker.h b/src/WindowMaker.h index dea943b9..f06f8015 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -378,6 +378,7 @@ extern struct WPreferences { char auto_focus; /* focus window when it's mapped */ char *icon_back_file; /* background image for icons */ char enforce_icon_margin; /* auto-shrink icon images */ + char mouse_wheel_focus; /* allow focus window with mouse wheel */ WCoord *root_menu_pos; /* initial position of the root menu*/ WCoord *app_menu_pos; diff --git a/src/defaults.c b/src/defaults.c index 6b6bc4c3..8472eac3 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -537,6 +537,8 @@ WDefaultEntry optionList[] = { NULL, getPropList, setHotCornerActions, NULL, NULL}, {"WindowListAppIcons", "NO", NULL, &wPreferences.window_list_app_icons, getBool, NULL, NULL, NULL}, + {"MouseWheelFocus", "NO", NULL, + &wPreferences.mouse_wheel_focus, getBool, NULL, NULL, NULL}, /* style options */ diff --git a/src/window.c b/src/window.c index 978f7b88..1f688cdc 100644 --- a/src/window.c +++ b/src/window.c @@ -2984,7 +2984,7 @@ static void frameMouseDown(WObjDescriptor *desc, XEvent *event) CloseWindowMenu(wwin->screen_ptr); - if (event->xbutton.button != Button4 && event->xbutton.button != Button5 && !(event->xbutton.state & ControlMask) && !WFLAGP(wwin, no_focusable)) + if ((wPreferences.mouse_wheel_focus || (event->xbutton.button != Button4 && event->xbutton.button != Button5)) && !(event->xbutton.state & ControlMask) && !WFLAGP(wwin, no_focusable)) wSetFocusTo(wwin->screen_ptr, wwin); if (event->xbutton.button == Button1)