Commit Graph

137 Commits (3cf4746df1d61d1db75512779e5575ed9d0924c1)

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
Michael Stapelberg 28b9ed6eb3 Bugfix: Ensure that all outputs have a ->con before handling disabled outputs (Thanks JimdiGriz)
Steps to reproduce:
• xrandr --output VGA1 --auto
• xrandr --output LVDS1 --off
2011-04-27 10:18:46 +02:00
Michael Stapelberg e835888a9e Bugfix: Actually re-attach dock clients when outputs get disabled (Thanks phnom)
Fixes: #348
2011-03-20 01:07:21 +01:00
Michael Stapelberg eeb5bdd66f cleanup code of workspace rotation on output changes 2011-03-17 17:53:56 +01:00
Simon Kampe 2f992f5c0e Added config key for default orientation of containers (new_container_orientation) and added support in randr.c for automatically changing the orientation when user does a xrandr rotate. 2011-03-17 17:43:35 +01:00
Fernando Tarlá Cardoso Lemos c0563af3e2 Bring back some more EWMH support. 2011-03-14 17:11:33 +01:00
Michael Stapelberg ffc71859a3 Implement support for top/bottom dock clients (according to _NET_WM_STRUT_PARTIAL or requested position) 2011-02-21 14:27:32 +01:00
Michael Stapelberg a92b9dca73 Bugfix: fix disabling RandR outputs 2011-02-21 01:43:39 +01:00
Michael Stapelberg a33d869885 Bugfix: Correctly open workspaces on additional outputs 2011-02-21 01:12:22 +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 3383437705 refactor some places to use con_descend_focused instead of duplicating code 2011-01-27 16:09:14 +01:00
Michael Stapelberg fe851b85f0 RandR: respect primary output 2011-01-27 15:40:02 +01:00
Michael Stapelberg 55b6d31e4a Bugfix: randr: Don’t close container if it was not initialized before 2011-01-06 14:35:04 +01:00
Michael Stapelberg 2312187439 RandR: use the next unused workspace instead of fixed counting 2011-01-05 00:26:23 +01:00
Michael Stapelberg f73c02ce92 Also initialize output->con when using neither RandR nor Xinerama 2011-01-05 00:19:51 +01:00
Michael Stapelberg 5098e45f23 Re-Implement support for RandR changes 2011-01-05 00:16:10 +01:00
Michael Stapelberg f54ce1ddda retab! randr.c 2011-01-04 22:51:42 +01:00
Michael Stapelberg c145f7e529 first step of the big refactoring ("tree" branch).
From here on, we can track changes. It made no sense to put the
development up to this point into git.
2010-04-13 13:17:39 +02:00
Michael Stapelberg a542515f9e Fix memory leaks 2010-03-26 01:52:39 +01:00
Michael Stapelberg 7bd4ea3699 randr: Don’t enable outputs with mode 0x0
Just a sanity check for some possibly broken drivers.
2010-03-26 01:52:08 +01:00
Michael Stapelberg a151fd95a8 remove newlines 2010-03-26 00:28:30 +01:00
Michael Stapelberg 6fd56757f0 Bugfix: Assign all workspace to new outputs as new outputs get available (Thanks badboy) 2010-03-26 00:13:28 +01:00
Michael Stapelberg 7eea1067f8 Bugfix: correctly translate coordinates for floating windows when outputs change 2010-03-24 16:09:43 +01:00
Michael Stapelberg 35a791f7e6 ipc: also send workspace event when initializing a workspace for an output 2010-03-20 02:56:23 +01:00
Michael Stapelberg 46bd9ac58a Bugfix: correctly re-assign dock clients when output goes inactive 2010-03-20 02:52:06 +01:00
Michael Stapelberg 3c8c426011 Disable RandR if no outputs are found (Thanks fallen) 2010-03-19 18:51:19 +01:00
Michael Stapelberg ee76b2ebf6 Bugfix: When disabling RandR/Xinerama, give a name to the pseudo-output (Thanks fallen) 2010-03-19 18:51:01 +01:00
Michael Stapelberg 1680071555 randr: use effective CRTC width/height, not its mode (Thanks moemoe)
This fixes setups which use panning and cloning.
2010-03-17 15:56:26 +01:00
Michael Stapelberg 2df1fb8ac8 Implement disabling the internal workspace bar 2010-03-14 12:59:45 +01:00
Michael Stapelberg bd76e994b8 Re-add old Xinerama code for the poor nvidia users
Add --force-xinerama when starting i3 to use Xinerama instead of RandR.
This should *ONLY* be done if you have no other choice (nvidia’s
binary driver uses twinview and does not expose the monitor information
through RandR).
2010-03-09 21:25:54 +01:00
Michael Stapelberg 8d648b4e37 Update function names, variable names and documentation for the RandR changes 2010-03-05 16:18:41 +01:00
Michael Stapelberg 8b192ac7ed Bugfix: Correctly hide/show workspaces when enabling new outputs, correctly handle focus (Thanks Merovius) 2010-03-05 15:22:12 +01:00
Michael Stapelberg 718d62a3cd Bugfix: Fix clone mode with new RandR code (Thanks Merovius) 2010-03-05 14:32:48 +01:00
Michael Stapelberg 85437877e8 fix comment (Thanks Merovius) 2010-03-05 00:09:52 +01:00
Michael Stapelberg 3cfe1b35e0 Update fullscreen client position/size when an output changes (Thanks Merovius)
This fixes #187.
2010-03-03 09:32:31 +01:00
Michael Stapelberg e3e7ebe23a Bugfix: only return active screens in get_screen_most 2010-03-02 15:45:03 +01:00
Michael Stapelberg aae824b1f3 Change workspace assignments to use the RandR output name instead of <screen> 2010-03-02 13:35:43 +01:00
Michael Stapelberg 818e02ef35 huge change: implement RandR instead of Xinerama
Thanks to Merovius for doing a proof of concept on this one and
being a driving force behind the idea.

Using RandR instead of Xinerama means that we are now able to use
the full potential of the modern way of configuring screens. That
means, i3 now has an idea of the outputs your graphic driver
provides, which allowed us to get rid of the ugly way of detecting
changes in the screen configuration which we used before. Now, your
workspaces should not be confused when changing output modes anymore.

Also, instead of having ugly heuristics to assign your workspaces
to (the screen at position X or the second screen in the list of
screens) you will be able to just specify an output name.

As this change basically touches everything, you should be prepared
for bugs. Please test and report them!
2010-03-02 12:47:21 +01:00