Subject: FVWM: VNC

From: John Carol Langford <[email-masked]>
Date: Wed, 16 Jun 1999 19:38:50 -0400

I've been playing with VNC (http://www.uk.research.att.com/vnc/)
lately and ran into a context switching problem.

The basic problem is that fvwm captures key events that you would like
to pass to VNC and the fvwm running for the Xvnc server.  For example,
if you have:

Key F4          A       M       Destroy

and do an alt-F4 over the vnc window, you will destroy the vnc window.
Instead, I'd like to have the alt-F4 passed into the VNC window where
the fvwm running on the Xvnc server can be commanded to destroy a
window.

Does anyone have a good solution to this?

I'd like to not arrange to have different command sets for the
internal and external fvwms - it becomes too confusing.

I messed with the code of void HandleKeyPress() to make it pass
events to the vnc window directly like so:

  if (Tmp_win && Tmp_win->frame_width == 1284 ) 
     /*my quick little hack to test if the window is a vnc window*/;
  else 
    for (key = Scr.AllBindings; key != NULL; key = key->NextBinding)
      {
	if ((key->Button_Key == Event.xkey.keycode) &&
	    ((key->Modifier == (modifier&(~LockMask)))||
	     (key->Modifier == AnyModifier)) &&
	    (key->Context & Context)&&
	    (key->IsMouse == 0))
	  {
	    ExecuteFunction(key->Action,Tmp_win, &Event,Context,-1);
	    return;
	  }
    }
  
  /* if we get here, no function key was bound to the key.  Send it
   * to the client if it was in a window we know about.
   */

This doesn't quite work.  It appears to pass an 'Alt' fine but not an
'Alt+F4'.  I suspect I don't fully understand the fvwm event model.
Any ideas?

-John
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Brad Giaccio <[email-masked]>
Date: Wed, 16 Jun 1999 21:09:40 -0400

Well unfortunatelly a while back I tried a code fix to this as well and
had equally poor results, and I do have a pretty good understanding of
the event model.

What I did find works is if I hit Num Lock on, all my bindings seem to
get passed through to the vnc window, instead of the external fvwm.  I
never figured out why it worked, but then again I didn't want to start
messing with it and have it break.  So try num lock and let me know if
it works for you as well.

Brad

On Wed, Jun 16, 1999 at 07:38:50PM -0400, John Carol Langford wrote:

> I messed with the code of void HandleKeyPress() to make it pass events
> to the vnc window directly like so:
>
>   if (Tmp_win && Tmp_win->frame_width == 1284 ) /*my quick little
>   hack to test if the window is a vnc window*/; else for (key
>   = Scr.AllBindings; key != NULL; key = key->NextBinding) { if
>   ((key->Button_Key == Event.xkey.keycode) && ((key->Modifier
>   == (modifier&(~LockMask)))|| (key->Modifier == AnyModifier))
>   && (key->Context & Context)&& (key->IsMouse == 0)) {
>   ExecuteFunction(key->Action,Tmp_win, &Event,Context,-1); return; } }
>
>   /* if we get here, no function key was bound to the key.  Send it *
>   to the client if it was in a window we know about. */
>

-- 
--- There are two kinds of knowledge, you either know the answer or
			you know where to find it
		      -Kane, Johnson, and anonymous
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: John Carol Langford <[email-masked]>
Date: Wed, 16 Jun 1999 21:57:31 -0400

>it works for you as well.

Cool.  Seems to work for me.  I bet what's happening is that
numlock-on/numlock-off counts as a 'hyper key' for X purposes.
Consequently, when the numlock is on, your normal control/meta/shift
combinations don't work because they also have the "numlock-on" bit
set.  Since the combination doesn't trigger an action, it's passed on
to the underlying window.  This all makes sense except it doesn't
account for why the internal fvwm ignores the numlock.  hmmm..

Anyway, thanks for the tip.

-John

---

From: Brad Giaccio <[email-masked]>
Date: Thu, 17 Jun 1999 07:49:45 -0400

On Wed, Jun 16, 1999 at 09:57:31PM -0400, John Carol Langford wrote:
> This all makes sense except it doesn't account for why the internal
> fvwm ignores the numlock. hmmm..
>

That was exactlly by thought, I know Num Lock does count as a modifier
but I couldn't figure out why the internal was stripping it either.  My
only thought was that maybe VNC strips it off, as part of there Windoze
support.

Glad to here that it worked though.

Brad