Commit Graph

19 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallée 2900ea6f01 Merge pull request #1842 from psychon/lgi-check
Port lgi-check.sh to C
2017-08-12 15:59:18 -04:00
Uli Schlachter e73eb3ad38 gears.surface.apply_shape_bounding: Finish temporary image
This function draws the wanted shape to a cairo image surface and then
uses it to set the shape of the passed-in object. After this commit,
this temporary image is finished afterwards, making it free most of its
memory immediately instead of only later when the garbage collector
collects the image surface.

Related-to: https://github.com/awesomeWM/awesome/issues/1958
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-08-04 13:18:01 +02:00
Uli Schlachter ddc51cf38c Port lgi-check.sh to C
Previously, the lgi check used the normal Lua interpreter to check if
lgi is installed. However, nothing ensures/requires that awesome is
built against the same Lua version as the Lua interpreter. This means
that if lgi is only available for some Lua version, then the check could
succeed even though awesome would later fail to start. Also, the check
might have failed even though awesome would not have any problems
finding lgi.

This commit replaces lgi-check.sh by a small C program which does the
same thing. This ensures that the same Lua version is used as awesome
will be using.

There are some places that still use the Lua interpreter: Example tests
(run through the Lua interpreter directly) and unit tests (run through
busted). For unit tests, this should not make much of a difference and
example tests might later get similar treatment.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-06-13 15:47:07 +02:00
Uli Schlachter 801a1f0a89 Deprecate widget-drawing functions in gears.surface
This marks the functions gears.surface.widget_to_svg() and
gears.surface.widget_to_surface() as deprecated in awesome 5. This means
that by the time that awesome 6 becomes a thing, we can finally remove
these...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-30 11:22:07 +02:00
Uli Schlachter 1078a9f395 Bump minimal LGI version to 0.8.0 (#1350)
Turns out that menubar already uses features that were only added in
that version.

Fixes: https://github.com/awesomeWM/awesome/issues/1348
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:53:02 +01:00
Uli Schlachter 289dfd1615 gears.surface.widget_to_*: Ignore repaints (#1155)
For some reason, the code here tried to handle widget::redraw_needed
signals even though it should apparently/obviously only produce a
current snapshot of the widget's look.

Fix this by just removing the redraw code.

While here, also factor out the widget context table into a local
variable and re-use it for the initial layout and for the later draw.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-19 12:32:30 +02: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 c25c0527a6 gears.surface: add a traceback for "Failed to load" errors
This is useful to see where the error is coming from.
2016-05-11 21:50:02 +02:00
Emmanuel Lepage Vallee 9da40d010c gears.surface: Add methods to convert widgets to surfaces
It can be saved directly to a PNG or SVG file or used as a cairo
surface or pattern.
2016-03-31 04:45:45 -04:00
Uli Schlachter 2ad147d740 gears.surface: Change the way that caching works
Loading a file normally has the same behaviour as before. First the cache is
checked and if nothing is found, the file is loaded and cached.

This commit changes the behaviour of loading a file uncached. This no longer
removes the file from the cache if it is cached (why should it?) and also does
not put it in the cache.

This means that users of load_uncached and load_uncached_silently can now freely
modify the resulting surface without interfering with other API users.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-28 17:21:10 +01:00
Uli Schlachter 8c26e2dab4 Fix all luacheck warnings in lib/gears
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:11:50 +01:00
Emmanuel Lepage Vallee 704c028621 gears.surface: Add a method to create a surface from a shape
Useful for icons
2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee dd93418afb gears.surface: Add an helper to set a shape to drawable 2016-01-18 17:22:44 -05:00
Uli Schlachter a2c1106401 gears.surface: Also apply default when called with "nil"
Before this, calling one of the loading functions with a nil argument always
made it return the default 0x0 surface. With this change, the passed-in default
value is now properly applied.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 17:33:39 +01:00
Uli Schlachter 58ecd92b8e Add better error handling to gears.surface
Previously, a Lua error was thrown when loading a file failed. Most callers are
not prepared for this and the result is less than optimal.

This commit makes the functions print the errors and return nil instead. For
callers that want to handle errors themselves, "_silent" variants of the
functions are introduced which just return errors to the caller.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 18:38:51 +01:00
actionless 7ae58b3208 doc(lib: gears: surface): more verbose docstring
Closes https://github.com/awesomeWM/awesome/pull/436.
2015-09-07 20:29:57 +02:00
actionless e023fd0640 fix(lib: gears: color): use surface for recolor 2015-09-04 21:09:46 +02:00
Daniel Hahler e47773933c Bump required lgi version to 0.7.1
Ref: https://github.com/pavouk/lgi/issues/41
Ref: https://github.com/awesomeWM/awesome/pull/392
2015-08-11 19:08:35 +02:00
Julian Wollrath 6cc7be512c Remove the *.in from all files.
Signed-off-b: Julian Wollrath <jwollrath@web.de>
2015-06-19 22:33:32 +02:00