Commit Graph

207 Commits

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
Michael Stapelberg 893dbae4b1 Bugfix: don’t overwrite the window’s geometry after restarting
fixes #1263
2014-06-13 22:29:47 +02:00
Michael Stapelberg e69fcbb17b Bugfix: ensure floating windows don’t drop out of fullscreen when restarting
fixes #1263
2014-06-13 22:26:06 +02:00
Michael Stapelberg 5beaea3034 handle windows whose WM_TRANSIENT_FOR points to themselve
I consider this behavior broken and not respecting the standard, but it
happens in real life, and it’s better for i3 to not busy-loop in such a
situation :).

fixes #1259
2014-06-12 21:16:45 +02:00
Michael Stapelberg 0552fd5666 Bugfix: fix crash when using multiple for_window statements that move windows (Thanks Antonio)
fixes #1257
2014-06-12 09:32:55 +02:00
Tony Crisci cfd06718fc Bugfix: double X render on manage
When a con is being managed, tree_render should only be called once to
push the changes to the rendering server to prevent wasting resources.
2014-05-20 20:10:22 +02:00
Aleksi Blinnikka 89dd868e82 Separate border width for floating windows
Floating windows already had their own border style, but the width was
the same for all windows.

The configuration directives 'new_window' and 'new_float' can now be
used simultaneously to have different border widths for floating and
tiled windows.

fixes #1244
2014-05-16 17:59:21 +02:00
Michael Stapelberg 77abb2ef19 Bugfix: clear wm_size_hints if they are not set
Otherwise, we read random garbage. Found by the testsuite due to
t/185-scratchpad.t failing because a window was incorrectly recognized
as a floating window.
2014-04-09 22:14:50 +02:00
Kernc 8ed95ae58c Improved detection of windows that want floating
Windows that match the following criteria are floated by default:
- dialog, utility, toolbar, or splash windows,
- modal windows, or
- windows that have specified equal minimum and maximum size.

closes #1182
2014-03-08 21:00:44 +01:00
Marco Hunsicker 00ee86de79 Send IPC window events for focus and title changes
This patch fixes ticket #1168 to extend the window IPC event mechanism
to send IPC events for window focus and title changes. The newly added
window events use the same format as the already established "new"
event.

Specifically this patch:

* Moves the ipc_send_window_event() function from src/manage.c into
  src/ipc.c and adds an argument for the change property of the event
* Updates src/manage.c to use the new function signature. To ensure
  that the "new" event does not send the same event data as the
  "focus" event, setting focus now happens after the "new" event
  has been sent
* Adds IPC focus event notification to src/x.c. To workaround a problem
  during window close when accessing the window name, a function has been
  added to query whether a window is actually attached to its parent. To
  avoid obsolete focus notification, a new field has been added to keep
  track of the focus without any interference by the click handling
* Adds IPC title event notification to src/handlers.c. To avoid
  obsolete title notification, a function has been added to determine
  whether a window title has actually changed
* Updates the IPC documentation to include the new events
* Updates testcases/t/205-ipc-windows.t to include the "focus" event
  in order to ensure the correct event sequence
* Adds two new unit tests, b/testcases/t/219-ipc-window-focus.t and
  b/testcases/t/220-ipc-window-title.t to ensure proper "focus" and
 "title" events
2014-02-26 22:24:19 +01:00
Tony Crisci dee6264d57 Respect Motif hint for window decorations
When the _MOTIF_WM_HINTS property of a window specifies it should have
no title bar, or no decorations at all, respond by setting the border
style of that container to BS_PIXEL or BS_NONE respectively.

This comes from the old Motif window manager. It was originally intended
to specify exactly what sort of decorations a window should have, and
exactly what sort of user input it should respond to. The EWMH spec
intended to replace Motif hints with _NET_WM_WINDOW_TYPE, but it is
still in use by popular widget toolkits such as GTK+ and Java AWT.

i3's implementation simply mirrors Gnome's Metacity. Official
documentation of this hint is nowhere to be found.

For more information see:
https://people.gnome.org/~tthurman/docs/metacity/xprops_8h-source.html
http://stackoverflow.com/questions/13787553/detect-if-a-x11-window-has-decorations

fixes #832
2014-01-18 16:25:37 +01:00
Michael Stapelberg f6ee035c61 fix killing placeholder windows
The only consequence of the previous situation was that there was a
misleading log message.
2014-01-04 22:24:47 +01: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
Michael Stapelberg 42e359ec60 kill placeholder windows when the actual window appears 2013-12-22 21:52:49 +01:00
Michael Stapelberg 2ce43783f8 add debug message to trace match deletions 2013-12-22 21:52:49 +01:00
Michael Stapelberg 58297f4ab5 layout restore: support more criteria, match only once (+test) 2013-12-22 21:52:49 +01:00
Tony Crisci e99158e419 Assigned windows open urgent when not visible
When i3 begins to manage a window, if the window opens on a workspace
that is not visible, the urgency hint on the newly managed window will
be set.

