Commit Graph

447 Commits (10646eb0021403c1f1448339603b24c50da0e604)

Author SHA1 Message Date
Tony Crisci 8d031bfbf8 Handle _NET_CLOSE_WINDOW client message requests
> Pagers wanting to close a window MUST send a _NET_CLOSE_WINDOW client
> message request to the root window.

We interpret this message as a request to close the con for the given
window.

See: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472668896

fixes #1396
2014-11-17 09:08:42 +01:00
Tony Crisci 344f6be84a Handle WM_CLASS changes
http://tronche.com/gui/x/icccm/sec-4.html

> The WM_CLASS property (of type STRING without control characters)
> contains two consecutive null-terminated strings. These specify the
> Instance and Class names to be used by both the client and the window
> manager for looking up resources for the application or as identifying
> information.

i3 processes changes to WM_CLASS by updating the cached property and
running assignments. This allows the property to be used in criteria
selection.

fixes #1052
2014-07-15 09:18:40 +02:00
Tony Crisci 0514be8d4b Handle EWMH requests to change current desktop
This request is used by pagers and bars to change the current
desktop likely as a result of some user action. We interpret this as
a request to focus the given workspace.

for more information see:

http://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368135008
2014-07-10 22:39:42 +02:00
Tony Crisci 136b3e345b Handle WM_CHANGE_STATE requests for iconic state
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.4

 > IconicState - The client's top-level window is iconic (whatever that
 > means for this window manager). The client can assume that its
 > top-level window is not viewable, its icon_window (if any) will be
 > viewable and, failing that, its icon_pixmap (if any) or its
 > WM_ICON_NAME will be displayed.

For these requests, we just close the window.

fixes #1279
2014-06-24 09:39:12 +02:00
Tony Crisci ca5137eeba remove unneeded render on map request
manage_window() will call tree_render() when appropriate, so pushing
changes to X here is not needed.
2014-06-24 09:32:14 +02:00
Tony Crisci e77103012f remove unneeded render on unmap
tree_render() will call x_push_changes(), so calling it afterward is not
needed.
2014-06-24 09:32:04 +02:00
Michael Stapelberg 3f5a0f0024 Switch to xcb-xkb and libxkbcommon
This removes our last dependency on Xlib! :)

(Okay, an Xlib dependency still comes in through other libraries that we
 link against, but it’s not us. Our code is simpler by this change and
 uses one less connection to X11.)
2014-06-21 19:10:37 +02:00
Michael Stapelberg 4c06e7a573 clang-format-3.5 **/*.h **/*.c
This should be the last commit that formats a big bunch of files. From
here on, whenever I merge patches, I’ll run clang-format like described
in the title.
2014-06-19 11:20:32 +02:00
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
Tony Crisci 8ece995001 Bugfix: prevent unneeded render on pointer enter
When `focus_follows_mouse` option is on, prevent an uneeded render on
pointer enter when the con is already focused.

This pointer enter might be caused by entering a window decoration of an
already-focused container.

This extra render can cause concurrency issues when focus is set
asynchronously with WM_TAKE_FOCUS.
2014-06-11 09:38:49 +02:00
Tony Crisci 22b4215d92 Feature: improve active window request handling
Allow client requests of type _NET_ACTIVE_WINDOW to switch workspaces if
they indicate they are a pager. Otherwise, set the urgency hint on that
con to indicate that something happened.

This allows task switchers like skippy-xd to work properly.

http://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368127856
2014-05-03 15:57:43 +02: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
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 85321bdf1d Bugfix: ignore _NET_ACTIVE_WINDOW for scratchpad windows (Thanks mistnim)
fixes: #1136
2013-12-21 21:32:23 +01:00
Tony Crisci 05e46848f0 Reply to _NET_REQUEST_FRAME_EXTENTS correctly
Reply to _NET_REQUEST_FRAME_EXTENTS by settings _NET_FRAME_EXTENTS
property of the window to widths of the respective borders added by i3.

