1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-30 02:12:30 +01:00

Allow exit panel to be bound to a key shortcut

While debugging the save/restore workspace state, I found quite
useful to be able to exit windowmaker using a key shortcut.
This commit is contained in:
David Maciejak
2023-02-19 12:10:08 +08:00
committed by Carlos R. Mafra
parent 630e9292c2
commit fabd4252ab
8 changed files with 59 additions and 37 deletions

View File

@@ -53,6 +53,7 @@
#include "xmodifier.h"
#include "main.h"
#include "event.h"
#include "shutdown.h"
#define ICON_SIZE wPreferences.icon_size
@@ -679,6 +680,46 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
return NULL;
}
void ExecuteExitCommand(WScreen *scr, long quickmode)
{
static int inside = 0;
int result;
/* prevent reentrant calls */
if (inside)
return;
inside = 1;
#define R_CANCEL 0
#define R_EXIT 1
result = R_CANCEL;
if (quickmode == M_QUICK) {
result = R_EXIT;
} else {
int r, oldSaveSessionFlag;
oldSaveSessionFlag = wPreferences.save_session_on_exit;
r = wExitDialog(scr, _("Exit"),
_("Are you sure you want to quit Window Maker?"), _("Exit"), _("Cancel"), NULL);
if (r == WAPRDefault) {
result = R_EXIT;
} else if (r == WAPRAlternate) {
/* Don't modify the "save session on exit" flag if the
* user canceled the operation. */
wPreferences.save_session_on_exit = oldSaveSessionFlag;
}
}
if (result == R_EXIT)
Shutdown(WSExitMode);
#undef R_EXIT
#undef R_CANCEL
inside = 0;
}
void ExecuteInputCommand(WScreen *scr, const char *cmdline)
{
char *cmd;