aboutsummaryrefslogtreecommitdiff
path: root/src/root.c
diff options
context:
space:
mode:
authorJohn Ankarstrom <john@ankarstrom.se>2021-06-30 20:01:38 +0200
committerJohn Ankarstrom <john@ankarstrom.se>2021-06-30 20:01:38 +0200
commit0d1af7a8c8e163250e940833d646a12852aa9e5b (patch)
tree4390dc3979aa499c1dc357ef7bd0e8a19f88e7b3 /src/root.c
parent5bca4a0a26f89c70357fbbbe13ad1fe9d3b07b24 (diff)
downloadjwm-0d1af7a8c8e163250e940833d646a12852aa9e5b.tar.gz
Associate 'confirm' value with each individual Exit menu item
Previously, the 'confirm' property would set a global value, controlling the behavior of all exits.
Diffstat (limited to 'src/root.c')
-rw-r--r--src/root.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/root.c b/src/root.c
index b110018..13f85e6 100644
--- a/src/root.c
+++ b/src/root.c
@@ -18,7 +18,6 @@
#define ROOT_MENU_COUNT 10
static Menu *rootMenu[ROOT_MENU_COUNT];
-static int showExitConfirmation = 1;
static void ExitHandler(ClientNode *np);
static void PatchRootMenu(Menu *menu);
@@ -131,12 +130,6 @@ void SetRootMenu(const char *indexes, Menu *m) {
/***************************************************************************
***************************************************************************/
-void SetShowExitConfirmation(int v) {
- showExitConfirmation = v;
-}
-
-/***************************************************************************
- ***************************************************************************/
int IsRootMenuDefined(int index) {
if(index >= 0 && index < ROOT_MENU_COUNT && rootMenu[index]) {
return 1;
@@ -228,8 +221,8 @@ void Restart() {
/***************************************************************************
***************************************************************************/
-void Exit() {
- if(showExitConfirmation) {
+void Exit(int confirm) {
+ if(confirm) {
ShowConfirmDialog(NULL, ExitHandler,
"Exit JWM",
"Are you sure?",
@@ -251,12 +244,19 @@ void RunRootCommand(const MenuAction *action) {
case MA_RESTART:
Restart();
break;
+ case MA_EXIT_NOW:
+ if(exitCommand) {
+ Release(exitCommand);
+ }
+ exitCommand = CopyString(action->data.str);
+ Exit(0);
+ break;
case MA_EXIT:
if(exitCommand) {
Release(exitCommand);
}
exitCommand = CopyString(action->data.str);
- Exit();
+ Exit(1);
break;
case MA_DESKTOP:
ChangeDesktop(action->data.i);