Orestis [Tue, 22 Jan 2019 20:35:44 +0000 (22:35 +0200)]
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.
Orestis [Sat, 12 Jan 2019 12:13:03 +0000 (14:13 +0200)]
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.
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.
Orestis Floros [Sun, 16 Dec 2018 01:27:09 +0000 (03:27 +0200)]
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.
- Explicitly document --replace, which was previously only mentioned
in the command syntax.
- Improve wording: "a window can only have one mark" is slightly
misleading because it appears to describe the limitation as a
property of the model, whereas this actually pertains the mark
command.
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.
Orestis Floros [Mon, 1 Oct 2018 16:47:33 +0000 (19:47 +0300)]
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.
travis: move (failing) ubuntu build from xenial to bionic
Ubuntu’s apt started refusing to load package files from unauthenticated
repositories, but the package for which we did that (xcb-xrm) is available in
newer versions of Ubuntu, so I just removed that part altogether.
Apparently this has been broken since April, and nobody noticed :-/
Orestis Floros [Mon, 29 Oct 2018 13:46:28 +0000 (15:46 +0200)]
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.
Orestis Floros [Thu, 11 Oct 2018 20:19:21 +0000 (23:19 +0300)]
Close & reopen tray selwin when needed
Fixes #1329
Fixes #3317 (duplicate)
Examples where the tray "disappeared":
- Start without a "tray_output", reload config with "tray_output none",
remove "tray_output none" and reload.
- Start with "tray_output primary" (or "tray_output <output>"), disable
the primary output and then reconnect it.