Commit Graph

2893 Commits (f397698d43e3dd4f4625e1fed1b1d0470d0acdf6)

Author SHA1 Message Date
Orestis Floros f397698d43
floating_resize: Use uint32_t 2018-11-12 18:45:00 +02:00
Orestis Floros 01960f956f
floating_check_size: Use window variable 2018-11-12 18:44:45 +02:00
Ingo Bürk 90c39a4bf6
Merge pull request #3484 from xzfc/3476-export-i3sock
Export I3SOCK
2018-11-10 22:12:01 +01:00
Ingo Bürk 56bb806b52
Merge pull request #3397 from orestisf1993/randr-enable-disable
Fix bugs in enabling & disabling randr outputs
2018-11-10 21:56:34 +01:00
Orestis Floros 11bc25b70b
Truncate wm_name utf8 strings to first zero byte
Fixes #3515
2018-11-09 19:42:32 +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
Ingo Bürk 44e8fddc28
Merge pull request #2954 from orestisf1993/swap-for-floating
Rewrite con_swap to work only with queue operations
2018-11-07 13:13:41 +00:00
Orestis Floros eb53ec83b9
load_layout: Correctly mark non-leaf containers
Example problematic layout:
    {
        "layout": "splith",
        "marks": ["H1"],
        "nodes": [
            {
                "swallows": [
                    {
                        "class": "^a$"
                    }
                ]
            }
        ]
    }

