Commit Graph

168 Commits (aa0b1f599f25cfe858ebbc7fa80d459bcdb2ae02)

Author SHA1 Message Date
Michael Stapelberg d644dbff64 bugfix: forgot to mark split containers as split = true (+test) (Thanks szalik)
When the workspace layout (formerly orientation) was forced to change
due to a move command, the split container we created was not marked as
split = true, which caused tree_flatten() to errnously kill the contents
of it and thus one window ended up unmanaged.

Also, the logic in tree_flatten() was inverted due to commit de94f6da.

fixes #790
2012-09-05 22:26:52 +02:00
Quentin Glidic b6c705a1a4 i3/window: Port window names to i3String 2012-08-13 11:30:08 +02:00
Michael Stapelberg 884627ef20 use I3__FILE__ for DLOG, leave __FILE__ as is
See also commit 0e752070ac, which broke
source code listings in gdb unless you cd into i3/src. This should give
us best of both :-).
2012-08-12 12:19:47 +02:00
Michael Stapelberg 6ba0944430 scratchpad: fix moving scratchpad window
From the source:

    When starting i3 initially (and after each change to the connected
    outputs), this function fixes the resolution of the __i3
    pseudo-output. When that resolution is not set to a function which
    shares a common divisor with every active output’s resolution,
    floating point calculation errors will lead to the scratchpad window
    moving when shown repeatedly.

fixes #632
2012-08-08 18:45:40 +02:00
Michael Stapelberg 0e752070ac explicitly set filenames to $(basename __FILE__)
This makes the debug log a bit more readable, especially since commit
48f1e383ca
2012-08-07 09:55:52 +02:00
Michael Stapelberg 1b2d222449 Properly report errors in 'focus parent' (Thanks eeemsi)
Also, make X11 errors debug log level only. They are harmless usually.

fixes #762
2012-08-05 20:57:20 +02:00
Michael Stapelberg de94f6da1a Introduce splith/splitv layouts, remove orientation
With this commit, the "default" layout is replaced by the splith and
splitv layouts. splith is equivalent to default with orientation
horizontal and splitv is equivalent to default with orientation
vertical.

The "split h" and "split v" commands continue to work as before, they
split the current container and you will end up in a split container
with layout splith (after "split h") or splitv (after "split v").

To change a splith container into a splitv container, use either "layout
splitv" or "layout toggle split". The latter command is used in the
default config as mod+l (previously "layout default"). In case you have
"layout default" in your config file, it is recommended to just replace
it by "layout toggle split", which will work as "layout default" did
before when pressing it once, but toggle between horizontal/vertical
when pressing it repeatedly.