fixes #1093
fixes #1069
2013-10-09 19:49:37 +02:00
Michael Stapelberg 1a1d421534 Bugfix: correctly recognize assigned windows as urgent (Thanks jookia)
fixes #1086
2013-09-24 07:47:36 +02:00
Michael Stapelberg 93463bc393 Bugfix: update root geometry on output changes for “fullscreen global” (Thanks kaersten)
fixes #1064
2013-08-30 19:59:57 +02:00
Kacper Kowalik (Xarthisius) 0b168ee499 Include float.h for DBL_EPSILON
https://bugs.gentoo.org/show_bug.cgi?id=480272

Patch was written by Jeroen Roovers <jer@gentoo.org>
2013-08-08 22:37:27 +02:00
Michael Stapelberg 0c7a76c2f1 Handle the _NET_REQUEST_FRAME_EXTENTS ClientMessage (java compat)
This ClientMessage can be used to estimate how big the window will be
before opening it. Java always sends the ClientMessage and checks the
atom that should be set by the window manager, but it seems that the
fallback code path has a race condition.

Let’s see if the situation gets better with this change. I have been
running this patch for about two weeks and have not seen any issues with
it.

fixes #934
fixes #709
2013-07-27 15:06:08 +02:00
Michael Stapelberg f55b7977e8 Store aspect_ratio instead of weird proportional_{width,height} (Thanks phillip)
This commit only goes to “next” because I am not sure whether it
actually makes things better in all cases and want to give it some
testing first.

There was no documented reason behind using the
proportional_{width,height} variables, so I suppose that code was just
stupidity on my part (it was written merely a month after I started this
project in 2009).

fixes #1032
2013-06-29 23:11:54 +02:00
Diego Ongaro 96575e14a0 Give layout enum a name: layout_t 2013-05-22 19:35:07 +02:00
oblique 8a4a719093 Add support for _NET_WM_STATE_DEMANDS_ATTENTION.
_NET_WM_STATE_DEMANDS_ATTENTION indicates that some action in or with
the window happened. It's a weaker hint than urgency flag of WM_HINTS,
but some applications and almost all Qt applications use it instead of
WM_HINTS' urgency flag (one example is Skype).
2013-03-09 10:55:13 +01:00
Marius Muja bfd150872d Fixing continuous resize bug in floating mode
fixes #910
2013-01-24 12:42:13 +01:00
Michael Stapelberg 36b106a9d3 Bugfix: Ignore ConfigureRequests for scratchpad windows (Thanks MeanEYE)
fixes #898
2012-12-22 14:08:11 +01:00
Sascha Kruse d8a036d776 mark parents of urgent container also as urgent 2012-09-22 19:31:34 +02:00
Simon Elsbrock 28104a480c implement delayed urgency hint reset
If there is a client with an urgency hint on another workspace and
switching to this workspace would cause the urgency to be reset (by
moving the focusing to the client), delay the reset by some time. This
gives the user the chance to see it.

This commit adds the possibility to configure the urgency delay timer
duration using the 'force_display_urgency_hint' directive. Also,
documentation and a testcase was added to allow for automated checks of
the intended behavior.

fixes #482
2012-09-22 14:12:09 +02:00
Michael Stapelberg c6c6d3a952 naive implementation of 'bindsym --release' (and bindcode)
The implementation is naive because the user has to generate exactly the
event he specified. That is, if you use this binding:

    bindsym --release $mod+x exec import /tmp/latest-screenshot.png

Then it will only be triggered if you hit $mod, hit x, release x,
release $mod. It will not be triggered if you hit $mod, hit x, release
$mod, release x. The reason is that the KeyRelease event in the latter
case will not have the modifier in its flags, so it doesn’t match the
configured binding.
2012-09-06 17:04:31 +02:00
Michael Stapelberg 65e5bcfdf4 Merge branch 'master' into next 2012-09-04 20:21:31 +02:00
Michael Stapelberg 5b95e20a62 Bugfix: Don’t allow ConfigureRequests while in fullscreen (Thanks Piotr)
This fixes a compatibility issue with gnome-terminal and xfce’s
terminal, where fullscreening would lead to moving the window and not
displaying the contents properly.