Since the marks were added to the json_node during end_map, the
container that ended up getting the "H1" mark was the child instead of
the parent.
2018-11-07 02:32:12 +02:00
Albert Safin 7926c817a2 Draw outer header borders for all layouts 2018-11-05 20:17:01 +07:00
Orestis dc16df439e Update ewmh focused only when new focus is different (#3496)
Fixes #3495.
2018-11-03 13:39:49 +01:00
Michael Stapelberg eedb257655 switch to clang-format-4.0
clang-format-3.8 is old enough to have vanished from Debian testing, which we
use for our CI.
2018-11-03 09:16:16 +01:00
Orestis Floros 64c493ef1f
Fix regression with moving floating windows
This fixes a regression introduced in 6d983b5. Consider 2 outputs:
fake-0: workspace '1'
fake-1: workspaces '2','3'
Workspace 1 focused, workspace 2 visible.
Open a floating window in 1 and move it to 3. Now, the floating window
appears in workspace 2 and disappears once focus is switched to
that workspace.

Instead of focusing 'old_focus' which might refer to a container in a
different output, we should restore focus by focusing the previously
focused workspace of the output.
2018-10-29 15:46:28 +02:00
Albert Safin aa20358620 Export I3SOCK (#3476) 2018-10-26 15:40:59 +07:00
Ingo Bürk 64e7646c7e
Merge pull request #3452 from orestisf1993/title_align
Add title_align config directive
2018-10-23 16:41:54 +02:00
Ingo Bürk 0ed29f5678
Merge pull request #3448 from orestisf1993/sticky
Fix sticky focus when switching to workspace on different output
2018-10-23 15:31:57 +02:00
Ingo Bürk 74a7bf31a5
Merge pull request #3444 from orestisf1993/move
Some move.c fixes
2018-10-23 15:29:48 +02:00
Orestis Floros 07dfb8450b
Fix typo: childs -> children 2018-10-13 21:10:11 +03:00
Orestis Floros 204eefc679
floating_reposition: avoid extra tree_render 2018-10-13 21:10:11 +03:00
Orestis Floros 8c17e4e38d
manage_window: cleaner variable declarations 2018-10-13 21:10:10 +03:00
Orestis Floros 966915cfb2
borders_to_hide doesn't need to be initialized 2018-10-13 21:10:10 +03:00
Orestis Floros 4219eb213b
root is externally declared 2018-10-13 21:10:10 +03: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 2a9522dda4
Enforce strict prototypes
i3 will now compile with no warnings when -Wstrict-prototypes is used.
2018-10-13 21:10:09 +03:00
Orestis Floros a15fff2370
Use path_exists 2018-10-13 21:10:09 +03:00
Orestis Floros 50880db2c5
Reduce some code around frees 2018-10-13 21:10:09 +03:00
Aestek 6d82753d53
Add title_align config directive
Controls the window titles alignment in title bars. Possible values are:
- left
- center
- right

Co-authored-by: Orestis Floros <orestisf1993@gmail.com>
- Made title_align a config directive instead of a command. Helps with
some tree_render() issues we had.
- Made title_max_width the same for all 3 cases.
- Modified title offset calculations and added explanations for each
case.
- Append title_padding to mark_width if a mark exists.

Fixes #1750
2018-10-12 19:58:48 +03:00
Orestis Floros b09090fa7d
Fix sticky focus when switching to workspace on different output
See the testcase for the exact steps to reproduce the problem.
2018-10-11 12:27:57 +03:00
Orestis Floros 6728696ec8
output_push_sticky_windows: Make a bit easier to understand 2018-10-11 12:27:56 +03:00
Orestis Floros 8e1687a317
Rewrite con_swap to work only with queue operations
Benefits are that we don't open a fake container and don't call many
complicated functions that can lead to redraws (x_push_changes calls) as
discussed in #2954.

Fixes #2810:
Windows exchange floating mode & window rects.
Swap will still not work with CT_FLOATING_CONs but this doesn't make
much sense.

Fixes #3280:
The behaviour is not very user friendly but swap behaves exactly as it
should. The rest is a tree_flatten issue. Attached pictures in #2954.
2018-10-10 17:09:26 +03:00
Orestis Floros 11dd2dbc66
tree_move: Don't change focus order when swapping containers
The call to ewmh_update_wm_desktop is removed since the change happens
under the same parent.
2018-10-09 22:39:38 +03:00
Orestis Floros 9380a75186
move.c: Fix move_to_output_directed problems
- Use workspace_show that correctly updates _NET_CURRENT_DESKTOP, warps
mouse.
- Use TAILQ_INSERT_TAIL only for focus_head. Focus order is not related
to direction.
- Call con_focus only if con was focused before. See testcase for
directional move with command criteria.
- Correct first call of move_to_output_directed in tree_move which
didn't call ipc_send_window_event("move", con) and
ewmh_update_wm_desktop().
- Don't produce events when the move doesn't happen. Correct
276-ipc-window-move.t as well.
2018-10-09 22:35:04 +03:00
Orestis 18dbfe699a userguide: Mention know issues for assign (#3434)
Fixes #3222
Fixes #3293
Related to #2060
2018-10-07 20:24:09 +02:00
Thomas Fischer 0ede8b9365 Correctly calculate max_aspect 2018-09-28 17:34:18 -07:00
Ingo Bürk ebf40889a1
Merge pull request #3424 from orestisf1993/con_num_windows
con_num_windows: Count floating windows
2018-09-28 09:27:58 +02:00
Orestis Floros 5e1d327e43
con_num_windows: Count floating windows
Fixes #3423.
2018-09-26 20:04:17 +03:00
Dan Elkouby 6877205ac1 Reject requests for WM_STATE_ICONIC
For compatiblity reasons, Wine will request iconic state and cannot
ensure that the WM has agreed on it; immediately revert to normal to
avoid being stuck in a paused state.
2018-09-25 15:04:55 +03:00
Orestis 7c21b5995d
Merge pull request #3400 from Synray/next
Respect max size from WM_NORMAL_HINTS
2018-09-20 11:36:22 +03:00
Thomas Fischer 690e6d1f0e
Respect max size in WM_NORMAL_HINTS 2018-09-20 11:31:19 +03:00
Orestis Floros 515dd45f59
match_matches_window: Check if focused->window exists
Fixes #3406.
2018-09-16 14:55:27 +03:00
Orestis Floros d407393d0d
_con_move_to_con: Move upwards only on CT_FLOATING_CON
If target is inside a floating container but not its direct child, the
move can be completed as is.

Fixes #3402.
2018-09-14 16:13:41 +03:00
Ingo Bürk ede954128a
Merge pull request #3342 from orestisf1993/tree_close_internal
Simplify tree_close_internal
2018-09-14 12:24:54 +02:00
Orestis Floros f6bb1e22bb
init_ws_for_output: Remove content argument 2018-09-12 16:53:20 +03:00
Orestis Floros 5976381012
output_init_con: Restore focus if possible
Before this, i3 would focus newly created workspaces on output init
2018-09-12 16:47:18 +03:00
Orestis Floros db3b9e4187
randr_disable_output: Always restore focus
con_detach and con_attach modify the focus stack.

This will make sure that the currently focused workspace will remain
focused after disabling an output.
2018-09-12 16:46:47 +03:00
Orestis Floros 4d21f4cfc2
init_ws_for_output: use workspace_move_to_output
This fixes a crash produced with the following config:
    # i3 config file (v4)
    workspace 1 output $screen1
    workspace 2 output $screen2

    exec --no-startup-id "i3-msg workspace 1, open && i3-msg workspace 2 && xrandr --output $screen2 --off && xrandr --output $screen1 --auto --output $screen2 --auto --right-of $screen1 "

Which results in:
ERROR: AddressSanitizer: heap-use-after-free on address …
READ of size 8 at 0x614000001f48 thread T0
    #0 0x5563df6e73a8 in init_ws_for_output i3/src/randr.c:468
    #1 0x5563df6ef3b4 in randr_query_outputs i3/src/randr.c:940
    #2 0x5563df68dbe1 in handle_screen_change i3/src/handlers.c:450

… is located 264 bytes inside of 448-byte region …
freed by thread T0 here:
    #1 0x5563df634b0a in con_free i3/src/con.c:96
    #2 0x5563df7151e6 in tree_close_internal i3/src/tree.c:344
    #3 0x5563df7280fe in workspace_show i3/src/workspace.c:499
    #4 0x5563df6e7315 in init_ws_for_output i3/src/randr.c:457
    #5 0x5563df6ef3b4 in randr_query_outputs i3/src/randr.c:940
    #6 0x5563df68dbe1 in handle_screen_change i3/src/handlers.c:450

Which is similar to #3228, #3248.
2018-09-12 16:46:47 +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
Orestis Floros 6a1f653508
libi3: validate UTF8 strings
Will validate container / window titles.

Fixes #3156.
2018-09-10 02:00:32 +03:00
Orestis Floros a3dcee35f3
tree_restore: Check croot
Related to #2414, #3156.
2018-09-09 16:11:48 +03:00
Orestis Floros be6faa3161
tree_append_json: Allow strings that are not valid UTF8
Fixes #3156.

I couldn't reproduce the problem in a "natural" way so I cheated:
1. Start i3 with gdb
2. Set breakpoing on tree_restore
3. Run, open window, i3-msg restart
5. Open the file in *path with a hex editor
6. Edit the "name" field of the window and insert bytes that are not
valid UTF8
7. Continue

After parsing fails, all nodes including croot are incomplete, meaning
they have to be deleted. We can't recover in any reasonable way so we
have to allow non-UTF8 characters to avoid this situation altogether.
2018-09-06 14:58:31 +03:00