Commit Graph

363 Commits (45be56be33da34aed4589dabc73adc069918484b)

Author SHA1 Message Date
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
Orestis Floros 5e8a3f3f0c cmd_move_window_to_position: improve error message 2018-03-20 16:59:06 +02:00
Orestis Floros 174dc389ff Remove 'method' from cmd_move_window_to_position
For command:
move window to [absolute] position X px Y px
if the optional keyword 'absolute' is provided the end result is the
same even though it is implemented differently. Only difference is that
with absolute the floating window can move completely outside of any
output.

This commit removes the 'method' argument and only keeps the sane
implementation.
2018-03-20 16:59:06 +02:00
Ingo Bürk 9610dc29b8
Merge pull request #3080 from orestisf1993/cmd_move_con_to_workspace
Reduce repetition in cmd_move_con_to_workspace*
2018-01-17 21:26:09 +01:00
Ingo Bürk 17fd50999f
Merge pull request #3102 from jolange/fix3071
tiling resize: remove minimum size (was 5%)
2018-01-17 21:24:52 +01:00
Michael Stapelberg fe95ac56bb
Merge pull request #2998 from orestisf1993/issue-2990
Don't raise floating windows when focused because of focus_follows_mouse
2018-01-14 18:22:44 +01:00
Orestis Floros 0c2fbeedc2 Don't raise floating windows when focused because of focus_follows_mouse
Fixes #2990.
2018-01-14 15:45:33 +02:00
livanh 7b59da8a4f Implement 'resize set <width> ppt <height> ppt' command for tiling windows (#3036) 2018-01-08 23:25:08 +01:00
Ingo Bürk 1a04608796 Send success response for nop. (#3113)
fixes #3112
2018-01-06 23:24:33 +01:00
livanh c0378f737b Improve resize_find_tiling_participants() and simplify cmd_resize_tiling_width_height() (#3111) 2018-01-06 17:59:27 +01:00
Orestis Floros e0f1579669 cmd_move_con_to_workspace_number: rename workspace->ws
For consistency with other cmd_move_con_to_workspace* functions.
2017-12-27 20:56:37 +02:00
Orestis Floros a2e9b1461f Reduce repetition in cmd_move_con_to_workspace* 2017-12-27 20:55:22 +02:00
Johannes Lange 8f30a04425 tiling resize: remove minimum size (was 5%)
fixes #3071
2017-12-26 12:02:00 +01:00
Orestis Floros 2403c43f7b Make 'focus' disable blocking fullscreen windows
The problem here is that con_fullscreen_permits_focusing() does not
check if there is a blocking fullscreen container in the workspace that
the container to be focused belongs. This makes it possible to focus a
container behind a fullscreen window if it's in an unfocused workspace.

This commit introduces a change in the 'focus' command behaviour. When
focusing a container blocked by a fullscreen container, either CF_OUTPUT
or CF_GLOBAL, the blocking container loses its fullscreen mode and the
target container is focused like normal.

This should not affect directional focus commands: left, right, up,
down, parent, child.

Fixes issue #1819.
2017-12-11 19:14:33 +02:00
Orestis Floros 2592c63603 Add error reply to cmd_focus_window_mode 2017-12-11 19:14:33 +02:00
Orestis Floros e3f8939a58 Skip internal workspaces with 'move workspace to output'
Fixes #3064.
2017-12-01 17:11:32 +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 e2bacc7df8 Add con_move_to_output_name function 2017-09-17 15:37:17 +03: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
Orestis 66f2148236 Check if con_id exists in cmd_swap (#2898)
Also adds some testcases for swap using con_id.

Fixes #2895
2017-09-06 07:34:14 +02:00
Ingo Bürk 85eb097677 Invert condition to log debug message in correct situation (#2896) 2017-09-05 09:01:53 +02:00
Ingo Bürk 5f9a5e8d7d Implement 'swap' command.
This patch introduces a new command 'swap' that swaps two containers so
that they assume each other's position and geometry.

fixes #917
2017-05-15 21:06:38 +02:00
Ingo Bürk c474ddd782 Merge pull request #2649 from s3rb31/next
layout toggle: take any combination of layouts as arguments (continuation of #2476)
2017-02-24 00:58:19 +01:00
s3rb31 3410cb256d Implement mapping from string to layout as extra function 2017-02-23 21:49:48 +01:00
Tony Crisci 04dcf42397 Add the ipc shutdown event (#2652)
This event is triggered when the connection to the ipc is about to
shutdown because of a user action such as with a `restart` or `exit`
command. The `change` field indicates why the ipc is shutting down. It
can be either "restart" or "exit".

fixes #2318
2017-01-22 14:08:32 -08:00
mihaicmn da5fe3b934 fix incorrect reply to ipc command (#2567) 2016-11-15 09:26:53 -08:00
Michael Stapelberg fff3f79da9 switch to clang-format-3.8 (#2547)
https://llvm.org/bugs/show_bug.cgi?id=30353 was filed for the unintended
line break between in e.g. “TAILQ_ENTRY(foo)\nbar;”.

Until that’s fixed or a workaround is known, we’ll live with line
breaks. To make it a bit easier for readers to see what’s going on, I
added extra line breaks around each such struct member/variable
definition, so that they at least visually are a single unit.

fixes #2174
2016-11-08 13:46:43 -08:00
Michael Stapelberg f354f53435 Ensure all *.[ch] files include config.h
Including config.h is necessary to get e.g. the _GNU_SOURCE define and
any other definitions that autoconf declares. Hence, config.h needs to
be included as the first header in each file.

This is done either via:
1. Including "common.h" (i3bar)
2. Including "libi3.h"
3. Including "all.h" (i3)
4. Including <config.h> directly

Also remove now-unused I3__FILE__, add copyright/license statement
where missing and switch include/all.h to #pragma once.
2016-10-23 21:09:24 +02:00
Ingo Bürk c71f6f8f7c Implement special value 'current' for output. (#2483)
This commit introduces the special 'current' value for outputs in both of

* move con to output current
* move workspace to output current

fixes #2357
2016-09-30 08:28:02 -07:00
Tony Crisci e690e3d483 Cast con id as uintptr_t (#2298)
Use `uintptr_t` to cast the con id to int instead of `long int`. This
type is guaranteed to hold the pointer as an int regardless of platform.

fixes #2283
2016-04-15 00:27:43 -07:00
Eric Engeström 66d9c983e4 Fix spelling mistakes 2016-04-04 09:33:59 +02:00
Michael Stapelberg f63701ed09 Allow workspace renames which change case
fixes #2211
2016-02-15 08:34:03 +01:00
Ingo Bürk 6cbff6bfd4 Ensure that the "border" command uses logical pixels.
Until now, only the config directive for borders (new_window,
new_float) respected the DPI setting (using logical_px). This
patch makes sure we also do so for runtime "border" commands.

fixes #2202
2016-02-09 21:03:44 +01:00
Michael Stapelberg fbfbdb8e12 travis: check spelling of binaries and manpages, use docker
We now build a docker base container based on debian sid (where the very
latest packages are available). That base container is updated once a
month, or whenever travis-build.Dockerfile or debian/control change, but
re-used for subsequent travis runs. While the initial build might take
up to 15 minutes, subsequent builds typically run in a minute or two.

All the different steps that we run on travis are now factored into
separate scripts in the travis/ directory.

Switching to docker should also help with issue #2174.
2016-02-06 10:36:43 +01:00
David Coppa 1041572769 Remove commented-out code. 2016-01-26 09:55:24 +01:00
Ingo Bürk 328035fb7e Handle the EWMH atom _NET_WM_DESKTOP.
We already claim _NET_WM_DESKTOP support in _NET_SUPPORTED since around 2009,
but haven't actually done anything with it. However, especially pagers like
gnome-panel rely on this property to be updated and many tools, like GTK, want
to use the corresponding client messages to make a window sticky, move it
around etc.

This patch implements full support according to the EWMH spec. This means:

* We set the property on all windows when managing it.
* We keep the property updated on all windows at all times.
* We read and respect the property upon managing a window if it was set before
  mapping the window.
* We react to client messages for it.
* We remove the property on withdrawn windows.

Note that the special value 0xFFFFFFFF, according to the spec, means that the
window shall be shown on all workspaces. We do this by making it sticky and
float it. This shows it on all workspaces at least on the output it is on.

Furthermore, the spec gives us the freedom to ignore _NET_WM_DESKTOP when
managing a window if we have good reason to. In our case, we give window
swallowing a higher priority since the user would likely expect that and we
want to keep placeholder windows only around for as long as we have to.
However, we do prioritize this property over, for example, startup
notifications.

fixes #2153
fixes #1507
fixes #938
2016-01-18 12:13:36 +01:00
Michael Stapelberg cb3cdb602a ASAN: trigger leak before exiting
This disables the default leak-check-on-exit behavior which reports a
bunch of leaks that are only leaks while exiting, at which point they
don’t matter, because the operating system will clean up the memory our
process used.
2016-01-09 17:18:05 +01:00
Michael Stapelberg 79594398e2 commands.c: fix memory leak 2016-01-09 13:39:00 +01:00
Michael Stapelberg 0d1aad0af4 rename workspace: fix heap-use-after-free 2016-01-08 20:21:54 +01:00
Ingo Bürk 1f660a4cc4 Move title_format from window to container.
This patch moves the title_format information from windows to containers.
Furthermore, it allows correctly setting it on window-less containers and
displays the title accordingly for split containers.

We now also dump and read title_format in GET_TREE / during restarts.

fixes #2120
2016-01-05 12:22:27 -05:00
Johannes Lange 8bfd06c3dd added "toggle" option to "split" command
as requested in #1814
2016-01-04 17:31:47 +01:00
Ingo Bürk 19c273a2ad Validate matched containers for "kill" command correctly.
We now execute the validations when "kill" is executed even if match
criteria are used. This prevents users from killing workspace containers,
which instead kills all clients (as before when not using criteria).

fixes #1761
2015-12-28 02:35:25 -05:00
Ingo Bürk 0dd71674de Rename tree_close() to tree_close_internal().
It should be clear for callers of this function that this is an internal
function that skips certain validations which might be important. Therefore
we make it clear that this is an internal function by renaming it.

relates to #1761
2015-12-27 20:58:35 -05:00
Ingo Bürk bba18453af Match on all criteria even if con_id or con_mark are given.
Previously, if a match specification contained the con_id or con_mark criterion,
all other criteria were ignored. However, a user may want to specify one of
those two unique identifiers and still specify others as well, for example to
match the currently focused window, but only if it has a certain WM_CLASS:

    [con_id=__focused__ class=special] kill

We now check all specified criteria.

fixes #2111
2015-12-17 08:56:05 -05:00
Ingo Bürk 8d36f78b8e Reject invalid match criteria with an error.
Previously, using a command like

  [con_id=foo] kill

would kill the currently focused window because while an error for
not being able to parse the con_id was logged, no further action
was taken, which caused the criterion to be ignored. In this case,
the fallback behavior of using the focused window took over.

For con_id, id and window_type we now reject incorrect values with
an error and abort the command.

fixes #2091
2015-12-09 14:00:53 +01:00
Ingo Bürk caeb193a6c Allow "move position center" to operate on matched windows
Moving windows to the center previously did not consider command criteria.
We now operate on matched windows as for other commands.

fixes #2090
2015-12-03 13:24:39 +01:00
Michael Stapelberg 2451551f63 Merge pull request #2040 from Airblader/bug-2034
Fix crash when trying to split and float a dock container.
2015-10-27 10:07:25 +01:00
Ingo Bürk 57a7ff301f Add --no-auto-back-and-forth for moving windows.
This patch extends the previously introduced flag --no-auto-back-and-forth
to also apply to

    move window to workspace <name>
    move window to workspace number <number>

relates to #2028
2015-10-26 22:40:06 +01:00
Ingo Bürk 3d6c76eb93 Fix crash when trying to split and float a dock container.
Since splitting a docking container was allowed and successful, the check
to prevent floating it fails to work. This causes a crash because the
workspace of the container cannot be determined as the dockarea is higher
up in the tree than the workspace it belongs to.

This patch extends to sanity check to nested dock containers when trying to
float a container and also disallows manually splitting a docked container
or changing its layout.

fixes #2034
2015-10-26 22:14:14 +01:00
Michael Stapelberg 30c3729a24 Merge pull request #2036 from Airblader/bug-2015
Make resize grow|shrink width|height work for a nested split in the s…
2015-10-26 09:14:28 +01:00