This is a new version of 'titlebar.lua'. There are now additional buttons for:
- setting the 'ontop' attribute
- setting the 'sticky' attribute
- maximizing the client
In addition to changing the state of the client the buttons also show if the
corresponding state is active for a client. All new buttons now require 4
images for:
- unfocused window, state inactive (i.e. ontop == false)
- unfocused window, state active (i.e. ontop == true)
- focused window, state inactive (i.e. ontop == false)
- focused window, state active (i.e. ontop == true)
It's not difficult to add more buttons with any kind of functionality. User
configuration is currently restricted to theming of the buttons. Buttons are
disabled simply by not configuring them in the theme. The icons for the new
buttons are taken from kde4. They're not really pretty but they're OK to
demonstrate the new features.
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>
This moves the call to wibox_draw() into wibox_map() which fixes garbage
being displayed if a wibox is made visible by setting its .visible.
Since wibox_draw() already calls simplewindow_refresh_pixmap(), that call is
dropped. Because wibox_need_update() just makes sure wibox_draw() is later
called, we can replace the call to wibox_draw() by this call. This should avoid
superflous updates.
Found by lua code like this:
local w = wibox({ position = "floating", bg = "#ff0000" })
w.visible = false
w.screen = 1
<do some other stuff>
w.visible = true
Signed-off-by: Uli Schlachter <psychon@znc.in>
This moves some common code into a helper function to reduce code
duplication and open-coding that function all the time.
This commit doesn't cause any behaviour change at all.
Signed-off-by: Uli Schlachter <psychon@znc.in>
For a floating wibox which isn't visible, all what wibox_position_update()
does is setting the geometry fields in the simplewindow struct. Since the next
thing luaA_wibox_new() does is setting the wibox' geometry, this call makes
no sense.
Signed-off-by: Uli Schlachter <psychon@znc.in>
If a wibox's screen is set to nil, this is reflected by setting the screen
struct member to SCREEN_UNDEF.
SCREEN_UNDEF is defined as -1. If we allow such a wibox in
wibox_position_update(), bad things will happen (globalconf.screens[-1]).
Signed-off-by: Uli Schlachter <psychon@znc.in>
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>
awesome_refresh() had a xcb_connection_t as first argument. Since there is
only one connection to the X server, this argument doesn't really have any
alternatives to globalconf.connection and thus makes no sense.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>