fixes #1088
2013-10-19 10:07:24 +02:00
Michael Stapelberg 031de8f720 Merge branch 'master' into next 2013-09-24 07:48:09 +02:00
Michael Stapelberg 1a1d421534 Bugfix: correctly recognize assigned windows as urgent (Thanks jookia)
fixes #1086
2013-09-24 07:47:36 +02:00
jj ee04f8bfda Fix handling of new windows with WM_STATE_FULLSCREEN
If the currently focused window is in fullscreen mode, and a new window
is opened with WM_STATE_FULLSCREEN set, the new window now becomes the
new fullscreen window and gains focus.
2013-09-24 06:36:56 +02:00
Michael Stapelberg e979f16ddb manage.c: use xcb_discard_reply() instead of free()ing the reply (Thanks psychon) 2013-05-28 18:57:26 +02:00
Mats a38749e7e4 Bugfix: Handle nested transient popups properly
During smart popup fullscreen handling, display all transient popups
that belong to the respective fullscreen application. A popup window
belongs to another window if the latter is reachable via the path
induced by the WM_TRANSIENT_FOR hints.

fixes #881
2013-02-24 15:59:38 +01:00
Piotr S. Staszewski 3facbbca5c Add a new IPC event for changes on windows.
Added new event id (I3_IPC_EVENT_WINDOW) so that a an IPC client can
subscribe to events on windows. Added a basic window event that gets
triggered when a window gets successfully reparented. This new event
also dumps the container data, so that IPC clients can get the initial
window name. IPC clients wishing to see window events should subscribe
to 'window'.
2013-02-18 10:55:11 +01:00
Michael Stapelberg 2c249b6949 Merge branch 'master' into next 2013-01-01 16:31:27 +01:00
Michael Stapelberg 138e04fd4d Bugfix: Fix for_window moving of assigned windows (Thanks bafain)
fixes #909
2013-01-01 16:31:08 +01:00
Michael Stapelberg 54fd3d3480 unregister as window manager before restarting (fixes a race condition) 2012-12-27 16:54:54 +01:00
Michael Stapelberg cde82eafa6 use xcb_aux_sync to make sure our changes reach the X server, flushing is not enough 2012-12-27 16:54:36 +01:00
Michael Stapelberg 9b87b2c8ec Implement smart popup_during_fullscreen mode
With this commit, the default behavior is to display popups while there
is a fullscreen application only if the popup belongs to that
application (as determined by the WM_TRANSIENT_FOR hint which
applications have to set properly).

fixes #663
2012-10-24 20:54:28 +02:00
Deiz fdfbc53c0b Focus windows when middle-clicking (X paste)
As with most click-based focusing, this only has an effect when
focus_follows_mouse is disabled.
2012-10-16 20:03:08 +02:00
Michael Stapelberg a3f3d5670c Bugfix: properly react to windows being unmapped before we can reparent (Thanks xeen, darkraven)
We need to verify that setting the event mask works, and we need to
include StructureNotify to get unmap events at any point in time.
Thanks darkraven for the pointer.

fixes #718
2012-09-27 12:09:06 +02:00
Michael Stapelberg 372d47842e Bugfix: Render workspaces created by assignments to use correct coordinates (Thanks meaneye)
Previously, i3 would send width=0, height=0 to windows which were put on
workspaces created by an assignment (that is, invisible workspaces,
which do not get rendered normally).

fixes #653
2012-09-24 23:57:58 +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 91786c3801 typo: s/transiert/transient/ 2012-08-11 22:53: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 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
darkraven 9d68d780e2 Use 32bit visual only when needed. Thus we could drop the --enable-32bit-visual option. 2012-03-26 16:50:44 +02:00
Michael Stapelberg 3b7f4d428e Correctly restore focus after in-place restarts
Note: This change requires two in-place restarts when you are upgrading
in-place from an old version.

