X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aac97549ab6be4d2a4bf49a1a7c781d648304eff..cd9a8d40c9a7380f7fefe676cbe01089833cdd60:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index a55d32a3ad..e6a12132c2 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1000,6 +1000,8 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event, #if wxUSE_UNICODE event.m_uniChar = gdk_keyval_to_unicode(gdk_event->keyval); #endif + wxGetMousePosition( &x, &y ); + win->ScreenToClient( &x, &y ); event.m_x = x; event.m_y = y; event.SetEventObject( win ); @@ -3100,22 +3102,37 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight; - int border = 0; + int left_border = 0; + int right_border = 0; + int top_border = 0; int bottom_border = 0; -#ifndef __WXGTK20__ + /* the default button has a border around it */ if (GTK_WIDGET_CAN_DEFAULT(m_widget)) { - /* the default button has a border around it */ - border = 6; +#ifdef __WXGTK20__ + GtkBorder *default_outside_border = NULL; + gtk_widget_style_get( m_widget, "default_outside_border", &default_outside_border, NULL ); + if (default_outside_border) + { + left_border += default_outside_border->left; + right_border += default_outside_border->right; + top_border += default_outside_border->top; + bottom_border += default_outside_border->bottom; + g_free( default_outside_border ); + } +#else + left_border = 6; + right_border = 6; + top_border = 6; bottom_border = 5; - } #endif + } - DoMoveWindow( m_x-border, - m_y-border, - m_width+2*border, - m_height+border+bottom_border ); + DoMoveWindow( m_x-top_border, + m_y-left_border, + m_width+left_border+right_border, + m_height+top_border+bottom_border ); } if (m_hasScrolling) @@ -3980,9 +3997,7 @@ void wxWindowGTK::GtkSendPaintEvents() if (GetThemeEnabled() && (GetBackgroundStyle() == wxBG_STYLE_SYSTEM)) { // find ancestor from which to steal background - wxWindow *parent = IsTopLevel() ? this : GetParent(); - while (parent && !parent->IsTopLevel()) - parent = parent->GetParent(); + wxWindow *parent = wxGetTopLevelParent((wxWindow *)this); if (!parent) parent = (wxWindow*)this;