client_hasproto() now doesn't have to query the X server anymore.
This fixes FS#543.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
The only real change in here is the first hunk to client.c which needs to
inline client_setfocus(). Nothing else in here should be a 'real' change.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
We now always know a client's WM_PROTOCOLS property without asking the X server.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
This function is only called from one place and there is no reason not
to inline it there.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
Sometimes we unref the icon image, but we did not reset NULL, which
can make the client refering to a not-refed image.
Signed-off-by: Julien Danjou <julien@danjou.info>
This patch fixes focus hooks calls - for every call to focus hook, there
should be call to unfocus hook.
Focus related info:
In this shape, awesome doesn't support multiple focused clients, that
means it follows the rule "there is only a single focus", which is not
true for MPX. To change this, I think it will need some magic with
FocusOut events handling and changes to some structures
(e.g. globalconf.screen_focus, screen_t.client_focus should be arrays) :p
Now we don't need to handle FocusOut events.
Signed-off-by: Mariusz Ceier <mceier@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
That is necessary because key_find() assume we always get one and only
one keybinding for an event, which is wrong, since we can have several.
Signed-off-by: Julien Danjou <julien@danjou.info>
Lua can preallocate space in table for array or non-array elements type.
This should improve performance when setting table, so when we can we
use lua_createtable() since this is just a gain.
Signed-off-by: Julien Danjou <julien@danjou.info>
We should prevent focus stealing, in case when there are e.g. 2 clients
on separate tags, first client has focus, and we receive FocusIn event
for second (invisible) client.
This patch adds prevention in the focus update handler. It sets focus
on previously focused client, when FocusIn event destination is
invisible(untagged) client.
This should fix FS#497.
Signed-off-by: Mariusz Ceier <mceier@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
We now use a client_array_t which is more efficient and we reverse the
array order compared to before.
Signed-off-by: Julien Danjou <julien@danjou.info>
This code actually belongs to 'root' since it does not send events to a
client but simply to X.
The window argument is only used in motion event, so fix that also.
Signed-off-by: Julien Danjou <julien@danjou.info>
I was creating 2000 wiboxes in a loop (don't ask) and creating them took
forever. According to callgrind, there were about 2 million calls to
xcb_configure_window() and most (if not all) of them were from client_stack().
Awesome spent 70% of its cpu time in these client_stack() calls.
client_stack() is O(N^2) on the number of clients (it walks the list of clients
itself twice and each call to client_stack_above() walks the list too) and O(N)
on the number of wiboxes (it walks the wibox list twice). So obviously calls to
it should be rare.
This patch makes client_stack() only set a flag which is later checked. This
should reduce the number of restacks to the bare minimum. With this patch,
neither xcb_configure_window() nor anything else client_stack() related shows
up as having a lot of calls or using much cpu time.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
Pretty much every single source file needs this struct, so it makes sense to
define it in a common header instead of in every single .c file.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>