X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9f8845289521c7f53e95b6dfd8275daab8b05639..a83ea9c15a7ac7bbdc6686164cfcbbc21ae5031a:/src/gtk1/control.cpp?ds=sidebyside diff --git a/src/gtk1/control.cpp b/src/gtk1/control.cpp index f8ea0c9dc3..06eaec261b 100644 --- a/src/gtk1/control.cpp +++ b/src/gtk1/control.cpp @@ -103,7 +103,6 @@ void wxControl::PostCreation(const wxSize& size) // GetBestSize is called. gtk_widget_ensure_style(m_widget); - InheritAttributes(); ApplyWidgetStyle(); SetInitialBestSize(size); } @@ -204,7 +203,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, if ( style && style->font_desc ) { wxNativeFontInfo info; - info.description = style->font_desc; + info.description = pango_font_description_copy(style->font_desc); attr.font = wxFont(info); } else @@ -237,9 +236,12 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void), int state) { wxVisualAttributes attr; + // NB: we need toplevel window so that GTK+ can find the right style + GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget* widget = widget_new(); + gtk_container_add(GTK_CONTAINER(wnd), widget); attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state); - gtk_widget_destroy(widget); + gtk_widget_destroy(wnd); return attr; } @@ -250,9 +252,12 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gcha int state) { wxVisualAttributes attr; + // NB: we need toplevel window so that GTK+ can find the right style + GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget* widget = widget_new(""); + gtk_container_add(GTK_CONTAINER(wnd), widget); attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state); - gtk_widget_destroy(widget); + gtk_widget_destroy(wnd); return attr; } @@ -264,9 +269,12 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustm int state) { wxVisualAttributes attr; + // NB: we need toplevel window so that GTK+ can find the right style + GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget* widget = widget_new(NULL); + gtk_container_add(GTK_CONTAINER(wnd), widget); attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state); - gtk_widget_destroy(widget); + gtk_widget_destroy(wnd); return attr; }