fixes #788
2012-09-04 20:21:07 +02:00
Michael Stapelberg 68a23b9577 Bugfix: only honor _NET_ACTIVE_WINDOW for visible windows (+test) (Thanks Tucos)
fixes #774
2012-08-12 16:08:53 +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 fa4894fbaa Support _NET_ACTIVE_WINDOW ClientMessages
Since we advertise _NET_ACTIVE_WINDOW support (but only set the
corresponding atom currently), it makes sense to also support the
ClientMessage. Apps such as Gajim use it to set focus to the roster
window when clicking on the tray icon for example.

fixes #767
2012-08-07 09:50:47 +02:00
Michael Stapelberg 122130d868 handlers.c: don’t call x_push_changes(croot), tree_render() already does 2012-08-07 09:50:25 +02:00
Michael Stapelberg ac8b2f637f cleanup i3 sync protocol messages 2012-08-04 16:34:57 +02:00
Michael Stapelberg cc7f16007a Display i3-nagbar when commands lead to an error
e.g. pressing Mod1+x when having the following in your configfile:

    bindsym Mod1+x some invalid command

will lead to an i3-nagbar instance popping up, offering you to view the
error log (which will contain parser errors from this commit on).
2012-08-02 17:45:09 +02:00
Michael Stapelberg 6e9bbe67ce Bugfix: fix reload crashes in rare cases (Thanks Tucos)
Depending on the memory layout, it could happen that bind->command was
exchanged with something else while the parser still accessed it.

Therefore, we now copy the command and let the parser use that copy.
2012-06-27 17:48:22 +02:00
Michael Stapelberg bbe607899c Send proper error messages upon parser failures, use yajl for generating command replies
Fixes: #693
2012-05-02 22:01:50 +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 d4523de6c8 Merge branch 'master' into next 2012-03-21 22:30:08 +01:00
Michael Stapelberg 1962c30dfb Force WM_TAKE_FOCUS event to be sent again upon EnterNotify
This fixes focus problems with Eclipse. Apparently, Eclipse waits for getting
notified about the focus, and since it used non-managed windows, i3 didn’t care
to update the focus.

Fixes: #621, #675
2012-03-21 22:27:31 +01:00
Michael Stapelberg ab9ba6fcf9 Use gettimeofday() and struct timevals instead of time()
Initially I thought using the second precision time() function is good enough,
but to make t/113-urgent.t considerably faster (>2s vs. 0.08s), we put in a
little more effort and use gettimeofday. Otherwise, this test blocks the whole
testsuite from completing much faster on modern machines :).
2012-02-21 13:38:49 +01:00
Michael Stapelberg e114b3dba2 Refactor the interface of commands.c
This change has two implications:

1) tree_render() will now be called precisely once for input which consists of
   multiple commands (like "focus left; focus right"). Also, the caller of
   parse_command() has to call it. This makes us able to fix tickets such as
   ticket #608 (where multiple tree_render() calls are noticable).

2) The output of a command is now a JSON array of return values of the
   individual subcommands. In the case of "focus left; focus right", this is:

   [{"success":true}, {"success":true}]

   While this is incompatible with what i3 returned before, the return value of
   commands was undocumented and therefore not subject to our API stability.
2012-02-15 20:57:25 +00:00
Jeremy O'Brien 53541817ef Implement urgency flag matcher
Currently it supports the following options:
"oldest": match the first window that triggered an urgent event
"latest": match the last window that triggered an urgent event
2012-02-14 22:47:10 +00:00
Michael Stapelberg 3229f7677f Rip out the old command parser, remove migration code 2012-01-27 22:11:03 +00:00
Michael Stapelberg 8d72a77c7a Merge branch 'master' into next
Conflicts:
	src/handlers.c
2012-01-21 11:50:22 +00:00
Michael Stapelberg 7a4d8ed6ed Bugfix: Force a new sequence number after UnmapNotify
This should fix the problem where (legitimate) EnterNotifys arrived with the
same sequence as the UnmapNotify and was ignored.

