This moves the loading of the rc.lua and managing of pre-existing clients to
after we ungrab the server during startup. To make sure we have no races with
clients which start up parallel to awesome, we do the QueryTree for all the
clients that we have to manage before the ungrab, but start managing the clients
only after the ungrab.
This means that we have already selected our event mask on the root window in
scan() and thus received an UnmapNotify event when we reparent windows into a
frame window. This has the effect that we immediately unmanage the client again,
whoops.
To fix this, we grab the server again and remove our event mask on the root
window again while we reparent.
This should hopefully fix all cases where we deadlock during startup because
pulseaudio wants to talk to the X server, but is being ignored because we have
the server grabbed while at the same time we are waiting for pulseaudio.
Signed-off-by: Uli Schlachter <psychon@znc.in>
We were only creating an X11 window for a new drawin after we handled all the
options that were passed in. However, this means that drawin({ height = 4 })
would try to resize the window before we created a window, which caused an X11
error.
Fix this by moving our initialization before of the handling of construction
arguments.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This option is no longer valid in modelines, so it has been removed from
all modelines using the following shellscript:
#!/bin/ksh
git ls-tree -r HEAD | cut -f2 | while read f; do
egrep -e '^(//|--) vim: .*encoding=' $f >/dev/null || continue
sed -E -e '/^(\/\/|--) vim:/s/:encoding=utf-8//' $f > /tmp/foo
mv /tmp/foo $f
done
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Open some windows, select a layout which does something (=not floating) and
restart awesome. It's likely that it will crash during the shutdown.
The reason is that awesome cleans up various state before going down. This is
mostly all the lua state. However, drawin_wipe, which is called for cleaning up
after a drawin, dared to emit a sigal which then let various lua code run which
had access to objects which were already destroyed.
Various bad things can happen this way, in this situation it was a crash when an
already-destroyed client was resized.
The fix is to move the signal out of drawin_wipe. It doesn't belong there
anyway. Instead, property::workarea should be emitted when the drawin's visible
property changes as this is when the workarea changes, too (screen_area_get()
only looks at visible drawins).
Signed-off-by: Uli Schlachter <psychon@znc.in>
xcb-util is now split into several repositories since 0.3.8. This
release also cleaned up the API a lot, thus update the code
accordingly.
Signed-off-by: Arnaud Fontaine <arnau@debian.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This fixes a crash when the opacity of a not-visible drawin is changed. This
happened because we got a PropertyNotify for our own change of _NET_WM_OPACITY
and then tried to set the drawin's opacity to this new value.
However, the drawin was only reachable through globalconf.drawins and wasn't
ref'd in lua. This means that the luaA_object_push() call in
property_handle_net_wm_opacity() didn't find the drawin and instead pushed a
nil. This then later caused an unprotected lua error in window_set_opacity().
Signed-off-by: Uli Schlachter <psychon@znc.in>
Both client_isvisible() and client_maybevisible() where almost exclusively
called with the client's screen as their second argument. Remove this second
argument and let these functions instead always act on the client's screen.
Signed-off-by: Uli Schlachter <psychon@znc.in>
There isn't much point in the screen property of a drawin because the geometry
already defines on which screen the drawin is.
The biggest chunk of changes from this is due to removing the functions
drawin_detach and drawin_attach which where called when the screen property was
set/unset.
The code from drawin_detach is moved into drawin_set_visible and drawin_wipe.
drawin_attach is moved into drawin_init.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Thanks to a recent commit, a drawin's window will always be a valid and existing
window. This means we can remove all the code which checks this before doing
something.
Signed-off-by: Uli Schlachter <psychon@znc.in>
We don't need an up-to-date pixmap and cairo surface for a drawin which isn't
visible. Thus, only bring those up-to-date when the drawin is visible.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead of creating/destroying a window whenever the drawin is attached/detached
from some screen, a window is now created when the drawin is created and it
isn't destroyed until the drawin is garbage collected.
Since we can now safely assume that a drawin always has a associated window,
this should make it possible to simplify some stuff.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When a client sets WM_NAME (client->alt_name) but doesn't set _NET_WM_NAME
(client->name), we give alt_name to lua when c.name is used. However, we still
emitted property::alt_name instead of property::name to lua. Obviously, this
breaks stuff.
(The same applies to client->alt_icon_name)
I noticed this via feh whose tasklist entry wasn't refreshed when multiple
images were displayed and I switched to the next one.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Before this commit, c:tags(tags) and t:clients(clients) first removed all
tags/clients and then added the new one.
This is now changed into only removing the tags/clients that have to be removed
and leaving the others in place. Hopefully, this avoids all kinds of weird
issues which we had.
Signed-off-by: Uli Schlachter <psychon@znc.in>
In commit 3dbf89c I removed a client_unban() in the code path for focusing
clients. The idea was that client focusing is now done after rebanning, so that
it should already be visible by the time this code is executed.
However, minimized clients obviously don't get unbanned, So we have to call
client_unban() here to make sure the client is unminimized.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The lua code could keep a reference to out cairo surface for a drawin after it
was destroyed. So make sure the surface is finished before the associated
drawable is destroyed.
Signed-off-by: Uli Schlachter <psychon@znc.in>
We actually have to set a proper background color on all our drawins, else the
default black will "flicker through" while the window is drawn.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead of immediately setting the X11 input focus when client.focus is assigned
something, we now just remember that we'll have to do something later. The focus
is then set in the next prepare call by libev (= after the current main loop run
is done).
Signed-off-by: Uli Schlachter <psychon@znc.in>
When we receive a DestroyNotify, we have to unmanage the client. However, we
were just informed that the window was destroyed, so it doesn't make sense to
try to do "something" with the window.
This commits fixes some errors from the X server (which we ignored, but still
they are gone now).
Signed-off-by: Uli Schlachter <psychon@znc.in>
Lua now has access to a cairo surface via drawin.surface. When the drawing to
this surface is finished, it should call drawin:refresh() to make the result
visible.
Signed-off-by: Uli Schlachter <psychon@znc.in>
These signals also contain the x and y coordinate of the event which the
capi.button()-based signals can't provide.
Signed-off-by: Uli Schlachter <psychon@znc.in>
It is perfectly valid for a cairo surface to delay the actual. This is mostly
done in situations where it speeds stuff up. Since we want our drawing to be
visible, we have to flush the cairo surface when we are done drawing.
Signed-off-by: Uli Schlachter <psychon@znc.in>
All windows which use globalconf.default_depth must also have a backpixel,
borderpixel and colormap set when they are created. Without this, all these
xcb_create_window() calls would fail when globalconf.default_depth is no longer
the screen's default depth.
Signed-off-by: Uli Schlachter <psychon@znc.in>
All the APIs that accept both an image and a cairo surface now only accept cairo
surfaces. Images are gone.
Signed-off-by: Uli Schlachter <psychon@znc.in>
For compatibility one can now set an imagebox' .image to both a cairo surface
and an image object. The image will automatically be converted into a cairo
image surface.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The last commit caused some lua errors and reading a wibox' type property
didn't work. This should all be fixed now.
Signed-off-by: Uli Schlachter <psychon@znc.in>
alloca() allocates stack space. The image that we were producing is possibly
huge which means that we were asking for e.g. 9MiB of stack space. This is not
really a good idea and caused crashes.
Fix this by using heap memory instead.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Function imlib_create_cropped_image() from imlib2 doesn't initialize
buffer for new image, so if we use crop bounds bigger than original ones
we need to erase garbage from derived image.
This bug produced colorful pressed buttons (FS#516, FS#822).
Signed-off-by: Roman Kosenko <madkite@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
If we called the widget layout for x widgets, but the layouts returned less
geometries than this, we silently ignored the left-over widgets. If the layouts
returned more geometries, we crashed.
Fix this by verifying that the number of widgets and the number of geometries
are equal. If they are different, we use the smaller of the two.
Signed-off-by: Uli Schlachter <psychon@znc.in>
While drawing the wibox, the C core builds up a list of widgets and their
associated geometry. This list consists of widget_node_t objects and is
constructed like this (This is from luaA_table2widgets()):
widget_node_t w;
p_clear(&w, 1);
w.widget = luaA_object_ref_item(L, idx, -1);
widget_node_array_append(widgets, w);
After we are done with this list of widget nodes, it is freed via
wibox_widget_node_array_wipe(). However, wibox_widget_node_array_wipe() passed
"&w" to luaA_object_unref_item() while it should have used "w.widget" (which is
what was returned from luaA_object_ref_item()). This made the unref fail and the
wibox was carrying around a reference to this widget forever. This was
effectively a memory leak.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When setting a new widgets table, the wibox obviously should drop its reference
on the old widgets table.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The only string format for colors that we now support are #rrggbb and #rrggbbaa.
All other strings will cause errors.
Thanks to this, color_init_cookie_t can be removed. There won't be a request to
the X server for transforming named colors any more and so there won't be a
cookie. This means that color_init_reply() has to be removed, too.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The systray bases its extents on the size of the wibox that it is contained in.
No idea how this is supposed to work when the systray doesn't get the full size,
but in a vertical wibox, using <height of wibox> * <number of icons in systray>
certainly doesn't work for computing the size.
The fix isn't hard: Check the wibox' orientation when drawing and base our
calculation on its width if its orientation is different from East.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit makes it an error if an unknown signal is connected, disconnected or
emitted. All signals have to be added before they can be used.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This reverts commit 27f9c0177a.
This commit broke code like the following because reading client.focus would
still return the previously focused client:
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
This moves the appropriate fields for client focus from screen_t to globalconf
since only the first screen's fields were used anyway.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This makes awesome support only a single X11 protocol screen. If you are still
using zaphod mode, you can run multiple instances of awesome on the single
screens, e.g.:
DISPLAY=:1.0 awesome & DISPLAY=:1.1 awesome &
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previously, if a client had nofocus == true, it wasn't unminimized if sth tried
to focus it. Also, if this client had the WM_TAKE_FOCUS protocol, the focusing
would fail since it's an error to set the input focus to an unviewable window.
For consistency, this also moves the code that sets a client's minimized
property to false into client_unban() since it doesn't make sense to have a
minimized client unbanned (i.e. visible).
Signed-off-by: Uli Schlachter <psychon@znc.in>
If this property is true, setting "client.focus" to this client might have some
effect. If it is false, setting "client.focus" will be ignored completely.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The old code used the wrong constants which meant we always returned "word" for
wrap and "end" for ellipsize.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previous, there was a round-trip after each request for a property since we
waited for the reply immediately. Instead, it makes a lot more sense to first
send all of the requests and then handle all the replies. This now takes only a
single round-trip for all the properties from client_update_properties().
Signed-off-by: Uli Schlachter <psychon@znc.in>