Commit Graph

2954 Commits (465447a96b6004c5f4371335e8552f780d267373)

Author SHA1 Message Date
Albert Safin beb96ad18c Move container to marked workspace: refine corner case
This commit should fix "move con to parent" trick (see below) in the
case when con->parent->parent is a workspace.

The trick:

    mark _a, focus parent, focus parent, mark _b,
    [con_mark=_a] move window to mark _b, [con_mark=_a] focus

The trick got broken in commit 626af81232
in order to fix an i3 crash (#2003).  Reverting said commit fixes the
trick.  The crash is caused by the fact that empty workspace isn't
considered a split (checked in src/con.c:1324), so the moved window ends
up as a sibling of the target workspace, not as its child.
2019-10-07 18:15:03 +00:00
Ingo Bürk ba0868e593
Merge pull request #3728 from cdlscpmv/next
Add setting for minimal width of workspace buttons
2019-10-06 00:22:44 +02:00
Orestis d22f0342b2
Merge pull request #3809 from xzfc/3606-floating-xterm
Fix regression: floating xterm created partially off screen
2019-10-02 10:52:40 +03:00
Albert Safin 67217822b8 do not try to center floating window on itself
Some apps including XTerm start with a WM_CLIENT_LEADER property
containing their own window ID.  Before this commit, i3 tried to center
such windows onto itself and did it wrong since
`leader->rect == {0,0,0,0}` at this moment.

The first affected commit is 128122e766,
however, before it such windows already was misplaced, but got sanitized
afterward [1].

[1]: 8a3ef3a81b/src/floating.c (L329-L335)

Fixes #3606
2019-10-02 04:00:05 +00:00
Albert Safin ff73ddeeee extract_workspace_names_from_bindings: handle optional flags
fixes #3527
2019-09-23 08:21:30 +00: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
David Shen efe84764b0 Unset _I3_RESTART_FD after restart (#3775)
Closes #3764
Closes #3765
2019-08-28 08:54:10 +02:00
Brian Ashworth 741e94ae4f cmd_move_to_mark: fix move to scratchpad hidden
This fixes the case where moving a container to a scratchpad hidden
container via a mark would cause the container to be tiling on the
__i3_scratch workspace. This still moves the container to the
__i3_scratch workspace, but properly adds it to the scratchpad so that
it becomes usable instead of requiring criteria to regain access to.
2019-08-21 19:58:49 -04:00
Orestis Floros 14d2a4c7f6
Correctly select output when pointer query fails 2019-08-13 16:54:55 +03:00
Orestis Floros fd7e51927d
get_first_output: prefer primary output
Used in two cases:
- When the pointer location can't be found but some initial container
needs to be focused
- When moving disabled outputs
2019-08-13 16:44:45 +03:00
izzel 0845d7b264 Remanage window after property updates (like titles) (#3759) 2019-08-13 08:50:48 +02:00
Antoine 3b88e41dd8 move workspace to output: don’t create duplicatively numbered workspaces (#3746)
fixes #3745
2019-08-08 07:43:01 +02:00
Michael Stapelberg 5bb7b73a4a
restart: make reply an array, add forgotten test to git (#3750)
related to #3565
2019-07-29 13:21:34 -07: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
Konst Mayer 94228fd902 Add setting for minimal width of workspace buttons 2019-06-25 13:10:01 +07:00
Orestis Floros 573574b301
Fix: delete decoration cache after swap
Fixes a regression after 8e1687a where swapping 2 containers across
different workspaces would not update their titles.
2019-05-25 00:05:18 +03: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 830465b39f
ewmh: Cache idx to avoid xcb_change_property calls
Updates ewmh_update_current_desktop, ewmh_update_number_of_desktops
2019-05-03 16:16:22 +03:00
Orestis Floros 8c25bc1bd4
tree_close_internal: Log workspace name in EWMH message 2019-05-03 15:39:04 +03:00
Orestis Floros 4a37d20602
ewmh: Introduce FOREACH_NONINTERNAL macro 2019-05-03 15:38:37 +03:00
Orestis Floros cc9b227978
Make small DLOG improvements
- manage_window: log the window in the start of the function so that the
reader knows what the rest of the messages refer to, even if the
function exits prematurely.
- con_is_floating: Message is spammy
2019-04-03 18:51:34 +03:00
Orestis Floros 8b88f00117
window.c: Reduce code in window_update_* functions 2019-04-03 18:51:34 +03:00
Orestis Floros ea6068a02d
Replace scalloc + strncpy with sstrndup 2019-04-03 18:51:34 +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 7754de900a
Move code clearing the config to a new function 2019-03-29 12:26:00 +02:00
Orestis Floros 4a2cacebf6
load_configuration: Remove conn argument 2019-03-29 02:49:10 +02:00
Orestis Floros f9c4011691
Update configuration.h
- parse_configuration was mentioning outdated config file order
- kill_configerror_nagbar was not used anywhere
2019-03-29 02:49:10 +02:00
Ingo Bürk 24a8eac134
Merge pull request #3658 from orestisf1993/workspace_move_to_output
Workspace move to output
2019-03-22 11:18:54 +01:00
Orestis Floros d4e4cbfd25
workspace_move_to_output: Avoid operations when workspace already at destination
Closes #3635.
Probably the bug can still happen when a tree_close_internal happens
inside a workspace_show but modifying the code to avoid them seems to
not be worth it.
2019-03-22 10:47:49 +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 Floros d0ab51db85
workspace_move_to_output: Make stylistic changes 2019-03-22 03:09:27 +02:00
Orestis Floros 8ce99cdacb
cfg_workspace: Accept outputs with spaces again
This is a regression from bce088679.

An other way to fix this would be to concatenate strings inside the
strtok loop when an output starts with a double quote but I'd rather
let the parser do the word splitting.

Fixes #3646
2019-03-21 21:31:30 +02:00
Michael Stapelberg 79b052230c x.c: correctly free con->frame_buffer in _x_con_kill
This fixes a crash which I could not reproduce in a testcase with reasonable effort, but the user reported the fix works.

Compare with src/x.c:946.

fixes #3554
fixes #3645
2019-03-19 09:50:22 +01:00
Orestis Floros 098b0e6976
create_workspace_on_output: send workspace init event
Fixes #3595
Like the issue mentions:
> instead of the newly created workspace (not referenced by variable
> here) the `"init"` event is fired with the current workspace (`ws`).

Plus, there was another issue where duplicate workspace init events
where being sent because of workspace_get().

304-ipc-workspace-init.t: Subtest "move workspace to output" fails with
current next.

Fixes #3631
No event was being sent here:
2d6e09a66a/src/randr.c (L487)

533-randr15.t: I confirmed that SKIP still works if the xrandr command
fails.
Added test fails with current next.
2019-02-23 12:00:55 +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
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