Fixes: #609
2012-01-21 11:49:46 +00:00
Michael Stapelberg 27b089e430 Fix prototype 2012-01-21 11:49:35 +00:00
Michael Stapelberg 47fd15649a Bugfix: Only ignore EnterNotify events after UnmapNotifies from managed windows
This should fix (some?) focus follows mouse problems.

Conflicts:

	src/handlers.c
2012-01-21 11:46:23 +00:00
Michael Stapelberg fd8e1c98c9 Merge branch 'master' into next
Conflicts:
	src/handlers.c
2012-01-18 19:18:22 +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 62cde927a5 Bugfix: Only ignore EnterNotify events after UnmapNotifies from managed windows
This should fix (some?) focus follows mouse problems.
2012-01-17 20:37:36 +00:00
Michael Stapelberg fca57ed077 Change prototype of handlers to static void, remove a bit of old code 2011-12-30 11:30:56 +01:00
Michael Stapelberg c4298b9311 Merge branch 'master' into next 2011-12-18 17:25:15 +00:00
Michael Stapelberg 4fba2d5f91 Bugfix: Correctly check boundaries and reassign floating windows when moving (Thanks xpt)
Fixes: #592
2011-12-18 17:24:27 +00:00
Michael Stapelberg 0d210277f0 x: Handle expose-events by only copying the requested region from our pixmap
This is faster than always updating the whole pixmap and should be safe.
2011-12-17 20:08:56 +00:00
Michael Stapelberg 75c57c4eef Bugfix: Ignore ConfigureRequests with out-of-bound coordinates (+test)
JDownloader seems to use these for its captcha popups when focus is not on the
same workspace, for some weird reason.
2011-12-17 17:15:52 +00:00
Michael Stapelberg bd4b240d56 Bugfix: Ignore EnterNotify events to prevent wrong focus in complex tabbed/stacked layouts (Thanks Phlogistique)
Fixes #560

Finally we have a good explanation and example for why we need to ignore
EnterNotify events which were caused by an Unmap :).
2011-11-28 23:26:45 +00:00
Michael Stapelberg 5f8d719835 Bugfix: Skip dock clients when handling FocusIn events (Thanks cradle) 2011-11-21 19:55:41 +00:00
Michael Stapelberg ee804a0635 Also call workspace_show() when moving cursor to an empty output (Thanks mw) 2011-10-25 23:41:52 +01:00
Michael Stapelberg 38447c4b47 Bugfix: Correctly use workspace_show() when focus changes to a different output via EnterNotify or FocusIn (Thanks pnutzh4x0r)
This makes i3bar show the correct workspace when you move your mouse from one
output to another.
2011-10-25 23:04:10 +01:00
Michael Stapelberg 91134f75c0 Move get_mod_mask to libi3, use it in i3 and i3-config-wizard
Also, the API changed a bit. There are two functions now, both assume you
already got the keysyms (which is the case for i3 and i3-config-wizard),
one gets the modifier mapping for you (aio_get_mod_mask_for) while the other
assumes you also got that. No roundtrips are required for the latter.
2011-10-23 21:26:15 +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
Michael Stapelberg f4f4d782bb implement a startup monitor, move code to src/startup.c 2011-10-10 15:54:17 +01:00
Michael Stapelberg c812cdcf9a make handle_client_message not return anything
The function returned an int for historical reasons.
2011-10-10 15:54:17 +01:00
Michael Stapelberg d1d4f39f9e save the last timestamp received by X11 in last_timestamp
We need it for startup notifications (to generate a unique id)

Conflicts:

	include/i3.h
	src/main.c
