Commit Graph

487 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee e12c000b97 layout: Add separator widget support to 3 layouts
The ratio, fixed and flex layout can now display a widget between
each layout elements.

The align layout was left out because it doesn't support spacing
2017-11-24 19:13:59 -05:00
Emmanuel Lepage Vallée 056af3d48d
Merge pull request #2109 from Elv13/revert_dpi_per_screen
screen: Revert the DPI per screen changes.
2017-11-23 23:42:26 -05:00
Emmanuel Lepage Vallee 314e307cd6 textbox: Ensure that the DPI arguments are not nil
Otherwise it fails. This allows better error message to be sent to the
user.
2017-11-23 23:28:32 -05:00
Uli Schlachter 5ef937c07c textclock: Detect failures from g_date_time_format (#2119)
If g_date_time_format() fails, it returns a NULL pointer. This change
makes the textclock detect this and print a warning. This warning
contains 'g_date_time_format()' so that people can ask their favorite
search engine for the supported formats of this function. This warning
also contains the actual format string so that all the information is
available in one place and possible bug reports hopefully include the
format string.

Reference: https://github.com/awesomeWM/awesome/issues/2118
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-11-23 23:27:18 -05:00
Emmanuel Lepage Vallee 33124d8605 widget: Add a separator widget. 2017-11-06 05:19:17 +01:00
Emmanuel Lepage Vallee cedeb2bb5a wibox: Add a `to_widget()` and `save_to_svg()` method.
Take a wibox snapshot as a widget. It also add an helper to save
it to a file. This is useful for debugging when called from
`awesome-client`
2017-10-21 19:34:04 +02:00
Uli Schlachter 1592180c83 textbox: Make some screen arguments optional again (#2057)
Since beautiful.xresources.get_dpi(s) allows nil as argument to query
some "global DPI", the functions to query the size of a textbox also
allowed to use nil as the screen, even though this was never documented
to work. Commit a137655791 broke this by assuming a valid screen
object.

This commit makes a nil argument work again, but will cause a
deprecation warning in awesome 5.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-21 19:32:35 +02:00
Daniel Hahler c362524a5f Merge pull request #2012 from Elv13/doc_tests_and_notif_p1_2
widget: Add a flexible generic constructor
2017-10-21 19:26:49 +02:00
Uli Schlachter a137655791 Add & use a dpi property on screen objects
Once upon a time, beautiful.xresources.get_dpi was added to query
Xft.dpi. That made sense since this queried an xresources property. Over
time, other, non-xresources-based ways to query DPI were added to this
function. Now, it makes no more sense to have this function here.

Also, recently it became possible to add new properties to C objects
from Lua code. Thus, we no longer need to have a get_dpi() function
somewhere, but can add s.dpi directly.

Thus, this commit adds s.dpi and makes everything use it. No functional
changes are intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-08 12:30:21 +02:00
Uli Schlachter b04b1b27af Add a force_update() method to the textclock (#2034)
Reference: https://github.com/awesomeWM/awesome/issues/344
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-09-10 20:12:25 +02:00
Emmanuel Lepage Vallée fd2307afd0 grid: fix an unavoidable assert (#2017)
`:add()` was called with the optional `...` arguments, but the
function required at least one argument.
2017-08-21 21:10:43 +02:00
Emmanuel Lepage Vallee 7e8f3e9b9b widget: Add a flexible generic constructor
This avoid copy pasting this kind of code in many places.
2017-08-19 22:45:54 -04:00
Uli Schlachter 12bb7f5a9e Improve docs for emit_signal_recursive (#1998)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-08-16 13:37:14 +02:00
Uli Schlachter 8dfe18a382 Fix wibox to forward shapes directly
When doing w.shape_bounding = foo on a wibox, the code would first read
shape_bounding from the underlying drawin. This would create a
(possibly) huge cairo image surface that just waits to be collected by
the garbage collector, resulting in increased memory usage.

Fix this by checking the force_forward table first. This tables contains
the names of shape properties. Thus, the evaluation of this statement
gets short-circuited and the property is on the drawin is not read.

Helps-with: https://github.com/awesomeWM/awesome/issues/1958
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-08-04 13:10:14 +02:00
Uli Schlachter 07d561ee91 wibox.widget.calendar: Stop using make_widget_declarative
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-07-09 19:00:16 +02:00
Emmanuel Lepage Vallee fb367c3f9e stack: Add offset support 2017-06-26 02:27:20 -04:00
Emmanuel Lepage Vallee 29f70c1b4c mirror: Fix documentation
It didn't render properly
2017-06-26 02:27:20 -04:00
Emmanuel Lepage Vallee 458340b4d4 doc: Add examples for the ratio layout 2017-06-26 02:27:20 -04:00
Emmanuel Lepage Vallee 0430f55257 ratio: Add a fill strategy for empty entries
This allows, for example, to imeplement the tag `master_fill_policy`
and simplify the client layouts by not having to hardcode empty
columns and rows in each layouts.
2017-06-26 02:27:20 -04:00
Emmanuel Lepage Vallée ef1d7d8396 Merge pull request #1647 from Elv13/free_layout
Add a manual (free floating) layout
2017-06-12 19:49:30 -04:00
getzze 5b0abb9541 widget: Add a calendar widget 2017-06-12 02:58:06 -04:00
Emmanuel Lepage Vallee 5d46d47ef7 wibox.layout: Add a `manual` layout.
A layout with manual widget positions. It is still useful as it is
manager by the hierarchy and widget position can be functions.
2017-06-11 01:14:10 -04:00
Uli Schlachter 6de6419180 Add functions to draw widgets to a cairo surface
These are supposed to eventually replace the already-existing functions
in gears.surface which have a similar signature

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-30 11:22:07 +02:00
Matt ddf9689767 Add timezone option for textclock widget (#1743)
Adds a third parameter "timezone" to the textclock widget that is
optional. Defaults to local timezone if nil.

Signed-off-by: Matt Harrison <matt@harrison.us.com>
2017-04-21 16:34:23 +02:00
getzze 59662bc971 wibox.widget.base: do not call set_children if children is nil 2017-04-18 15:00:39 +02:00
axujen 8e70b71c9c Fix imagebox:set_image not returning anything
set_image should always return true or false according to the docs
2017-04-06 19:33:14 +01:00
Uli Schlachter 3bda88ff64 Remove obsolete entries from check_for_invalid_requires.lua (#1673)
Most of the entries that are marked as "TODO: Get rid of these" were
handled. wibox.layout.align:get_children() never worked (it always
called a non-existent function), so we can easily fix this entry without
introducing a regression.

I opened https://github.com/awesomeWM/awesome/issues/1672 to track the
underlying problem behind the broken :get_children() function (which is
missing test coverage).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-26 15:20:18 -04:00
FireFish5000 ffda3b0c4c Add null check to set imagebox to blank state 2017-03-25 00:07:55 -05:00
Kevin Zander 7687275607 Move awful.util.deprecate and awful.util.deprecate_class to gears.debug
Change all awful.util function calls to gears.debug function calls
Update all old deprecate calls to have deprecated_in=4
2017-03-15 20:08:22 -05:00
Emmanuel Lepage Vallée 957966d636 Merge pull request #1646 from psychon/systray_removal
Partly fix removal of systray from a wibox
2017-03-12 15:43:40 -04:00
Kevin Zander 2f105eac86 Move string functions out of awful.util into new gears.string (#1584)
Update deprecated awful.util string function calls to gears.string calls
2017-03-11 18:57:32 -05:00
Uli Schlachter 64b964972b systray: Enable properties and improve documentation
I spent way too much time trying to figure out why setting "visible" to
false did not work...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-11 18:46:40 +01:00
Uli Schlachter 13dbc558fc wibox.hierarchy: Only count "really visible" widgets
Widgets with width or height zero cannot really be counted as visible,
so do not do so.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-11 18:44:56 +01:00
Uli Schlachter 51e4a47938 Partly fix removal of systray from a wibox
This commit changes the systray widget, wibox.drawable and the C code to
fix the following bug: When the systray widget is removed from a
drawable without being moved somewhere else, the systray stayed visible.
This was because the systray is not drawn by awesome, but only placed.
When the widget is no longer "drawn", it stays wherever it was placed
last.

This change works by detecting the situation when the systray is
removed. Then, the C code is specifically told to remove the systray
window from the drawable.

Note that this is only a partial fix. This change works correctly when
the widget is removed completely, because it is no longer placed by its
parent widget. However, for example, when you do
wibox.widget.systray().visible = false, the effect is just that the
systray widget gets size 0x0. This is not really visible, but as far as
this change is concerned, the widget is still part of the drawable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-11 18:14:38 +01:00
Uli Schlachter e1fe1de98f wibox.hierarchy: Add ability to count widgets
This adds new code so that we can count how often a specific widget is
visible inside of all widget hierarchies.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-11 13:55:57 +01:00
0x041E caf90887a7 doc: Fix arcchart documentation (#1643) 2017-03-08 16:05:23 -05:00
Kevin Zander c3461b535c gears: Move awful.util.table to gears.table (#1641)
* Move table functions out of awful.util into new gears.table

* travis: Use v9999 prefix for full requests

Make sure no newly deprecated functions are used

* Move all `awful.util.table.*` calls to `gears.table.*` calls
Move table test functions from awful/util_spec to new gears/table_spec
Change awful.util.subsets call to gears.math.subsets in awful/key.lua
2017-03-08 15:18:33 -05:00
Uli Schlachter 6f803cf3b3 Fix code using awful.util.round
This gets rid of lots of deprecation warnings

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-06 17:11:05 +01:00
getzze 9a3cdab534 Add grid layout
Remove dependency to awful and remove get_cell_sizes function

Remove matrix and add superpose property

Update documentation, remove beautiful dep

Add insert, extend and remove columns and rows

Change x and y to horizontal and vertical
2017-03-04 20:57:33 -05:00
Kevin Zander 3f6df8ddee Fix Luacheck 0.19.0 release Travis breaks 2017-03-03 16:41:12 -06:00
Daniel Hahler 04b73db722 Merge pull request #1601 from psychon/improvements-thanks-to-Unode
Improvements on wibox.container.scroll thanks to Unode
2017-02-28 19:58:28 +01:00
Uli Schlachter d8a272d2dd wibox.container.scroll: Also mention some caveats
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-02-25 17:05:33 +01:00
Uli Schlachter 3b40954223 wibox.container.scroll: Add a description
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-02-25 16:56:51 +01:00
Uli Schlachter 6fb40a196f wibox.container.scroll: Add a usage example
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-02-25 16:51:03 +01:00
Uli Schlachter 3d12ba3b65 Fix wibox.container.scroll's property magic
Creating a widget already sets a metatable (at least these days).
However, wibox.container.scroll overwrote this metatable with its own
metatable. This commit removes this overwrite.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-02-25 16:42:27 +01:00
Lego Stax bc728a5f46 doc: Update fixed.lua (#1591) 2017-02-21 22:03:21 -05:00
Emmanuel Lepage Vallee 1e50f7b376 container: Add an placement container.
It should be called "align", but the name is already taken

It doesn't use awful.placement because it would break the dependency
graph.

Some cases previously required 2 wibox.layout.align layouts,
one for each axis. This is massively overkill to simply place
a widget at the center of a larger area.
2017-02-11 16:10:13 -05:00
Emmanuel Lepage Vallée cbd22eea50 Merge pull request #1475 from psychon/input-shape-support
Input shape support
2017-02-03 12:25:56 -05:00
Emmanuel Lepage Vallée 5a914b3496 Merge pull request #1198 from psychon/wibox-shape
Wibox: Add gears.shape support
2017-01-26 05:30:42 -05:00
Uli Schlachter 47d69e7824 Update docs for shape_input
I grepped for shape_clip and edited places that needed editing.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-26 11:15:28 +01:00
Uli Schlachter 2d736bf3b5 wibox.drawable: Draw black if no wallpaper is available (#1437)
Fixes: https://github.com/awesomeWM/awesome/issues/1411
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-25 23:10:37 +01:00
Holger Schurig 2627f087c5 doc: fix beautiful.arcchart_thickness (#1439)
The arcchart_ prefix was missing.
2017-01-23 21:26:18 +01:00
Uli Schlachter ddfe652173 fixup! wibox: Add shape property 2016-12-26 13:55:33 +01:00
Uli Schlachter 1a9887335e wibox: Add shape property
This bridges between gears.shape and the shapes. So far, it does not try
to do any kind of anti-aliasing magic, so you get "steep edges".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-26 13:28:34 +01:00
Uli Schlachter 40c653c4b6 Fix luacheck warnings in wibox.drawable
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-25 13:05:26 +01:00
Uli Schlachter 4d2a1d5534 wibox.drawable: Support forced screens
Up to now, a drawable always figured out the screen that it is on by
looking at its position. This causes memleak-like problems with wibars:
A wibar has a screen assigned, but its underlying drawable will end up
referring to another screen. Via this, we were managing to build a long
reference chain of screens and drawable that meant that none of the fake
screens that our test suite added could be garbage collected.

To fix this, add wibox.drawable._force_screen(s). After this function is
called, the normal screen detection based on the position is skipped and
instead the given screen is always used. This breaks the above reference
chain and things become garbage-collectable.

Also, this chains the drawable to the life time of the screen: When the
screen becomes invalid (.valid == false), the drawable will stop
redrawing.

Fixes: https://github.com/awesomeWM/awesome/issues/1237
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-18 10:56:47 +01:00
Uli Schlachter 9f2c4719ed Make the piechart deterministic (#1258)
Previously, the API to set the data that should be displayed was
:set_data(t) where t is a table. This table has the labels to use as its
keys and the numbers as its values. With this API, it was not possible
to influence the order in which the "pie pieces" were drawn.

This commit adds and uses a new API called :set_data_list(t). Here, t is
a table with integer keys and tables as values, thus one can iterate
over this with ipairs() and the order is well-defined. The tables used
as values contain the label as their first entry and the number as their
second entry.

Fixes: https://github.com/awesomeWM/awesome/issues/1249
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-07 20:20:09 +01:00
MoreThanOneAnimal 51bbb53b30 Add references to gears.color in documentation. 2016-11-28 20:07:29 -08:00
Daniel Hahler fc13b1b4eb doc: s/Wether/Whether/ 2016-11-22 02:40:15 +01:00
Daniel Hahler eed3d7e63a lib/wibox/widget/base.lua: doc fixes 2016-11-22 02:40:15 +01:00
Emmanuel Lepage Vallee 4b34e64fe2 widget: Add a slider widget. 2016-10-12 02:24:47 -04:00
Uli Schlachter 259c4f716f Remove @release @AWESOME_VERSION@ everywhere (#1157)
It does not provide much value. The version number is already known to
ldoc globally in the "description" variable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-09 22:36:20 +02:00
Daniel Hahler 05d962f778 Merge pull request #1147 from psychon/remove_weak_tables
Remove some weak tables
2016-10-07 22:00:23 +02:00
Uli Schlachter 01a9cb2031 Merge branch 'drawable-visibility' of https://github.com/psychon/awesome 2016-10-06 20:59:38 +02:00
Uli Schlachter 90044e00da wibox: Remove weak table hack
No idea what self referencing loops this refers to. Lua 5.1's and
LuaJIT's garbage collector both should handle cycles just fine. Things
only start getting complicated when you start using weak tables.

Unless someone comes up with an example where this patch causes a leak,
let's remove the weak table magic.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-05 20:35:04 +02:00
Uli Schlachter 4bb02d1b53 wibox.hierarchy: Fix the matrix_to/from_device
Matrix operations are hard. Apparently I always keep confusing the order
that transformations are applied in the matrix resulting from a matrix
multiplication.

This commit fixes things in wibox.hierarchy that were wrong due to the
wrong order and changes a unit test so that it would now catch the
breakage (and makes sure that it does not happen again).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-05 20:07:19 +02:00
Uli Schlachter 6d8e91f5e2 Change API for wibox.drawable:find_widgets()
Instead of matrix_to_device and matrix_to_parent, this now provides the
full hierarchy instance managing the current widget.

In addition to x, y, width and height (which are an over-approximation
of the widget's extents on the drawable), this now also provides
widget_width and widget_height in the widget's local coordinate system.
These last two values are exact.

For example, the tooltip needs x/y/width/height while a widget that
wants to figure out which point on it was hit with a mouse press will
need widget_width and widget_height (together with the position argument
that is passed in with mouse::press).

I don't know how to document the return type of this function properly.
Hopefully just describing the structure of the resulting table is good
enough.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-05 20:04:24 +02:00
Uli Schlachter eb9dbf991c Widgets: Get mouse position right for button press/release
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-05 20:04:24 +02:00
Uli Schlachter 0183372ac2 wibox.drawable: Do not relayout while invisible
Similar to the previous commit, this makes the drawable not apply a
pending relayout while it is not visible. When it becomes visible again,
the relayout is done.

The hope here is that less work is done while a drawable is not visible,
saving CPU time.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-05 20:00:20 +02:00
Daniel Hahler 332681aaad progressbar: keep set_height/set_width working (#1141)
Ref: https://github.com/awesomeWM/awesome/issues/1140
2016-10-05 00:24:43 +02:00
Uli Schlachter 9b51779f2f wibox.drawable: Fix a possible crash
LGI does not protect against use-after-free issues that can occur due to
using an object after finalisation. This manifests itself as occasional
crashes on Travis in cairo_region_union_rectangle() (AFAIK no one ran
into this issue in real-world usage).

Since visible drawables are always strongly reachable, the issue can
only occur with invisible drawables. The previous commit made sure that
those are fully repainted when they become visible, so we can just
ignore redraws for those and fix the crash issue.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-04 21:27:10 +02:00
Uli Schlachter 650b01eb71 wibox.drawable: Stop using weak tables
Instead of tracking all drawables that are alive, the code now only
tracks visible drawables. When a drawable is made visible it is
completely repainted. This should not cause a difference when a wibox is
initially made visible, because it has to be redrawn anyway. However,
this introduces a full repaint when a wibox is hidden and then made
visible again.

Thanks to this change, we can stop using weak tables. Visible drawables
cannot be collected and so we can keep a strong reference to them. This
allows us to get rid of the weak tables which solves various problems
involving finalizers and using objects after finalisation.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-04 21:20:55 +02:00
Uli Schlachter 843d0bdcf5 wibox.drawable: Add visibility tracking callback
This new function is called whenever the visibility of the drawable
changes. Later commits can use this for explicitly tracking the lifetime
of drawables instead of using magic weak tables.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-04 21:18:18 +02:00
Emmanuel Lepage Vallee b6421699da doc: Add more graph documentation. 2016-09-26 01:20:57 -04:00
Emmanuel Lepage Vallee 5ef9b64b40 graph: Add shape support
This complete the shape API. Now, everything support shapes.
2016-09-26 01:20:57 -04:00
Emmanuel Lepage Vallee 68999f4a86 graph: Add min_value
Fix #277
2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee f517538b6a background: Avoid some redraw 2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee 549d68dcc5 doc: Add more progressbar shape examples 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 7b11f1c1b4 tests: Test progressbat paddings, margins and clip 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee a8568eb969 doc: Add examples for vertical and labelled progressbar 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee e1733dd37a progressbar: Add paddings and margins properties
This restore a feature that was available in Awesome 2.1-3.2.

The reason margin is implemented rather than use a container is to
be able to make the background smaller than the bar.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 915c10b1f8 progressbar: Add shape support
The current progressbar code dates from a time when Awesome had
a very limited drawing API. This commit first re-write the
algorithm to remove the workaround used to draw the border using
full rectangles only. It then add support for outer and inner
shapes with their respective border settings.

This commit also add clip support. This is enabled by default, but
could be disabled to have the bar taller than the background.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 8ec53c827b progressbar: Fix a race condition
When created using the declarative syntax, set_value could be
called before set_max_value, this trimmed the value.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee e5d4c188f1 progressbar: Remove vertical/width/height code
The deprecation message should be enough. This doesn't remove
the functionalities themselves.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee e28b79944f doc: Use @property for the progressbar doc. 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 8d7f228301 progressbar: Conform to the new widget conventions.
It is not Awesome 3.2 anymore, progressbars are no longer userdata.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 7cbcc800bc progressbar: Remove dead code. 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 2c620468f0 progressbar: Deprecate width, height and vertical properties. 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 89f796b268 doc: Fix copy paste mistake. 2016-09-25 22:47:35 -04:00
Daniel Hahler 9b7e655afe Merge pull request #1111 from psychon/assorted-fixes
Some assorted fixes
2016-09-25 01:35:55 +02:00
Emmanuel Lepage Vallee 525a76018f container: Add an 'Arc chart' container.
A lot of conky config use this type of widgets. It looks very nice
on thicker wiboxes.
2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee 0a3a71dd45 widgets: Add a piechart widget. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee 3f0b033e72 checkbox: Add a shape based checkbox widget. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee a4743ed2c2 radialprogressbar: Upstream Elv13 round progressbar 2016-09-24 14:45:08 -04:00
Uli Schlachter ab135fa7c9 wibox.drawable: Don't redraw invalid drawables
Twice now we had problems with the garbage collector which caused signals
established via weak_connect_signal() not to be disconnected when we wanted them
to be disconnected. The effect was that we tried to redraw a drawable after it
was garbage collected which caused errors.

Instead of playing whack-a-mole with all the various ways that might make us
redraw a drawable after GC, let's just fix all of these issues by explicitly
checking for this case and turning it into a no-op.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 14:37:07 +02:00
Uli Schlachter f6761e662c wibox.drawable: React to screen changes
The previous commit made wibox.drawable turn a "normal redraw" into a complete
repaint when it was moved to another screen. However, nothing happened until
that normal redraw.

This commit triggers a normal redraw when we are (possibly) moved to another
screen. More precise, this means that whenever a screen appears, disappears or
changes its geometry and when the drawable is moved, we trigger a normal redraw.
This redraw will likely do nothing, because no relayout is pending and no part
of the surface needs a redraw, so it is cheap.

However, if the drawable really ends up on another screen, then the code from
the previous commits makes us do a full relayout and redraw.

This commit likely fixes the current instability of test-screen-changes.lua. See
https://github.com/awesomeWM/awesome/issues/982#issuecomment-231712056.

As explained there, the test fails because the fake screen that it created is
still referenced, so cannot be garbage collected, but the test doesn't succeed
unless the screen is garbage collected. So something is still referencing the
screen that was removed. This something can be a client's titlebar, because the
underlying drawable still has a context member referring to the old screen.

This commit should fix that problem, because we now trigger a redraw which will
compute a new context and thus the reference to the old screen is released.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 14:37:07 +02:00
Uli Schlachter 752d49ed47 wibox.drawable: Force full repaint when the context changes
The previous commit made the hierarchy do a re-layout when the context changes.
However, widgets could change their appearance depending on the context without
changing their layout. Thus, the previous commit is not enough.

This commit also makes the drawable redraw everything when the context changes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 14:37:07 +02:00
Uli Schlachter e0a3ecba01 wibox.hierarchy: Update when the context changes
When the context for widget changes (e.g. we are on a new different screen or
have a different DPI value), widgets might change their appearance even though
they didn't emit widget::layout_changed. Thus, update the hierarchy in these
cases.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 14:37:07 +02:00
Uli Schlachter 8d2dde3a34 wibox: Remove some dead code
widget_at() no longer exists since 0aa4304bda (and the surrounding commits
stopped us using this function).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 14:37:07 +02:00
Emmanuel Lepage Vallee 12b72d6164 drawable: Prevent collected drawables from being redrawn. 2016-09-07 00:41:10 -04:00