Commit Graph

9 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 5fdce4d845 Move 'surface_size' to gears.surface and make it public 2014-04-08 22:51:55 +02:00
Uli Schlachter 79ad0d3e6e gears.surface: Cache files from disk
Instead of loading files from disk every time we need them, add a cache to
gears.surface as a weak table that maps strings to cairo surfaces.

If this cache should be avoided, there is a new gears.surface.load_uncached()
function which works just like gears.surface.load() worked before.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-29 22:01:01 +01:00
Uli Schlachter 41bc77d64c Bump minimum lgi dependency to 0.7.0
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>
2014-03-17 17:52:09 +01:00
uzsolt 23fe017bd4 fix locale problem (decimal separator isn't dot but comma)
If user changes locale with os.setlocale to a "dirty"
locale (which use comma as decimal separator (not dot), e.g.
hu_HU) `tonumber` will produce "0,6" instead of "0.6"
which causes bad comparision.

Signed-off-by: uzsolt <udvzsolt@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-01-06 12:08:02 +01:00
Uli Schlachter 4b049c310d gears.surface: Update required lgi version
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-06-22 23:22:58 +02:00
Arvydas Sidorenko 65de8a7ab5 Broken lgi version checking
Currently it takes `require('lgi.version')`, converts it blindly to
number and compares with another value.
I am using lgi v0.6.1 and that is not convertable to number value,
thus tonumber() returns nil and crashes Awesome.
The fix is to take major and minor numbers only ignoring the rest.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-06-22 23:21:14 +02:00
Arvydas Sidorenko e789cfaf66 Ported lib/gears to lua 5.2
Tested with lua 5.1: all good

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-16 17:37:30 +02:00
Uli Schlachter ca2fc7811a gears.surface: Add a version check for lgi
The cairo bindings are quite new in lgi and thus we depend on a quite new
version of lgi. Older versions will fail with lots of weird errors, e.g.:

lib/gears/color.lua:61:attempt to call field 'create_rgba' (a nil value)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-06-05 16:22:04 +02:00
Uli Schlachter 4f30dfd198 Switch from oocairo to lgi.cairo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-27 19:20:34 +02:00