Commit Graph

2919 Commits (72ccd341fc07476137fea00d67cf7a61d3c99098)

Author SHA1 Message Date
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
nejni-marji 22ac5827b0 Make binding modes case sensitive 2019-01-16 19:32:24 -06:00
Orestis 5aa0459be0 Use ipc queue for all messages (#3585)
I was able to reproduce #3579 in Linux by running:
`sudo sysctl net.core.wmem_default=10000`

If a subscription message was too big to be sent at once, it was
possible to break a client by sending a reply to an other message sent
by the client. Eg:
- Write 8192 out of 11612 bytes of a workspace event.
- Blockingly write the reply to a workspace change message.
- Write the rest 3420 bytes of the workspace event.

This commit fixes this by utilizing the ipc queue for all types of
writes.

ipc_receive_message can only be called from a callback started in
ipc_new_client. This callback uses the same file descriptor with the
client also created in ipc_new_client. When the client is deleted, the
read callback is now also stopped. Thus, we can assume that whenever
ipc_receive_message is called, the corresponding client should still
exist.

- ipc_client now contains pointers to both write and read watchers. When
freed, a client will stop both of them.
- IPC_HANDLERs now work with ipc_clients instead of fds.

Fixes #3579.
2019-01-12 13:13:03 +01:00
Orestis Floros 0abb4f7e88
Fix crash with popups when fullscreen is non-leaf
Introduced in b3e69ed12

Fixes #3582
2019-01-11 14:46:13 +02:00
Nguyễn Thái Ngọc Duy 6462cf1ca3
Remove \n from errx and die messages
errx() already appends \n internally. "\n" in the error message will
result in a blank line after the message. die() is just a wrapper around
errx() so it receives the same treatment.
2019-01-02 14:23:56 +02:00
Orestis Floros 318528e3fc
Fix: render_con shows floating containers on wrong workspace
After 204eefc. Alternative fix:
    diff --git a/src/floating.c b/src/floating.c
    index f5c61782..6dd79668 100644
    --- a/src/floating.c
    +++ b/src/floating.c
    @@ -954,7 +954,7 @@ bool floating_reposition(Con *con, Rect newrect) {
             con->scratchpad_state = SCRATCHPAD_CHANGED;

         /* Workspace change will already result in a tree_render. */
    -    if (!reassigned) {
    +    if (!reassigned && workspace_is_visible(con_get_workspace(con))) {
             render_con(con);
             x_push_node(con);
         }
but I don't think that the extra complexity is worth it.

Change in handlers.c because of d2d6d6e0 where the bug also appears.

Fixes #3567
2018-12-16 03:49:21 +02:00
Orestis Floros fb1ae61d1c
Invalidate last_focused when focusing the EWMH support window
Fixes #3562
2018-12-14 23:47:48 +02:00
Orestis Floros dd708199ea
Fix: killing unfocused window shouldn't produce focus event 2018-12-14 23:46:21 +02:00
Orestis Floros 605b6ba00f
attach_to_workspace: set new parent before tree_render
on_remove_child calls tree_close_internal which calls tree_render and
the tree is in an invalid state if con->parent still points to the old
parent.

Fixes #3556
2018-12-12 19:12:01 +02:00
Albert Safin 64ab1f42b7 Preserve back_and_forth during restart
Add new key "previous_workspace_name" to the json dump of the root container.
2018-12-11 20:46:06 +07:00
Ingo Bürk f08119298e
Merge pull request #3549 from xzfc/small-fixes
Small fixes
2018-12-09 18:13:13 +01:00
TAL b479dc1a0f Fix #3535 - Check for DISPLAY when requesting version information 2018-12-09 02:20:47 +01:00
Albert Safin 27030c8566 Code style: fix misaligned and misindented comments 2018-12-09 08:04:55 +07:00
Albert Safin b6282b47bc Remove unused con_get_next()
This function has unused for a long time since the commit
8f4b9ddaa4.
2018-12-09 08:04:41 +07:00
Albert Safin 0eb07dea5c Remove unnecessary code in route_click()
This case is handled by resize_find_tiling_participants() anyway which
is introduced in the commit dbec5eb905.
2018-12-09 07:48:40 +07:00
Albert Safin 9a1eb7a783 commands.c: Add missing error replies 2018-12-09 07:41:19 +07:00
Michael Stapelberg 01c1b5dec2 Bugfix: use restore_conn, not conn
Using the wrong X11 connection breaks the libev event handling model:
xcb_flush() must be called immediately before handing control to libev.

Before this fix:

1. xcb_prepare_cb would read and flush conn
2. restore_xcb_prepare_cb would read and flush restore_conn,
   BUT also inadvertantly call xcb_flush(conn), resulting in new
   events being filled into the XCB event queue
3. libev waits for new events
4. after 1 minute, libev times out and the events are processed

Diagnosed using strace on testcases/complete-run.pl.

related to commit 0d8b6714e3

related to #3510
2018-12-08 13:31:53 +01:00
Orestis Floros a81e22a277
Apply title_align to non-leaf containers
Additionally, marks will now display for non-leaf containers.

Fixes #3540.
2018-12-04 20:50:32 +02:00
Albert Safin 1a85619498 Add input and bounding shapes support (#2742)
Basic idea: if the window has a shape, set the parent container shape as
the union of the window shape and the shape of the frame borders.

Co-authored-by: Uli Schlachter <psychon@znc.in>
2018-12-01 11:52:41 +07:00
Albert Safin 9273f67734 Log window id in state_for_frame() 2018-12-01 10:31:11 +07:00
Michael Stapelberg 7ade46c61f
switch to clang-format-6.0 (#3533) 2018-11-28 17:38:16 +01:00
Ingo Bürk a080551f26
Merge pull request #3432 from orestisf1993/aspect-ratio
Fix aspect ratio bugs
2018-11-17 16:08:22 +01:00
Orestis Floros a84b30f8a9
randr.c: Fix regression with focusing NULL container
This was introduced in db3b9e4187 which
removed the NULL check for next.

Fixes #3523.
2018-11-15 13:49:26 +02:00
Orestis Floros d2d6d6e0a8
Re-render floating cons alone when possible 2018-11-12 19:05:51 +02: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
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