Commit Graph

87 Commits (d75c5a18d79f52e5b81a0487e149dab74e76227b)

Author SHA1 Message Date
Michael Stapelberg 9200094203 format **/*.c with clang-format-3.5
This has multiple effects:

1) The i3 codebase is now consistently formatted. clang-format uncovered
   plenty of places where inconsistent code made it into our code base.

2) When writing code, you don’t need to think or worry about our coding
   style. Write it in yours, then run clang-format-3.5

3) When submitting patches, we don’t need to argue about coding style.

The basic idea is that we don’t want to care about _how_ we write the
code, but _what_ it does :). The coding style that we use is defined in
the .clang-format config file and is based on the google style, but
adapted in such a way that the number of modifications to the i3 code
base is minimal.
2014-06-15 19:07:02 +02:00
Peter Boström 9c15b9504e Fix clang -Wextra except -Wunused-parameter.
Cleared all warnings that occur when passing
CFLAGS="-Wall -Wextra -Wno-unused-parameter" to make using clang 3.3 on
Linux x86-64.
2014-01-02 22:15:33 +01:00
Yuxuan Shui 5adb09c5fc Use a saner sanity check for floating_reposition.
The function contained_by_output checks whether any output contains any
parts of a give rect. Rather than relying on the central point of the rect.
2013-03-21 23:41:07 +01:00
Francesco Mazzoli f13d8ed06f wrap when moving things to outputs with direction 2013-01-26 19:27:58 +01:00
Michael Stapelberg 34a5bbb7e9 exit with a proper error message when there are no outputs available (Thanks flo)
fixes #842
2012-10-14 20:56:13 +02:00
Deiz eb4a7f725d In get_output_next(), avoid an off-by-one for adjacent outputs and || mutually-exclusive failure conditions. 2012-09-22 18:12:49 +02:00
Michael Stapelberg 19883108a9 Make get_output_next() work with non-aligned RandR setups (+test) (Thanks Feh, swh, Moritz)
A good visualization of the new algorithm is this:

           +--------+
           |        |
+--------+=|   S1   |========================
|        | |        |
|   S0   | +--------+
|        |         +--------+
+--------+=========|        |================
                   |   S2   | +--------+
                   |        | |        |
                   +--------+ |   S3   |
                              |        |
                              +--------+

When focus is on S0, 'focus output right' will first match S1 (the
closest output which overlaps in the highlighted area), then S2, but not
S3 (since S3 does not overlap into the highlighted area).

fixes #669
fixes #771
2012-09-22 16:54:59 +02:00
Michael Stapelberg 5257a1268f Bugfix: don’t change tabbed/stacked cons to splitv/splith layout (Thanks Merovius)
To automagically do the right thing when rotating monitors with regards
to splith/splitv layout (depending on width/height of the monitor), we
change the orientation of existing workspaces and the first child.

If that first child happens to be a stacked/tabbed con, we cannot change
the layout unconditionally (previously, the orientation was not in the
layout, so we never noticed this problem).

fixes #768
2012-08-17 01:55:31 +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 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 fb4ee17b05 Merge branch 'master' into next 2012-08-04 16:10:37 +02:00
Michael Stapelberg d57d51da6d Bugfix: Properly fix floating coordinates when disabling outputs (Thanks Tucos)
Since the content containers are not yet updated (they will be when
rendering), we need to use the output containers’s rects instead.
2012-08-04 16:09:16 +02:00
Michael Stapelberg e867fd8105 Bugfix: fix floating coordinates when moving assigned workspaces 2012-08-04 16:09:10 +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 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
Fernando Tarlá Cardoso Lemos a22f161ab5 If moving the last ws, create a new one in its place.
This seems better than refusing to move the last workspace.
2012-02-15 17:59:33 +00:00
Michael Stapelberg c1e0c38b27 randr: Skip workspaces which are assigned to a different output when creating a new workspace
If you had workspace 1, 2, 3, 4 on LVDS1 and you enabled HDMI2 (where workspace
1 to workspace 5 are assigned to HDMI2), i3 would look for a new workspace for
LVDS1 (since all workspaces were moved), create workspace 5, move that over due
to assignment and then create workspace 6. Effectively, you would end up with
an empty workspace 5.
2012-02-07 21:10:16 +00:00
Fernando Tarlá Cardoso Lemos 8cffde232f Don't migrate unfocused empty workspaces when disabling output.
This is more similar to what happens when you close the last client
of an unfocused workspace (the workspace gets reaped).
2012-02-07 20:45:14 +00:00
Michael Stapelberg 36464c7a54 Merge branch 'master' into next 2012-01-29 18:02:48 +00:00
Fernando Tarlá Cardoso Lemos 55525015cc Fix coords of floating containers when the output is disabled.
This prevents floating containers from "disappearing" when their
associated output is disabled. Thanks Michael for the advice.
2012-01-29 18:02:27 +00:00
Michael Stapelberg fabcd7d911 Merge branch 'master' into next 2012-01-21 15:08:36 +00:00
Michael Stapelberg 077d2433a7 Bugfix: Fix coordinates when the rect of an output changes (Thanks Paul)
Fixes #623
2012-01-21 15:07:53 +00:00
Michael Stapelberg 6df971d5d5 Ignore next_on_output/prev_on_output when looking for the first workspace 2012-01-08 16:31:07 +00:00
Michael Stapelberg d25e77ce75 Don’t set the _NET_WM_WORKAREA hint at all (Thanks cg)
Fixes: #539
2011-11-30 20:33:07 +00:00
Michael Stapelberg d686f2f873 Bugfix: Don’t create a workspace named "back_and_forth" on startup
Fixes #565
2011-11-26 22:24:30 +00:00
Michael Stapelberg 227a58b0c3 Bugfix: Fix startup when RandR is not present 2011-11-24 23:49:35 +00:00
Michael Stapelberg 2b6504d310 Bugfix: RandR: Correctly keep focus on the focused workspace when an output disappears (Thanks AlexanderB, xeen) 2011-10-31 12:11:34 +00:00
Michael Stapelberg 9d15a00ba8 introduce sasprintf() in libi3, use it everywhere 2011-10-23 13:16:56 +01:00
Michael Stapelberg 42d355f2b7 normalize modelines/headers across src/*.c 2011-10-22 23:40:02 +01:00
Michael Stapelberg 0f74f9b921 remove left-over type definition for mode_info 2011-10-09 18:25:21 +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 8928b5f55d Bugfix: Correctly handle workspace names which do not start with a zero 2011-09-05 22:21:10 +02:00
Michael Stapelberg 7c6f693c8a Bugfix: Don’t consider the workspace next/prev command when looking for named workspaces
Fixes #469
2011-08-17 12:28:45 +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
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 d0741975f1 Bugfix: Use the appropriate number when assigning numbered workspaces in randr.c 2011-08-04 00:10:23 +02:00
Michael Stapelberg 9800d5286f Bugfix: Correctly check if the workspace already exists 2011-08-03 12:18:30 +02:00
Michael Stapelberg dcba8024de also handle quoted workspace names, extend t/72 for that 2011-08-03 03:33:12 +02:00
Michael Stapelberg 0092b245a1 Bugfix: When looking for an unused workspace, try the named workspaces first
Fixes: #449
2011-08-03 03:08:59 +02:00
Michael Stapelberg d3e3339a05 Bugfix: Fix small memory leak when initializing output Cons 2011-07-31 17:11:51 +02:00
Michael Stapelberg ffe297f5e5 Bugfix: use the global root variable, don’t get the first one (Thanks quaec) 2011-07-23 22:29:01 +02:00
Michael Stapelberg b35ff6a7c9 Bugfix: Correctly attach new output cons to the root con (Thanks mseed) 2011-06-11 14:36:09 +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 97e45b9cfc Bugfix: RandR: Correctly assign focused workspaces to outputs
Fixes: #399
2011-05-29 14:39:41 +02:00
Michael Stapelberg d3e458bc78 Remove old code from randr.c and workspace.c 2011-05-14 22:38:19 +02:00
Michael Stapelberg 5db97dc473 Bugfix: Fix initialization / assignments when RandR is missing 2011-05-14 22:34:34 +02:00
Michael Stapelberg 3f45d3c447 re-implement assignments of workspace to specific outputs 2011-05-14 22:19:58 +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