GtkIMContext must be the first to process keypress events, otherwise you won't be able to enter all characters with some IMs; this is same thing as what GtkEntry and GtkTextView do
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28014 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1097,6 +1097,17 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
|
|||||||
if (g_blockEventsOnDrag)
|
if (g_blockEventsOnDrag)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
if (win->m_imContext)
|
||||||
|
{
|
||||||
|
// In GTK 2.0, we need to hand over the key event to an input method
|
||||||
|
// and the IM will emit a "commit" event containing the actual utf8
|
||||||
|
// character. In that case the EVT_CHAR events will be sent from
|
||||||
|
// there.
|
||||||
|
if ( gtk_im_context_filter_keypress(win->m_imContext, gdk_event) )
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wxKeyEvent event( wxEVT_KEY_DOWN );
|
wxKeyEvent event( wxEVT_KEY_DOWN );
|
||||||
if ( !wxTranslateGTKKeyEventToWx(event, win, gdk_event) )
|
if ( !wxTranslateGTKKeyEventToWx(event, win, gdk_event) )
|
||||||
@@ -1134,20 +1145,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
long key_code;
|
long key_code;
|
||||||
KeySym keysym = gdk_event->keyval;
|
KeySym keysym = gdk_event->keyval;
|
||||||
#ifdef __WXGTK20__
|
|
||||||
// In GTK 2.0, we need to hand over the key event to an input method
|
|
||||||
// and the IM will emit a "commit" event containing the actual utf8
|
|
||||||
// character. In that case the EVT_CHAR events will be sent from
|
|
||||||
// there. But only do it this way for non-KeySym keys.
|
|
||||||
key_code = wxTranslateKeySymToWXKey(gdk_event->keyval, FALSE /* isChar */);
|
|
||||||
if ( !key_code && win->m_imContext )
|
|
||||||
{
|
|
||||||
gtk_im_context_filter_keypress(win->m_imContext, gdk_event );
|
|
||||||
ret = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// Find key code for EVT_CHAR and EVT_CHAR_HOOK events
|
// Find key code for EVT_CHAR and EVT_CHAR_HOOK events
|
||||||
key_code = wxTranslateKeySymToWXKey(keysym, TRUE /* isChar */);
|
key_code = wxTranslateKeySymToWXKey(keysym, TRUE /* isChar */);
|
||||||
if ( !key_code )
|
if ( !key_code )
|
||||||
@@ -1186,7 +1183,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// win is a control: tab can be propagated up
|
// win is a control: tab can be propagated up
|
||||||
if ( !ret &&
|
if ( !ret &&
|
||||||
|
@@ -1097,6 +1097,17 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
|
|||||||
if (g_blockEventsOnDrag)
|
if (g_blockEventsOnDrag)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
if (win->m_imContext)
|
||||||
|
{
|
||||||
|
// In GTK 2.0, we need to hand over the key event to an input method
|
||||||
|
// and the IM will emit a "commit" event containing the actual utf8
|
||||||
|
// character. In that case the EVT_CHAR events will be sent from
|
||||||
|
// there.
|
||||||
|
if ( gtk_im_context_filter_keypress(win->m_imContext, gdk_event) )
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wxKeyEvent event( wxEVT_KEY_DOWN );
|
wxKeyEvent event( wxEVT_KEY_DOWN );
|
||||||
if ( !wxTranslateGTKKeyEventToWx(event, win, gdk_event) )
|
if ( !wxTranslateGTKKeyEventToWx(event, win, gdk_event) )
|
||||||
@@ -1134,20 +1145,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
long key_code;
|
long key_code;
|
||||||
KeySym keysym = gdk_event->keyval;
|
KeySym keysym = gdk_event->keyval;
|
||||||
#ifdef __WXGTK20__
|
|
||||||
// In GTK 2.0, we need to hand over the key event to an input method
|
|
||||||
// and the IM will emit a "commit" event containing the actual utf8
|
|
||||||
// character. In that case the EVT_CHAR events will be sent from
|
|
||||||
// there. But only do it this way for non-KeySym keys.
|
|
||||||
key_code = wxTranslateKeySymToWXKey(gdk_event->keyval, FALSE /* isChar */);
|
|
||||||
if ( !key_code && win->m_imContext )
|
|
||||||
{
|
|
||||||
gtk_im_context_filter_keypress(win->m_imContext, gdk_event );
|
|
||||||
ret = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// Find key code for EVT_CHAR and EVT_CHAR_HOOK events
|
// Find key code for EVT_CHAR and EVT_CHAR_HOOK events
|
||||||
key_code = wxTranslateKeySymToWXKey(keysym, TRUE /* isChar */);
|
key_code = wxTranslateKeySymToWXKey(keysym, TRUE /* isChar */);
|
||||||
if ( !key_code )
|
if ( !key_code )
|
||||||
@@ -1186,7 +1183,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// win is a control: tab can be propagated up
|
// win is a control: tab can be propagated up
|
||||||
if ( !ret &&
|
if ( !ret &&
|
||||||
|
Reference in New Issue
Block a user