Commit Graph

6874 Commits

Author SHA1 Message Date
Orestis Floros be9a2bb7f8 Add con_exists function
Checks the all_cons queue and returns true if a given con is found.
2017-09-23 03:22:20 +03:00
Orestis Floros 76214b04e8 Raise floating window to top when it gets focus
Applied for:
1. '[...] focus' for a floating container raises it to the top.
2. Focusing a window through a focus event raises it to the top.

Fixes #2572
2017-09-23 02:41:58 +03:00
Vladimir Panteleev 28f7e14650
Add "focus_wrapping" option
Fixes #2352.
2017-09-22 23:40:41 +00:00
Martin T. H. Sandsmark bf7aeced30 Don't put new floating windows on top unless they're focused 2017-09-22 21:45:28 +03:00
Ingo Bürk dd13cae5c0 Merge pull request #2959 from orestisf1993/issue-2764
Allow assign to output
2017-09-22 16:24:26 +02:00
Vladimir Panteleev 536f60e230
docs/userguide: Update description of focus wrapping
Focus wrapping applies to all kinds of containers, not just
tabbed/stacked ones.
2017-09-21 15:32:44 +00:00
Vladimir Panteleev 8144a0f480 Do not canonicalize special output names
canonicalize_output_name allowed the "primary" special output name to
be canonicalized, thus converting it to the name of whatever output
was the primary output at the time. This caused settings
(specifically, i3bar output and tray_output settings) to be stored as
specific output names, instead of the intended special names whose
referred output may change as the system's configuration (i.e. current
primary output) changes.

Add a check to canonicalize_output_name to return the name as-is if it
is the special name "primary".
2017-09-19 18:58:35 +02:00
Vladimir Panteleev e4bfb4dae3 fake_outputs: Allow designating a fake output as primary
Allow appending 'P' to the fake output specification to set the
created output's "primary" flag, to allow writing test cases that
depend on the presence of a primary output.
2017-09-19 18:58:32 +02:00
Vladimir Panteleev c932c88ea9 fake_outputs: Don't read past the end of string
fake_outputs_init would unconditionally increase the string read
pointer variable (walk) by one character more than the number of
characters that have been read, to skip past the character delimiting
records (a comma). However, when the input string was not terminated
by a comma, it would cause the function to read past the null
terminator instead.

Avoid this by explicitly checking for the expected delimiter.
2017-09-19 18:58:28 +02:00
Vladimir Panteleev 4ddf18ef6b fake_outputs: Use %n format specifier instead of sprintf
fake_outputs_init used a sprintf invocation with a throw-away buffer
to estimate how many characters the sscanf invocation consumed. This
was unnecessary, and also potentially incorrect, as differences
between the read and formatted strings (such as leading zeros) could
lead to fake_outputs_init to lose its track.

Instead, use the %n format specifier which allows saving the number of
characters consumed by sscanf so far. %n is part of C99.
2017-09-19 18:58:25 +02:00
Michael Stapelberg 919e66399b Merge pull request #2970 from CyberShadow/i3bar-primary-output
Do not canonicalize special output names
2017-09-19 18:57:55 +02:00
Vladimir Panteleev 760b2e1b4a
Do not canonicalize special output names
canonicalize_output_name allowed the "primary" special output name to
be canonicalized, thus converting it to the name of whatever output
was the primary output at the time. This caused settings
(specifically, i3bar output and tray_output settings) to be stored as
specific output names, instead of the intended special names whose
referred output may change as the system's configuration (i.e. current
primary output) changes.

Add a check to canonicalize_output_name to return the name as-is if it
is the special name "primary".
2017-09-19 14:57:08 +00:00
Vladimir Panteleev caae4db0bc
fake_outputs: Allow designating a fake output as primary
Allow appending 'P' to the fake output specification to set the
created output's "primary" flag, to allow writing test cases that
depend on the presence of a primary output.
2017-09-19 14:57:08 +00:00
Vladimir Panteleev 19b00346e5
fake_outputs: Don't read past the end of string
fake_outputs_init would unconditionally increase the string read
pointer variable (walk) by one character more than the number of
characters that have been read, to skip past the character delimiting
records (a comma). However, when the input string was not terminated
by a comma, it would cause the function to read past the null
terminator instead.

