X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/afa9873106ea8e6ee90f8811bae4d06485e42ba6..12bb29f5432174ecbd65549bda832d70d34a98ae:/src/gtk/window.cpp?ds=sidebyside diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index a264041af7..e6d8aeba8a 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -961,7 +961,7 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), int command = ancestor->GetAcceleratorTable()->GetCommand( event ); if (command != -1) { - wxCommandEvent menu_event( wxEVT_COMMAND_MENU_SELECTED, command ); + wxCommandEvent menu_event( wxEVT_MENU, command ); ret = ancestor->HandleWindowEvent( menu_event ); if ( !ret ) @@ -969,7 +969,7 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), // if the accelerator wasn't handled as menu event, try // it as button click (for compatibility with other // platforms): - wxCommandEvent button_event( wxEVT_COMMAND_BUTTON_CLICKED, command ); + wxCommandEvent button_event( wxEVT_BUTTON, command ); ret = ancestor->HandleWindowEvent( button_event ); } @@ -1069,24 +1069,32 @@ static void gtk_wxwindow_commit_cb (GtkIMContext * WXUNUSED(context), const gchar *str, wxWindow *window) +{ + // Ignore the return value here, it doesn't matter for the "commit" signal. + window->GTKDoInsertTextFromIM(str); +} +} + +bool wxWindowGTK::GTKDoInsertTextFromIM(const char* str) { wxKeyEvent event( wxEVT_CHAR ); // take modifiers, cursor position, timestamp etc. from the last // key_press_event that was fed into Input Method: - if (window->m_imKeyEvent) + if ( m_imKeyEvent ) { - wxFillOtherKeyEventFields(event, window, window->m_imKeyEvent); + wxFillOtherKeyEventFields(event, this, m_imKeyEvent); } else { - event.SetEventObject( window ); + event.SetEventObject(this); } const wxString data(wxGTK_CONV_BACK_SYS(str)); if( data.empty() ) - return; + return false; + bool processed = false; for( wxString::const_iterator pstr = data.begin(); pstr != data.end(); ++pstr ) { #if wxUSE_UNICODE @@ -1100,9 +1108,22 @@ gtk_wxwindow_commit_cb (GtkIMContext * WXUNUSED(context), AdjustCharEventKeyCodes(event); - window->HandleWindowEvent(event); + if ( HandleWindowEvent(event) ) + processed = true; } + + return processed; } + +bool wxWindowGTK::GTKOnInsertText(const char* text) +{ + if ( !m_imKeyEvent ) + { + // We're not inside IM key handling at all. + return false; + } + + return GTKDoInsertTextFromIM(text); } @@ -1628,6 +1649,7 @@ window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win) // FIXME: Get these values from GTK or GDK event.m_linesPerAction = 3; + event.m_columnsPerAction = 3; event.m_wheelDelta = 120; // Determine the scroll direction. @@ -1903,6 +1925,12 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxWindow* win) if (w < 0) w = 0; if (h < 0) h = 0; } + GtkAllocation a; + gtk_widget_get_allocation(win->m_widget, &a); + // update position for widgets in native containers, such as wxToolBar + // (for widgets in a wxPizza, the values should already be the same) + win->m_x = a.x; + win->m_y = a.y; win->m_useCachedClientSize = true; if (win->m_clientWidth != w || win->m_clientHeight != h) { @@ -1910,8 +1938,6 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxWindow* win) win->m_clientHeight = h; // this callback can be connected to m_wxwindow, // so always get size from m_widget->allocation - GtkAllocation a; - gtk_widget_get_allocation(win->m_widget, &a); win->m_width = a.width; win->m_height = a.height; if (!win->m_nativeSizeEvent)