Thanks very much for this:

[first message]
> To see that this is so, change
>
>   XSetInputFocus (dpy, w, RevertToPointerRoot, tim);
>
> in function SetFocus in file util.c to
>
>   if(tmp_win && tmp_win->full_name != "npviewer.bin")
>     XSetInputFocus (dpy, w, RevertToPointerRoot, tim);
>
> (Also, add "npviewer.bin" to the "NoBorder" and "AlwaysOnTop"
> lists in your .ctwmrc file, and add a specification of
>
>   "npviewer.bin"  "+0+0"
>
> to the "WindowGeometries" list.)  Then, flash fullscreen should
> not be a problem anymore.

[Second message:]
>
> >   if(tmp_win && tmp_win->full_name != "npviewer.bin")
> >     XSetInputFocus (dpy, w, RevertToPointerRoot, tim);
>
> Sorry.  I take back what I just said.  The above works
> because it is essentially an implementation of sloppy focus,
> since focus is not being given back to the root window
> (when tmp_window is NULL).
>
> What happens is that after the fullscreen window has been
> realized, the focus is subsequently given back to root
> (SetFocus is called with tmp_win set to NULL).  This happens
> from function HandleLeaveNotify, where it says "pretend there
> was a focus out".  Any idea why this is there?  If I comment
> out that call to SetFocus, flash fullscreen works without any
> other changes, and everything (so far) seems to work as before.


I used the change in the second message, and it works. Amazing!

So I can now abandon openbox and go back to ctwm.

However, I had to do some extra work to make the keyboard work as it
did previously.

After the change I could not get keyboard focus back to root if I
moved (using keyboard) from a window running a newly opened web page
in firefox (or opera) in one workspace to an empty adjacent
workspace. In my .ctwmrc I had

   # Use control key plus left or right arrow to go to next or previous
   # workspace (next and previous in the order listed in workspace definitions.)
   "Left"  =  c    : all   : f.prevworkspace
   "Right" =  c    : all   : f.nextworkspace

This makes it easy for me to move through workspaces (treated as a
linear list) going left or right, using CTRL+Left or CTRL+Right. I
also had

"F1"    =       : r     : ! "xterm  -sb -sl 500 -j  -geometry 105x49+0+0&"

I.e. with focus in root, key F1 starts an xterm window. I use that
many times a day.

But after the edit I found that if if I used Ctrl+Left or Ctrl+Right
to move out of a workspace containing firefox or opera into an empty
workspace that is empty, no keyboard functions worked.

So after such a move into an empty workspace, I could not move to
the next workspace, or use F1 to start an xterm though I could use
the mouse, which I prefer not to do. In particular if I moved the
mouse into and out of the workspace manager or iconmanager then
those keyboard functions worked again. So I assume the change cased
keyboard focus to be left in the wrong place after moving from a
workspace running a newly opened web site in firefox (or opera) to
an empty workspace.

I managed to fix this by changing my move commands. Instead of
calling the two built in functions directly I defined two new
functions, using f.unfocus to restore focus to the root in an empty
window after the move.

    Function "GoLEFT"
    { f.prevworkspace
      f.unfocus
    }

    Function "GoRIGHT"
    { f.nextworkspace
      f.unfocus
    }

Then:

    "Left"  =  c    : all   : f.function "GoLEFT"
    "Right" =  c    : all   : f.function "GoRIGHT"

There may be other things I have not tested that would also need to
be changed.

I don't know whether it would be better to have a built in option to
cause f.prevworkspace and f.nextworkspace and similar functions to
unset focus directly.

Anyhow, thanks for the fix: I'll be very glad to be back to using
ctwm instead of openbox, not least because it seems to use less
power on my laptop than openbox does, when it is running on battery.

Aaron
http://www.cs.bham.ac.uk/~axs

Reply via email to