Avoid this by explicitly checking for the expected delimiter.
2017-09-19 14:57:08 +00:00
Vladimir Panteleev 755b223278
fake_outputs: Use %n format specifier instead of sprintf
fake_outputs_init used a sprintf invocation with a throw-away buffer
to estimate how many characters the sscanf invocation consumed. This
was unnecessary, and also potentially incorrect, as differences
between the read and formatted strings (such as leading zeros) could
lead to fake_outputs_init to lose its track.

Instead, use the %n format specifier which allows saving the number of
characters consumed by sscanf so far. %n is part of C99.
2017-09-19 14:57:03 +00:00
Michael Stapelberg da72a5be91 tests: unflake tests by not starting i3bar 2017-09-19 16:13:27 +02:00
Michael Stapelberg 69a6887ab2 tests: remove the (broken) exit_gracefully check
I previously tried to fix the check, but could only come up with a fix which
required removing our module pre-loading, which makes the tests considerably
more expensive. Instead, let’s just remove the check.
2017-09-19 16:13:24 +02:00
Michael Stapelberg e5ee11d896 tests: use i3_config arg instead of precisely one launch_with_config
This way, tests are shorter, and i3test’s invocation of launch_with_config
parallelizes work better, using dont_block => 1.
2017-09-19 16:13:21 +02:00
Michael Stapelberg 28bfeadbb0 i3test::XTEST: don’t “use i3test” to avoid clobbering state
Before this commit, the $i3_autostart variable was accidentally overridden.
2017-09-19 16:13:17 +02:00
Michael Stapelberg 5d9db61dda Reorder tests to not use the same number (#2947)
Distinct numbers make re-running individual tests easier by helping with
tab-completion.

Completeness verified using:
% for i in $(seq 0 600)
do
  files=$(ls testcases/t/$(printf "%03d" $i)-*.t 2>&- | wc -l)
  [ "$files" != "0" ] && [ "$files" != "1" ] && echo "clash: $i"
done
2017-09-19 16:13:14 +02:00
Michael Stapelberg 31834b3ce4 Kill windows between tests 2017-09-19 16:12:42 +02:00
Michael Stapelberg 4fd05e4db2 i3test: add kill_all_windows convenience function 2017-09-19 16:12:38 +02:00
Michael Stapelberg dbd3ca749c 529-net-wm-desktop: avoid timeout, avoid restarts, split
This shaves off almost half a second of the wall-clock time (from 5.9s to 5.6s).
2017-09-19 16:12:34 +02:00
Michael Stapelberg e46dc19f82 165-for_window: merge config and re-use i3 instance, split remainder
This reduces total test wall-clock time by 1.5s (from 7.5s down to 5.9s).
2017-09-19 16:12:31 +02:00
Michael Stapelberg ee1546386b t/265-swap: don’t start new i3 instances with the same config
$config is never touched after being initially set up.
Not restarting i3 between each test case reduces the runtime of this test by an
order of magnitude.
2017-09-19 16:12:26 +02:00
Michael Stapelberg 501dfd6eb8 ipc: document how to detect i3’s byte order in memory-safe languages (#2961)
related to issue #2958
2017-09-19 15:47:06 +02:00
Michael Stapelberg 7726b9a759 Bugfix: avert crash by fixing focus when creating output containers (#2966)
fixes #2854
2017-09-19 15:47:01 +02:00
Michael Stapelberg 0b6d851d7c Bugfix: don’t invalidate layout upon invalid 'layout toggle' params (#2965)
fixes #2903
2017-09-19 15:46:58 +02:00
Michael Stapelberg 910bcd68bc docs/ipc: "urgent": complete the list of container types (#2967)
Thanks chressie!
2017-09-19 15:46:53 +02:00
Kent Fredric 5acddc259b Migrate tooling to ExtUtils::MakeMaker (#2963) 2017-09-19 15:46:49 +02:00
Michael Stapelberg 3bc91118c8 ipc: rename COMMAND to RUN_COMMAND for consistency (#2956)
All other message types are verbs, only our first-ever message COMMAND wasn’t.

While we’re here, also change the message type dictionary into a table with
clickable links to the corresponding reply type.

Authors of downstream IPC libraries are encouraged to keep the old name around
so as to not break existing code, but mark it as deprecated.
2017-09-19 15:46:38 +02:00
Orestis Floros 395dc7bebd Fix use of err after it is freed 2017-09-19 15:46:32 +02:00
Orestis Floros b5583d6cf4 Fix wrong call to free
To confirm, assign n to a constant value and try to use the
append_layout command.

Without the change i3 crashes.
2017-09-19 15:46:28 +02:00
Orestis Floros 5dad79ff34 Prevent freeing of uninitialized pointer
> variable 'buf' is used uninitialized whenever 'if' condition is true

Note: freeing a NULL pointer is fine.
2017-09-19 15:46:24 +02:00
Michael Stapelberg f1e9da71f0 ipc: tree reply: document focus, nodes and floating_nodes (#2955)
These haven’t ever changed, but were only included in the example, not in the
list, so people might not have realized that these are safe for use.
2017-09-19 15:46:19 +02:00
Vladimir Panteleev ba7a76e367 Fix erratic behavior with single container child jumping outputs
This fixes a regression introduced in commit
4e88c10564ca5366c2578908f62ec56625a26718: when attempting to move the
single child of a container in the direction of another output, i3
would move the window to the output, despite the window not being at
the edge of its output, instead of moving it to its parent container.

The bug occurred because the check for moving containers across
outputs with non-default workspace layouts (issue #1603) did not
actually verify that the moved window lies at the edge of the
workspace, despite what its comment said.

Fixes issue #2466.
2017-09-19 15:46:07 +02:00
Vladimir Panteleev 8e520deb89 Fix typo in con_parent_with_orientation description 2017-09-19 15:46:04 +02:00
Michael Stapelberg b421799d9c tests: unflake t/257-keypress-group1-fallback.t (#2946)
fixes #2944
2017-09-19 15:45:42 +02:00
Orestis a3a7d04a43 291-swap.t: make tests fail less (#2964) 2017-09-18 18:02:38 +02:00
Michael Stapelberg 8e5731bde8 ipc: document how to detect i3’s byte order in memory-safe languages (#2961)
related to issue #2958
2017-09-18 17:15:28 +02:00
Michael Stapelberg e48441ecbd Bugfix: avert crash by fixing focus when creating output containers (#2966)
fixes #2854
2017-09-18 16:37:34 +02:00
Michael Stapelberg d1296cd1cf Bugfix: don’t invalidate layout upon invalid 'layout toggle' params (#2965)
fixes #2903
2017-09-18 16:36:57 +02:00
Michael Stapelberg 39415fe16d docs/ipc: "urgent": complete the list of container types (#2967)
Thanks chressie!
2017-09-18 16:36:34 +02:00
Kent Fredric 54a7e559ed Migrate tooling to ExtUtils::MakeMaker (#2963) 2017-09-18 13:03:54 +02:00
Michael Stapelberg 607e97e651 ipc: rename COMMAND to RUN_COMMAND for consistency (#2956)
All other message types are verbs, only our first-ever message COMMAND wasn’t.

While we’re here, also change the message type dictionary into a table with
clickable links to the corresponding reply type.

Authors of downstream IPC libraries are encouraged to keep the old name around
so as to not break existing code, but mark it as deprecated.
2017-09-17 15:25:00 +02:00
Orestis Floros a35854ddf4 Allow assign to output
Implements the "assign" part of issue #2764.
2017-09-17 15:37:17 +03:00
Orestis Floros 45d1e51857 Fix userguide formatting error 2017-09-17 15:37:17 +03:00
Orestis Floros 716a5b3660 166-assign.t: improve open_special call 2017-09-17 15:37:17 +03:00
Orestis Floros 1c975a1b8c 166-assign.t: fix typo 2017-09-17 15:37:17 +03:00
Orestis Floros e2bacc7df8 Add con_move_to_output_name function 2017-09-17 15:37:17 +03:00