Fixes #611
2012-01-21 18:35:15 +00:00
Michael Stapelberg 2d14ced024 Bugfix: Respect WM_HINTS.input for WM_TAKE_FOCUS clients
This fixes problems with Qt apps (like Quassel) and apparently Eclipse since
the last commit.
2012-01-18 19:16:57 +00:00
Michael Stapelberg 9d15a00ba8 introduce sasprintf() in libi3, use it everywhere 2011-10-23 13:16:56 +01:00
Michael Stapelberg 10d3281b0f remove/shorten a lot of debugging messages
Some of them are useless nowadays, others very unlikely to be a problem.
Those which might still be interesting somewhen in the future are just
commented out.
2011-10-23 00:15:13 +01:00
Michael Stapelberg 42d355f2b7 normalize modelines/headers across src/*.c 2011-10-22 23:40:02 +01:00
Peter Bui 9d67ae2202 Focus new window only if it is on a visible workspace on the current focused output. 2011-10-18 18:56:39 +01:00
Michael Stapelberg 4204b8e2b0 Get the _NET_STARTUP_ID in manage_window, get the corresponding workspace 2011-10-10 15:54:17 +01:00
Michael Stapelberg b3adaa2983 Implement the window_role criterion (checks WM_WINDOW_ROLE)
Closes: #446

This is handy for matching specific windows of a multi-window application, for
example only Pidgin’s buddy list window.
2011-09-18 16:05:10 +01:00
Michael Stapelberg 6d91a6248e Merge branch 'master' into next 2011-08-26 02:02:50 +02:00
Michael Stapelberg 7741608a9d Bugfix: Only consider tiling windows when attaching tiling windows to workspaces (Thanks Tucos)
Fixes #436
2011-08-26 02:01:06 +02:00
Michael Stapelberg 22e30061f3 Merge branch 'master' into next 2011-08-17 16:37:09 +02:00
Michael Stapelberg f172359ba5 Bugfix: Don’t change focus when assigned windows start on invisible workspaces (+test) (Thanks ioflag)
Fixes #468
2011-08-17 16:36:19 +02:00
Michael Stapelberg 2abe23d6ff Merge branch 'master' into next 2011-08-17 01:52:45 +02:00
Michael Stapelberg 7951445849 xcb: use predefined XCB_ATOM_ atoms, don’t request them 2011-08-17 01:41:19 +02:00
Mateusz Poszwa cd5ebc2dca src/manage.c: properly set automatic flag when calling floating_enable() 2011-08-09 09:29:47 +02:00
Michael Stapelberg 7180dca3b2 Bugfix: Correctly free the xcb_get_geometry reply when not managing a window 2011-07-31 20:39:33 +02:00
Michael Stapelberg 52b3646ecc xcb: don’t use the _unchecked variant for requests which have a reply 2011-07-31 18:19:41 +02:00
Michael Stapelberg 7f3f7c26b6 Bugfix: free replies after using them 2011-07-31 18:17:56 +02:00
Michael Stapelberg 71741d7620 Bugfix: Only set ENTER_WINDOW event mask for mapped windows (fixes focus problems)
Fixes focus problems when switching to empty workspaces or when going in/out of
fullscreen.
2011-07-04 13:41:02 +02:00
Michael Stapelberg fb9d77305e Implement 'fullscreen global' 2011-06-10 18:27:20 +02:00
Michael Stapelberg 58e02e84e2 Bugfix: Don’t break focus stack when inplace restarting with fullscreen windows (Thanks mike) 2011-06-03 01:48:55 +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 18ec15b0f9 x: fix race condition where the new event mask was not set directly after reparenting 2011-05-29 13:20:41 +02:00
Michael Stapelberg 7ae0c9c973 Bugfix: Check swallows before assignments when managing windows (Thanks julien)
Fixes #395 (empty containers on restart when assigned windows are visible)
2011-05-25 21:00:53 +02:00
Michael Stapelberg 7208d01048 remove unused code from manage.c 2011-05-25 20:47:47 +02:00
Michael Stapelberg 2c68c234ea Implement assignments for (named) workspaces, with '~' compatibility (floating) 2011-05-23 18:41:17 +02:00
Michael Stapelberg 5ae4620a24 Time Lord technology: for_window config directive to run arbitrary cmds
An example to set all XTerms floating:
    for_window [class="XTerm"] mode floating

To make all urxvts use a 1-pixel border:
    for_window [class="urxvt"] border 1pixel

A less useful, but rather funny example:
    for_window [title="x200: ~/work"] mode floating

The commands are not completely arbitrary. The commands above were tested,
others may need some fixing. Internally, windows are compared against your
criteria (class, title, …) when they are initially managed and whenever one of
the relevant values change. Then, the specified command is run *once* (per
window). It gets prefixed with a criteria to make it match only the specific
window that triggered it. So, if you configure "mode floating", i3 runs
something like '[id="8393923"] mode floating'.
2011-05-15 20:10:25 +02:00
Michael Stapelberg 3d1acd6c2f re-implement assigning windows to workspaces 2011-05-02 23:29:26 +02:00
Michael Stapelberg 6419e42f6d bugfix: fix race condition where window titles were not correctly updated
Fixes: #351
2011-04-01 21:39:58 +02:00
Michael Stapelberg 82e286ed7c Only send WM_TAKE_FOCUS when the client supports it in the protocols atom
Fixes opening xterm, for example
2011-03-18 17:07:56 +01:00
Michael Stapelberg 0639a7d95b Make i3 compatible with the very latest xcb
This involves:
 • Compiling with xcb-util instead of xcb-{atom,aux} (they merged the libraries)
 • Not using xcb-{event,property} anymore (code removed upstream)
 • Not using the predefined WINDOW, CARDINEL, … atoms (removed upstream)
 • Using the new xcb_icccm_* data types/functions instead of just xcb_*
   (for example xcb_icccm_get_wm_hints instead of xcb_get_wm_hints)

Also I refactored the atoms to use x-macros.
2011-03-18 14:39:27 +01:00
Fernando Tarlá Cardoso Lemos b4e3dfd76b Add the "created" parameter to workspace_get.
If created is not NULL, *created is set to whether or not the
workspace has been just created.
2011-03-14 17:07:53 +01:00
Michael Stapelberg 0a24057241 When leaving fullscreen, set focus to con which was opened during fullscreen (+testcase) (Thanks dothebart) 2011-03-07 00:06:27 +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 8ce5f2a21b Bugfix: Fix crash with transient dock clients caused by 7154fecbb 2011-03-06 22:02:02 +01:00
Michael Stapelberg 7154fecbbf Implement the popup_during_fullscreen option, set default to leave_fullscreen
Fixes #333
2011-03-06 15:46:06 +01:00
Michael Stapelberg caa1ac1a9f Use the original geometry for floating windows 2011-03-03 16:22:22 +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 b6f81fe43c Bugfix: restore the original width/height with X11 border when restarting (Thanks Merovius) 2011-02-21 03:13:27 +01:00
Michael Stapelberg 35e79c87c8 Place dock clients on the output corresponding to their geometry request 2011-02-21 01:28:29 +01:00
Michael Stapelberg 9a0bc77baf bugfix: dock clients cannot be floating 2011-02-21 00:23:07 +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 228b5c51ff change many LOG/printf messages to use DLOG 2011-01-07 20:58:58 +01:00
Michael Stapelberg cbd53e8a7f bugfix: check if the client leader is a managed window (Thanks fernandotcl) 2010-11-14 23:55:53 +01:00
Michael Stapelberg 76c07900c2 take into account x11 border_width settings (fixes uxterm border issue) 2010-11-14 23:44:13 +01:00
Michael Stapelberg e8b5a802e2 Bugfix: only set clients to floating which have a leader that is not their own window (Thanks fernandotcl) 2010-11-14 22:49:05 +01:00
Michael Stapelberg 33eb00d6ae automatically set windows with client_leader to floating 2010-11-14 20:15:51 +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 432073dbe5 implement support for WM_TRANSIENT_FOR, expand testcase 2010-11-13 01:19:21 +01:00
Michael Stapelberg ad9be5402a Implement support for WM_CLIENT_LEADER 2010-11-12 23:46:03 +01:00
Michael Stapelberg 57e602a97c respect position in geometry of floating windows 2010-11-12 20:55:26 +01:00
Michael Stapelberg 5c2758af26 Implement support for size hints (including test case) 2010-10-11 21:32:29 +02:00
Michael Stapelberg 160c12ed9a recognize dock windows (and support matching them) 2010-08-15 12:18:27 +02:00
Michael Stapelberg c33d352fd2 floating: re-implement floating_modifier + left/right mouse button to drag/resize 2010-06-28 22:23:32 +02:00
Michael Stapelberg 84e78c6dba automatically set dialog windows to floating 2010-06-28 21:40:36 +02:00
Michael Stapelberg 14a312c152 more debug output 2010-06-02 17:04:26 +02:00
Michael Stapelberg a7d2c5942a Clear event mask while reparenting
This way, we can avoid to ignore UnmapNotify events generated by reparenting.
It is generally considerable to have as little ignored events as possible
due to side-effects.
2010-06-02 17:02:10 +02:00
Michael Stapelberg 8c5d824fa8 Ignore UnmapNotify events generated by reparenting 2010-05-14 23:37:56 +02:00
Michael Stapelberg b0f47b25a0 throw out some old code from manage.c, cleanups 2010-04-17 18:26:46 +02:00
Michael Stapelberg 68542f3c22 When assigning children to containers, reset their x window state 2010-04-17 16:41:20 +02:00
Michael Stapelberg 53dcebfd8a put container in fullscreen mode if the fullscreen state is set when mapping 2010-04-17 14:21:34 +02:00
Michael Stapelberg dd7acf73e9 re-add support for legacy window titles (WM_NAME) 2010-04-13 17:46:54 +02:00
Michael Stapelberg fd8735a6fd correctly update/display window title/class 2010-04-13 17:22:34 +02:00
Michael Stapelberg bcfb0d2505 more reformatting 2010-04-13 16:48:42 +02:00