Use IME in wxGTK wxComboBox too

There was confusing with the method GTKIMFilterKeypress() in wxGTK
wxTextEntry: it was called the same as wxWindow virtual method of the
same name, but didn't override it, of course, as wxTextEntry doesn't
derive from wxWindow.

It also wasn't called for wxComboBox which inherited from wxTextEntry
but didn't override wxWindow::GTKIMFilterKeypress() to actually call its
method.

Fix this and rename the wxTextEntry to use a different name for clarity.
This commit is contained in:
Vadim Zeitlin
2019-07-09 19:37:21 +02:00
parent 5c766c0b8b
commit 958df5fb74
3 changed files with 8 additions and 3 deletions

View File

@@ -145,6 +145,10 @@ protected:
virtual GtkEntry *GetEntry() const wxOVERRIDE virtual GtkEntry *GetEntry() const wxOVERRIDE
{ return m_entry; } { return m_entry; }
virtual int GTKIMFilterKeypress(GdkEventKey* event) const wxOVERRIDE
{ return GTKEntryIMFilterKeypress(event); }
GtkEntry* m_entry; GtkEntry* m_entry;
private: private:

View File

@@ -91,8 +91,9 @@ protected:
virtual bool DoAutoCompleteStrings(const wxArrayString& choices) wxOVERRIDE; virtual bool DoAutoCompleteStrings(const wxArrayString& choices) wxOVERRIDE;
virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) wxOVERRIDE; virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) wxOVERRIDE;
// Override the base class method to use GtkEntry IM context. // Call this from the overridden wxWindow::GTKIMFilterKeypress() to use
virtual int GTKIMFilterKeypress(GdkEventKey* event) const; // GtkEntry IM context.
int GTKEntryIMFilterKeypress(GdkEventKey* event) const;
static int GTKGetEntryTextLength(GtkEntry* entry); static int GTKGetEntryTextLength(GtkEntry* entry);

View File

@@ -862,7 +862,7 @@ void wxTextEntry::ForceUpper()
// IM handling // IM handling
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
int wxTextEntry::GTKIMFilterKeypress(GdkEventKey* event) const int wxTextEntry::GTKEntryIMFilterKeypress(GdkEventKey* event) const
{ {
int result = false; int result = false;
#if GTK_CHECK_VERSION(2, 22, 0) #if GTK_CHECK_VERSION(2, 22, 0)