2011-10-10 15:54:17 +01:00
Michael Stapelberg 1481cd95c9 Implement the I3_SYNC client protocol
This is mainly useful for the testsuite. The tests can wait until i3 processed
all X11 events and then continue. This eliminates sleep() calls which leads to
a more robust and faster testsuite.
2011-09-22 23:13:12 +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 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 f2f636f9e7 Bugfix: Honor the X11 window border in ConfigureRequests 2011-09-17 14:11:01 +01:00
Michael Stapelberg b1aa8107b3 Bugfix: Correctly handle ConfigureRequests for floating windows in multi-monitor setups (Thanks thomasba)
Fixes #519
2011-09-14 22:59:19 +01:00
Michael Stapelberg e97a7e34f7 Bugfix: Re-implement reconfiguring height of dock windows (+test) (Thanks thomasba) 2011-08-27 13:47:10 +02:00
Michael Stapelberg 7951445849 xcb: use predefined XCB_ATOM_ atoms, don’t request them 2011-08-17 01:41:19 +02:00
Michael Stapelberg 95416175cd Bugfix: use FREE to correctly handle NULL replies 2011-08-09 09:27:24 +02:00
Peter Bui 5e06b1b21d Fix some potential memory leaks 2011-08-09 09:27:15 +02:00
Michael Stapelberg c883e7050a Include <limits.h> in all.h 2011-08-04 00:10:04 +02:00
Michael Stapelberg 088681c781 Bugfix: property handlers: correctly free replies in all cases 2011-07-31 17:46:41 +02:00
Michael Stapelberg 4875868689 Bugfix: Free property replies in their handlers 2011-07-31 17:12:37 +02:00
Michael Stapelberg 7a7764a0d9 handlers.c: fix warnings 2011-07-25 00:32:03 +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 78d25c4cd9 expose event handler: use x_deco_recurse 2011-07-10 22:06:16 +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 8acea3d34c call tree_render() only after commands which require it
Saves one call of tree_render for exec, for example
2011-05-29 13:20:34 +02:00
Michael Stapelberg f680c8841f x: only re-render the tree in handle_normal_hints when they actually changed 2011-05-29 11:46:01 +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 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 b0e871e0cf Bugfix: Fix focus follows mouse for non-default layout cons (Thanks phnom)
Fixes: #361
2011-05-12 22:24:52 +02:00
Michael Stapelberg c62f70856f Bugfix: Don’t crash when dock clients set the urgency hint (+testcase) 2011-05-11 22:45:20 +02:00
Michael Stapelberg 8b21812bbd Bugfix: Add missing tree_render() when handling the urgency hint (Thanks mxf) 2011-04-30 00:37:03 +02:00
Michael Stapelberg 3721bcb868 Bugfix: Ignore EnterNotifies generated by UnmapNotifies
Actually, commit 1c5adc6c35 commented out code
without ever fixing it. I think this was responsible for the 'workspace
switching sometimes does not work' bug. My observations:

Had it again today and analyzed a log of it. Looks like after unmapping the
windows on one workspace (in my case: chromium, eclipse, urxvt, focus on
eclipse) we get UnmapNotify events for chromium and eclipse, but then we get an
EnterNotify for the terminal (due to unmapping the other windows and therefore
mapping the terminal under the cursor), only afterwards the UnmapNotify
follows.

So, there are two things wrong with that:

• We handle EnterNotifys for unmapped windows

• Unmapping windows sometimes works in a sequence, sometimes the sequence gets
  split. Not sure why (if unmapping can take longer for some windows or if our
  syncing is wrong -- but i checked the latter briefly and it looks correct).
  Maybe GrabServer helps?

• We don’t ignore EnterNotify events caused by UnmapNotifies. We used to, but
  then there was a different problem and we decided to solve the EnterNotify
  problem in another way, which actually never happened (commit
  1c5adc6c35).
2011-04-19 21:50:56 +02:00
Michael Stapelberg 20b1fd4293 Skip FocusIn events with mode == NOTIFY_MODE_GRAB or NOTIFY_MODE_UNGRAB
According to the Xlib Programming Manual section 10.7.2 [1], these events are
generated when keyboard grabs activate/deactivate, while we are only interested
in focus changes which are done by other programs independend from the
keyboard.

