7532 Commits

Author SHA1 Message Date
Michael Stapelberg
f1754e12c0 increase drag threshold, run it through logical_px()
related to https://github.com/i3/i3/issues/5155
2022-10-24 21:12:53 +02:00
Michael Stapelberg
e12d2f6a1d tiling drag: fix cursor (wrong argument passed) (#5207)
Currently, the cursor is XCURSOR_CURSOR_TOP_RIGHT_CORNER (== BORDER_TOP),
but the intended cursor was XCURSOR_CURSOR_MOVE.

noticed this as part of https://github.com/i3/i3/issues/5198
2022-10-24 21:12:51 +02:00
Michael Stapelberg
b88ca36a5a tiling drag: allow click immediately, to focus on decoration click (#5206)
With the introduction of tiling drag, i3’s click behavior in window decorations
changed: before tiling drag, in a tabbed or stacked container, a window would be
focused/raised on mouse down. After tiling drag, on mouse up.

This commit sends XCB_ALLOW_REPLAY_POINTER before running the tiling drag code,
thereby restoring the focus/raise-on-mouse-down behavior without affecting the
tiling drag operation.

fixes https://github.com/i3/i3/issues/5169
2022-10-24 21:12:48 +02:00
bodea
7abd58abf2 Escape ~ to prevent interpretation as subscript. (#5168) 2022-10-24 21:12:43 +02:00
Matias Goldfeld
d62183a2b8 Fix segfault during config validation (#5167) (#5173)
Configs with bar blocks will segfault during validation since they
copy the i3 font which is not set during validation.
2022-10-24 21:12:38 +02:00
Tudor Brindus
9d6a8735eb Raise floating windows when their border is clicked (#5196)
This logic already existed for `floating_drag_window`, but we need it
for `floating_resize_window` too.

Fixes #5195.
2022-10-24 21:12:30 +02:00
Michael Stapelberg
decc37eba1 Fix i3-dmenu-desktop quoting (#5162)
Commit 70f23caa9a18afc146f696fdf7d2481e5f7f0101 introduced new issues.

Instead of distinguishing " and \, as that commit attempted,
let’s instead keep the level of escaping by escaping each backslash,
just like each double quote.

I tested this with:

    # recommended way to quote $ and " in quoted arguments, not ambiguous
    Exec=/tmp/logargs "hello \\$PWD \\"and\\" more"

    # permitted way to quote $ and " in quoted arguments, but ambiguous
    Exec=/tmp/logargs "hello \$PWD \"and\" more"

    # permitted way to quote arguments, slightly unusual to quote first arg
    Exec="/tmp/logargs" hey

    # a complicated shell expression, not ambiguous
    Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec /tmp/logargs --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec /tmp/logargs --alternate-editor= --create-frame; fi" placeholder %F

related to https://github.com/i3/i3/issues/4697 (electrum, original)
related to https://github.com/i3/i3/issues/5152 (phpstorm, breakage)
related to https://github.com/i3/i3/issues/5156 (emacsclient, breakage)
2022-10-24 21:12:27 +02:00
Orestis Floros
3f58d51ec6 Fix motif logic for new floats
- manage.c still used wrong `motif_border_style == BS_NORMAL`
- container must be set to floating first for correct code path and
  correct max_user_border_style to be used in con_set_border_style
- Motif test now includes default_floating_border
2022-10-24 21:12:25 +02:00
Orestis Floros
304e815ed4 Motif hints: Respect maximum border style configuration set by user
Context:
Motif hints [1] allow applications to request specific window manager
frame decorations. Most applications like alacritty, chromium, and
godot, use the hints as a binary flag, setting or un-setting
`MWM_DECOR_ALL`.
Previously [2], we had disallowed applications to set the "normal"
border style through motif hints. This effectively meant that users that
had set `default_border pixel` would not see applications spawning with
normal decorations [3].
However, that meant that applications like godot [4] could not toggle
their border between none and normal so the behaviour changed with
v4.21 [5].
That change however also allowed applications to override the default
none/pixel border style the user set. For example, alacritty can be
configured to either have all or no decorations [6] and they always set
the motif hint on startup, completely overriding i3 user's preference:
1. If decorations are disabled with alacritty's config then they will
   override `default_border normal` and no title will be used.
2. If decorations are enabled (also the default behavior) with
   alacritty's config then they will override `default_border pixel` and
   a title will be used.

This patch redefines how we interpret motif hints. When a client sets
`MWM_DECOR_ALL`, we interpret it as "the maximum decoration the user has
allowed for this window". I.e., if a client was all decorations and the
user expects the window to not have a title, we don't include the title
in "all" decorations.

The user's preference is determined by these:
1. For new tiling windows, as set by `default_border`
2. For new floating windows, as set by `default_floating_border`
3. For all windows that the user runs the `border` command, whatever is
   the result of that command for that window.
Example:
- User opens new tiling window with `default_border pixel` => maximum
  decoration = PIXEL
- Window requests all/title decorations => i3 enforces the user maximum
  decoration, PIXEL (no change)
- Window requests no decorations => i3 accepts it and sets border to
  NONE, maximum decoration remains PIXEL
- User toggles the border, next style is NORMAL => maximum decoration is
  now NORMAL
- Window requests no decorations => i3 accepts it and sets border to
  NONE
- Window requests all/title decorations => i3 accepts it and sets the
  maximum border, NORMAL
- User toggles the border, next style is NONE => maximum decoration is
  now NONE
- Window requests all/title decorations => i3 enforces the user maximum
  decoration, NONE (no change)

With this, we will still allow behaviour where windows can toggle their
border style with motif hints [4][7].

Reference/footnotes:
[1]: https://linux.die.net/man/3/vendorshell
[2]: https://github.com/i3/i3/pull/2386
[3]: Notice how there is apparently a gap because `default border none`
settings would not be respected if an application wanted just "border"
decorations but this was never reported, probably because of the rare
conjunction of applications requesting that and users defaulting to none
borders.
[4]: https://github.com/godotengine/godot/issues/40037
[5]: https://github.com/i3/i3/pull/5135
[6]: Set by an underlying library here:
fafdedfb7d/src/platform_impl/linux/x11/util/hint.rs (L113-L142)
called by alactitty here:
4ddb608563/alacritty/src/display/window.rs (L341)
[7]: https://github.com/i3/i3/issues/3678

Closes #3678
Fixes #5149
2022-10-24 21:12:23 +02:00
Orestis Floros
0af2bac9ed Order border_style_t enum according to amount of decoration
The only place where this matters is with command `border toggle` which
cycles through them. Luckily, the behaviour does not change because the
order is the same with the new enum.
2022-10-24 21:12:20 +02:00
Erich Heine
5e4ed2fc75 Adds sticky field to get_tree reply in ipc doc 2022-10-24 21:12:00 +02:00
Orestis Floros
de3fc07123
Update actions/checkout to v3 (#5226)
Fixes #5225
2022-10-24 21:01:23 +02:00
Orestis Floros
b18b80ca40
i3-dmenu-desktop test: Do not autostart i3 (#5224)
This actually fixes a hang that happens on my machine for some reason.
Regardless, starting i3 is not necessary for this test.
2022-10-24 19:57:07 +02:00
Michael Stapelberg
5e759ed424
tiling drag: only start when there are drop targets (#5213)
This prevents potentially confusing drag & drop on fullscreen containers and
only-containers on workspaces.

fixes https://github.com/i3/i3/issues/5184
2022-10-18 22:10:03 +02:00
Michael Stapelberg
941229ee62
tiling drag: ignore scratchpad windows when locating drop targets (#5211)
fixes https://github.com/i3/i3/issues/5170
2022-10-16 22:12:45 +02:00
Michael Stapelberg
55d400b17d make tiling drag configurable
fixes https://github.com/i3/i3/issues/5155
2022-10-16 18:21:08 +02:00
Michael Stapelberg
2ba393f084 tiling drag: left-click needs threshold, mod-click doesn’t
related to https://github.com/i3/i3/issues/5155
2022-10-16 18:21:08 +02:00
Michael Stapelberg
6479cb7deb increase drag threshold, run it through logical_px()
related to https://github.com/i3/i3/issues/5155
2022-10-16 18:21:08 +02:00
Michael Stapelberg
8128774386
tiling drag: fix cursor (wrong argument passed) (#5207)
Currently, the cursor is XCURSOR_CURSOR_TOP_RIGHT_CORNER (== BORDER_TOP),
but the intended cursor was XCURSOR_CURSOR_MOVE.

noticed this as part of https://github.com/i3/i3/issues/5198
2022-10-16 16:53:15 +02:00
Michael Stapelberg
a6c86fd794
tiling drag: allow click immediately, to focus on decoration click (#5206)
With the introduction of tiling drag, i3’s click behavior in window decorations
changed: before tiling drag, in a tabbed or stacked container, a window would be
focused/raised on mouse down. After tiling drag, on mouse up.

This commit sends XCB_ALLOW_REPLAY_POINTER before running the tiling drag code,
thereby restoring the focus/raise-on-mouse-down behavior without affecting the
tiling drag operation.

fixes https://github.com/i3/i3/issues/5169
2022-10-16 15:21:22 +02:00
bodea
4f3d4c26f6
Escape ~ to prevent interpretation as subscript. (#5168) 2022-10-11 18:09:26 +02:00
Matias Goldfeld
c5dc0d8c93
Fix segfault during config validation (#5167) (#5173)
Configs with bar blocks will segfault during validation since they
copy the i3 font which is not set during validation.
2022-10-10 18:52:55 +02:00
Tudor Brindus
06e31ece8f
Raise floating windows when their border is clicked (#5196)
This logic already existed for `floating_drag_window`, but we need it
for `floating_resize_window` too.

Fixes #5195.
2022-10-10 14:22:55 +02:00
Michael Stapelberg
812ec43d46
Fix i3-dmenu-desktop quoting (#5162)
Commit 70f23caa9a18afc146f696fdf7d2481e5f7f0101 introduced new issues.

Instead of distinguishing " and \, as that commit attempted,
let’s instead keep the level of escaping by escaping each backslash,
just like each double quote.

I tested this with:

    # recommended way to quote $ and " in quoted arguments, not ambiguous
    Exec=/tmp/logargs "hello \\$PWD \\"and\\" more"

    # permitted way to quote $ and " in quoted arguments, but ambiguous
    Exec=/tmp/logargs "hello \$PWD \"and\" more"

    # permitted way to quote arguments, slightly unusual to quote first arg
    Exec="/tmp/logargs" hey

    # a complicated shell expression, not ambiguous
    Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec /tmp/logargs --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec /tmp/logargs --alternate-editor= --create-frame; fi" placeholder %F

related to https://github.com/i3/i3/issues/4697 (electrum, original)
related to https://github.com/i3/i3/issues/5152 (phpstorm, breakage)
related to https://github.com/i3/i3/issues/5156 (emacsclient, breakage)
2022-09-28 18:29:26 +02:00
Orestis Floros
8ec41334ec Fix motif logic for new floats
- manage.c still used wrong `motif_border_style == BS_NORMAL`
- container must be set to floating first for correct code path and
  correct max_user_border_style to be used in con_set_border_style
- Motif test now includes default_floating_border
2022-09-24 20:46:47 +02:00
Orestis Floros
f6097d4a37 Motif hints: Respect maximum border style configuration set by user
Context:
Motif hints [1] allow applications to request specific window manager
frame decorations. Most applications like alacritty, chromium, and
godot, use the hints as a binary flag, setting or un-setting
`MWM_DECOR_ALL`.
Previously [2], we had disallowed applications to set the "normal"
border style through motif hints. This effectively meant that users that
had set `default_border pixel` would not see applications spawning with
normal decorations [3].
However, that meant that applications like godot [4] could not toggle
their border between none and normal so the behaviour changed with
v4.21 [5].
That change however also allowed applications to override the default
none/pixel border style the user set. For example, alacritty can be
configured to either have all or no decorations [6] and they always set
the motif hint on startup, completely overriding i3 user's preference:
1. If decorations are disabled with alacritty's config then they will
   override `default_border normal` and no title will be used.
2. If decorations are enabled (also the default behavior) with
   alacritty's config then they will override `default_border pixel` and
   a title will be used.

This patch redefines how we interpret motif hints. When a client sets
`MWM_DECOR_ALL`, we interpret it as "the maximum decoration the user has
allowed for this window". I.e., if a client was all decorations and the
user expects the window to not have a title, we don't include the title
in "all" decorations.

The user's preference is determined by these:
1. For new tiling windows, as set by `default_border`
2. For new floating windows, as set by `default_floating_border`
3. For all windows that the user runs the `border` command, whatever is
   the result of that command for that window.
Example:
- User opens new tiling window with `default_border pixel` => maximum
  decoration = PIXEL
- Window requests all/title decorations => i3 enforces the user maximum
  decoration, PIXEL (no change)
- Window requests no decorations => i3 accepts it and sets border to
  NONE, maximum decoration remains PIXEL
- User toggles the border, next style is NORMAL => maximum decoration is
  now NORMAL
- Window requests no decorations => i3 accepts it and sets border to
  NONE
- Window requests all/title decorations => i3 accepts it and sets the
  maximum border, NORMAL
- User toggles the border, next style is NONE => maximum decoration is
  now NONE
- Window requests all/title decorations => i3 enforces the user maximum
  decoration, NONE (no change)

With this, we will still allow behaviour where windows can toggle their
border style with motif hints [4][7].

Reference/footnotes:
[1]: https://linux.die.net/man/3/vendorshell
[2]: https://github.com/i3/i3/pull/2386
[3]: Notice how there is apparently a gap because `default border none`
settings would not be respected if an application wanted just "border"
decorations but this was never reported, probably because of the rare
conjunction of applications requesting that and users defaulting to none
borders.
[4]: https://github.com/godotengine/godot/issues/40037
[5]: https://github.com/i3/i3/pull/5135
[6]: Set by an underlying library here:
fafdedfb7d/src/platform_impl/linux/x11/util/hint.rs (L113-L142)
called by alactitty here:
4ddb608563/alacritty/src/display/window.rs (L341)
[7]: https://github.com/i3/i3/issues/3678

Closes #3678
Fixes #5149
2022-09-24 20:46:47 +02:00
Orestis Floros
eddced6b45 Order border_style_t enum according to amount of decoration
The only place where this matters is with command `border toggle` which
cycles through them. Luckily, the behaviour does not change because the
order is the same with the new enum.
2022-09-24 20:46:47 +02:00
Orestis Floros
8e9b29419f
Merge pull request #5151 from orestisfl/release-notes
Clean up 4.21 release notes
2022-09-22 15:37:03 +02:00
Orestis Floros
016d0b5f07
Clean up 4.21 release notes 2022-09-22 15:28:53 +02:00
Michael Stapelberg
4ab34d5042
GitHub Actions: skip build + test steps in meson dist (#5148)
Originally I thought we should remove the build and test steps in favor of the
“meson dist” step. But, then we lose verbose build command lines and access
to the test logs, and having the failing test logs readily available is
critical.

So, instead, let’s make the “meson dist” step not repeat the work that was
already done in earlier steps. The Meson manual even documents the --no-tests
flag precisely for our use case:

> The meson dist command has a --no-tests option to skip build and tests steps
> of generated packages. It can be used to not waste time for example when done
> in CI that already does its own testing.

From https://mesonbuild.com/Creating-releases.html

fixes https://github.com/i3/i3/issues/5145
2022-09-21 22:19:57 +02:00
Michael Stapelberg
28671a622b release.sh: re-add warning about debian/changelog changes
As long as we push auto builder packages from our CI, we need to update the
version number via the changelog.
2022-09-21 21:58:41 +02:00
Michael Stapelberg
3e434ba0ce release.sh: latest released version numbers 2022-09-21 21:58:41 +02:00
Michael Stapelberg
6ae232a323 release.sh: fix Debian source repository configuration
Debian switched to deb822 sources.list:

https://twitter.com/zekjur/status/1572622368492888065
2022-09-21 21:58:41 +02:00
Michael Stapelberg
5caf49323c release.sh: fix regexp for updating version in index.html 2022-09-21 21:58:41 +02:00
Michael Stapelberg
12cdf435aa release.sh: update website branch name 2022-09-21 21:58:41 +02:00
Michael Stapelberg
d7b9a45ff3 release.sh: remove dput instruction
Package maintenance is done by sur5r these days (thanks!)
2022-09-21 21:58:41 +02:00
Erich Heine
0967021858 Adds sticky field to get_tree reply in ipc doc 2022-09-21 19:27:32 +02:00
Michael Stapelberg
f0856c285c debian: update changelog 2022-09-21 18:38:54 +02:00
Michael Stapelberg
ac95dffd6b Update debian/changelog 2022-09-21 18:26:55 +02:00
Michael Stapelberg
2bdcae8149 Merge branch 'release-4.21' 2022-09-21 18:26:55 +02:00
Michael Stapelberg
c0ef3caec8 Merge branch 'next' into stable 2022-09-21 18:26:55 +02:00
Michael Stapelberg
d7f4707e05 Restore non-git version suffix 2022-09-21 18:26:55 +02:00
Michael Stapelberg
5bc4280a48 release i3 4.21 4.21 2022-09-21 18:26:43 +02:00
Michael Stapelberg
8ade46bdf0
unflake t/289-ipc-shutdown-event.t (#5144)
Before this commit, the test was flaky: it relied on the Perl test process
sending the kill() system call before i3 exited. This can easily be triggered
by adding a sleep(1) after the “cmd 'exit'” line.

This is because with i3_autostart => 1 (the default), i3test.pm kills i3
or bails out if it can’t.

So, we instead set i3_autostart => 0 and launch i3 ourselves.
This will unfortunately still make the code kill i3 and bail out,
because launch_with_config updates the $i3_pid variable that i3test.pm
uses for tracking whether it should clean up i3.
The solution is to exit i3 by calling exit_gracefully,
which will make the i3test.pm state correct.

related to https://github.com/i3/i3/issues/3009
2022-09-21 17:47:40 +02:00
Orestis Floros
227c1538be
Add some release notes (#5138) 2022-09-20 09:13:34 +02:00
Orestis Floros
516d442e9a
tiling_drag: Correctly switch to workspace when dragging across outputs (#5141)
Fixes #5089
2022-09-20 09:13:14 +02:00
viri
8252144cc3
motif: restore BS_NORMAL correctly (#5135)
motif hints: restore BS_NORMAL correctly
2022-09-19 20:12:15 +02:00
Orestis Floros
0ac5e248f2
tiling_drag: con_rect_plus_deco_height: Fix underflow (#5129)
Fixes #5069
2022-09-17 13:00:29 +02:00
zhrvn
5ce8e3241b
Fix crash in parse_file() when parsing nested variables (#5003)
Count extra_bytes correctly

If there is a variable with the same name as the rest of another
variable after removing $, then it will be counted twice. Therefore,
we need to completely replace it with spaces (variable names cannot
contain spaces) in order to correctly calculate the length of a new
string.

fixes https://github.com/i3/i3/pull/5002

Co-authored-by: Ivan Zharov <zhiv.email@gmail.com>
Co-authored-by: Michael Stapelberg <stapelberg@users.noreply.github.com>
2022-09-12 09:03:50 +02:00
zhrvn
e48b9aa284
Fix segfault with mode "default" key bindings (#5007)
ignore bindings when not in a valid mode

Co-authored-by: Ivan Zharov <zhiv.email@gmail.com>
Co-authored-by: Michael Stapelberg <stapelberg@users.noreply.github.com>
2022-09-11 15:22:01 +02:00