diff --git a/include/wx/x11/private.h b/include/wx/x11/private.h index 303f28a8ee..e2ae2945e7 100644 --- a/include/wx/x11/private.h +++ b/include/wx/x11/private.h @@ -58,7 +58,7 @@ extern bool wxAddClientWindowToTable(Window w, wxWindow *win); // TranslateXXXEvent() functions - translate X event to wxWindow one // ---------------------------------------------------------------------------- extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, XEvent *xevent); -extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window window, XEvent *xevent); +extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window window, XEvent *xevent, bool isAscii = FALSE); extern Window wxGetWindowParent(Window window); diff --git a/samples/text/text.cpp b/samples/text/text.cpp index 9aaa7d1d95..ef899cfae0 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -1183,7 +1183,7 @@ void MyFrame::OnFileSave(wxCommandEvent& event) wxLogStatus(this, _T("Successfully saved file (text len = %lu, file size = %ld)"), (unsigned long)m_panel->m_textrich->GetValue().length(), - file.Length()); + (long) file.Length()); #endif } else diff --git a/src/x11/app.cpp b/src/x11/app.cpp index a56fb706b3..fbbbdd1d50 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -593,6 +593,9 @@ bool wxApp::ProcessXEvent(WXEvent* _event) return TRUE; keyEvent.SetEventType(wxEVT_CHAR); + // Do the translation again, retaining the ASCII + // code. + wxTranslateKeyEvent(keyEvent, win, window, event, TRUE); if (win->GetEventHandler()->ProcessEvent( keyEvent )) return TRUE; diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 0b26998fbe..8ee15a5f5d 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -1514,7 +1514,7 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, return FALSE; } -bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window WXUNUSED(win), XEvent *xevent) +bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window WXUNUSED(win), XEvent *xevent, bool isAscii) { switch (XEventGetType(xevent)) { @@ -1527,8 +1527,10 @@ bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window WXUNUSED(win (void) XLookupString ((XKeyEvent *) xevent, buf, 20, &keySym, NULL); int id = wxCharCodeXToWX (keySym); // id may be WXK_xxx code - these are outside ASCII range, so we - // can't just use toupper() on id - if (id >= 'a' && id <= 'z') + // can't just use toupper() on id. + // Only change this if we want the raw key that was pressed, + // and don't change it if we want an ASCII value. + if (!isAscii && (id >= 'a' && id <= 'z')) { id = id + 'A' - 'a'; }