From 61c219008206e14cca53cf66675a029d417530e3 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Wed, 22 Sep 1999 16:27:50 +0000 Subject: [PATCH] Wed Sep 22 09:33:27 PDT 1999 (Raster) fix the focus fixup - shoudl let focus change as per before AND fix up transient focus errors too... i hope.. needs some testing. added "set focus to logout are you ssure" dialog and make sure it accepts the standard retrun/escape keybindings for "yes/no" like the settings dialogs do. SVN revision: 365 --- src/ChangeLog | 11 +++++++++++ src/borders.c | 2 +- src/focus.c | 22 +++++++--------------- src/session.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ae296429..3631e86e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2159,3 +2159,14 @@ Tue Sep 21 23:17:24 PDT 1999 (Raster) only allow one "default group settings" configuration dialog at a time + +------------------------------------------------------------------------------- + +Wed Sep 22 09:33:27 PDT 1999 +(Raster) + +fix the focus fixup - shoudl let focus change as per before AND fix up +transient focus errors too... i hope.. needs some testing. + +added "set focus to logout are you ssure" dialog and make sure it accepts the +standard retrun/escape keybindings for "yes/no" like the settings dialogs do. diff --git a/src/borders.c b/src/borders.c index 6f07d7d9..c20ebf82 100644 --- a/src/borders.c +++ b/src/borders.c @@ -1423,7 +1423,7 @@ CreateEwin() XChangeWindowAttributes(disp, ewin->win_container, CWEventMask | CWDontPropagate, &att); EMapWindow(disp, ewin->win_container); - if (mode.focusmode == FOCUS_CLICK) + if ((mode.clickalways) || (mode.focusmode == FOCUS_CLICK)) XGrabButton(disp, AnyButton, 0, ewin->win_container, False, ButtonPressMask, GrabModeSync, GrabModeAsync, None, None); diff --git a/src/focus.c b/src/focus.c index 1fcf002a..eb0abcc4 100644 --- a/src/focus.c +++ b/src/focus.c @@ -14,26 +14,18 @@ FixUpBadFocus(int val, void *data) if (mode.focusmode == FOCUS_CLICK) return; XGetInputFocus(disp, &win, &revert); - ewin = GetEwinPointerInClient(); - if ((!ewin) && (mode.focusmode = FOCUS_POINTER)) - { - ewin = FindItem("", win, LIST_FINDBY_ID, LIST_TYPE_EWIN); - if (ewin) - { - XSetInputFocus(disp, root.win, RevertToPointerRoot, CurrentTime); - mode.focuswin = NULL; - mode.realfocuswin = NULL; - mode.context_ewin = NULL; - if (mode.kde_support) - KDE_UpdateFocusedWindow(); - } - return; - } + ewin = FindItem("", win, LIST_FINDBY_ID, LIST_TYPE_EWIN); if (ewin) { if (win != ewin->client.win) XSetInputFocus(disp, ewin->client.win, RevertToPointerRoot, CurrentTime); + mode.focuswin = NULL; + mode.realfocuswin = NULL; + mode.context_ewin = NULL; + if (mode.kde_support) + KDE_UpdateFocusedWindow(); } + return; val = 0; data = NULL; } diff --git a/src/session.c b/src/session.c index 0e31a32b..ceed06f2 100644 --- a/src/session.c +++ b/src/session.c @@ -470,6 +470,14 @@ LogoutCB(int val, void *data) data = NULL; } +static void CB_SettingsEscape(int val, void *data); +static void +CB_SettingsEscape(int val, void *data) +{ + DialogClose((Dialog *) data); + val = 0; +} + /* This is the original code from actions.c(doExit). */ void doSMExit(void *params) @@ -584,6 +592,7 @@ doSMExit(void *params) else if (!strcmp(s, "logout")) { Dialog *d; + EWin *ewin; AUDIO_PLAY("SOUND_LOGOUT"); d = CreateDialog("LOGOUT_DIALOG"); @@ -597,7 +606,12 @@ doSMExit(void *params) ); DialogAddButton(d, " Yes, Log Out ", LogoutCB, 1); DialogAddButton(d, " No ", NULL, 1); + DialogBindKey(d, "Escape", CB_SettingsEscape, 0, d); + DialogBindKey(d, "Return", LogoutCB, 0, d); ShowDialog(d); + ewin = FindEwinByDialog(d); + if (ewin) + FocusToEWin(ewin); return; } } @@ -1077,6 +1091,14 @@ SaveSession(int shutdown) } } +static void CB_SettingsEscape(int val, void *data); +static void +CB_SettingsEscape(int val, void *data) +{ + DialogClose((Dialog *) data); + val = 0; +} + /* * Normally, the SM will throw away all the session data for a client * that breaks its connection unexpectedly. In order to avoid this we @@ -1163,6 +1185,7 @@ doSMExit(void *params) else if (!strcmp(s, "logout")) { Dialog *d; + EWin *ewin; d = CreateDialog("LOGOUT_DIALOG"); DialogSetTitle(d, "Are you sure?"); @@ -1175,7 +1198,12 @@ doSMExit(void *params) ); DialogAddButton(d, " Yes, Log Out ", LogoutCB, 1); DialogAddButton(d, " No ", NULL, 1); + DialogBindKey(d, "Escape", CB_SettingsEscape, 1, d); + DialogBindKey(d, "Return", LogoutCB, 0, d); ShowDialog(d); + ewin = FindEwinByDialog(d); + if (ewin) + FocusToEWin(ewin); return; } else if (!strcmp(s, "restart_wm"))