[1] http://tronche.com/gui/x/xlib/events/input-focus/grab.html
2011-03-30 23:00:48 +02:00
Michael Stapelberg e913e519f2 refactor handlers.{c,h}: declare the handlers static, remove unnecessary parameters 2011-03-20 16:53:12 +01:00
Michael Stapelberg c130cefa93 Handle FocusIn events generated by clients and update decoration accordingly (Thanks mseed) 2011-03-20 16:26:36 +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
Michael Stapelberg 89ef41dadf re-implement support for MappingNotifys 2011-03-14 17:20:04 +01:00
Michael Stapelberg f162e7efaa refactor font caching to just save the ID instead of mainting a cache with pattern→id-mapping 2011-03-10 23:20:17 +01:00
Michael Stapelberg 0689f6d8f1 Bugfix: use tree_render() instead of x_push_changes() to re-render and update the stack 2011-03-06 20:45:03 +01:00
Michael Stapelberg f6a21994bf Re-implement focus follows mouse for outputs
That is, moving your mouse pointer to a different workspace which does not have
any windows on it yet will correctly update the focus.
2011-03-03 16:36:18 +01:00
Michael Stapelberg e0647b7fc2 Bugfix: don’t focus dock clients (Thanks mseed, mist)
Fixes #321 and #323
2011-03-03 13:59:42 +01:00
Fernando Tarlá Cardoso Lemos f4ec0bceff Very minor issues found with statical analysis.
The Clang Static Analyzer uncovered those issues:

- The variable "changed" in handlers.c is written to, but it's
  never read since that specific write, so the write is not
  necessary.

- In util.c, "tail" may be NULL. In that case, we shouldn't pass
  it to strlen because strlen's behavior is not defined when s is
  NULL.

- In util.c, "write_index" is incremented twice. It's never used
  anymore after being incremented once, so the second increment is
  not necessary.
