X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c6896d71102174e20e8ea4367d3f2e80fbb7045..c893f25d86ce00a0f5fc0a37a18e41d487a014fb:/src/gtk1/window.cpp diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index a148d6e60d..c823a1b56f 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1009,6 +1009,12 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, } s_lastKeyPress = { 0, 0 }; KeySym keysym = gdk_event->keyval; + + wxLogTrace(TRACE_KEYS, _T("Key %s event: keysym = %d"), + event.GetEventType() == wxEVT_KEY_UP ? _T("release") + : _T("press"), + keysym); + long key_code = wxTranslateKeySymToWXKey(keysym, FALSE /* !isChar */); if ( !key_code ) @@ -1034,6 +1040,9 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, // and then back but always using the lower register Display *dpy = (Display *)wxGetDisplay(); KeyCode keycode = XKeysymToKeycode(dpy, keysym); + + wxLogTrace(TRACE_KEYS, _T("\t-> keycode %d"), keycode); + KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0); // use the normalized, i.e. lower register, keysym if we've @@ -1071,10 +1080,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, } } - wxLogTrace(TRACE_KEYS, _T("Key %s event: keysym = %d => keycode = %ld"), - event.GetEventType() == wxEVT_KEY_UP ? _T("release") - : _T("press"), - gdk_event->keyval, key_code); + wxLogTrace(TRACE_KEYS, _T("\t-> wxKeyCode %d"), key_code); // sending unknown key events doesn't really make sense if ( !key_code ) @@ -1156,12 +1162,12 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, { if ( gdk_event->length == 1 ) { - key_code = gdk_event->string[0]; + key_code = (unsigned char)gdk_event->string[0]; } - else if ((keysym & 0xFF) == keysym) + else if ( wxIsAsciiKeysym(keysym) ) { // ASCII key - key_code = (guint)keysym; + key_code = (unsigned char)keysym; } }