Commit Graph

6512 Commits

Author SHA1 Message Date
Orestis Floros d134745c4f Prevent access of freed workspace in _workspace_show
The bug triggers when _workspace_show calls tree_close_internal and
old == old_focus. Ie, when the old workspace was empty and needs to be
closed but then is accessed as output_push_sticky_windows's argument:
Breakpoint 1, output_push_sticky_windows (to_focus=0x55555589c8a0) at ../../i3/src/output.c:102
102	                    con_move_to_workspace(current, visible_ws, true, false, current != to_focus->parent);
(gdb) print con_exists(to_focus)
$1 = false

The access violation can also be prevented by checking if
con_exists(old_focus) but it shouldn't be necessary: the old_focus
container can only be killed when it is an empty workspace.

With --enable-sanitizers this causes i3 to exit but with
--disable-sanitizers the access violation doesn't reliably cause a crash
and the con_move_to_workspace call continues with:
(gdb) print current != to_focus->parent
$2 = 1

Since current->type is CT_FLOATING_CON and to_focus->type is
CT_WORKSPACE, in this specific case ignore_focus would always be true.
So, in this case, passing NULL instead of old_focus to
output_push_sticky_windows doesn't change the behaviour of i3.

Fixes #3075.
2017-12-10 21:37:43 +02:00
Ingo Bürk 8cbe705674
Merge pull request #3076 from orestisf1993/v3-to-v4-issue
minor V3 to v4 issues
2017-12-09 19:42:30 +01:00
Orestis Floros 1890517f96 migrate_config: scalloc converted config
Prevents a false-positive error eg with config file:
set $mod Mod4
bindsym $mod+h split h
bindsym $mod+v split v

ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set ', ...
ERROR: CONFIG: Line   8:     status_command i3status
ERROR: CONFIG: Line   9: }
ERROR: CONFIG: Line  10: <BE><BE><BE><BE><BE><BE>
2017-12-09 20:07:58 +02:00
Orestis Floros ed22785909 Fix v3 to v4 crash with a variable with longer name than value 2017-12-09 19:50:43 +02:00
Ingo Bürk 9d2d602d60
Merge pull request #3074 from orestisf1993/issue-2921
Fix workspace_show-related issues
2017-12-09 15:52:01 +01:00
Orestis Floros cf28147c5e Show workspace in _tree_next
Fixes a regression introduced by #2980.
2017-12-09 16:39:33 +02:00
Orestis Floros 9ced77384b Remove useless check in _tree_next
con_descend_focused on an empty workspace should return the workspace.
2017-12-09 16:39:33 +02:00
Orestis Floros 87ed8df4fa floating_maybe_reassign_ws: show workspace before focusing
With this change i3 will correctly switch to the focused workspace.
This fixes bug with moving floating windows with 'move <direction>' or by dragging like _NET_CURRENT_DESKTOP not getting updated or 'workspace back_and_forth' not working.

Fixes #2921.
2017-12-09 16:39:33 +02:00
Ingo Bürk 23cfbc54c5
Merge pull request #3073 from veselov/i3-3072
Fixes #3072, Xft.dpi can be floating point
2017-12-09 15:34:13 +01:00
Pawel S. Veselov d2b35388b4 Fixes #3072, Xft.dpi can be floating point 2017-12-09 15:12:25 +01:00
Ingo Bürk 90dd84ee62
Merge pull request #3070 from orestisf1993/issue-3068
Add '--release' flag for bindsym in the bar block
2017-12-08 14:29:17 +01:00
Orestis Floros 315ff17563 Add '--release' flag for bindsym in the bar block
i3bar's handle_button is modified to also handle XCB_BUTTON_RELEASE
events. During these button release events, only custom commands are
checked to avoid sending multiple workspace ipc messages.

The way this patch is implemented will allow to assign a custom command
for both the press and release of the same button:
bar {
  ...
  bindsym buttonX exec command1
  bindsym --release buttonX exec command2
}

