From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Sun, 2 Apr 2023 00:18:25 +0000 (+0200) Subject: followMouse: add followMouseRequiresMovement X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=9a9e20d;p=proto%2Flabwc.git followMouse: add followMouseRequiresMovement This implements the same config option as `underMouse` in Openbox. Fixes #862 --- diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index be70b596..e6d03d5b 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -116,6 +116,14 @@ The rest of this man page describes configuration options. Make focus follow mouse, i.e. focus is given to window under mouse cursor. Default is no. +** [yes|no] + Requires cursor movement if followMouse is enabled. It is the same + as the "underMouse" setting in Openbox. If set to "no", labwc will + additionally focus the window under the cursor in all situations + which change the position of a window (e.g. switching workspaces, + opening/closing windows). Focusing a different window via A-Tab is + still possible, even with this setting set to "no". Default is yes. + ** [yes|no] Raise window to top when focused. Default is no. diff --git a/docs/rc.xml.all b/docs/rc.xml.all index 3de44aae..a8d2faba 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -53,6 +53,7 @@ no + yes no diff --git a/include/config/rcxml.h b/include/config/rcxml.h index ad50ec82..7b808dfe 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -35,6 +35,7 @@ struct rcxml { /* focus */ bool focus_follow_mouse; + bool focus_follow_mouse_requires_movement; bool raise_on_focus; /* theme */ diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 37b5067c..466d02ba 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -531,6 +531,8 @@ entry(xmlNode *node, char *nodename, char *content) fill_font(nodename, content, font_place); } else if (!strcasecmp(nodename, "followMouse.focus")) { set_bool(content, &rc.focus_follow_mouse); + } else if (!strcasecmp(nodename, "followMouseRequiresMovement.focus")) { + set_bool(content, &rc.focus_follow_mouse_requires_movement); } else if (!strcasecmp(nodename, "raiseOnFocus.focus")) { set_bool(content, &rc.raise_on_focus); } else if (!strcasecmp(nodename, "doubleClickTime.mouse")) { @@ -720,11 +722,16 @@ rcxml_init(void) init_font_defaults(&rc.font_menuitem); init_font_defaults(&rc.font_osd); + rc.focus_follow_mouse = false; + rc.focus_follow_mouse_requires_movement = true; + rc.raise_on_focus = false; + rc.doubleclick_time = 500; rc.scroll_factor = 1.0; rc.repeat_rate = 25; rc.repeat_delay = 600; rc.screen_edge_strength = 20; + rc.snap_edge_range = 1; rc.snap_top_maximize = true; diff --git a/src/cursor.c b/src/cursor.c index 583dde3c..8746e2c2 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -519,8 +519,10 @@ _cursor_update_focus(struct server *server) /* Focus surface under cursor if it isn't already focused */ struct cursor_context ctx = get_cursor_context(server); - if (ctx.view && rc.focus_follow_mouse && !server->osd_state.cycle_view) { - /* Prevent changing keyboard focus during A-Tab */ + if (ctx.view && rc.focus_follow_mouse + && !rc.focus_follow_mouse_requires_movement + && !server->osd_state.cycle_view) { + /* Prevents changing keyboard focus during A-Tab */ desktop_focus_and_activate_view(&server->seat, ctx.view); if (rc.raise_on_focus) { view_move_to_front(ctx.view);