Commit Graph

426 Commits

Author SHA1 Message Date
nixo abe82f31a6 add move to workspace 2020-05-12 14:56:06 +02:00
nixo 03cbf0a766 more progresses 2020-05-10 18:31:26 +02:00
nixo c8f383329d many progresses 2020-05-10 17:20:32 +02:00
Orestis Floros f63a4bef54
cmd_bar improvements (#4014)
- Split cmd_bar into 2 functions, improving errors and reducing strcmps
- Only update barconfig when something has changed
- Only update barconfig for the specific bar that has changed

Fixes #3958
2020-05-07 09:22:03 +02:00
Orestis Floros 0b62129224
Remove unused headers
With help from
https://github.com/include-what-you-use/include-what-you-use/
2020-04-20 04:25:06 +02:00
Orestis Floros 3c522d9f2f
Sort includes in *.c files
Not enabling in .clang-format because it breaks headers files.

Used:
    IncludeCategories:
      - Regex:           '^<config'
        Priority:        0
      - Regex:           '^".*"'
        Priority:        1
      - Regex:           '^<(xcb|xkb|yajl|X11)'
        Priority:        3
      - Regex:           '.*'
        Priority:        2
2020-04-19 09:58:25 +02:00
Ingo Bürk f4b1da7f23
Merge pull request #4011 from orestisfl/floating_reposition-needs_tree_render
Call tree_render if floating move changes workspace
2020-04-11 19:50:14 +02:00
Orestis Floros bb8f2927ae
Call tree_render if floating move changes workspace
This fixes a bug where moving a floating container with
cmd_move_direction displays a "broken" state if the container crosses
workspace boundaries.
2020-04-11 10:52:35 +02:00
Orestis Floros 964456b628
Limit log length with IPC commands
Fixes #3525
2020-04-10 16:59:46 +02:00
Orestis Floros 4b4f1f604f
cmd_focus_sibling: Fix crash on workspace level
Fixes #3997
2020-04-09 11:29:14 +02:00
xzfc 1f0c628cde
clang-format: bring back ForeachMacros (#3948)
* clang-format: bring back ForeachMacros

ForeachMacros was disabled in 4211274fcd
due to the breakage of include/queue.h. The currently used version,
clang-format-6.0 doesn't break it.

* Add curly braces

Co-authored-by: Orestis Floros <orestisflo@gmail.com>
2020-02-19 11:31:09 +01:00
Orestis Floros f76b11327f
Do not error on exec not matching a container
See #3903, #3905
2020-01-18 11:09:14 +01:00
Ingo Bürk 110bdcbee5
Merge pull request #3905 from Airblader/bug-3903
Respect match criteria for exec command
2020-01-16 22:19:25 +01:00
Ingo Bürk f002584509 Respect match criteria for exec command
We currently do not evaluate match criteria for the exec command
since generally executing the same command multiple times is
unlikely to make sense.

However, it does make sense when the match is empty and this should
prevent the command from running, which currently does not happen.

For consisteny we execute the command as many times as there are
matched criteria, but print a warning if it matches more than one
container.

fixes #3903
2020-01-16 22:07:37 +01:00
Orestis Floros 0ed94fc788
Use EXIT_SUCCESS/FAILURE instead of 0/1 2020-01-16 09:27:05 +01:00
Orestis Floros 17d0cd7034
Remove various unused parameters 2019-10-20 16:14:20 +03:00
Orestis Floros 359d75cd3c
Fix crash with moving container that is to be flattened
Same can happen with move_to_output_directed but it is not so easy to
write a test about it.

Fixes #3831
2019-10-16 01:32:05 +03:00
Orestis Floros bbc4c99c72
Refactor tree_next
- Makes `tree_next` not recursive.
- Adds `focus next|prev [sibling]` command. See (1.) and (2.) in
https://github.com/i3/i3/issues/2587#issuecomment-378505551 (Issue also
requests move command, not implemented here).
- Directional focus command now supports command criteria.

Wrapping is not implemented inside a floating container. This was also
true before the refactor so I am not changing it here.
2019-10-14 03:31:24 +03:00
Orestis Floros f402f45702
Introduce CMD_FOCUS_WARN_CHILDREN 2019-10-14 02:38:53 +03:00
Ingo Bürk 736ac40b10
Merge pull request #3814 from orestisfl/net_active_fullscreen
handlers.c: new focus should not end up behind fullscreen
2019-10-09 13:25:38 +02:00
Albert Safin 7e4eb51d23 When renaming a workspace, update the previous_workspace_name too
Fixes #3694
2019-10-09 08:09:24 +00:00
Orestis Floros 34c217acc8
Introduce con_activate_unblock 2019-10-09 02:31:52 +03:00
Orestis Floros a73510026f
Remove packed attribute from Rect
Fixes #3785 -- the issue where the Travis build failed because of gcc's
-Werror=address-of-packed-member.

Adds an equality function to avoid relying on memcmp().
2019-09-03 10:43:36 +03:00
Michael Stapelberg e4ecc6e4a1
Make `restart` IPC command send a reply once restart completed (!) (#3743)
This is achieved by retaining the IPC connection which is sending the restart
command across the restart.

This is the cleaner fix for https://github.com/i3/go-i3/issues/3

fixes #3565
2019-07-21 14:52:12 +02:00
Orestis Floros c9efa6dffe
Call all ewmh_update_* functions together when necessary
The testcase is changed because it was actually incorrect. Easy to
verify because:
> _NET_CURRENT_DESKTOP
> …
> The index of the current desktop. This is always an integer between 0
> and _NET_NUMBER_OF_DESKTOPS - 1.

Fixes #3696.
Also updates the viewports.

Finally, fixes an issue with _NET_CURRENT_DESKTOP not being updated
after a workspace rename. Example:
- workspaces 1, 2, 3
- rename workspace 1 to 5
- All workspaces changed their index but _NET_CURRENT_DESKTOP was not
updated
2019-05-03 16:19:11 +03:00
Orestis Floros 08cdc3a6ae
Allow checking for duplicate bindings with -C
- Having both parse_configuration and parse_file is excessive now
- We detect if we are parsing only by checking if conn is NULL, not with
use_nagbar
- font.pattern needs to be set to NULL because it is freed in
free_font()

Fixes #3660
2019-03-29 12:30:04 +02:00
Orestis Floros 4a2cacebf6
load_configuration: Remove conn argument 2019-03-29 02:49:10 +02:00
Orestis Floros 7fc3bf660e
cmd_focus_output: Avoid assertion crash
Happened when the command criteria didn't match any windows. For
example: `[con_mark=doesnotexist] focus output left`.
2019-03-22 10:47:48 +02:00
Orestis Floros 351d891f4c
get_output_for_con: Assert result != NULL
- The result from con_get_output was always not NULL because
con_get_output asserts so
- get_output_by_name should always be able to get an output from the
corresponding container
- workspace_move_to_output doesn't return bool anymore since it can't
fail
2019-03-22 03:10:00 +02:00
Orestis 02bb2693f9 cmd_exit: Let i3_exit handle shutdown (#3600)
- __lsan_do_leak_check() will terminate the process, so move it to the
end of the function.
- ev_loop_destroy() must be called after ipc_shutdown() because the
latter calls ev_ functions.

Fixes #3599
2019-01-22 21:35:44 +01:00
Albert Safin 9a1eb7a783 commands.c: Add missing error replies 2018-12-09 07:41:19 +07:00
Orestis Floros 100d05a2a6
render_con: Get rid of render_fullscreen argument
Only true for the fullscreen container and doesn't affect any of its
children. Thus, we can get the same result by checking
->fullscreen_mode.
2018-11-12 19:05:50 +02:00
Orestis Floros 29f2510fa9
Fix aspect ratio bugs
- ICCCM says: > If a base size is not provided, the minimum size is to
be used in its place and vice versa.
i3 didn't obey the "vice versa" part. Min size and base size are both
saved without replacements in window_update_normal_hints,
floating_check_size makes the needed replacements if either was not
provided.
- Aspect ratio is now saved correctly in manage_window because
window_update_normal_hints is called.
- i3 didn't save the aspect ratio if the window conformed the given
aspect ratio range when handle_normal_hints was called. If the window
was resized to a size outside of the given bounds, i3 didn't correct it.
- Aspect ratio now affects only tiling windows, like the rest of the
normal size hints
- The aspect ratio calculation is now done without a loop

A real life example of how these changes affect the workflow:
An mpv window, when playing a video, sets its min == max aspect ratio
during mapping. i3 ignored these hints. When resized, the window's
aspect ratio was not preserved. With this commit, resizing floating mpv
windows will always preserve the aspect ratio.
2018-11-12 18:45:00 +02:00
aksel bbfa140c0f For resizing, convert pixel diff to percentage, based on parent.
Previously, it first calculated one of the containers' next percentage, and then subtracted the previous percentage to find the actual change.

Now it directly calculates the change, and subtracts and adds the change to the two affected containers.

Added util function con_rect_size_in_orientation.

Removed px_resize_to_percent; inlined, using con_rect_size_in_orientation.

Also, prematurely return when pixel diff is 0, as no action is necessary.

This is related to [this issue on i3-gaps](https://github.com/Airblader/i3/issues/247).
2018-11-08 23:15:23 +01:00
Orestis Floros e4d2b38552
Make comment style more consistent 2018-10-13 21:10:10 +03:00
Orestis Floros a65914f338
Fix missing prototypes
i3 will now compile with no warnings when -Wmissing-prototypes is used.
2018-10-13 21:10:10 +03:00
Orestis Floros e67be1ccd3
commands.c: Improve error replies
- Improve / add various error messages.
- Replace all `LOG(…); ysuccess(false);` with `yerror(…);`.
- switch_mode: Remove redundant "ERROR:" ELOG string.
- cmd_move_con_to_workspace*: Make sure that we don't try to move an
empty workspace to another workspace. This can be problematic when we
match a workspace using command criteria (eg marks) and the target is a
non-existing workspace. We create the new workspace but since nothing is
moved there, we are left with an empty workspace. See added testcase.
2018-09-11 08:35:58 +03:00
Ingo Bürk cb6da7169a
Merge pull request #3389 from orestisf1993/resize-ensure-1px
Ensure containers have a size of at least 1px after resize
2018-09-06 08:41:00 +02:00
Ingo Bürk 9edb7c7a3b
Merge pull request #3390 from orestisf1993/resize-tile
resize set for tiling: default to px when not specified
2018-09-06 08:38:53 +02:00
Orestis Floros 64142eeef2
resize set for tiling: default to px when not specified 2018-09-06 05:58:51 +03:00
Orestis Floros 23c1c13d34
Ensure containers have a size of at least 1px after resize
Fixes #2226.
Fixes #2776.
Fixes #3241.
Related to #3194.
2018-09-06 04:56:31 +03:00
Orestis Floros 6846ac98c0
cmd_rename_workspace: correct order of events
1. Rename happens
2. Workspace is moved because of assignments
3. Workspace closes because it is empty (#3248)

Fixes #3248.
2018-09-06 03:42:07 +03:00
Ingo Bürk 4cba9fcbda
Merge pull request #3368 from orestisf1993/render_root
(floating) global fullscreen bugs & others
2018-08-24 09:49:41 +02:00
Orestis Floros 096cff0aad
Make resize set ppt more accurate
See the testcase for the usecase.
2018-08-24 04:13:25 +03:00
Orestis Floros 51d230ad4c
Make resize set px work with tiling containers 2018-08-24 04:13:25 +03:00
Orestis Floros 423e20b960
cmd_resize* statics: remove useless 'way' argument 2018-08-24 04:13:25 +03:00
Orestis Floros 26bbaf6237
Make cmd_resize_tiling_width_height work with pixels 2018-08-24 04:13:25 +03:00
Orestis Floros 2ead7745d6
Make cmd_resize_tiling_direction work with pixels
Introduces resize_neighboring_cons in resize.c which is also used by
resize_graphical_handler.

Co-authored-by: Andrew Laucius <andrewla@gmail.com>
Authored original code and tests in #3240. I rewrote most of the
resizing code and fixed the failing tests.
2018-08-24 04:13:03 +03:00
Orestis Floros 9522b46f1b
Introduce parse_direction
Also fixes the following bug: in the fix for #1011 in
cmd_resize_floating direction "width" is not considered.

Influenced by #3240.
2018-08-23 15:45:24 +03:00
Orestis Floros efc78de4ee
Introduce con_get_fullscreen_covering_ws
This commit will also fix the following bugs:
1. click.c: Users could drag global fullscreen floating containers.
2. render.c: Floating containers would get rendered with a global fullscreen container in another
workspace.
2018-08-22 14:05:50 +03:00