Commit Graph

248 Commits (eca8fae2de2a2f7d6a8953d5ce6e0a76c6dc1264)

Author SHA1 Message Date
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
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
Orestis Floros b0997234ab
con_toggle_layout: free(tm_dup) outside loop 2018-03-25 20:48:20 +03: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 cb73fd5e31 Fix focus order issues when encapsulating workspaces
See new tests for an explanation of the problem.
2018-02-26 23:08:57 +02:00
Orestis Floros dc2363a665 Introduce *focus_order functions 2018-02-26 23:06:04 +02: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
Orestis Floros df437aa87e Use con_has_parent in con_fullscreen_permits_focusing 2017-12-11 14:00:14 +02:00
Dan Elkouby 26014ca1a2 Default to L_SPLITH with toggle split when last_split_layout hasn't been initialized 2017-10-14 12:27:56 +03:00
Dan Elkouby c028f0cb17 Create a new split container when switching a workspace container to split layout
The behavior before 52ce8c8 was to do it regardless of what layout we're
switching to.

Fixes #2846
2017-10-14 12:26:47 +03:00
Ingo Bürk 9fe508b791 Merge pull request #2977 from orestisf1993/issue-1627
Check container existance during drag events
2017-09-23 10:40:34 +02:00
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
Ingo Bürk dd13cae5c0 Merge pull request #2959 from orestisf1993/issue-2764
Allow assign to output
2017-09-22 16:24:26 +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
Orestis Floros e2bacc7df8 Add con_move_to_output_name function 2017-09-17 15:37:17 +03:00
Orestis Floros fa5d8a0209 Make swap work with fullscreen windows
Swap works like normal with fullscreen windows but swaps the fullscreen
mode of the 2 containers after it's done.

Fixes #2811
2017-09-16 13:49:20 +03:00
Vladimir Panteleev bfa76016de
Fix typo in con_parent_with_orientation description 2017-09-15 00:07:40 +00:00
Michael Stapelberg b23e1f644f Bugfix: free incomplete containers when JSON parsing fails
related to #2755
2017-09-13 16:39:13 +02:00
Vladimir Panteleev 30b1ab38b3
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 08:22:57 +00: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
Michael Stapelberg 260bcf283f Respect dont_warp flag when moving containers (#2867)
fixes #2681
fixes #2592
2017-08-20 17:07:23 +02:00
Michael Stapelberg 6dd4252cd5 Merge pull request #2496 from Airblader/feature-917
Implement 'swap' command.
2017-05-15 21:35:10 +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 9178c5b8ca Force container to be redrawn upon moving to another container. (#2769)
This is necessary as otherwise urgent containers can be broken
after moving them.
2017-05-12 19:26:35 +02:00
Mihai Coman 52ce8c803d Fix changing of root workspace layout from stacked/tabbed 2017-04-27 17:50:55 +03:00
s3rb31 37658bd6d7 layout toggle: take any combination of layouts as arguments (#2649)
With this PR the 'layout toggle' command can be passed any
combination of valid layout keywords as arguments. They will
be activated one after another each time you issue the command,
advancing from left to right always selecting the layout after
the currently active layout or the leftmost layout if the active
layout is not in the argument list.

This PR also incorporates the feature request from #2476.
2017-02-24 00:34:18 +01: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 f58dde2850 Merge pull request #2507 from stapelberg/autotools
Switch to autotools (GNU build system)
2016-10-25 08:56:12 +02: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 e51a89e842 Implement new window::mark IPC event. (#2503)
This introduces a new type of 'window' event sent wit change:mark whenever
a mark on a window changes.

fixes #2501
2016-10-18 07:32:41 +01:00
Michael Stapelberg fac57699b4 Bugfix: avoid setting urgency hint on content container and above
fixes #2098 (I _think_)
2016-09-04 21:08:21 +02:00
Julien Lequertier 4bec3b9d24 Smart option added to hide_edge_borders config param (#2191) (#2191)
Use case:

* When managing multiple terminals in a workspace, the borders makes it easier
to know where the focus is, but when there is only one it's obvious where the
focus is.

* When there's only a web browser for example, the borders are actually counter-
productive since it makes clicking a side scrollbar or a tab a bit harder (if I
smash my cursor to the side or the top of the workspace, I have to move it in
the other direction by just a few pixels to be able to grab it)

Behaviour:

* No borders when there's a single window in a workspace
* Borders when there are multiple windows in a workspace

fixes #2188
2016-05-10 20:27:20 +02:00
Ingo Bürk b2397c9f01 Remove redundant depth argument from x_con_init(). (#2323) 2016-05-05 14:18:27 +02:00
Ingo Bürk 80dddd9961 Correctly count the number of windows for no_focus. (#2296)
Previously we counted the number of (direct) children of the workspace to
decide whether no_focus should be applied or not. However, this doesn't
work correctly if there's a single container with multiple windows on the
workspace.

This patch correctly counts all windows on the workspace.

fixes #2292
2016-04-15 00:26:42 -07:00
wentasah fec1a9511e Make fullscreen windows open on the output which is indicated by their geometry
With this change, multi-monitor presentations (e.g. as implemented by
LibreOffice Impress) work out of the box. Previously, one had to move
the presentation windows to the right outputs oneself.
2016-04-06 21:19:10 +02: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 f904511b7e con_get_tree_representation: fix memory leak 2016-01-09 17:06:58 +01:00
Michael Stapelberg 08976f7a2a con_mark: fix heap-use-after-free 2016-01-08 20:41:09 +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
Michael Stapelberg bc126aaeaf Merge pull request #2134 from Airblader/bug-1761
Properly validate containers when killing via criteria
2015-12-29 11:50:58 +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 61a8bc81ec Move urgent flag before killing the parent.
We need to move the urgent flag when moving a container across
workspaces before calling on_remove_child on the parent in order
to avoid a crash.

fixes #2128
2015-12-27 18:08:30 -05:00
Ingo Bürk 780cb8d15d Use 32-bit visual by default if available.
With this patch, we use 32-bit visuals per default whenever it is
available. Otherwise, we fall back to the actual root window's
depth, which will typically be 24-bit.

Before this patch, we already used 32-bit depth for containers with
a window that uses 32-bit. However, this means that we didn't use
32-bit for split parent containers on which decoration is drawn.
For 32-bit windows using transparency, this caused a graphical glitch
because the decoration pixmap behind it would show through. This
behavior is fixed with this change.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk b665049883 Migrate i3 rendering to cairo.
This patch migrates all decoration rendering of i3 to cairo. Using the
compile switch CAIRO_SUPPORT, rendering can be switched back to the
previous XCB behavior, just like with the previous migration to cairo
in i3bar.

This patch also fixes a bug in draw_util.c where copying one surface
to another would use incorrect coordinates if the source coordinates
are not 0, 0.

Furthermore, this patch implicitly fixes some minor issues in the
decoration rendering which would be ignored previously due to the fact
that errors would only show up in the event queue, but not cause the
rendering code path to crash. One example is zero-height pixmaps which
are not allowed. Using cairo, these would cause i3 to instantly segfault,
so this patch avoids this.

Lastly, this patch annotates other issues found but not fixed in this patch
using TODO comments, e.g., the zero-height check not working correctly
and the comment that it should probably work the same way for zero-width
pixmaps.

relates to #1278
2015-11-23 22:18:02 +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
Ingo Bürk 9537ada5ad Make 'unmark' aware of matched windows.
This patch allows using 'unmark' on matched windows. The old behavior
of applying it to all windows if no criteria were specified is kept.

relates to #2014
2015-10-22 15:32:18 +02:00