diff --git a/src/core/prefs.c b/src/core/prefs.c index 29b9055f7..99854f156 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -92,7 +92,7 @@ static GDesktopTitlebarAction action_right_click_titlebar = G_DESKTOP_TITLEBAR_A static gboolean dynamic_workspaces = FALSE; static gboolean disable_workarounds = FALSE; static gboolean auto_raise = FALSE; -static gboolean auto_raise_delay = 500; +static int auto_raise_delay = 500; static gboolean focus_change_on_pointer_rest = FALSE; static gboolean bell_is_visible = FALSE; static gboolean bell_is_audible = TRUE; diff --git a/src/tests/meson.build b/src/tests/meson.build index 7f933d357..ccb294126 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -709,6 +709,8 @@ stacking_tests = [ 'suspend-state-timeout', 'cloned-windows', 'sloppy-focus', + 'sloppy-focus-pointer-rest', + 'sloppy-focus-auto-raise', ] foreach stacking_test: stacking_tests diff --git a/src/tests/stacking/sloppy-focus-auto-raise.metatest b/src/tests/stacking/sloppy-focus-auto-raise.metatest new file mode 100644 index 000000000..c143e1849 --- /dev/null +++ b/src/tests/stacking/sloppy-focus-auto-raise.metatest @@ -0,0 +1,48 @@ +resize_monitor default 800 600 +set_pref focus-mode sloppy +set_pref focus-change-on-pointer-rest false +set_pref auto-raise true +set_pref auto-raise-delay 25 + +move_cursor_to 150 50 +wait + +new_client w wayland + +create w/0 csd +resize w/0 100 100 +show w/0 + +create w/1 csd +resize w/1 100 100 +show w/1 + +wait_reconfigure + +move w/0 0 0 +move w/1 100 0 + +wait_reconfigure + +assert_stacking w/0 w/1 +assert_focused w/1 + +assert_position w/0 0 0 +assert_size w/0 100 100 +assert_position w/1 100 0 +assert_size w/1 100 100 + +move_cursor_to 150 50 + +assert_stacking w/0 w/1 +assert_focused w/1 + +move_cursor_to 50 50 + +assert_stacking w/0 w/1 +assert_focused w/0 + +sleep 50 + +assert_stacking w/1 w/0 +assert_focused w/0 \ No newline at end of file diff --git a/src/tests/stacking/sloppy-focus-pointer-rest.metatest b/src/tests/stacking/sloppy-focus-pointer-rest.metatest new file mode 100644 index 000000000..2394497ef --- /dev/null +++ b/src/tests/stacking/sloppy-focus-pointer-rest.metatest @@ -0,0 +1,59 @@ +resize_monitor default 800 600 +set_pref focus-mode sloppy +set_pref focus-change-on-pointer-rest true + +move_cursor_to 150 50 +wait + +new_client w wayland + +create w/0 csd +resize w/0 100 100 +show w/0 + +create w/1 csd +resize w/1 100 100 +show w/1 + +create w/2 csd +resize w/2 100 100 +show w/2 + +wait_reconfigure + +move w/0 0 0 +move w/1 100 0 +move w/2 200 0 + +wait_reconfigure + +assert_stacking w/0 w/1 w/2 +assert_focused w/2 + +assert_position w/0 0 0 +assert_size w/0 100 100 +assert_position w/1 100 0 +assert_size w/1 100 100 +assert_position w/2 200 0 +assert_size w/2 100 100 + +move_cursor_to 50 50 +sleep 50 + +assert_stacking w/0 w/1 w/2 +assert_focused w/0 + +move_cursor_to 150 50 + +assert_stacking w/0 w/1 w/2 +assert_focused w/0 + +move_cursor_to 250 50 + +assert_stacking w/0 w/1 w/2 +assert_focused w/0 + +sleep 50 + +assert_stacking w/0 w/1 w/2 +assert_focused w/2 \ No newline at end of file diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c index a4f941452..42871656d 100644 --- a/src/tests/test-runner.c +++ b/src/tests/test-runner.c @@ -1332,6 +1332,20 @@ test_case_do (TestCase *test, g_assert_true (g_settings_set_boolean (mutter, "focus-change-on-pointer-rest", value)); } + else if (strcmp (argv[1], "auto-raise") == 0) + { + gboolean value; + if (!str_to_bool (argv[2], &value)) + BAD_COMMAND("usage: %s %s [true|false]", argv[0], argv[1]); + + g_assert_true (g_settings_set_boolean (wm, "auto-raise", value)); + } + else if (strcmp (argv[1], "auto-raise-delay") == 0) + { + int value = atoi (argv[2]); + + g_assert_true (g_settings_set_int (wm, "auto-raise-delay", value)); + } else { BAD_COMMAND("Unknown preference %s", argv[1]); }