diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 991c245fd7..375912170f 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2220,10 +2220,28 @@ size_allocate(GtkWidget* WXUNUSED_IN_GTK2(widget), GtkAllocation* alloc, wxWindo #if GTK_CHECK_VERSION(3,14,0) if (wx_is_at_least_gtk3(14)) { + // Prevent under-allocated widgets from drawing outside their allocation GtkAllocation clip; gtk_widget_get_clip(widget, &clip); if (clip.width > w || clip.height > h) - gtk_widget_set_clip(widget, alloc); + { + GtkStyleContext* sc = gtk_widget_get_style_context(widget); + int outline_offset, outline_width; + gtk_style_context_get(sc, gtk_style_context_get_state(sc), + "outline-offset", &outline_offset, "outline-width", &outline_width, NULL); + const int outline = outline_offset + outline_width; + GtkAllocation a = *alloc; + if (outline > 0) + { + // Allow enough room for focus indicator "outline", it's drawn + // outside of GtkCheckButton allocation with Adwaita theme + a.x -= outline; + a.y -= outline; + a.width += outline + outline; + a.height += outline + outline; + } + gtk_widget_set_clip(widget, &a); + } } #endif if (win->m_wxwindow)