X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/40bab631d2020265f7d0e5e872a2925757bc92aa..ce336c6d76d8c513487af08857c1cd3cbe806d30:/src/gtk/control.cpp?ds=sidebyside diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index da63b425be..06eaec261b 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -236,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; } @@ -249,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; } @@ -263,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; }