Commit Graph

702 Commits

Author SHA1 Message Date
Uli Schlachter f5610fa920 objects: Add .valid property (Fixes #110)
This property is especially useful for client objects which are unusable after
unmanage. "Unusuable" here means that pretty much everything you do with the
client object results in a lua error.

Syntax is c.valid.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-02-15 12:16:03 +01:00
Daniel Hahler f562b4a64b luaA_object_emit_signal: check for valid object
By the time a signal gets emitted the object might be invalid already,
e.g. when it is very short-lived and unmanaged by the time the delayed
call to emit_signal is being invoked.

Ref: https://github.com/awesomeWM/awesome/pull/87#issuecomment-70901168
2015-02-10 14:52:47 +01:00
Uli Schlachter 8eed5e7bcf client: Include c.name in the result of tostring(c)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 18:16:05 +01:00
Uli Schlachter a7cdbf468b Only include awesome-version-internal.h in one place
This means we have one less file which gets recompiled every time the result
from "git describe" changes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-13 17:48:03 +02:00
Uli Schlachter d2b1e92f9e Clean up header includes
Every .c file has to include the corresponding .h file first to make sure the
headers are self-contained. Additionally, this moves some unneeded includes
around.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 20:07:48 +02:00
Uli Schlachter 1b21dce46c Revert "client: Add c.blob property"
This reverts commit a54636751b.

We now have the new xproperty API which does the same thing in a much nicer way.
Thanks to Elv13 for the idea!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-07 16:21:11 +01:00
Uli Schlachter 2b1febeabe Make objects properly inherit signals from classes
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-07 14:42:03 +01:00
Uli Schlachter a54636751b client: Add c.blob property
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-02-23 12:26:13 +01:00
Uli Schlachter 1703801728 ewmh: remove _NET_DESKTOP_GEOMETRY support
Our tag concept doesn't really fit into ewmh. Thus, we were setting this
property to a way too small value anyway (just the size of the first screen in
case of multiple screens).

Since this property is optional in ewmh, let's just drop it.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-27 23:01:49 +02:00
Uli Schlachter 381d840a82 Use $PATH when starting $SHELL
If $SHELL is set to "bash", previously awesome failed to restart itself, because
it could not find "bash". This commit makes awesome use execlp() instead of
execl() which means that $PATH is searched if the started command does not
contain a slash and this problem is fixed.

$SHELL is specified in POSIX and it doesn't seem to require an absolute path
name.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-27 16:22:55 +02:00
Uli Schlachter aaa771f887 Switch from libXcursor to libxcb-cursor
Thanks to Michael Stapelberg, there is now a xcb-only port of libXcursor which
does everything we need. This patch switches awesome over to that new library.

Since the only reason for using XOpenDisplay() instead of xcb_connect() was so
that we can use libXcursor, we can get back to that older state again. This
means that this effectively reverts the following commits:

531f8b415c "Added initial support for Xlib cursor themes"
77243cd09a "Add x11-xcb to the pkg-config checks"
779d43fc46 "Don't let Xlib own the event queue"
03759b4847 "Fix keyboard layouts"

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-19 16:48:10 +02:00
Gregor Best a2cd466103 Remove compiler warnings
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-24 18:15:34 +01:00
Tumin Alexander 531f8b415c Added initial support for Xlib cursor themes
I hope this time i got all right with git format-patch.

Signed-off-by: Tumin Alexander <iamtakingiteasy@eientei.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-07 12:39:56 +02:00
Arvydas Sidorenko c491cd034c common/util.h: dodgy non-__GNUC__ p_delete
I assume nobody have tried to compile Awesome with GNU uncompatible
compiler for ages and thus non-__GNUC__ p_delete version got
overlooked for quite some time.
First of all, a problem I see is that it assigns void** to a variable
of type void* and then dereferences the same void* variable.
None of the compilers I am aware of will let you go through this
without an error.
And second of all, lets have one portable p_delete.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-07-31 16:33:05 +02:00
Uli Schlachter 2853d58f52 root: Add a wallpaper setter
This allows lua code to set a wallpaper directly instead of having to spawn some
external tools which possibly aren't installed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-07-29 15:32:04 +02:00
Uli Schlachter 05a8ef2ed9 Handle execv() errors
Previously, awesome would just crash when execv() fails, because it already
destroyed all of its internal state, but then tries to do another main loop
iteration. Whoops.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-07-15 00:18:44 +02:00
Arvydas Sidorenko f41590e19c Wrapped luaL_register
Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2012-06-12 13:32:40 +02:00
Arvydas Sidorenko 508dce9c14 Replaced already in Lua 5.1 deprecated lua_open()
In Lua 5.1 lua_open directly calls luaL_newstate, but was deprecated.
In Lua 5.2 lua_open was removed.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 11:07:15 +02:00
Arvydas Sidorenko d612b922f3 lua_objlen wrapped in luaA_rawlen
In lua 5.2 lua_objlen was renamed for now reason

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 11:02:57 +02:00
Arvydas Sidorenko 47e21ad3cc Wrapped lua_[gs]etfenv into luaA_[gs]etuservalue
Lua 5.2 removed lua_[gs]etfenv and introduced
lua_[gs]etuservalue. Not sure though if it provides
the required functionality which awesome is using.
Thus, need some testing.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 11:02:34 +02:00
Arvydas Sidorenko f2942a994d luaL_typerror -> luaA_typerror
Lua 5.2 removed luaL_typerror leaving to write our own version
if need it.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 10:56:19 +02:00
Arvydas Sidorenko a77dc54f87 Unnecessary #define's to static inline functions
Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 10:54:08 +02:00
Arvydas Sidorenko d61cdb86c9 Renamed luaL_reg to luaL_Reg
The original struct name is luaL_Reg, but Lua v5.1 had a
`typedef luaL_reg luaL_Reg`, which in v5.2 was removed
and as a result breaking the build in Awesome which uses luaL_reg
version exclusively.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 10:52:10 +02:00
Edward O'Callaghan 3ba9eabd86 Add platform support for DragonflyBSD.
Simply adds a define required for awesomewm to work on the BSDs.

Signed-off-by: Edward O'Callaghan <eocallaghan@auroraux.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-20 22:46:34 +02:00
dodo 97040eb91d common/version.c: show lua release & version
Signed-off-by: Julien Danjou <julien@danjou.info>
2012-04-23 17:39:29 +02:00
Uli Schlachter a8fa910586 luaA_object_emit_signal: Fix a crash on non-objects
This was first fixed in 79b1f5aba1, but 3fbb5f15 reintroduced the crash. The
only "real" change in here is that there is now a "return;" after the
warn("Trying...");. The rest is just re-indentation.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-04 17:09:52 +01:00
Majic 0e8fc995bb Minor readability fixes, STREQ()-like macros added
Signed-off-by: Julien Danjou <julien@danjou.info>
2011-11-18 17:56:21 +01:00
Gregor Best c2ea920ca0 remove encoding=utf-8 from modelines
This option is no longer valid in modelines, so it has been removed from
all modelines using the following shellscript:

    #!/bin/ksh

    git ls-tree -r HEAD | cut -f2 | while read f; do
        egrep -e '^(//|--) vim: .*encoding=' $f >/dev/null || continue
        sed -E -e '/^(\/\/|--) vim:/s/:encoding=utf-8//' $f > /tmp/foo
        mv /tmp/foo $f
    done

Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-11 17:34:09 +02:00
Arnaud Fontaine be7fda45d8 Update the code following release of xcb-util 0.3.8.
xcb-util is now split into several repositories since 0.3.8. This
release also cleaned up the API a lot, thus update the code
accordingly.

Signed-off-by: Arnaud Fontaine <arnau@debian.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-05-10 18:27:39 +02:00
Uli Schlachter 79b1f5aba1 Don't use luaL_error in luaA_object_emit_signal (FS#713)
This function can be called from unprotected contexts. Calling luaL_error() in
this case results in a call to luaA_panic() and awesome dies.

The only real change here is that this now calls warn() instead of luaL_error().
The rest is reindentation because warn() returns while luaL_error() didn't.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-11 13:48:31 +01:00
Uli Schlachter 22a5137299 Print a warning if an invalid reference is dropped (FS#820)
Previously, if you called luaA_object_decref() it would silently *create* a new
reference with reference count -1. Obviously, this is not good.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-11 13:25:44 +01:00
Uli Schlachter e12212855b orientation: Remove
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 20:10:29 +02:00
Uli Schlachter 8701295e6c Track the number of objects
With this patch, we track the number of objects that are alive for any class.
This information can be accessed via class.instances()

For example:

  print("wiboxes", wibox.instances())
  print("widgets", widget.instances())

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-17 17:39:41 +02:00
Uli Schlachter 53565f6bc3 Remove tokenize.gperf
This file isn't used since 6bb646861c, but
apparently I forgot to actually remove it. Whoops.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-10 12:28:31 +02:00
Uli Schlachter 9b972842c3 xutil: Remove an unused define
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:37:10 +02:00
Uli Schlachter fc3cac5f73 position: This is unused, so remove
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:28:12 +02:00
Uli Schlachter 6bb646861c Stop using gperf
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:24:39 +02:00
Uli Schlachter 1f9547b4e0 common/xutil.c: Stop using a_tokenize
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:22:08 +02:00
Uli Schlachter f96019639d common/util.h: Stop using a_tokenize()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:00:31 +02:00
Uli Schlachter eae3e5b9c4 luaclass properties: Use C strings
This modifies the lua class code to use C strings instead of the tokens
generated via gperf.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-01 15:41:41 +02:00
Uli Schlachter 0783ee8ffb barray: Work with more compare functions
Currently, this code requires a compare functions to return either -1, 0 or 1.
Values outside of this range will result in endless loops. Fix this by using if
instead of switch() for the result of the compare function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-01 15:37:21 +02:00
Uli Schlachter 03e0ee53d2 Wibox: Remove shape support
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-30 10:22:50 +02:00
Uli Schlachter 2732475403 signal: Make non-existing signals non-fatal
This function is also called from unprotected C contexts and there shouldn't be
any reason why this really has to be fatal.

A warning makes you lose less sessions. ;)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 16:29:36 +02:00
Uli Schlachter ab4c151ed8 Add signals before using them
This commit makes it an error if an unknown signal is connected, disconnected or
emitted. All signals have to be added before they can be used.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-25 23:00:36 +02:00
Uli Schlachter 948f960b7e Also rename the signal_* C function
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-25 20:48:42 +02:00
Julien Danjou 6d332f07a0 lua{class,object}: rename signals functions
I knew this was wrong at the beginning, f*ck.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-25 20:28:20 +02:00
Julien Danjou f523b37e1d lua{class,object}: {add,remove}_signal() take lua_CFunction as arg
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-25 20:14:55 +02:00
Julien Danjou 3fbb5f1535 luaobject: emit signals on class too
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-18 10:41:52 +02:00
Uli Schlachter 5d35771673 Save the screen in globalconf.
There can only be on xcb_screen_t now, so we can save it in globalconf.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-16 14:10:58 +02:00
Uli Schlachter 32d9a5b2ab Remove support for zaphod mode
This makes awesome support only a single X11 protocol screen. If you are still
using zaphod mode, you can run multiple instances of awesome on the single
screens, e.g.:

DISPLAY=:1.0 awesome & DISPLAY=:1.1 awesome &

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-16 13:47:40 +02:00