Commit Graph

3057 Commits

Author SHA1 Message Date
Julien Danjou a5806d5e61 lua: arrays use __next and __pairs metamethods
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 16:19:56 +02:00
Konstantin 4ab499fe26 Alternative export method of arrays from C to Lua
The patch is mainly to export client_array_t object to Lua,
but can be used to export any ..._array_t object.

The idea: export to Lua not a table, but userdata with
metamethods to get/set/define length of ..._array_t object
directly.

Now when I get clients field from tag object C code
creates full copy of client_array_t structure into Lua table.
It takes traversing a whole array of data.

I did it in other way: userdata is exported, with __index,
__newindex, and __len meta-methods defined, and Lua
script gains direct access to client_array_t C-array:
it can get client object, get length of array and assign
client objects to some index in C-array.

Pros:
No overhead of creation a copy of C-structure into Lua-table:
if I want just to test a number of clients for a tag, I don't need
a whole loop to build table, I just want to read clients->len field,
and I do so via __len meta-method.
Also if I want to get some client from tags.clients, I don't need
to create ALL clients Lua-objects, I just get client_t C-struct
and create Lua-object from it. Just in place.
So Lua-loop enuming all tag.clients is not 2 loops internally
(first create copy of tag.clients into Lua-table, then enum this table),
but only one, and if I break out of loop in the middle, I create
only some client Lua-objects, not all of them from tag.clients.

Contras:
As far as clients field is not a table, I cant use pairs/ipairs
and other table functions for it.
But it can be implemented in other way:
for k,c pairs(tag.clients) => for k = 1, #tag.clients,
table.insert(tag.clients, client) => tag.clients[#tag.clients+1] = client

etc.

One more Pro now:
As far as tag.clients in current implementation returns copy of data
table.insert doesn't do what's expected: it doesn't really add client
into tag.clients "array".
With my implementation client is added as expected, as we work with
client_array_t structure directly.

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 16:18:59 +02:00
Julien Danjou 8b5f6266da lua: add support for __pairs and __next metamethods
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 16:15:15 +02:00
Julien Danjou 4b452510ba taglist: append area even if function fails
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 16:15:15 +02:00
Julien Danjou 415defdba5 client: allow screen change only if xinerama is active
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 10:32:59 +02:00
Fabienne Ducroquet 0348b0566e libs: fix callback call and untab
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 08:04:09 +02:00
Konstantin 36cf917890 awful.lua - use new tags.clients to enum clients in taglist.label.all
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-09 19:48:17 +02:00
Kanru Chen 94dab79ff3 awesomerc: put systray into statusbar
table.insert doesn't work on statusbar.widgets because statusbar.widgets
always returns a new copy.

'condition and a or b' works like 'condition ? a : b' in C.

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-09 10:00:20 +02:00
MATSUU Takuto 533dee543f build: fix gdkpixbuf dependency
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-09 09:55:01 +02:00
Julien Danjou 2f04baed34 beautiful: fix luadoc module name
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 19:07:42 +02:00
Julien Danjou a89cf77002 change codename
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 18:53:45 +02:00
Julien Danjou 9e9b7c1bf3 mouse: refresh titlebars on the fly
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 17:38:51 +02:00
Julien Danjou cde948bd61 titlebar: add position in __newindex
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 17:15:23 +02:00
Julien Danjou bfad5a0d0d titlebar: add position in __index
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 17:10:29 +02:00
Julien Danjou eb2eb9c30b awful: check for selected
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 17:07:31 +02:00
Julien Danjou 2900127619 awesomerc: revert titlebar off
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 16:50:55 +02:00
Julien Danjou 56b42a7878 titlebar: widgets are now returned/set as array
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 16:49:26 +02:00
Julien Danjou 874e62d849 titlebar: replace client_get() by client attribute
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 16:04:18 +02:00
Julien Danjou e5d828b369 statusbar: widgets is now an array
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 15:47:09 +02:00
Julien Danjou e73269c727 awful: use tag screen number
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 14:45:50 +02:00
Julien Danjou 856eb1a9b2 tag: add support for tag screen change
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 14:39:03 +02:00
Julien Danjou 81da69b282 lua: remove spurious \n
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 14:37:27 +02:00
Julien Danjou 4dd5a2b6b0 tag: check for screen number before invalidate
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 14:34:50 +02:00
Julien Danjou 9cb22b96eb lua: exports client.tags and tags.clients
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-07 16:39:45 +02:00
Julien Danjou 3814103a1e lua: implement objecttable
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-07 16:39:30 +02:00
Julien Danjou 0826351a72 awful: check for sel.screen after sel
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-07 16:34:37 +02:00
Julien Danjou a7c7ab2eb0 ewmh: check tags tab size
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-07 16:23:43 +02:00
Julien Danjou 85caf26d63 awesomerc: add colons
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-07 14:06:34 +02:00
Jay Bromley d5c82f9982 awesomerc: improve management of floating/predefined tags (FS#241)
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-07 12:13:54 +02:00
Damien Leone 03645feec0 beautiful: allow extra spaces in theme file
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-07 08:20:08 +02:00
Julien Danjou cbfc510fbf client: change screen if screen is !=
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 21:25:06 +02:00
Damien Leone 171ece9918 awful: add focusbydirection() (FS#166)
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 21:11:47 +02:00
Julien Danjou 395e4b46d4 awful: indentation fix
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 21:10:10 +02:00
Julien Danjou ebb9aba4e7 lua: refresh after cs event
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 20:58:27 +02:00
Julien Danjou 13714a2b8b remove useless include
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 20:54:20 +02:00
Kanru Chen cb9c8ef9f5 lua: refresh after calling timer hooks.
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 20:51:28 +02:00
Julien Danjou 938170fe14 client: fix memory leak in client title update
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 17:37:26 +02:00
Julien Danjou e9adbff429 mouse: fix memory leak on resize
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 16:22:48 +02:00
Julien Danjou db9e50e728 event: fix memory leak on client size hints update
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 16:13:42 +02:00
Julien Danjou 9cf1bc00c9 libs: add vim modeline
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 15:39:51 +02:00
Damien Leone be9e53f4be beautiful: remove useless var and close file
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 15:38:41 +02:00
Julien Danjou 1755dd51fe awful: add beautiful support
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 15:15:13 +02:00
Julien Danjou f28fac6107 widget: optimize cache invalidation
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 14:24:54 +02:00
Julien Danjou 6bbbf03c95 mouse: factorize xcb_aux_sync calls
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 14:11:33 +02:00
Julien Danjou 3b785d6f6c awful: fix titlebar creation
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 14:11:22 +02:00
Julien Danjou ebb7000cee client: reduce server grabbing time
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 14:06:51 +02:00
Julien Danjou 9cbee5b32e remove goto statement
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-06 14:05:11 +02:00
Julien Danjou bacd864400 beautiful: fix Damien's mail address
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-05 22:26:34 +02:00
Julien Danjou 2735144b8c beautiful: import
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-05 22:24:14 +02:00
Julien Danjou 48d49c085c doc: add SIGHUP
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-05 17:51:46 +02:00