2011-02-28 16:48:22 +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 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 38b231b848 handlers.c: remove obsolete code 2010-11-29 22:25:55 +01:00
Fernando Tarlá Cardoso Lemos 371ec037b8 Fix click to focus. 2010-11-29 22:09:05 +01:00
Michael Stapelberg 49308d5026 Bugfix: don’t update focus when moving mouse over stacked/tabbed decorations (Thanks fernandotcl) 2010-11-28 21:07:08 +01:00
Michael Stapelberg 61e3415ddc Bugfix: Add deco_height to bsr.y (to configure the floatingcon correctly). Fixes t/12-floating-resize.t 2010-11-28 20:43:35 +01:00
Michael Stapelberg 02b786509b Upon ConfigureRequests, send a generated ConfigureNotify (Thanks fernandotcl)
This fixes problems with GVim in stacking mode for example.
2010-11-28 13:19:49 +01:00
Michael Stapelberg 622b51a1ea Fix switching containers by moving the mouse over their decorations when in the same container 2010-11-28 01:13:18 +01:00
Michael Stapelberg 6fe0e58a64 Bugfix: Also render decorations of nearby cons when getting an ExposeEvent (Thanks fernandotcl) 2010-11-28 00:52:24 +01:00
Michael Stapelberg 3f3fa08b15 more debug for ClientMessages 2010-11-27 16:44:32 +01:00
Michael Stapelberg 6431d3d187 fix indention 2010-11-27 16:44:20 +01:00
Michael Stapelberg 962fe075b9 Bugfix: Upon ExposEvents, redraw decoration also for the window itself
In the meantime, windows can have decorations (borders) on their own frame, too.
2010-11-26 18:37:34 +01:00
Michael Stapelberg e744b48b30 Bugfix: When handling an EnterNotify for a child window, access the correct con->layout 2010-11-26 18:18:40 +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 ea1e9b20be Get rid of the remaining hardcoded height. 2010-11-15 12:25:06 +01:00
Michael Stapelberg 055bd18142 Bugfix: after the first UnmapNotify, unignore the event 2010-11-14 20:15:12 +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 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 8f7bd538d8 implement configure requests, adapt testcase
testcase does not pass 100% due to clients not being reparented correctly yet.
2010-11-12 21:41:10 +01:00
Michael Stapelberg 5c2758af26 Implement support for size hints (including test case) 2010-10-11 21:32:29 +02:00
Michael Stapelberg 61f9a79347 use decimal coordinates in debug message 2010-07-11 22:01:25 +02:00
Michael Stapelberg 32be3af109 Re-implement support for the urgency hint, extend t/13-urgent.t
The actual rendering will follow
2010-06-02 17:55:10 +02:00
Michael Stapelberg 14a312c152 more debug output 2010-06-02 17:04:26 +02:00
Michael Stapelberg 1c5adc6c35 Don’t ignore sequence in UnmapNotify, there might be multiple windows in one sequence
This would lead to i3 thinking that a new window was already managed if it
has the same X-ID as the old window. Instead, we need to fix the EnterNotify
problem in a different way.
2010-06-02 17:03:26 +02:00
Michael Stapelberg 2d52ecf071 Add parameter to reparent windows instead of killing them when closing a container
Necessary because when windows are unmapped, they are not necessary to
be killed (an application can unmap it temporarily).
2010-05-15 00:16:59 +02:00
Michael Stapelberg def41582d1 re-render the three after calling parse_cmd 2010-05-14 23:41:17 +02:00
Michael Stapelberg 8c5d824fa8 Ignore UnmapNotify events generated by reparenting 2010-05-14 23:37:56 +02:00
Michael Stapelberg 7adf921bc3 use the new parser for handling keybindings 2010-05-11 23:04:47 +02:00
Michael Stapelberg c4d87e2f81 handle destroynotify events 2010-04-17 17:27:53 +02:00
Michael Stapelberg d973f30fc2 push X11 changes after a window is mapped 2010-04-17 16:43:34 +02:00
Michael Stapelberg c56867792a handle client messages (fullscreen window state) 2010-04-17 13:54:45 +02:00
Michael Stapelberg 2534f21940 ignore sequence of unmapnotify events (generates enternotify events) 2010-04-16 20:56:49 +02:00
Michael Stapelberg 24725cd94a re-add fullscreen mode 2010-04-13 20:51:43 +02:00
Michael Stapelberg 8959c5005f cleanups 2010-04-13 19:33:40 +02:00
Michael Stapelberg 8e5a831e27 re-add focus follows mouse handling 2010-04-13 18:43:37 +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 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 46e7cf5fe1 Handle destroy notify events like unmap notify events
This helps for windows which are immediately destroyed instead of
unmapped, like when starting i3status | ./foobar | dzen2 -dock
and foobar does not exist (i3status and dzen2 will get a SIGPIPE).
2010-03-24 16:52:16 +01:00
Michael Stapelberg 56139f3656 Bugfix: only restore focus if the workspace is focused, not if it is visible 2010-03-23 14:43:35 +01:00
Michael Stapelberg aec40126b4 ipc: implement output event 2010-03-19 22:40:43 +01:00
Michael Stapelberg c738b2e454 Don’t use SYNC key bindings for Mode_switch but re-grab keys
Before this commit, i3 used key bindings in SYNC mode for bindings
like Mode_switch + <a> and replayed the key if the current state
did not include Mode_switch. This had some problems:

1) The WM needed to acknowledge much more key presses than you
   actually had bindings for, thus making the system a bit laggy
   sometimes.
2) Users of layouts who constantly type in the third level (like
   russian layouts) did not get their cyrillic symbols correctly
   (they were not replayed right), neither did the keybindings
   work in both modes.

So, the current implementation uses the following approach: XKB
provides an event which contains the current state (including
the current level). i3 signs up for this event and upon receival,
it re-maps the bindings using Mode_switch (enables them when the
level goes to the third level and disables them as soon as the
level goes back to normal). This fixes both problems.
2010-03-14 22:40:58 +01:00
Michael Stapelberg 3db4890683 ipc: implement events, cleanup the code a bit 2010-03-12 21:05:05 +01:00
Michael Stapelberg 93a9f3c244 Bugfix: Don’t mess up x/y coordinates in configurerequests for floating windows
This was the cause for ticket #93, which actually has a false
conclusion for the reason of this bug.

This code needs to be refactored.
2010-03-11 23:34:29 +01:00