followMouse: add followMouseRequiresMovement

This implements the same config option as `underMouse` in Openbox.

Fixes #862
This commit is contained in:
Consolatis 2023-04-02 02:18:25 +02:00 committed by Johan Malm
parent bdd3849138
commit 9a9e20d2b0
5 changed files with 21 additions and 2 deletions

View file

@ -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;

View file

@ -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);