Fixes #3068.
2017-12-08 12:16:22 +02:00
Ingo Bürk ee0c016091
Merge pull request #3066 from orestisf1993/xvfb-opt
complete-run.pl: accept the xvfb option from command line
2017-12-05 07:29:10 +01:00
Orestis Floros b6bbb91479 complete-run.pl: accept the xvfb option from command line 2017-12-05 00:22:14 +02:00
Ingo Bürk 458e2a2e46
Merge pull request #3022 from orestisf1993/i3bar-leaks
Fix i3bar leaks
2017-12-03 19:51:25 +01:00
Orestis Floros 54c79e4b2f i3bar: free output data structures 2017-12-03 20:25:34 +02:00
Ingo Bürk 730264d9b2
Merge pull request #3065 from orestisf1993/issue-3064
Skip internal workspaces with 'move workspace to output'
2017-12-03 18:46:34 +01:00
Orestis Floros e3f8939a58 Skip internal workspaces with 'move workspace to output'
Fixes #3064.
2017-12-01 17:11:32 +02:00
Ingo Bürk f6f198c3fe
Merge pull request #3058 from d-e-s-o/fix-FREE
do not check for NULL in FREE macro
2017-11-29 08:33:27 +01:00
Daniel Mueller 3e34122de4 Perform proper cleanup for signals with 'Term' action (#3057)
Issue #3049 describes a case where terminating i3 by means of SIGTERM
causes it to leak the runtime directory and all its contents. There are
multiple issues at play: first, any cleanup handlers registered via
atexit are never invoked when a signal terminates the program (see
atexit(3)). Hence, the log SHM log cleanup performed in i3_exit is not
invoked in that case. Second, compared to the shutdown path for the
'exit' command, we do not unlink the UNIX domain socket we create,
causing it to be leaked as well. Third, a handler for SIGTERM is not
registered at all despite handle_signal claiming to be the handler for
all 'Term' signals.
This change addresses all three problems and results in a graceful exit
including cleanup to happen when we receive a signal with the default
action 'Term'. It addresses issue #3049.
2017-11-28 23:29:47 -08:00
Ingo Bürk e4d6458cc3
Merge pull request #3052 from d-e-s-o/remove-magic-numbers
i3bar: replace magic numbers with more meaningful constructs
2017-11-29 08:22:51 +01:00
Michael Stapelberg f9efc09b98
Merge pull request #3059 from stapelberg/debuglog
i3-dump-log: enable shmlog on demand
2017-11-26 23:34:10 -08:00
Michael Stapelberg 02b237b14d shmlog: remote atom when disabled 2017-11-26 18:07:13 +01:00
Michael Stapelberg 1facb450c0 i3-dump-log: enable shmlog on demand
fixes #3055
2017-11-26 18:07:02 +01:00
Michael Stapelberg c07936d91b no-op refactoring: make ipc_connect find socket path 2017-11-26 16:41:59 +01:00
Daniel Mueller 865bd462b4
do not check for NULL in FREE macro
free(3) is safe to invoke on a NULL pointer, in which case no action is
taken. This change adjusts the FREE macros to omit this unnecessary
check.
2017-11-23 15:41:33 -08:00
Ingo Bürk 2eabfc88fe
Merge pull request #3050 from d-e-s-o/fix-typo
fix typo in src/main.c
2017-11-18 19:19:25 +01:00
Daniel Mueller 2481301dfc
fix typo in src/main.c 2017-11-18 09:49:41 -08:00
Daniel Mueller 222d8210ab
i3bar: replace magic numbers with more meaningful constructs
In i3bar/src/config.c we compare string lengths agains magic numbers.
This change replaces those numbers with the lengths of the strings they
represent.
2017-11-17 06:58:12 -08:00
Ingo Bürk d1f8266df0
Merge pull request #3041 from d-e-s-o/update-userguide
docs/userguide: Correct mark/goto i3-input commands
2017-11-17 15:09:50 +01:00
Ingo Bürk a78c9ab82f
Merge pull request #3040 from jchook/next
$mod+r toggles resize mode
2017-11-13 22:01:06 +01:00
Ingo Bürk 0617b9f2a7
Merge pull request #3042 from Mayeu/kitty-terminal
add the kitty terminal in i3-sensible-terminal
2017-11-12 13:38:52 +01:00
Cast 22ba46e2a3 add the kitty terminal in i3-sensible-terminal 2017-11-12 16:48:21 +08:00
Daniel Mueller 3a22c6e765
docs/userguide: Correct mark/goto i3-input commands
The userguide still mentions an old 'goto' command which no longer
exists and will be ignored silently (when used in the i3 config) or
causes an error to be reported (when invoked from the command line).
This change updates the userguide to correct this problem. In addition
to that it also updates the i3-input command shown to no longer use the
deprecated -p flag but -F instead.
2017-11-11 17:06:43 -08:00
xzfc 103e78e04a Bugfix: avert endless loop on unexpected EOF at ipc messages (#3021)
Fix freeze on invalid ipc commands like

    echo -n $'i3-ipc\0\0\0\xa\0\0\0\0focus left' | socat - `i3 --get-socketpath`

Also, treat incomplete headers as IPC violation. Example of incomplete header:

    echo -n i3-ip | socat - `i3 --get-socketpath`
2017-11-09 11:18:23 -08:00
Ingo Bürk c207921949
Merge pull request #2980 from orestisf1993/issue-1160-pr
Use con_descend_focused for workspaces in _tree_next
2017-11-05 17:42:31 +01:00
Ingo Bürk b18f507b9b
Merge pull request #3030 from tylerbrazier/next
config: use ascii single quote
2017-11-05 17:37:53 +01:00
Ingo Bürk 01029da840
Merge pull request #3023 from orestisf1993/issue-2816
Add support to resize floating container in percentage
2017-11-05 17:27:48 +01:00
Wes Roberts 0afe714e2b $mod+r toggles resize mode 2017-10-30 21:19:12 -04:00
Tyler Brazier e0287e00d9 config: use ascii single quote
The unicode quote doesn’t render very well in terminals that don't
support unicode
2017-10-25 15:26:44 -05:00
Michael Stapelberg 787e799e3c Merge pull request #3028 from stapelberg/flakes2
Eliminate causes of flakyness
2017-10-25 08:56:02 +02:00
Michael Stapelberg 0d8b6714e3 Move XCB event handling into xcb_prepare_cb.
Previously, we used ev_check watchers, which are executed at the beginning of an
event loop iteration.

This was problematic if one of the handlers happened to fill the XCB event
queue, e.g. by reading a reply from X11 and an event happened in the meantime.

In that situation, we would hand control to the event loop, entirely ignoring
the pending event. This would manifest itself as a 1-minute hang,
reproducible (sometimes) in the i3 testsuite.

issue #2790 describes an instance of this issue in i3bar, and we fixed that by
changing the watcher priority to run last. Handling events in xcb_prepare_cb has
the same effect, as ev_prepare watchers are run just before the event loop goes
to sleep.
2017-10-23 21:06:13 +02:00
Michael Stapelberg 1946cc6cab t/525: remove flaky focus check 2017-10-23 21:06:13 +02:00
Michael Stapelberg 7a672a9d41 i3test: blockingly wait for events
…as polling the xcb file descriptor directly is not reliable.
2017-10-23 21:06:07 +02:00
Michael Stapelberg 8e528d2de8 skip ConfigureNotify events with --force_xinerama
This prevents an i3 crash under certain conditions when running the tests.
2017-10-23 21:04:20 +02:00
Michael Stapelberg 7208df2d38 i3test: reliably warp the pointer to (0, 0) before tests start 2017-10-23 21:04:20 +02:00
Michael Stapelberg 5d55f93eb3 tests: add sync_with_i3 after open_window
We need to set dont_map => 1 on the sync window to prevent an endless loop.

Further, t/219-ipc-window-focus.t made assumptions about windows being named
incrementally, and that assumption is broken by the sync window opened by the
first sync_with_i3 call from open_window, so use the more reliable ->name.
2017-10-23 21:04:20 +02:00
Michael Stapelberg 4f751610c2 _NET_ACTIVE_WINDOW: invalidate focus to force SetInputFocus call (#3027)
The sender of the _NET_ACTIVE_WINDOW client message might know better when to
set focus than i3, as i3 does not know about unmanaged (override_redirect=1)
windows.

related to https://github.com/i3/i3lock/issues/35
2017-10-22 22:16:15 +02:00
Orestis Floros b17e7b82c6 Add support to resize floating container in percentage
resize set is modified to accept both 'px' and 'ppt' height and width.

Fixes #2816.
2017-10-18 02:07:11 +03:00
Orestis Floros a05663c59e i3bar: avoid possible va_args leak 2017-10-17 04:28:07 +03:00