The rationale behind this commit is that it’s cleaner to have all
parameters that influence how windows are rendered in the layout itself
rather than having a special parameter in combination with only one
layout. This enables us to change existing split containers in all cases
without breaking existing features (see ticket #464). Also, users should
feel more confident about whether they are actually splitting or just
changing an existing split container now.

As a nice side-effect, this commit brings back the "layout toggle"
feature we once had in i3 version 3 (see the userguide).

AFAIK, it is safe to use in-place restart to upgrade into versions
after this commit (switching to an older version will break your layout,
though).

Fixes #464
2012-08-04 03:13:24 +02:00
Michael Stapelberg 1b3435807a add missing \n in debug message 2012-08-04 03:12:06 +02:00
Fernando Tarlá Cardoso Lemos 8bf4e9e059 Restrict directional focus in fullscreen.
This reuses the same fullscreen focus logic to ensure that focus
doesn't escape a fullscreen container.
2012-06-03 16:24:53 +02:00
Fernando Tarlá Cardoso Lemos 250c260eaa Allow focus child/parent when in fullscreen.
This is now restricted according to the already defined fullscreen
focus constraints. Test case 157 was removed, as we don't prevent
level up/down in fullscreen anymore. Those commands are properly
tested in fullscreen by test case 156.

Fixes: #612
2012-06-03 16:24:53 +02:00
Michael Stapelberg 206b96202c Use (void) instead of () for functions without args (Thanks fernandotcl)
See also:
http://article.gmane.org/gmane.linux.kernel/1268792

The C compiler will handle (void) as "no arguments" and () as "variadic
function" (equivalent to (...)) which might lead to subtle errors, such
as the one which was fixed with commit 0ea64ae4.
2012-03-31 10:53:04 +02:00
Michael Stapelberg ed2bcc15e3 Merge branch 'master' into next 2012-02-07 17:42:58 -05:00
Michael Stapelberg 0fc459892e Bugfix: Properly split when the current container is alone within a stacked/tabbed con (+test) (Thanks aksr)
Fixes: #630
2012-02-07 17:42:35 -05:00
Michael Stapelberg ae049449af force rendering in more cases 2012-01-22 17:24:55 +00:00
Michael Stapelberg ef522b4dc1 Force re-rendering after changing the orientation of a split container 2012-01-22 13:19:37 +00:00
Michael Stapelberg 08986a1798 Implement scratchpad functionality (see userguide) 2011-12-21 23:15:32 +00:00
Michael Stapelberg 42d355f2b7 normalize modelines/headers across src/*.c 2011-10-22 23:40:02 +01:00
Noe Rubinstein 92cc4494aa refactor workspace_show and friends 2011-10-02 21:57:00 +01:00
Michael Stapelberg 1717b88174 Merge branch 'master' into next 2011-09-22 20:11:44 +01:00
Michael Stapelberg 4dbda73114 Bugfix: Correctly revert focus to other floating windows when closing a floating window
Uncovered by the testsuite \o/
2011-09-22 20:10:51 +01:00
Michael Stapelberg 05c0a8985b Merge branch 'master' into next 2011-09-18 17:44:00 +01:00
Michael Stapelberg 2fe0949abd Bugfix: Only change focus in tree_close() when the container was focused before
Fixes: #441

I’m not sure if that’s really all there is to it. Seems a bit too simple :).
We’ll see if I missed some corner cases in the next few days…
2011-09-18 17:43:02 +01:00
Michael Stapelberg 172f3563f7 Implement focus switching (focus left/right) for floating windows
Fixes: #475
2011-09-17 19:28:41 +01:00
Peter Bui 36224f86d1 Only warp pointer once during x_push_changes()
- Introduce warp_to static variable in x.c that stores the coordinates
  to warp to as a Rect.

- Add x_set_warp_to function to set this variable.  Use in _tree_next,
  workspace_show, and con_move_to_workspace.

- In x_push_chanages, if warp_to is set, then call xcb_warp_pointer_rect
  and then reset it to NULL.

This fixes all know bugs for pointer warping for me.
2011-08-17 12:12:40 +02:00
Michael Stapelberg 99ba193ce7 Bugfix: the up/down directions were swapped
Also compare 'output' and 'current' in the same order in both parts of the
condition to make the comparison more clear.
2011-08-07 15:46:24 +02:00
Michael Stapelberg 692d65b0fd little style fixes 2011-08-07 15:24:51 +02:00
Peter Bui a547365a88 Implement switching focus across screens.
Modify _tree_next() so that when we reach the workspace container:

1. Find the next corresponding output (screen) using the added
get_output_next().

2. If there is another output, find the visible workspace.

3. Call workspace_show on found workspace.

4. Find the appropriate window to focus (leftmost/rightmost, etc.) using
con_descend_direction, and then focus it.

I've only tested on horizontal monitors (left/right).
2011-08-07 14:33:07 +02:00
Michael Stapelberg 05e39c1c48 Ignore X11 errors caused by ReparentWindow / ChangeProperty on already destroyed windows
These errors can happen because a DestroyWindow request by a client will
trigger an UnmapNotify, then a DestroyNotify. We cannot distinguish this
UnmapNotify from an UnmapNotify not followed by a DestroyNotify, so we just try
to send the ReparentWindow / ChangeProperty and ignore the errors, if any.
2011-07-10 23:44:13 +02:00
Michael Stapelberg d641e1da3b Don’t force wrapping when focusing in a direction would work (+test)
Think of the following layout:

 -------------
 | tab |     |
 | con | win |
 |     |     |
 -------------

The tabbed container on the left has two children. Assume you have focused the
second/right child in the tabbed container. i3 used to focus the first/left
container of the tabbed container when using 'focus right' (it wrapped focus).

With this commit, the default behaviour is to instead focus the window on the
right of the screen.

The intention is to make focus switching more intuitive, especially with tabbed
containers supporting 'focus left'/'focus right' in tree. You should end up
using less 'focus parent' :).

You can force the old behaviour with 'force_focus_wrapping true' in your
config.

Code coverage is 62.5% with this commit.
2011-06-12 12:56:50 +02:00
Michael Stapelberg fb9d77305e Implement 'fullscreen global' 2011-06-10 18:27:20 +02:00
Michael Stapelberg 1585d942ea Make workspace_layout handle all cons at workspace level, not only the first one (+test)
This makes opening new windows on workspace level and moving windows to the
right/left more like in the old i3.
2011-06-02 17:21:38 +02:00
Michael Stapelberg aea445b690 Bugfix: Attach new cons at the correct place when a floating con is focused (+test) (Thanks fernandotcl)
New containers were previously attached directly to the workspace instead of to
the previously focused place in the workspace (for example a stacked con).

Fixes: #376
2011-05-13 21:30:37 +02:00
Michael Stapelberg 167bdd26b7 Argument for 'kill' for killing a specific window (now default) or the whole client (+test)
Use 'kill window' to kill a specific window (for example only one specific
popup), use 'kill client' to kill the whole application (or X11 connection to
be specific).
2011-05-13 20:41:03 +02:00
Michael Stapelberg 836a3ad615 Bugfix: set WM_STATE to WITHDRAWN when an app unmaps their window(s) (+test)
Fixes: #362
2011-05-13 17:04:55 +02:00
Michael Stapelberg eb8ad348b2 Bugfix: Don’t run into an endless loop when killing con with children (Thanks mseed)
When a tabbed container had more than one child and at least the first one
supported WM_DELETE, i3 entered an endless loop when killing that tabbed
container. This was due to tree_close only sending WM_DELETE without actually
removing the child, while the loop in tree_close assumed that with every call
of tree_close one child would be removed.
2011-05-11 20:22:47 +02:00
Michael Stapelberg b25477b15e Re-implement rendering to pixmaps (double-buffering) and caching decorations 2011-03-20 14:25:09 +01:00
Michael Stapelberg 86637d2e07 Bugfix: Make level up a noop during fullscreen mode (+testcase) (Thanks dothebart)
Fixes #341
2011-03-09 18:37:05 +01:00
Michael Stapelberg 74b90cd83f Bugfix: Send WM_DELETE / kill window the right way (Thanks dothebart)
Fixes #336
2011-03-09 18:08:26 +01:00
Michael Stapelberg 287d7f9527 Bugfix: Don’t focus new cons when there is a fullscreen con (Thanks dothebart)
Also, remove the focus_it parameter from tree_open_con, it makes more sense to
call con_focus outside of the function.
2011-03-06 23:26:02 +01:00
Michael Stapelberg a038d2674b Bugfix: 'level up' needs to stop at the workspace con + testcase (Thanks mseed) 2011-03-03 14:30:13 +01:00
Michael Stapelberg 77640da9e7 Bugfix: don’t focus the dockarea when closing a dock client 2011-03-03 14:03:06 +01:00
Michael Stapelberg 7f89c71689 Implement dock mode, update testsuite
Currently, dock clients are only possible at the top.
2011-02-20 23:43:03 +01:00
Michael Stapelberg 86500c5b88 Skip containers which got only one child when looking for the next/previous one to focus 2011-02-19 19:50:09 +01:00
Michael Stapelberg 26a416e016 refactor tree_move() into src/move.c, change config (!), change testcase
Due to lots of cases which were added and added to tree_move(), the function
was not really easy to understand. For this refactoring, I wrote tree_move()
from scratch, thinking about (hopefully) all cases. The testsuite still passes.

The move command also has different parameters now. Instead of the hard to
understand 'before v' stuff, we use 'move [left|right|up|down]'.
2011-02-14 23:05:20 +01:00
Michael Stapelberg 28dd226259 refactor code for removing children from a con
Let’s see how this callback stuff will work out. If it doesn’t work out well,
we will remove it.
2011-02-14 18:08:36 +01:00
Michael Stapelberg 4d0106b00f bugfix: don’t crash when moving windows out of a floating con (Thanks mseed) 2011-02-01 17:53:15 +01:00
Michael Stapelberg 9b01b1a7a6 Bugfix: When the container which was just closed is focused, we *do* need to focus another one (Thanks mseed) 2011-02-01 16:42:59 +01:00
Michael Stapelberg dad7c0da00 Don’t create a split container if no other cons are on a workspace (Thanks mseed)
This fixes #306.
2011-02-01 16:08:47 +01:00
Fernando Tarlá Cardoso Lemos 8be40932f2 Fix assertion when moving out of a floating container. 2011-01-28 01:25:06 +01:00
Fernando Tarlá Cardoso Lemos f465b3c11d Don't mess with the focus if we're not killing.
If we're not killing the mapped window and we're not killing the
parent window either in tree_close, then there's no reason to try
to change the focus. This fixes focus issues when moving a
container around another container (move up, left, bottom, right).
2011-01-28 01:25:03 +01:00
Fernando Tarlá Cardoso Lemos b29af954f6 Don't mess with the percentages in tree_flatten. 2011-01-28 00:12:26 +01:00
Fernando Tarlá Cardoso Lemos 5f4123f842 Fix some resizing issues (thanks mseed). 2011-01-27 23:42:37 +01:00
Michael Stapelberg 676afce540 bugfix: correctly move cons out of floating cons when the workspace has no other tiling cons (Thanks mseed) 2011-01-27 16:51:41 +01:00
Michael Stapelberg 334e41daa4 bugfix: don’t assume a workspace always has tiling cons when focusing (Thanks mseed) 2011-01-27 16:51:16 +01:00
Michael Stapelberg 3383437705 refactor some places to use con_descend_focused instead of duplicating code 2011-01-27 16:09:14 +01:00
Fernando Tarlá Cardoso Lemos 432563d6e7 Fix the percentages when moving containers. 2011-01-27 13:00:14 +01:00
Fernando Tarlá Cardoso Lemos bc82fc7e9f This parameter is no longer needed.
The algorithm is now always the same, doesn't matter if we're
adding or removing a container to/from its parent.
2011-01-27 13:00:14 +01:00
Fernando Tarlá Cardoso Lemos a93f4643ec Only fix the percentages after we insert the container.
This is what floating.c does and it allows us to unify the logic that
calculates those percentages.
2011-01-27 13:00:14 +01:00
Michael Stapelberg 3fe4146e24 Bugfix: fix crash in tree_flatten (Thanks mseed) 2011-01-19 09:31:31 +01:00
Michael Stapelberg d6d4c962f4 Bugfix: Call mark_unmapped() on floating nodes aswell (Thanks mseed)
This fixes #292.
2011-01-17 14:11:56 +01:00
Michael Stapelberg 83f6e445a0 Bugfix: Don’t use ->old_parent for floating cons (Thanks eelvex)
Instead, we attach them to their workspace when toggling back to tiling. This
makes more sense; afterall, floating clients are always directly below a
CT_WORKSPACE container.
2011-01-08 00:44:03 +01:00
Michael Stapelberg 54b9549713 Bugfix: Look for cons to focus *starting* at the ws, not beneath the ws (Thanks mseed)
This should fix #286.
2011-01-08 00:10:49 +01:00
Michael Stapelberg 115462f103 Implement tree flattening to automatically solve situations of redundant chains of split containers
This should fix the move problems. See comment of tree_flatten() for a little
example.
2011-01-07 22:21:41 +01:00
Michael Stapelberg 228b5c51ff change many LOG/printf messages to use DLOG 2011-01-07 20:58:58 +01:00
Michael Stapelberg 5098e45f23 Re-Implement support for RandR changes 2011-01-05 00:16:10 +01:00
Michael Stapelberg 1fb9b7c431 Bugfix: Correctly change focus after closing floating containers (Thanks litemotiv!) 2011-01-04 22:40:05 +01:00
Michael Stapelberg 0416be18df fix memleak: free struct Window members 2011-01-04 22:39:45 +01:00
Michael Stapelberg 80ecd157f6 fix memleak: free con->name before overwriting it 2011-01-04 22:38:33 +01:00
Michael Stapelberg 9713419327 Bugfix: Also change focus when the killed container was focused (Thanks fernandotcl) 2011-01-02 18:08:45 +01:00
Michael Stapelberg 50914e0483 Bugfix: Correctly change focus when closing a split-container
The problem was i3 leaving an invalid focus pointer valid (after killing the
container) because the container itself is not mapped (if it has no x11 window,
for example split containers).
2010-12-30 23:01:58 +01:00
Michael Stapelberg f65e4f5b16 Bugfix: Don’t redistribute resize percentage values when closing floating (!) windows (Thanks Merovius) (+testcase) 2010-12-30 02:39:14 +01:00
Michael Stapelberg d184587959 Bugfix: Don’t focus next window if the window was not mapped at the moment (on a different ws) 2010-12-28 02:27:11 +01:00
Fernando Tarlá Cardoso Lemos c88c3e3ab2 Default to a file in /tmp for the restart state.
The file is now created in /tmp using the process PID and the
username of the user running i3. The restart state file is only
loaded when restarting (the --restart option is appended to the
command line prior to the restart). That means that renaming the
old state file with the ".old" extension is no longer needed.

This "--restart" switch is supposed to be only used by i3. The
"-L" switch can be used to load a layout (and not delete it
afterwards). We unlink the state file after we load it so that
we don't keep cruft in /tmp or try to restart from an old config
file if restart_state is set.
2010-12-27 13:33:03 +01:00
Michael Stapelberg b0068de3d7 Bugfix: Transfer 'percent' factor when splitting, add testcase for resizing 2010-11-29 11:24:12 +01:00
Michael Stapelberg 2dba7ec1ec Bugfix for the last commit (broke some moving situations), update testcase 2010-11-28 20:15:47 +01:00
Michael Stapelberg 780b0ddbbc look & feel: when moving, descend if the container in target direction is a split-container 2010-11-28 18:35:11 +01:00
Michael Stapelberg 4fcd2f6e7e Bugfix: Fix focus when moving Cons
When having two v-splits on a horizontal desktop:
----------------
|  t1   |  t3  |
|-------|------|
|  t2   |  t4  |
----------------
…focus is on t2, and you move it into the right v-split (move after h), the
focus was not properly updated. That is, inside the right v-split, focus was
correct, but the workspace focus was still pointing to the left v-split.
2010-11-28 18:05:53 +01:00
Michael Stapelberg 511cbec49b look and feel: when moving a Con is not possible, split a workspace level
This allows you to open three cons, then move the last one to the right (like
in previous i3 releases).
2010-11-28 14:45:14 +01:00
Michael Stapelberg 81044a7104 Correctly restore focus when restarting (Thanks fernandotcl) 2010-11-28 14:27:44 +01:00
Michael Stapelberg 3bab222aa7 Bugfix: Re-attach windows in correct order when switching layout (Thanks fernandotcl) 2010-11-28 01:51:16 +01:00
Michael Stapelberg 2c157283ea fix third argument to strncat(), use smalloc(), use strlen(".old")+1 2010-11-28 01:22:10 +01:00
Fernando Tarlá Cardoso Lemos 0a17fe973c Make the restart path configurable. 2010-11-28 01:18:10 +01:00
Michael Stapelberg 0cfebcb5b6 remove some debug messages 2010-11-27 18:05:45 +01:00
Michael Stapelberg 1de97a1f1f correctly sort numbered workspaces (+testcase)
Numbered workspaces (workspaces with a name containing only digits) will be
inserted in the correct order now. Named workspaces are always sorted after
numbered workspaces and in the order of creation.
2010-11-21 23:35:49 +01:00
Michael Stapelberg fab8b84db7 ipc: fix current_workspace 2010-11-21 22:12:34 +01:00
Michael Stapelberg 2d280469af Bugfix: Don’t draw borders for fullscreen windows 2010-11-21 17:00:10 +01:00
Michael Stapelberg 09b5b17830 Bugfix: Don’t attach tiling containers to floating containers
This bug happened when there were only floating containers on a workspace and a
new tiling window was to be opened.
2010-11-21 16:49:59 +01:00
Michael Stapelberg db651679c5 Bugfix: Properly ignore UnmapNotify events (especially for floating windows)
This fixes the bug which caused floating windows to be visible even when
switching to a different workspace.

Instead of ignoring a specific sequence, we now set an ignore_unmap counter for
each container. (So, should containers be closed too early or stay open even if
they should be closed, we probably need to have a closer look at the counter.
At the moment, it is increased by one on reparenting and unmapping (for
workspace changes) and decremented by one on each UnmapNotify event).

This system is better because a sequence does not describe a single unmap or
reparent request but a request to X11 on the network layer -- which can contain
multiple requests.
2010-11-20 19:11:43 +01:00
Fernando Tarlá Cardoso Lemos bfa12a5819 Port the path resolution and config loading code from -next. 2010-11-15 14:00:46 +01:00
Michael Stapelberg 39b378b0a4 don’t allow useless splits, change orientation of existing split container instead 2010-11-14 23:18:39 +01:00
Michael Stapelberg d760a1c7b2 Bugfix: don’t kill parent when currently in tree_close() for a child of this parent 2010-11-14 20:14:09 +01:00
Michael Stapelberg f0efb3737e don’t remove floating container twice (it’s already removed in con_detach) 2010-11-14 20:11:46 +01:00
Michael Stapelberg 945632ddcb Implement setting the WM_NAME of i3 container windows for debugging 2010-11-14 16:41:46 +01:00
Michael Stapelberg 7c6f2dbfc6 Rendering fixes for stacking mode 2010-11-13 22:39:59 +01:00
Michael Stapelberg dc10c67060 Bugfix: Close containers which are empty due to a move (Thanks fernando) 2010-11-13 14:55:11 +01:00
Michael Stapelberg c1d574f84e enumerate workspaces when initializing outputs 2010-11-12 17:33:59 +01:00
Michael Stapelberg 099df7f438 Bugfix: Keep focus on the current workspace when moving containers, add testcase 2010-07-17 13:27:34 +02:00
Michael Stapelberg 49add4f3e4 Bugfix: Don’t go further when switching focus on a CT_WORKSPACE 2010-07-17 01:56:16 +02:00
Michael Stapelberg 69e5c0f6ce Treat stacking containers as if they are in vertical orientation, add testcase 2010-07-17 01:27:47 +02:00
Michael Stapelberg 09c6b587d3 close empty parent containers, add testcase 2010-07-17 00:54:47 +02:00