X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a5b274d7fc1f9a06e6580da294c7ee15777e7521..5335e9c406f59fa71910e919bd4e6fa4b9a82706:/src/stc/stc.cpp.in?ds=sidebyside diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 702062aa61..e07f6d5194 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -17,8 +17,8 @@ #include -#include "wx/stc/stc.h" -#include "ScintillaWX.h" +#define Point macPoint // These names are also defined by some mac headers so +#define Style macStyle // change their names, and then undef before we need them #include #include @@ -26,6 +26,11 @@ #include #include +#undef Point +#undef Style + +#include "wx/stc/stc.h" +#include "ScintillaWX.h" //---------------------------------------------------------------------- @@ -179,6 +184,9 @@ void wxStyledTextCtrl::Create(wxWindow *parent, #endif SetBestFittingSize(size); + + // Reduces flicker on GTK+/X11 + SetBackgroundStyle(wxBG_STYLE_CUSTOM); } @@ -526,7 +534,7 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) { void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { - // On (some?) non-US keyboards the AltGr key is required to enter some + // On (some?) non-US PC keyboards the AltGr key is required to enter some // common characters. It comes to us as both Alt and Ctrl down so we need // to let the char through in that case, otherwise if only ctrl or only // alt let's skip it. @@ -541,32 +549,38 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { #endif bool skip = ((ctrl || alt) && ! (ctrl && alt)); - int key = evt.GetKeyCode(); - -// printf("OnChar key:%%d consumed:%%d ctrl:%%d alt:%%d skip:%%d\n", -// key, m_lastKeyDownConsumed, ctrl, alt, skip); - - if ( (key <= WXK_START || key > WXK_COMMAND) && - !m_lastKeyDownConsumed && !skip) { - m_swx->DoAddChar(key); - return; + if (!m_lastKeyDownConsumed && !skip) { +#if wxUSE_UNICODE + int key = evt.GetUnicodeKey(); + bool keyOk = true; + + // if the unicode key code is not really a unicode character (it may + // be a function key or etc., the platforms appear to always give us a + // small value in this case) then fallback to the ascii key code but + // don't do anything for function keys or etc. + if (key <= 127) { + key = evt.GetKeyCode(); + keyOk = (key <= 127); + } + if (keyOk) { + m_swx->DoAddChar(key); + return; + } +#else + int key = evt.GetKeyCode(); + if (key <= WXK_START || key > WXK_COMMAND) { + m_swx->DoAddChar(key); + return; + } +#endif } + evt.Skip(); } void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { - int key = evt.GetKeyCode(); - bool shift = evt.ShiftDown(), - ctrl = evt.ControlDown(), - alt = evt.AltDown(), - meta = evt.MetaDown(); - - int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, meta, &m_lastKeyDownConsumed); - -// printf("KeyDn key:%%d shift:%%d ctrl:%%d alt:%%d processed:%%d consumed:%%d\n", -// key, shift, ctrl, alt, processed, m_lastKeyDownConsumed); - + int processed = m_swx->DoKeyDown(evt, &m_lastKeyDownConsumed); if (!processed && !m_lastKeyDownConsumed) evt.Skip(); }