summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx36
1 files changed, 24 insertions, 12 deletions
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index a3948e9610b2..6db5fef0040e 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -1140,7 +1140,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
gtk_widget_path_append_type( pCPath, GTK_TYPE_TEXT_VIEW );
gtk_widget_path_iter_add_class( pCPath, -1, GTK_STYLE_CLASS_VIEW );
gtk_style_context_set_path( pCStyle, pCPath );
- gtk_style_context_set_parent(pCStyle, gtk_widget_get_style_context(mpWindow));
gtk_widget_path_free( pCPath );
GdkRGBA field_background_color;
gtk_style_context_get_background_color(pCStyle, GTK_STATE_FLAG_NORMAL, &field_background_color);
@@ -1428,15 +1427,22 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
return false;
}
+static GtkWidget* gCacheWindow;
+static GtkWidget* gDumbContainer;
+
void GtkData::initNWF() {}
-void GtkData::deInitNWF() {}
+
+void GtkData::deInitNWF()
+{
+ if (gCacheWindow)
+ gtk_widget_destroy(gCacheWindow);
+}
void GtkSalGraphics::getStyleContext(GtkStyleContext** style, GtkWidget* widget)
{
+ gtk_container_add(GTK_CONTAINER(gDumbContainer), widget);
*style = gtk_widget_get_style_context(widget);
g_object_ref(*style);
- gtk_style_context_set_parent(*style, gtk_widget_get_style_context(mpWindow));
- gtk_widget_destroy(widget);
}
GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
@@ -1446,14 +1452,22 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
{
m_xTextRenderImpl.reset(new GtkCairoTextRender(*this));
- if (style_loaded)
+ if(style_loaded)
return;
+ GtkWidgetPath* path;
+
style_loaded = true;
gtk_init(NULL, NULL);
/* Load the GtkStyleContexts, it might be a bit slow, but usually,
* gtk apps create a lot of widgets at startup, so, it shouldn't be
* too slow */
+ gCacheWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gDumbContainer = gtk_fixed_new();
+ gtk_container_add(GTK_CONTAINER(gCacheWindow), gDumbContainer);
+ gtk_widget_realize(gDumbContainer);
+ gtk_widget_realize(gCacheWindow);
+
getStyleContext(&mpEntryStyle, gtk_entry_new());
getStyleContext(&mpButtonStyle, gtk_button_new());
@@ -1464,15 +1478,14 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
getStyleContext(&mpToolButtonStyle, gtk_button_new());
/* Create a widget path for our toolbutton widget */
- GtkWidgetPath* path = gtk_widget_path_new();
+ path = gtk_widget_path_new();
gtk_widget_path_append_type(path, GTK_TYPE_TOOLBAR);
gtk_widget_path_append_type(path, GTK_TYPE_TOOL_BUTTON);
gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
gtk_widget_path_iter_add_class (path, 0, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
- gtk_widget_path_iter_add_class (path, 1, GTK_STYLE_CLASS_TOOLBAR);
+ gtk_widget_path_iter_add_class (path, 0, GTK_STYLE_CLASS_TOOLBAR);
gtk_widget_path_iter_add_class (path, 2, GTK_STYLE_CLASS_BUTTON);
gtk_style_context_set_path(mpToolButtonStyle, path);
- gtk_style_context_set_parent(mpToolButtonStyle, gtk_widget_get_style_context(mpWindow));
gtk_widget_path_free (path);
getStyleContext(&mpVScrollbarStyle, gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL));
@@ -1483,7 +1496,9 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
getStyleContext(&mpCheckButtonStyle, gtk_check_button_new());
/* Menu */
- getStyleContext(&mpMenuStyle, gtk_menu_new());
+ GtkWidget *menu = gtk_menu_new();
+ mpMenuStyle = gtk_widget_get_style_context(menu);
+ g_object_ref_sink(menu);
/* Menu Items */
path = gtk_widget_path_new();
@@ -1493,7 +1508,6 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
gtk_widget_path_iter_add_class(path, 1, GTK_STYLE_CLASS_MENUITEM);
mpMenuItemStyle = gtk_style_context_new();
gtk_style_context_set_path(mpMenuItemStyle, path);
- gtk_style_context_set_parent(mpMenuItemStyle, mpMenuStyle);
gtk_widget_path_free(path);
/* Menu bar */
@@ -1506,7 +1520,6 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
/* Combobox */
mpComboboxStyle = gtk_style_context_new();
PrepareComboboxStyle(mpComboboxStyle, true);
- gtk_style_context_set_parent(mpComboboxStyle, gtk_widget_get_style_context(mpWindow));
/* Listbox */
mpListboxStyle = gtk_style_context_new();
@@ -1515,7 +1528,6 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
gtk_widget_path_iter_add_class(path, 1, GTK_STYLE_CLASS_BUTTON);
gtk_style_context_set_path(mpListboxStyle, path);
- gtk_style_context_set_parent(mpListboxStyle, gtk_widget_get_style_context(mpWindow));
gtk_widget_path_free(path);
}