I apologize, thats prolly written down and I should have looked first before submitting the patch. Here is a correctly formatted git patch against current head.
I originally wrote the C restart parameter as an int before I noticed that stdbool was in use. Then I got a little overzealous in converting 1's to true's. It happened to work though. :) Regards, Chris Newton On Sun, Mar 20, 2011 at 11:37 AM, Uli Schlachter <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Hi, > > Am 20.03.2011 17:20, Chris Newton wrote: >> [..] So I did a little digging and came up with this >> quite small patch that adds a flag to the exit signal which indicates >> if its an exit for a restart or an exit for a real shutdown of >> awesome. > > thanks for the patch. The idea certainly doesn't seem bad, but I got some > comments about this. > > First, please use git and send the result of "git format-patch > origin/master.." > to the mailing list. That way git tracks you as the author. > > To clone the git tree, use "git clone git://git.naquadah.org/awesome.git". > > Here is a random howto that came to my mind for this: > http://www.x.org/wiki/Development/Documentation/SubmittingPatches > > Now, about the patch itself... > >> diff -ru awesome-3.4.9.org//awesome.c awesome-3.4.9/awesome.c >> --- awesome-3.4.9.org//awesome.c 2011-01-17 04:38:13.000000000 -0700 >> +++ awesome-3.4.9/awesome.c 2011-03-20 08:42:04.789788001 -0600 >> @@ -62,14 +62,15 @@ >> /** Call before exiting. >> */ >> void >> -awesome_atexit(void) >> +awesome_atexit(bool restart) >> { > [...] >> >> - signal_object_emit(globalconf.L, &global_signals, "exit", 0); >> + lua_pushboolean(globalconf.L, restart); >> + signal_object_emit(globalconf.L, &global_signals, "exit", true); > ^^^^ > This is the number of arguments for the signal. You want "1" instead of > "true". > > Cheers, > Uli > > - -- > The Angels have the phone box! > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > > iQEcBAEBCAAGBQJNhjtPAAoJECLkKOvLj8sGVk8H/3yx7zutB13rddFx7gY79FEe > lq5IrQQBaEPaAVyCr2t4T9xFHW86INJPtjesIvkv9FlLaWCzUGMeBZrvbtyXay8h > SSlwl7cWp8xXD7HjUGRvTJyLbXaZgU36AqoWmnxQXVHa4LlpG/jNqp/JtKx0ySxH > tqwBOYpTkSxkW4RFHHyFLKi5EzcFyYqikF6j/dI40gpMmUk5pMczRA7E0B/V+Myc > sw3mYtDHEDIjo7tMM4g/3V9chukH/IZT8OcOi4V6p56N2rIGT6ho4fPFpnw+dQ4K > BPGrmSmm92OMpMg1hNlmZrsiIpDLIZtnxJC+hrfMCoRF7enWkITakaMzjqAH+qM= > =bBxa > -----END PGP SIGNATURE----- > > -- > To unsubscribe, send mail to [email protected]. >
From 0e552e7a7a90263032d5f3301d5b299e717d0c42 Mon Sep 17 00:00:00 2001 From: Chris Newton <[email protected]> Date: Sun, 20 Mar 2011 16:20:02 -0600 Subject: [PATCH] Added a restart flag to the exit signal so lua-space can differentiate restart and shutdown. --- awesome.c | 9 +++++---- awesome.h | 4 +++- luaa.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/awesome.c b/awesome.c index 8749ccf..f2beade 100644 --- a/awesome.c +++ b/awesome.c @@ -57,9 +57,10 @@ static char *awesome_argv; /** Call before exiting. */ void -awesome_atexit(void) +awesome_atexit(bool restart) { - signal_object_emit(globalconf.L, &global_signals, "exit", 0); + lua_pushboolean(globalconf.L, restart); + signal_object_emit(globalconf.L, &global_signals, "exit", 1); a_dbus_cleanup(); @@ -276,7 +277,7 @@ exit_on_signal(EV_P_ ev_signal *w, int revents) void awesome_restart(void) { - awesome_atexit(); + awesome_atexit(true); a_exec(awesome_argv); } @@ -571,7 +572,7 @@ main(int argc, char **argv) ev_ref(globalconf.loop); ev_io_stop(globalconf.loop, &xio); - awesome_atexit(); + awesome_atexit(false); return EXIT_SUCCESS; } diff --git a/awesome.h b/awesome.h index 9835aab..bba6591 100644 --- a/awesome.h +++ b/awesome.h @@ -22,8 +22,10 @@ #ifndef AWESOME_AWESOME_H #define AWESOME_AWESOME_H +#include <stdbool.h> + void awesome_restart(void); -void awesome_atexit(void); +void awesome_atexit(bool restart); #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/luaa.c b/luaa.c index fe52c50..c6dfa31 100644 --- a/luaa.c +++ b/luaa.c @@ -87,7 +87,7 @@ luaA_exec(lua_State *L) { const char *cmd = luaL_checkstring(L, 1); - awesome_atexit(); + awesome_atexit(false); a_exec(cmd); return 0; -- 1.7.1
