Commit Graph

6329 Commits (702e83c95ed75e6debbff8729177a8560f373956)

Author SHA1 Message Date
Orestis Floros 626af81232
Fix crash when moving container to marked workspace
Was a small typo.

This also has the (positive) side-effect of allowing to move all the
content of a marked workspace next to the target container, see added
tests.
2018-04-07 21:58:55 +03:00
Ingo Bürk a92acadfc0
Merge pull request #3223 from orestisf1993/minor
Minor changes
2018-04-05 10:59:34 +02:00
Orestis bfe047e8bc
Merge pull request #3221 from ograff/issue-3208
Issue #3208
2018-04-05 11:32:38 +03:00
Oliver Graff e4a184e77e
Workspace renaming: Interpret outputs as nondirectional
Currently when renaming outputs, an output assignment of "left" will
cause the workspace to move left. Treat this assignment as a proper name
instead (even though it is unlikely an output will be named "left").

Move logic for determining output to move to out of
`workspace_move_to_output`

Add test for ignoring direcionality during rename.

Fixes #3208.
2018-04-04 13:37:59 -04:00
Orestis Floros 0aa636b207
Prefer compiler warnings to assertions for unhandled switch cases
Using 'default:' cases can hide logical errors which would lead to i3
crashes for users. With this change the compiler will print a warning
when a case is not handled. For example, if I add a new value in the
Font.type enum:
../../i3/libi3/font.c: In function ‘draw_text’:
../../i3/libi3/font.c:378:5: warning: enumeration value ‘NEWFONT’ not handled in switch [-Wswitch]
     switch (savedFont->type) {
     ^~~~~~
2018-04-04 19:20:55 +03:00
Orestis Floros 393412a204
A__NET_REQUEST_FRAME_EXTENTS: use render_font_height() 2018-04-04 18:09:34 +03:00
Ingo Bürk bc760c2036
Merge pull request #3215 from orestisf1993/focus-next-prev
Small window decoration scrolling bugfix
2018-04-03 20:42:00 +02:00
Orestis Floros 96ee336a0b
Use con_orientation instead of ternary operator 2018-04-01 12:18:27 +03:00
Orestis Floros fbce834b20
Window decoration scrolling: don't focus sibling
The current behaviour is buggy in the following layout:
T [ A* V [ B C ] ], where the focus stack in V is B > C.
When the user scrolls down, focus correctly moves to B but if the user
scrolls down again the whole vertical container is focused.

This happens because 'bool scroll_next_possible' is false but
con_activate is called on the tabbed container's sibling - the vertical
container.
2018-04-01 12:18:27 +03:00
Ingo Bürk 666aa9e0dd
Merge pull request #2941 from orestisf1993/issue-2938
Fix focus order in floating_disable & floating_enable for unfocused windows
2018-03-31 20:34:17 +02:00
Ingo Bürk 8a805cdd5c
Merge pull request #3214 from stapelberg/sync
unflake t/525-i3bar-mouse-bindings.t
2018-03-30 21:33:03 +02:00
Michael Stapelberg 874151bb09 t/525-i3bar-mouse-bindings.t: sync with i3 _and_ i3bar
See the comment in the code for rationale.
2018-03-30 21:14:53 +02:00
Michael Stapelberg 145ac532aa i3bar: forward the sync request via IPC, not X11
i3bar’s X11 output is not what our testcases are testing — the state
manipulations which i3bar triggers via IPC messages to i3 are what we are
interested in.
2018-03-30 21:14:51 +02:00
Michael Stapelberg eca8fae2de introduce the sync IPC command
Sending the sync command via IPC ensures pending IPC messages are handled by i3
before the sync response is read. This is rarely useful for direct IPC
connections to i3, but becomes useful when synchronizing with i3bar, which might
have pending IPC messages in response to button clicks.
2018-03-30 21:09:52 +02:00
Michael Stapelberg 725ee3ce62 move i3 sync code into sync_respond (for following commits) 2018-03-30 21:05:32 +02:00
Orestis Floros 791e407fd3
Remove special handling of floating containers in con_next_focused
Explanation for the changed test:
After $third is switched to floating, the test moves focus to $second.
So, the parent of $second (the stacked container) is above $third in the
focus stack and it's children ($first, $second) should get focused
before $second. When $second is switched to floating the correct focus
order for the workspace should be $second->parent (floating con is the
parent) > $first->parent (stacked con) > $third.

Fixes #1975
2018-03-30 18:29:33 +03:00
Orestis Floros 2c6da57e81
Add testcases for toggling floating windows from different workspaces 2018-03-30 18:29:33 +03:00
Orestis Floros 3a89f88fb6
Fix focus order in floating_enable for unfocused windows
Partially fixes issue #2938
2018-03-30 18:29:32 +03:00
Orestis Floros 10a3c1e827
Fix focus order in floating_disable for unfocused windows
Partially fixes issue #2938
2018-03-30 18:20:40 +03:00
Orestis Floros 60875c7bcb
Use con_detach instead of TAILQ_REMOVE in floating 2018-03-30 18:20:40 +03:00
Joona 4e0bf58109 Add --modifier flag to i3-config-wizard (#3210)
Add --modifier flag to i3-config-wizard

The --modifier flag accepts either alt or win, and will generate the
configuration file without opening a window.

Also adds i3-config-wizard's flags to the manpage.

Fixes #3136.
2018-03-30 13:57:41 +03:00
Ingo Bürk 63133c878f
Merge pull request #3213 from orestisf1993/issue-2535
Fix memory leak when _XKB_RULES_NAMES can't be found
2018-03-30 12:48:12 +02:00
Orestis Floros 4143f3abfc
Fix memory leak when _XKB_RULES_NAMES can't be found
Steps to reproduce:

1. Force the branch to be taken:

diff --git a/src/bindings.c b/src/bindings.c
index fe77bc8f..caa5848c 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -941,7 +941,7 @@ bool load_keymap(void) {

     struct xkb_keymap *new_keymap = NULL;
     int32_t device_id;
-    if (xkb_supported && (device_id = xkb_x11_get_core_keyboard_device_id(conn)) > -1) {
+    if (0) {
         if ((new_keymap = xkb_x11_keymap_new_from_device(xkb_context, conn, device_id, 0)) == NULL) {
             ELOG("xkb_x11_keymap_new_from_device failed\n");
             return false;

2. Run `python2 ./xproperty.py _XKB_RULES_NAMES ''` (from
https://github.com/siemer/xproperty) in the xinitrc
3. Memory sanitizers detect memory leaks.

Note: We don't (and didn't) pass NULL in xkb_keymap_new_from_names() but
an xkb_rule_names structures with NULL fields (fill_rmlvo_from_root only
fills its argument when there are no errors) should be equivalent:
767fa86d42/NEWS (L349-L351)
> The function xkb_keymap_new_from_names() now accepts a NULL value for
the 'names' parameter, instead of failing. This is equivalent to passing
a 'struct xkb_rule_names' with all fields set to NULL.

Fixes #2535.
2018-03-29 17:46:41 +03:00
Ingo Bürk 77bfa595df
Merge pull request #3200 from orestisf1993/_con_move_to_con
_con_move_to_con: don't change focus when moving to active workspace
2018-03-29 12:06:29 +02:00
Ingo Bürk 145a93d5b4
Merge pull request #3207 from orestisf1993/get_workspace_by_
Introduce get_workspace_by_* functions
2018-03-29 12:06:05 +02:00
Orestis 6dfa348960
Merge pull request #3192 from Exagone313/next
translate_keysyms: fix potential memory leak
2018-03-29 12:16:12 +03:00
Orestis Floros 0b5799412a
Introduce get_existing_workspace_by_num 2018-03-28 15:18:43 +03:00
Orestis Floros 6a2728ba79
Introduce get_existing_workspace_by_name 2018-03-28 15:18:43 +03:00
Orestis Floros 6d983b5ee0
_con_move_to_con: don't change focus when moving to active workspace
Seems to be the intention, indicated by this comment (con.c:1307-1309):
    /* For split containers, we use the currently focused container within it.
     * This allows setting marks on, e.g., tabbed containers which will move
     * con to a new tab behind the focused tab. */

Related to #3085.
2018-03-28 15:10:11 +03:00
Elouan Martinet e6bd2006bc Fix potential memory leak
xkb_state_new uses calloc and may fail in a rare case, which would cause a memory leak.
Note that xkb_state_unref checks if the parameter given is not null (!state) before freeing.
Calls to xkb_state_new have been grouped to remove code duplication.

Signed-off-by: Elouan Martinet <exa@elou.world>
2018-03-27 10:23:16 +00:00
Ingo Bürk 45be56be33
Merge pull request #3205 from orestisf1993/free
cmd_append_layout: resolve_tilde already allocates memory
2018-03-27 09:02:28 +02:00
Orestis Floros e424a31307
cmd_append_layout: resolve_tilde already allocates memory
Fixes a small memory leak with all append_layout commands.
2018-03-27 03:37:57 +03:00
Ingo Bürk 6f4b0e1fdd
Merge pull request #3204 from orestisf1993/focus_next
_con_move_to_con: focus_next isn't always con_next_focused(con)
2018-03-26 21:35:12 +02:00
Orestis a0309cbd52 xcb_drag_prepare_cb: drain events (#3193)
As discussed in PR #3085, X11 events can appear while
dragloop->callback() is running.

Co-authored-by: Michael Stapelberg <michael@stapelberg.de>
2018-03-26 17:59:34 +02:00
Orestis Floros c7dde08673
_con_move_to_con: focus_next isn't always con_next_focused(con)
con_next_focused uses con's parent. But since con can be inside an
unfocused container this means that one of it's siblings could become
focused in the current workspace.
2018-03-26 00:09:26 +03:00
Ingo Bürk f560519f5c
Merge pull request #3203 from orestisf1993/free
memory leaks
2018-03-25 20:12:16 +02:00
Orestis Floros b0997234ab
con_toggle_layout: free(tm_dup) outside loop 2018-03-25 20:48:20 +03:00
Orestis Floros e19a120961
Free A_TO_WORKSPACE_NUMBER assignments 2018-03-25 20:35:53 +03:00
Orestis Floros a5014dc7f8
cfg_workspace: memleak on duplicate workspace assignment
assignment->output is set but lost since TAILQ_INSERT_TAIL is never
called when duplicate is set.
This essentially happens on every reload.
2018-03-25 20:27:07 +03:00
Orestis Floros ee1f551195
startup.c: free timer
Small memleak. The timer is not called used again since ev_timer_init is
called with repeat = 0.
2018-03-25 20:04:31 +03:00
Ingo Bürk 6c3533b615
Merge pull request #3202 from orestisf1993/issue-3201
Prefer fullscreen floating containers when on directional focus
2018-03-25 14:31:39 +02:00
Orestis Floros 37106aa84b
Prefer fullscreen floating containers when on directional focus
Fixes #3201
2018-03-25 14:47:45 +03:00
Ingo Bürk b849fe3e44
Merge pull request #3196 from orestisf1993/_con_move_to_con
_con_move_to_con cleanup
2018-03-24 18:49:26 +01:00
Ingo Bürk 16a707cd19
Merge pull request #3199 from orestisf1993/workspace_show
workspace_show: remove redundant if
2018-03-24 18:39:37 +01:00
Orestis Floros 9e3b48dd22 con_activate -> con_focus when it is used as a building block 2018-03-24 15:21:11 +02:00
Orestis Floros 9a1fcff4e0 _con_move_to_con: remove outdated comment 2018-03-24 15:21:11 +02:00
Orestis Floros 037b1c3710 _con_move_to_con: showing target_ws is useless
The current_ws is shown latter anyway:
    if (!ignore_focus) {
        workspace_show(current_ws);
        ...

This also causes the following bug:
- Open a window in an empty workspace
- Switch to another workspace
- seturgent to the first window
- Move another window to the first workspace
- Urgent flag is now reset
2018-03-24 15:19:49 +02:00
Orestis Floros f46bb0396e workspace_show: remove redundant if 2018-03-24 15:15:02 +02:00
Ingo Bürk a41912430a
Merge pull request #3198 from orestisf1993/_workspace_show
_workspace_show -> workspace_show
2018-03-24 13:47:59 +01:00
Orestis Floros 4097769105 _workspace_show -> workspace_show
a9b57a44a9 removed the extra parameter of
workspace_show.
2018-03-24 14:26:11 +02:00