X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a3c15d892d21e938f3e53dfa81c62eb5da4ce3c8..422d0ff0bec79832494fe4605ffdcf8e87ba6c03:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 2fec24eb3a..8947ad7008 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1353,7 +1353,7 @@ static void gtk_wxwindow_commit_cb (GtkIMContext *context, if (ansistr.data() == NULL) return; event.m_keyCode = ansistr[0u]; - wxLogTrace(TRACE_KEYS, _T("IM sent character '%c'"), event.m_keyCode); + wxLogTrace(TRACE_KEYS, _T("IM sent character '%c'"), (wxChar)event.m_keyCode); #endif // wxUSE_UNICODE bool ret = false; @@ -2655,6 +2655,7 @@ void wxWindowGTK::Init() #ifdef __WXGTK20__ m_imData = NULL; m_x11Context = NULL; + m_dirtyTabOrder = false; #else #ifdef HAVE_XIM m_ic = (GdkIC*) NULL; @@ -3116,6 +3117,11 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags void wxWindowGTK::OnInternalIdle() { +#ifdef __WXGTK20__ + if ( m_dirtyTabOrder ) + RealizeTabOrder(); +#endif + // Update invalidated regions. GtkUpdate(); @@ -3484,7 +3490,7 @@ int wxWindowGTK::GetCharHeight() const g_object_unref( G_OBJECT( layout ) ); - return (int) (rect.height / PANGO_SCALE); + return (int) PANGO_PIXELS(rect.height); #else GdkFont *gfont = font.GetInternalFont( 1.0 ); @@ -3518,7 +3524,7 @@ int wxWindowGTK::GetCharWidth() const g_object_unref( G_OBJECT( layout ) ); - return (int) (rect.width / PANGO_SCALE); + return (int) PANGO_PIXELS(rect.width); #else GdkFont *gfont = font.GetInternalFont( 1.0 ); @@ -3569,17 +3575,18 @@ void wxWindowGTK::GetTextExtent( const wxString& string, pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data )); #endif } - PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data; PangoRectangle rect; - pango_layout_line_get_extents(line, NULL, &rect); + pango_layout_get_extents(layout, NULL, &rect); - if (x) (*x) = (wxCoord) (rect.width / PANGO_SCALE); - if (y) (*y) = (wxCoord) (rect.height / PANGO_SCALE); + if (x) (*x) = (wxCoord) PANGO_PIXELS(rect.width); + if (y) (*y) = (wxCoord) PANGO_PIXELS(rect.height); if (descent) { - // Do something about metrics here - (*descent) = 0; + PangoLayoutIter *iter = pango_layout_get_iter(layout); + int baseline = pango_layout_iter_get_baseline(iter); + pango_layout_iter_free(iter); + *descent = *y - PANGO_PIXELS(baseline); } if (externalLeading) (*externalLeading) = 0; // ?? @@ -3703,6 +3710,62 @@ void wxWindowGTK::DoAddChild(wxWindowGTK *child) (*m_insertCallback)(this, child); } +#ifdef __WXGTK20__ + +void wxWindowGTK::AddChild(wxWindowBase *child) +{ + wxWindowBase::AddChild(child); + m_dirtyTabOrder = true; + if (g_isIdle) + wxapp_install_idle_handler(); +} + +void wxWindowGTK::RemoveChild(wxWindowBase *child) +{ + wxWindowBase::RemoveChild(child); + m_dirtyTabOrder = true; + if (g_isIdle) + wxapp_install_idle_handler(); +} + +void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move) +{ + wxWindowBase::DoMoveInTabOrder(win, move); + m_dirtyTabOrder = true; + if (g_isIdle) + wxapp_install_idle_handler(); +} + +void wxWindowGTK::RealizeTabOrder() +{ + if (m_wxwindow) + { + if (m_children.size() > 0) + { + GList *chain = NULL; + + for (wxWindowList::const_iterator i = m_children.begin(); + i != m_children.end(); ++i) + { + chain = g_list_prepend(chain, (*i)->m_widget); + } + + chain = g_list_reverse(chain); + + gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain); + g_list_free(chain); + } + else + { + gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow)); + } + } + + m_dirtyTabOrder = false; +} + +#endif // __WXGTK20__ + void wxWindowGTK::Raise() { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );