Commit Graph

6767 Commits

Author SHA1 Message Date
Orestis Floros 71e309597c Add SWAP util macro 2017-09-16 13:49:19 +03:00
Ingo Bürk 8cad1c1fa6 Merge pull request #2887 from orestisf1993/next
Allow assign to workspace by number
2017-09-15 21:26:35 +02:00
Michael Stapelberg 6b8e3560ef Merge pull request #2950 from CyberShadow/pull-20170914-153533
Fix erratic behavior with single container child jumping outputs
2017-09-15 11:31:33 +02:00
Vladimir Panteleev 480f688b44
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-15 09:27:32 +00:00
Orestis 00912add46 Use numeric comparison in sort for $displaynum (#2952)
Eg in the case of sockets:
- X0
- X99
- X100

X99 would be picked instead of X100.
2017-09-15 11:21:35 +02:00
Orestis Floros eaf7a49e28 Allow assign to workspace by number
Makes "assign [<criteria>] workspace number <number>" work in the same
manner as "move to workspace number <number>" instead of assigning the
window to a workspace named "number <number>".

config.spec is modified to expect a 'number' string and an extra
argument is used in cfg_assign.

For workspaces that don't exist yet, workspace_get is used as a
fallback. This also allows the user to assign to "<number> <workspace>"
eg "2: work" and the full name will be used if workspace number 2
doesn't exist yet.

Fixes #2590.
2017-09-15 03:38:13 +03:00
Vladimir Panteleev bfa76016de
Fix typo in con_parent_with_orientation description 2017-09-15 00:07:40 +00:00
Orestis 6411130c85 Add -name argument for Xephyr (#2937)
This way you can assign the test windows to an empty workspace to avoid
interacting with them (when xvfb-run is not an option):
assign [instance="i3test"] workspace testing
2017-09-14 22:10:16 +02:00
Michael Stapelberg 98a7baf16e Merge pull request #2945 from stapelberg/i3-config
simplify tests which use launch_with_config precisely once
2017-09-14 22:08:36 +02:00
Michael Stapelberg 24462f98ae tests: unflake tests by not starting i3bar 2017-09-14 21:46:20 +02:00
Michael Stapelberg 363417e010 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-14 21:46:20 +02:00
Michael Stapelberg 02786155dc 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-14 21:46:20 +02:00
Michael Stapelberg 53e7f18710 i3test::XTEST: don’t “use i3test” to avoid clobbering state
Before this commit, the $i3_autostart variable was accidentally overridden.
2017-09-14 21:45:48 +02:00
Michael Stapelberg 3a31a76b2a 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-14 17:49:02 +02:00
Michael Stapelberg a5aed10d09 tests: unflake t/257-keypress-group1-fallback.t (#2946)
fixes #2944
2017-09-14 17:48:37 +02:00
Michael Stapelberg d0b8f93d4f travis: install xrandr in Docker container for t/533-randr15.t (#2949) 2017-09-14 17:48:22 +02:00
Michael Stapelberg 51da57d5e6 validate JSON before loading
This commit also introduces slurp() which reads a file in its entirety. Using
this function instead of doing IO in the functions in load_layout.c again and
again makes the code cleaner (fixing at least two memory leaks) and avoids
re-reading the same file 3 times.

related to #2755
2017-09-13 18:46:17 +02:00
Michael Stapelberg f120a9d929 Bugfix: free incomplete containers when JSON parsing fails
related to #2755
2017-09-13 18:46:12 +02:00
Orestis Floros d35de66f1e scalloc parse_config input to make sure it terminates with '\0'
Otherwise strchr() can crash for files that don't end with '\n' because
it won't find a null char to terminate at.

Fixes #2934
2017-09-13 18:46:04 +02:00
Orestis Floros 919ac9c7ef Don't insert newline at end of config with launch_with_config 2017-09-13 18:46:02 +02:00
Vladimir Panteleev 2159306b94 docs/userguide: Document that i3 can accept RandR output names 2017-09-13 18:45:46 +02:00
Vladimir Panteleev 92ff6fbe24 533-randr15.t: Add test for bar output name canonicalization 2017-09-13 18:45:46 +02:00
Vladimir Panteleev fb1d9efb27 533-randr15.t: Stop hard-coding the output name
Refactor away all mentions of DP3.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev f5e9b518da 533-randr15.t: Add a fake output connected to the fake monitor
Add an output ID to the simulated RRGetMonitors reply, then add a
simulated RRGetOutputInfo reply describing the added output.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev 21dd8c475a testcases/lib: Add inject_randr15_outputinfo argument
Allow tests to specify a file name for inject_randr15's
--getoutputinfo_reply command-line parameter.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev 7fb027ad37 inject_randr1.5: Intercept X11 error responses in addition to replies
Allow clients to send garbage to the server, then intercept the
server's error response and substitute it with the supplied simulated
reply data.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev 80a937f43c inject_randr1.5: Add RRGetOutputInfo reply injection
Add a --getoutputinfo_reply switch to indicate a filename containing
the RRGetOutputInfo reply data to inject.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev 38447ab78c inject_randr1.5: Refactor reading and storing reply buffer to a struct
Allows easier introduction of additional reply buffers in upcoming
changes.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev 16e0d5ec06 ipc: Canonicalize output names in bar configuration
Convert the output names specified in the "output" and "tray_output"
fields in bar blocks in i3's configuration to the referred output's
primary name. This allows specifying names other than the primary
output's name in the given fields without changing the IPC protocol.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev c35cacfd78 randr: Look up alternative output names when searching outputs
Update get_output_by_name to look at all additional names added by the
change in the previous commit, not just the primary one.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev 08ad82c3bb randr: Register monitors' output names as additional i3 output names
In addition to the name of the monitor itself (which is still used as
the i3 output's primary name), register RandR output names associated
with the RandR monitor as alternative i3 output names.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev 6c0e715877 Store output names as a linked list
Currently, only one name is ever added, and only the first name is
ever accessed; actually using the capability to store and access
multiple names comes in the following commits.
2017-09-13 18:45:46 +02:00
Vladimir Panteleev 1b419431cd Introduce output_primary_name function
Currently simply returns output->name, but this will make it easier to
change how output names are stored in the following commits.

Also replace reading output->name with invocations of
output_primary_name. Code which writes output->name is unchanged. Done
using a mostly mechanical replacement of output->name to
output_primary_name(output).
2017-09-13 18:45:46 +02:00
Michael Stapelberg d0c9e81f04 testsuite: install Module::Install so that AnyEvent-I3/Makefile.PL works (#2940)
As per https://perlmaven.com/cant-locate-inc-module-install-in-inc, the inc/
directory should not be under version control.

fixes #2914
2017-09-13 18:42:47 +02:00
Orestis 0631568b2d Fix userguide bug (#2932)
Fixes #2931
2017-09-13 18:42:43 +02:00
Vladimir Panteleev c3c94a8e1a docs/hacking-howto: Update section topology
- Promote the "How to build?" sub-section to a top-level
  section ("Building i3")

- Convert the "Introduction" sub-section as the intro to the remaining
  contents of the "Using git / sending patches" section

- Keep "Which branch to use?" as a level-3 sub-section, thus making it
  a sub-section of what used to be the "Introduction" sub-section.
2017-09-13 18:42:37 +02:00
Vladimir Panteleev 83d61e4b81 docs/hacking-howto: Promote "How to build?" sub-section
Move the "How to build?" sub-section to the top of its parent section.
2017-09-13 18:42:32 +02:00
Vladimir Panteleev bf59c0fbfc docs/hacking-howto: Promote "Using git / sending patches" section
Move the contents of the "Using git / sending patches" section to the
top of the document.
2017-09-13 18:42:27 +02:00
Michael Stapelberg 6203c6cb39 tests: run 533-randr15.t at the very end
The test runs `xrandr setmonitor`, which will otherwise affect any test
scheduled after 533-randr15.t, causing flakyness in t/217-NET_CURRENT_DESKTOP.t
for example.
2017-09-13 18:42:22 +02:00
Michael Stapelberg 6dc164a652 tests: unflake t/263-edge-borders.t 2017-09-13 18:42:18 +02:00
Michael Stapelberg 429af6dbb3 tests: re-seed random number generator in workers 2017-09-13 18:42:13 +02:00
Vladimir Panteleev 2eaf58a553 docs/testsuite: Correct Xephyr package name on Arch Linux (#2913)
The package is called `xorg-server-xephyr`, not `xorg-xserver-xephyr`.
2017-09-13 18:41:51 +02:00
Michael Stapelberg 155e307a3f testcases/Makefile.PL: tell MakeMaker this is a pure-Perl distribution (#2922)
fixes #2914
2017-09-13 18:41:46 +02:00
Orestis 7cb9465db9 Add files generated by make check in AnyEvent-I3/ to .gitignore (#2915) 2017-09-13 18:41:31 +02:00
Michael Stapelberg 083b6a31f4 Include AnyEvent-I3 directory in dist tarballs (#2916)
fixes #2905
2017-09-13 18:41:26 +02:00
Michael Stapelberg 4b0a6ba769 travis: downgrade temporarily due to asan issue
fixes #2912
2017-09-13 18:41:21 +02:00
Michael Stapelberg a542b3d26c i3bar: ensure get_buffer does not leak memory
This fixes an AddressSanitizer warning which recently popped up.

related to #2907
2017-09-13 18:41:13 +02:00
Michael Stapelberg 75d118203b Merge pull request #2942 from stapelberg/append
Improve append_layout’s invalid JSON handling
2017-09-13 18:38:47 +02:00
Michael Stapelberg 100fad741f Add .editorconfig (see editorconfig.org) (#2943)
This file uses the same settings which we currently have in our vim modeline,
but can be picked up by many different editors without having to add and
maintain editor-specific modelines in all of our source files.
2017-09-13 18:38:27 +02:00
Michael Stapelberg c45c002bad validate JSON before loading
This commit also introduces slurp() which reads a file in its entirety. Using
this function instead of doing IO in the functions in load_layout.c again and
again makes the code cleaner (fixing at least two memory leaks) and avoids
re-reading the same file 3 times.

related to #2755
2017-09-13 17:41:05 +02:00