Sent this to Bram instead of the list accidentally; forwarding.

---------- Forwarded message ----------
From: Matt Wozniski <[EMAIL PROTECTED]>
Date: Mon, Feb 25, 2008 at 4:02 PM
Subject: Re: Mapping <s-space> with GTK2 (was "write 'set t_Co=256',
scroll and keybind problems")
To: Bram Moolenaar <[EMAIL PROTECTED]>


On Mon, Feb 25, 2008 at 3:26 PM, Bram Moolenaar wrote:

>
 >  Matt Wozniski wrote:
 >
 >  > I'm attaching a patch that fixes mapping <s-space> for me, and (for a
 >  > quick test, though I'm not a heavy XIM user) doesn't seem to break
 >  > anything.  All it does is checks if the keycode is "space" and and
 >  > "shift" is pressed, fake a response from XIM saying that it can't
 >  > handle the key.  This seems safe to do, since if the user pressed
 >  > <s-space> when he could have just pressed <space> to insert the same
 >  > character, he was obviously trying to give a special keypress to vim,
 >  > not to XIM.
 >
 >  Note that S-Space is often used to activate XIM.  Better have this patch
 >  checked by some heavy users of XIM to check for any side effects.  Input
 >  Methods are always tricky.

 Yes, but in the particular case of vim compiled with +gui_gtk2, +xim,
 and +hangul_input, we see...

 #ifdef FEAT_XIM
    if (xim_queue_key_press_event(event, TRUE))
        return TRUE;
 #endif

 #ifdef FEAT_HANGULIN
    if (key_sym == GDK_space && (state & GDK_SHIFT_MASK))
    {
        hangul_input_state_toggle();
        return TRUE;
    }
 #endif

 xim_queue_key_press_event() will consume a shift-space in the default
 GTK2 IM, even though there is no activation key, and there is no way
 to hit the hangul_input_state_toggle() command without changing to an
 input method that doesn't consume shift-space (if there even is one, I
 only played around with a few so far, and they all consumed
 shift-space.)  That behavior can not be considered correct by any
 stretch.

 That being said, if the GTK2 IMs can be set to use shift-space as an
 activation key, my patch is a bit wrong.  It just means that we should
 make sure that (keyval != im_activatekey_keyval || state !=
 im_activatekey_state) in addition to (keyval == GDK_SPACE && state ==
 GDK_SHIFT_MASK), and probably have the entire thing inside an #ifdef
 FEAT_GUI_GTK2/#endif (I misread last night thinking that the whole
 function already was).  Apart from ensuring that we only do this for
 GTK2 GUI's, and that we only do it if shift-space is not the activate
 key, I can't see any way that this could make things worse.

 ~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui