NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: ctwm focus on new window?
On Tue, 6 Jun 2023, adr wrote:
hmm... by the nature of xorg and looking at the code of ctwm this
looks unachievable. It would be easy to add an option like MapToFocus
so all new mapped windows get focus (and grab the pointer). That's
the behaviour already when ClickToFocus is set and the window wants
input (A similar behaviour occurs with transient windows when
AutoFousToTransients is set). The window should also grab the
pointer to not lose focus, for example moving it using the keyboard
when ClicToFocus is not set.
This patch does that, if someone wants to try it.
==================================================
diff -ur usr/xsrc/external/mit/ctwm/dist/ctwm_main.c /usr/xsrc/external/mit/ctwm/dist/ctwm_main.c
--- usr/xsrc/external/mit/ctwm/dist/ctwm_main.c 2021-04-11 09:36:52.000000000 +0100
+++ /usr/xsrc/external/mit/ctwm/dist/ctwm_main.c 2023-06-07 02:33:34.572100881 +0100
@@ -1074,6 +1074,7 @@
scr->StayUpMenus = false;
scr->WarpToDefaultMenuEntry = false;
scr->ClickToFocus = false;
+ scr->MapToFocus = false;
scr->SloppyFocus = false;
scr->SaveWorkspaceFocus = false;
scr->NoIconTitlebar = false;
diff -ur usr/xsrc/external/mit/ctwm/dist/event_handlers.c /usr/xsrc/external/mit/ctwm/dist/event_handlers.c
--- usr/xsrc/external/mit/ctwm/dist/event_handlers.c 2021-04-11 09:36:52.000000000 +0100
+++ /usr/xsrc/external/mit/ctwm/dist/event_handlers.c 2023-06-07 02:53:24.600649543 +0100
@@ -2020,6 +2020,9 @@
Tmp_win->wmhints->input) {
SetFocus(Tmp_win, CurrentTime);
}
+ if(Scr->MapToFocus && Tmp_win->wmhints->input) {
+ WarpToWindow(Tmp_win, true);
+ }
break;
case InactiveState:
diff -ur usr/xsrc/external/mit/ctwm/dist/parse_be.c /usr/xsrc/external/mit/ctwm/dist/parse_be.c
--- usr/xsrc/external/mit/ctwm/dist/parse_be.c 2021-04-11 09:36:52.000000000 +0100
+++ /usr/xsrc/external/mit/ctwm/dist/parse_be.c 2023-06-07 02:37:27.498039084 +0100
@@ -128,6 +128,7 @@
#define kw0_GrabServer 76
#define kw0_DontNameDecorations 77
#define kw0_StrictWinNameEncoding 78
+#define kw0_MapToFocus 79
#define kws_UsePPosition 1
#define kws_IconFont 2
@@ -326,6 +327,7 @@
{ "lock", LOCK, 0 },
{ "m", META, 0 },
{ "maketitle", MAKE_TITLE, 0 },
+ { "maptofocus", KEYWORD, kw0_MapToFocus },
{ "mapwindowbackground", CLKEYWORD, kwcl_MapWindowBackground },
{ "mapwindowcurrentworkspace", MAPWINDOWCURRENTWORKSPACE, 0},
{ "mapwindowdefaultworkspace", MAPWINDOWDEFAULTWORKSPACE, 0},
@@ -788,6 +790,10 @@
Scr->ClickToFocus = true;
return true;
+ case kw0_MapToFocus:
+ Scr->MapToFocus = true;
+ return true;
+
case kw0_ReallyMoveInWorkspaceManager:
Scr->ReallyMoveInWorkspaceManager = true;
return true;
diff -ur usr/xsrc/external/mit/ctwm/dist/screen.h /usr/xsrc/external/mit/ctwm/dist/screen.h
--- usr/xsrc/external/mit/ctwm/dist/screen.h 2021-04-11 11:11:58.000000000 +0100
+++ /usr/xsrc/external/mit/ctwm/dist/screen.h 2023-06-07 02:38:16.774530269 +0100
@@ -879,6 +879,7 @@
bool StayUpMenus; ///< StayUpMenus config var
bool WarpToDefaultMenuEntry; ///< WarpToDefaultMenuEntry config var
bool ClickToFocus; ///< ClickToFocus config var
+ bool MapToFocus; ///< MapToFocus config var
bool SloppyFocus; ///< SloppyFocus config var
bool SaveWorkspaceFocus; ///< SaveWorkspaceFocus config var
bool NoIconManagers; ///< NoIconManagers config var
Home |
Main Index |
Thread Index |
Old Index