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:
On Tue, 6 Jun 2023, Rhialto wrote:
ctwm is also in pkgsrc and that version is newer.
If you change some code and make it nicely optional (personally I think
it is far too dangerous if new windows take the focus away from wherever
it is: what if you're in the middle of typing a password?) it could be
merged upstream.

Yes, the idea is to give focus and move the pointer to the newly
created window by a keybinding. I think that is a reasonable
behaviour.

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.

event_handlers.c
================
[...]
void HandleMapRequest(void)
{
[...]
witch(state) {
            case DontCareState:
            case NormalState:
            case ZoomState:
                if(Tmp_win->StartSqueezed) {
                    Squeeze(Tmp_win);
                }
                else {
                    XMapWindow(dpy, Tmp_win->w);
                }
                XMapWindow(dpy, Tmp_win->frame);
                SetMapStateProp(Tmp_win, NormalState);
                SetRaiseWindow(Tmp_win);
                Tmp_win->mapped = true;
                if(Scr->ClickToFocus && Tmp_win->wmhints->input) {
                    SetFocus(Tmp_win, CurrentTime);
                }
                /* kai */
                if(Scr->AutoFocusToTransients &&
                                Tmp_win->istransient &&
                                Tmp_win->wmhints->input) {
                    SetFocus(Tmp_win, CurrentTime);
                }
                break;
================

There are other things that make using the keyboard unconfortable,
for example selecting a window in TwmAllWindows menu, the window
is raised but not focus. Maybe use Return to rise it and grab focus
and pointer, rigth cursor to only rise it?

I'll think about all this and maybe share it upstream.

adr


Home | Main Index | Thread Index | Old Index