From 87af08966a5080345e2d4935d886b9fe91f66159 Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Thu, 24 May 2018 21:02:38 +0300 Subject: [PATCH 01/13] Don't focus tabbed and stacked containers on mouseover --- sway/input/cursor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 9a0b4f01b..0f8202eaf 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -162,7 +162,11 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, seat_set_focus_warp(cursor->seat, c, false); } } else { - seat_set_focus_warp(cursor->seat, c, false); + // Don't switch focus on mouseover for stacked and tabbed layouts + if(c->parent && c->parent->layout != L_STACKED + && c->parent->layout != L_TABBED) { + seat_set_focus_warp(cursor->seat, c, false); + } } } From c1be4b0153fc18b130ce795e71c8600c2dd31fc0 Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Thu, 24 May 2018 23:19:18 +0300 Subject: [PATCH 02/13] Fix focusing from other containers --- sway/input/cursor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 0f8202eaf..72dc87003 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -163,8 +163,9 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, } } else { // Don't switch focus on mouseover for stacked and tabbed layouts - if(c->parent && c->parent->layout != L_STACKED - && c->parent->layout != L_TABBED) { + if(focus->parent == c->parent && + (c->parent->layout != L_STACKED + || c->parent->layout != L_TABBED)) { seat_set_focus_warp(cursor->seat, c, false); } } From c62efbb5cea36300706e0b366a271697da70d201 Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Fri, 25 May 2018 14:12:09 +0300 Subject: [PATCH 03/13] Implement correct focusing for tabbed containers --- sway/input/cursor.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 72dc87003..564c7763d 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -162,10 +162,31 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, seat_set_focus_warp(cursor->seat, c, false); } } else { - // Don't switch focus on mouseover for stacked and tabbed layouts - if(focus->parent == c->parent && - (c->parent->layout != L_STACKED - || c->parent->layout != L_TABBED)) { + // Get container-local cursor position + double c_local_y = cursor->cursor->y - c->y; + bool is_below_title = + c_local_y - container_titlebar_height() > 0.001; + + bool do_mouse_focus = true; + + // Don't switch focus on title mouseover for stacked and tabbed + // layouts + if(c->parent && (c->parent->layout == L_STACKED + || c->parent->layout == L_TABBED) + && !is_below_title) { + do_mouse_focus = false; + } + + // If pointed container is in nested container + // inside tabbed/stacked layout we should skip this nested container + if(c->parent && c->parent->parent && + (c->parent->parent->layout == L_STACKED + || c->parent->parent->layout == L_TABBED) + && !is_below_title) { + do_mouse_focus = false; + } + + if(do_mouse_focus) { seat_set_focus_warp(cursor->seat, c, false); } } From 3b672533128d5ff7233e26603d52277abfd6724a Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Fri, 25 May 2018 15:37:06 +0300 Subject: [PATCH 04/13] Skip all nested containers --- sway/input/cursor.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 564c7763d..4b15e0e22 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -167,23 +167,19 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, bool is_below_title = c_local_y - container_titlebar_height() > 0.001; + // Don't switch focus on title mouseover for + // stacked and tabbed layouts + // If pointed container is in nested containers which are + // inside tabbed/stacked layout we should skip them bool do_mouse_focus = true; - - // Don't switch focus on title mouseover for stacked and tabbed - // layouts - if(c->parent && (c->parent->layout == L_STACKED - || c->parent->layout == L_TABBED) - && !is_below_title) { - do_mouse_focus = false; - } - - // If pointed container is in nested container - // inside tabbed/stacked layout we should skip this nested container - if(c->parent && c->parent->parent && - (c->parent->parent->layout == L_STACKED - || c->parent->parent->layout == L_TABBED) - && !is_below_title) { - do_mouse_focus = false; + struct sway_container *p = c->parent; + while(p) { + if((p->layout == L_TABBED || p->layout == L_STACKED) + && !is_below_title) { + do_mouse_focus = false; + break; + } + p = p->parent; } if(do_mouse_focus) { From e19fe56e2f6bd0bf6cc9c8d608941116ebd06c49 Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Fri, 25 May 2018 16:41:16 +0300 Subject: [PATCH 05/13] Focus inactive container instead of checking cursor position --- sway/input/cursor.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 4b15e0e22..362474161 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -162,27 +162,27 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, seat_set_focus_warp(cursor->seat, c, false); } } else { - // Get container-local cursor position - double c_local_y = cursor->cursor->y - c->y; - bool is_below_title = - c_local_y - container_titlebar_height() > 0.001; - // Don't switch focus on title mouseover for // stacked and tabbed layouts // If pointed container is in nested containers which are // inside tabbed/stacked layout we should skip them bool do_mouse_focus = true; struct sway_container *p = c->parent; + struct sway_container *first_tabbed_parent = c->parent; while(p) { - if((p->layout == L_TABBED || p->layout == L_STACKED) - && !is_below_title) { + if(p->layout == L_TABBED || p->layout == L_STACKED) { do_mouse_focus = false; - break; + first_tabbed_parent = p; } p = p->parent; } - - if(do_mouse_focus) { + if(!do_mouse_focus) { + struct sway_container *next_focus = seat_get_focus_inactive( + cursor->seat, first_tabbed_parent); + if(next_focus) { + seat_set_focus_warp(cursor->seat, next_focus, false); + } + } else { seat_set_focus_warp(cursor->seat, c, false); } } From f85d3e15ba058daf5b7325ab51a8e5ccca18e8d4 Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Fri, 25 May 2018 16:51:03 +0300 Subject: [PATCH 06/13] Fixed styling issues --- sway/input/cursor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 362474161..bd23af6fb 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -169,17 +169,17 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, bool do_mouse_focus = true; struct sway_container *p = c->parent; struct sway_container *first_tabbed_parent = c->parent; - while(p) { - if(p->layout == L_TABBED || p->layout == L_STACKED) { + while (p) { + if (p->layout == L_TABBED || p->layout == L_STACKED) { do_mouse_focus = false; first_tabbed_parent = p; } p = p->parent; } - if(!do_mouse_focus) { + if (!do_mouse_focus) { struct sway_container *next_focus = seat_get_focus_inactive( cursor->seat, first_tabbed_parent); - if(next_focus) { + if (next_focus) { seat_set_focus_warp(cursor->seat, next_focus, false); } } else { From 53516fa03fd291cdcedbd9e27457cf1cfd40f903 Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Fri, 25 May 2018 17:22:25 +0300 Subject: [PATCH 07/13] Fix mouse focusing for horizontal/vertical views in tabbed containers --- sway/input/cursor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index bd23af6fb..4e01df702 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -170,7 +170,8 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, struct sway_container *p = c->parent; struct sway_container *first_tabbed_parent = c->parent; while (p) { - if (p->layout == L_TABBED || p->layout == L_STACKED) { + if ((p->layout == L_TABBED || p->layout == L_STACKED) + && !view_is_visible(c->sway_view)) { do_mouse_focus = false; first_tabbed_parent = p; } From 740234a4bc9c8509c766f8feb9f7116bf8950c49 Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Fri, 25 May 2018 17:45:41 +0300 Subject: [PATCH 08/13] Break after first tabbed/stacked layout --- sway/input/cursor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 4e01df702..0b6999ea8 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -168,19 +168,18 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, // inside tabbed/stacked layout we should skip them bool do_mouse_focus = true; struct sway_container *p = c->parent; - struct sway_container *first_tabbed_parent = c->parent; while (p) { if ((p->layout == L_TABBED || p->layout == L_STACKED) && !view_is_visible(c->sway_view)) { do_mouse_focus = false; - first_tabbed_parent = p; + break; } p = p->parent; } if (!do_mouse_focus) { struct sway_container *next_focus = seat_get_focus_inactive( - cursor->seat, first_tabbed_parent); - if (next_focus) { + cursor->seat, p); + if (next_focus && view_is_visible(next_focus->sway_view)) { seat_set_focus_warp(cursor->seat, next_focus, false); } } else { From 7af172ed0a94ced56660bf1d54463d93822cd791 Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 25 May 2018 19:11:43 +0100 Subject: [PATCH 09/13] Delete old asciidoc man pages --- swaylock/swaylock.1.scd | 1 - swaylock/swaylock.1.txt | 116 ---------------------------------------- swaymsg/swaymsg.1.txt | 89 ------------------------------ 3 files changed, 206 deletions(-) delete mode 100644 swaylock/swaylock.1.txt delete mode 100644 swaymsg/swaymsg.1.txt diff --git a/swaylock/swaylock.1.scd b/swaylock/swaylock.1.scd index 2580bff9a..35d6444cd 100644 --- a/swaylock/swaylock.1.scd +++ b/swaylock/swaylock.1.scd @@ -100,4 +100,3 @@ Locks your Wayland session. Maintained by Drew DeVault , who is assisted by other open source contributors. For more information about sway development, see https://github.com/swaywm/sway. - diff --git a/swaylock/swaylock.1.txt b/swaylock/swaylock.1.txt deleted file mode 100644 index 9dbc00a27..000000000 --- a/swaylock/swaylock.1.txt +++ /dev/null @@ -1,116 +0,0 @@ -///// -vim:set ts=4 sw=4 tw=82 noet: -///// -:quotes.~: - -swaylock (1) -============ - -Name ----- -swaylock - Screen locker for sway - -Synopsis --------- -'swaylock' [options] - -Lock the current sway session. - -Options -------- - -*-h, --help*:: - Show help message and quit. - -*-c, \--color* :: - Turn the screen into the given color. If -i is used, this sets the - background of the image to the given color. Defaults to white (ffffff), or - transparent (00000000) if an image is in use. - -*-f, \--daemonize*:: - Fork into the background after spawning. Note: this is the default behavior of - i3lock. - -*-i, \--image* [:]:: - Display the given image, optionally only on the given output. Use -c to set - a background color. - -*--scaling*:: - Scaling mode for images: stretch, fill, fit, center, or tile. - -*-t, --tiling*:: - Same as --scaling=tile. - -*-u, --no-unlock-indicator*:: - Disable the unlock indicator. - -*-v, \--version*:: - Show the version number and quit. - -*--socket *:: - Use the specified socket path. Otherwise, swaymsg will ask sway where the - socket is (which is the value of $SWAYSOCK, then of $I3SOCK). - -Appearance ----------- - -*--bshlcolor* :: - Sets the color of backspace highlight segments. - -*--font* :: - Sets the font of the text inside the indicator. - -*--insidecolor* :: - Sets the color of the inside of the indicator when typing or idle. - -*--insidevercolor* :: - Sets the color of the inside of the indicator when verifying. - -*--insidewrongcolor* :: - Sets the color of the inside of the indicator when invalid. - -*--keyhlcolor* :: - Sets the color of keypress highlight segments. - -*--linecolor* :: - Sets the color of the lines that separate the inside and outside of the - indicator. - -*-s, \--line-uses-inside*:: - Use the color of the inside of the indicator for the line separating the - inside and outside of the indicator. - -*-r, \--line-uses-ring*:: - Use the outer ring's color for the line separating the inside and outside of - the indicator. - -*--ringcolor* :: - Sets the color of the outside of the indicator when typing or idle. - -*--ringvercolor* :: - Sets the color of the outside of the indicator when verifying. - -*--ringwrongcolor* :: - Sets the color of the outside of the indicator when invalid. - -*--separatorcolor* :: - Sets the color of the lines that seperate highlight segments. - -*--textcolor* :: - Sets the color of the text inside the indicator. - -*--indicator-radius* :: - Sets the radius of the indicator to _radius_ pixels. The default value is - 50. - -*--indicator-thickness* :: - Sets the thickness of the indicator to _thickness_ pixels. The default value - is 10. - -Authors -------- - -Maintained by Drew DeVault , who is assisted by other open -source contributors. For more information about sway development, see -. - diff --git a/swaymsg/swaymsg.1.txt b/swaymsg/swaymsg.1.txt deleted file mode 100644 index 52209b129..000000000 --- a/swaymsg/swaymsg.1.txt +++ /dev/null @@ -1,89 +0,0 @@ -///// -vim:set ts=4 sw=4 tw=82 noet: -///// -:quotes.~: - -swaymsg (1) -=========== - -Name ----- -swaymsg - Send messages to a running instance of sway over the IPC socket. - -Synopsis --------- -'swaymsg' [options] [message] - -Options -------- - -*-h, --help*:: - Show help message and quit. - -*-q, \--quiet*:: - Sends the IPC message but does not print the response from sway. - -*-r, \--raw*:: - Use raw output even if using a tty. - -*-s, --socket* :: - Use the specified socket path. Otherwise, swaymsg will ask sway where the - socket is (which is the value of $SWAYSOCK, then of $I3SOCK). - -*-t, \--type* :: - Specify the type of IPC message. See below. - -*-v, \--version*:: - Print the version (of swaymsg) and quit. - -IPC Message Types ------------------ - -**:: - The message is a sway command (the same commands you can bind to keybindings - in your sway config file). It will be executed immediately. - + - See **sway**(5) for a list of commands. - -*get_workspaces*:: - Gets a JSON-encoded list of workspaces and their status. - -*get_seats*:: - Gets a JSON-encoded list of current seats. - -*get_inputs*:: - Gets a JSON-encoded list of current inputs. - -*get_outputs*:: - Gets a JSON-encoded list of current outputs. - -*get_tree*:: - Gets a JSON-encoded layout tree of all open windows, containers, outputs, - workspaces, and so on. - -*get_marks*:: - Get a JSON-encoded list of marks. - -*get_bar_config*:: - Get a JSON-encoded configuration for swaybar. - -*get_version*:: - Get JSON-encoded version information for the running instance of sway. - -*get_clipboard*:: - Get JSON-encoded information about the clipboard. - Returns the current clipboard mime-types if called without - arguments, otherwise returns the clipboard data in the requested - formats. Encodes the data using base64 for non-text mime types. - -Authors -------- - -Maintained by Drew DeVault , who is assisted by other open -source contributors. For more information about sway development, see -. - -See Also --------- - -**sway**(5) From 820a8c9c2d12b863b7bf9a9d2f45a3214dff72fa Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Sat, 26 May 2018 13:34:14 +0300 Subject: [PATCH 10/13] Moved visibility check of of loop, added asserts --- sway/input/cursor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 0b6999ea8..b404a6347 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -167,10 +167,12 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, // If pointed container is in nested containers which are // inside tabbed/stacked layout we should skip them bool do_mouse_focus = true; + sway_assert(c->type == C_VIEW, "pointed container is not a view"); + bool is_visible = view_is_visible(c->sway_view); struct sway_container *p = c->parent; while (p) { if ((p->layout == L_TABBED || p->layout == L_STACKED) - && !view_is_visible(c->sway_view)) { + && !is_visible) { do_mouse_focus = false; break; } @@ -179,6 +181,8 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, if (!do_mouse_focus) { struct sway_container *next_focus = seat_get_focus_inactive( cursor->seat, p); + sway_assert(next_focus->type == C_VIEW, + "focus inactive container is not a view"); if (next_focus && view_is_visible(next_focus->sway_view)) { seat_set_focus_warp(cursor->seat, next_focus, false); } From 6e6b0decd95eb3fd4b336817839c08a2c71c7505 Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Sat, 26 May 2018 15:51:36 +0300 Subject: [PATCH 11/13] Fix usage of sway_assert --- sway/input/cursor.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index b404a6347..62967cb86 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -167,7 +167,9 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, // If pointed container is in nested containers which are // inside tabbed/stacked layout we should skip them bool do_mouse_focus = true; - sway_assert(c->type == C_VIEW, "pointed container is not a view"); + if(!sway_assert(c->type == C_VIEW, "pointed container is not a view")) { + return; + } bool is_visible = view_is_visible(c->sway_view); struct sway_container *p = c->parent; while (p) { @@ -181,8 +183,10 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, if (!do_mouse_focus) { struct sway_container *next_focus = seat_get_focus_inactive( cursor->seat, p); - sway_assert(next_focus->type == C_VIEW, - "focus inactive container is not a view"); + if(!sway_assert(next_focus->type == C_VIEW, + "focus inactive container is not a view")) { + return; + } if (next_focus && view_is_visible(next_focus->sway_view)) { seat_set_focus_warp(cursor->seat, next_focus, false); } From 464ec44b005aa7584c9240cb9721382d23d288cf Mon Sep 17 00:00:00 2001 From: Ivan Chebykin Date: Sat, 26 May 2018 15:54:49 +0300 Subject: [PATCH 12/13] Check for next_focus before assert --- sway/input/cursor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 62967cb86..987809891 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -183,7 +183,7 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, if (!do_mouse_focus) { struct sway_container *next_focus = seat_get_focus_inactive( cursor->seat, p); - if(!sway_assert(next_focus->type == C_VIEW, + if(next_focus && !sway_assert(next_focus->type == C_VIEW, "focus inactive container is not a view")) { return; } From fea654a6ce4d618bfd0cc9b5d78d0726802889ec Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 26 May 2018 10:35:15 -0400 Subject: [PATCH 13/13] Replace oft-failing abort with if statement Fixes #2045 --- sway/input/cursor.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 987809891..1cf432f3c 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -161,15 +161,12 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, if (output != focus) { seat_set_focus_warp(cursor->seat, c, false); } - } else { + } else if (c->type == C_VIEW) { // Don't switch focus on title mouseover for // stacked and tabbed layouts // If pointed container is in nested containers which are // inside tabbed/stacked layout we should skip them bool do_mouse_focus = true; - if(!sway_assert(c->type == C_VIEW, "pointed container is not a view")) { - return; - } bool is_visible = view_is_visible(c->sway_view); struct sway_container *p = c->parent; while (p) {