Previously, odd things could happen if a widget was getting fitted into a
negative width or, even worse, width being NaN (not a number)!
This can e.g. happen due to a margin layout which doesn't get enough space to
even draw the margin that it is supposed to add.
Fix this by enforcing a minimum value of 0 for the width and height that a
widget gets fitted into.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Given an imagebox i with i.resize_forbidden = false and a valid image set, the
call t:fit(0, 0) would return two times "not a number".
This is because the code first does some calculations to get the input image
into the available space and then tried to do some calculations needed for
scaling images up.
The first calculation already gave us h == 0 == w, the second calculation would
then calculate 0/0. This results in NaNs.
This was only noticed because NaN is not a valid table index in lua.
Fix this by returning 0,0 if we have an image of width or height 0 after the
first calculation. Since 0x0 images are valid in cairo, this also fixes the same
bug with such images.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Most of these are unused since the drawing code was moved to lua. For example,
the old wibox code needed the metatable entries __next, __ipairs and __pairs so
that w.widgets worked correctly and could pretend to be a regular lua table.
Signed-off-by: Uli Schlachter <psychon@znc.in>
There is a strong hint that you are doing something wrong: You call
client.emit_signal(some_signal, c). Chances are high that this signal is
supposed to be emitted on the client object 'c' instead of the underlying client
class.
This applies to awful.rules' usage of this signal.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Before commit 1b2826 in lgi, the get_rgba() function on cairo SolidPatterns was
specified like this:
get_rgba = { ret = cairo.Status,
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' } },
The above commit fixed this (without saying so) and the code became:
get_rgba = { ret = cairo.Status,
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' } },
The prototype for the corresponding cairo function is:
cairo_public cairo_status_t
cairo_pattern_get_rgba (cairo_pattern_t *pattern,
double *red, double *green,
double *blue, double *alpha);
As you see, this functions gets four double* as arguments and it will save its
result via those pointers. Old versions of lgi call this function with too few
arguments and this will cause a segmentation fault when cairo dereferences an
invalid pointer.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The X11 server tells us about things that need to be redrawn via expose events.
When we get such an expose event before lua drew the drawable, we just fill the
exposed area with old data (which is black for newly-created drawables).
Fix this by tracking if we have any usable data in a drawable's double buffering
pixmap. This flag is unset whenever we throw away the old content (e.g. due to a
resize) and is set when lua gave us some new content to display.
Signed-off-by: Uli Schlachter <psychon@znc.in>
We now handle all "important" EWMH messages in lua and lua can decide to do
different things than the current obvious one.
Consistency!
Signed-off-by: Uli Schlachter <psychon@znc.in>
We can't just directly assign c->sticky directly, because we should emit the
right signals and unban the client if it is currently ban. All of that gets
handled by client_set_sticky().
Signed-off-by: Uli Schlachter <psychon@znc.in>
Commit e291c0398 already made awesome ignore invalid values for _NET_WM_DESKTOP.
That commit just made it tag clients with the first tag if they used an invalid
value for this property.
This commit reverts 90% of that change. What is still left is the range
validation. Previously, awesome would untag a client completely when it got such
a _NET_WM_DESKTOP property / message. Now, such messages are just silently
ignored.
Signed-off-by: Uli Schlachter <psychon@znc.in>
If a client gets moved to a screen without any selected tags, that client
disappears and it is non-trivial to get it back. Since this is unexpected and
annoying, make movetoscreen do nothing if the target screen has no tags
selected.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This allows to apply properties and callbacks to a client like
awful.rules.apply would do, without the matching part.
This is useful with the new startup notifications, and lets you apply
the same properties and callbacks from e.g. a manage signal handler.
Previously, ownership of the pixmaps that we are using for double buffering was
a little weird. The pixmap belonged to the drawin/titlebar, but the
corresponding cairo surface was owned by the drawable. Clean this up by moving
the pixmap to the drawable.
This cleans up lots of ugly code and also fixes a crash: When a drawable was
garbage collected before its drawin, drawin_wipe() would crash accessing the
drawable. This was needed to make it forget about the cairo surface we gave to
it for the pixmap that is being destroyed.
By moving the pixmap to the drawable, this whole issues goes away.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Whenever a titlebar of a client needed to be refreshed, all (possibly) four
titlebars would get completely refreshed. So if someone actually added more than
one titlebar to a client, awesome would copy each titlebar's content to the
window four times. Fix this by introducing more fine-grined functions for
uploads.
This also makes awesome only update the affected area when it gets an expose
event for a titlebar instead of all four titlebars completely.
Signed-off-by: Uli Schlachter <psychon@znc.in>
If a drawable has an opaque background, we don't need pseudo transparency and
thus its content don't change when it is moved. However, when we need pseudo
transparency, then we have to redraw the drawable to apply the new background.
Previously we just always did the redraw. This commit adds a helper function
gears.color.create_opaque_pattern() that analyzes a cairo pattern for
transparency. We use this new function to only redraw-on-move when there is
actual pseudo transparency in effect. Otherwise, this redraw can be skipped.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Before this commit, we always threw away the drawin's cairo surface whenever it
was made visible and thus forced a redraw.
This commit changes this so that we only force a redraw if the drawin was
resized why it wasn't visible. To remember when this happens, we free the
drawin's cairo surface without allocating a new one when the drawin is resized
while not being visible. Thus, we then only have to allocate a new surface if
the drawin doesn't have one when it is being made visible.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This allow to spawn something, then apply some properties or rules when
the client show up ("manage").
This commit add:
* "startup_id" property for all clients object (immutable, can be nil)
* Second return value to awful.util.spawn() with the startup_id
* Update the documentation
Example:
local wait_for_it = {}
local pid,snid = awful.util.spawn("urxvtc")
wait_for_it[snid] = {ontop=true,sticky=false,
tag = awful.tag.gettags(mouse.screen)[1] }
client.connect_signal("manage", function (c, startup)
if c.startup_id and wait_for_it[c.startup_id] then
for k,v in pairs(wait_for_it[c.startup_id]) do
c[k] = v
end
if wait_for_it[c.startup_id].tag then
c:tags({wait_for_it[c.startup_id].tag})
end
end
end)
Signed-off-by: Uli Schlachter <psychon@znc.in>
There isn't much of a point in doing all the GetGeometry requests in an extra
run through the list. This commit merges it into the previous loop through all
windows.
This means that we now request some information during startup that we never
actually need, but I can live with that just fine.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This helps in cases where you have accidentally cloned an entry from
`layouts`.
Previously, no current index would be found and the function would
silently fail.
Signed-off-by: Daniel Hahler <git@thequod.de>
This allows for having clones of a table, where its entries are still
references to the original values.
This is useful for copying a "default props" table, where you want to
keep the reference to entries like `awful.layout.suit.tile`.
Signed-off-by: Daniel Hahler <git@thequod.de>
Added set_expand function with options of "none" "outside" or "inside" modes.
The "inside" mode is the default and will result in the original behavior. The
main benefit is being able to actually center a widget in the available space
with options of how to draw the outside widgets (expand to take the space,
or not.) Further functionality can be had by ommiting one of the outside
widgets. Set default layout mode in the constructor.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This changes the align layout fit function so that align:fit will not return
more space than is actually needed by its sub-widgets. Changes to align:draw
were also required so that any widget assigned to the middle slot will expand
to fill the remaining space.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead, use stack_client_push and emit the `request::activate` signal
from awful.rules.apply, if the client gets focus.
Signed-off-by: Daniel Hahler <git@thequod.de>
Since commit 3c40d6b, the passed in argument is decomposed into an array of
strings before the sn-related code runs. This means we already know argv[0] and
thus we don't need the code here that tries to figure it out again.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previously, any not-string-convertible entry in the array argument would result
in lua_tostring() returning NULL which g_strdup() would pass through. Thus, we
would end up with a NULL entry in an array whose end is marked with a NULL
entry. This mainly means that we had a memory leak.
Fix this by actually verifying that we only have strings in the table that we
are looking at.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When e.g. calling awesome.spawn({}), our argv array would be empty, so just a
pointer to a NULL pointer that marks the end of the array.
Since startup notification was enabled, this would then try to figure out the
name of the started binary. This would immediately dereference a NULL pointer
and crash.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Pressing CTRL+DELETE removes the visible history entry, if any, then moves to the next history entry (like pressing DOWN would do).
If the last history entry is removed the previous one is shown in the prompt (like pressing UP would do).
CTRL+DELETE works on history entries only: i.e. it has no effect on a command entered but not executed yet.
To implement above behaviour I added saving history table to file on Escape key press.
Signed-off-by: Massimiliano Brocchini <massimiliano.brocchini@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>