+ GtkRcStyle *style = CreateWidgetStyle(forceStyle);
+ if ( style )
+ {
+ DoApplyWidgetStyle(style);
+ gtk_rc_style_unref(style);
+ }
+
+ // Style change may affect GTK+'s size calculation:
+ InvalidateBestSize();
+}
+
+void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style)
+{
+ if (m_wxwindow)
+ gtk_widget_modify_style(m_wxwindow, style);
+ gtk_widget_modify_style(m_widget, style);
+}
+
+bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
+{
+ wxWindowBase::SetBackgroundStyle(style);
+
+ if (style == wxBG_STYLE_CUSTOM)
+ {
+ GdkWindow *window = (GdkWindow*) NULL;
+ if (m_wxwindow)
+ window = GTK_PIZZA(m_wxwindow)->bin_window;
+ else
+ window = GetConnectWidget()->window;
+
+ if (window)
+ {
+ // Make sure GDK/X11 doesn't refresh the window
+ // automatically.
+ gdk_window_set_back_pixmap( window, None, False );
+#ifdef __X__
+ Display* display = GDK_WINDOW_DISPLAY(window);
+ XFlush(display);
+#endif
+ m_needsStyleChange = false;
+ }
+ else
+ // Do in OnIdle, because the window is not yet available
+ m_needsStyleChange = true;
+
+ // Don't apply widget style, or we get a grey background
+ }
+ else
+ {
+ // apply style change (forceStyle=true so that new style is applied
+ // even if the bg colour changed from valid to wxNullColour):
+ ApplyWidgetStyle(true);
+ }
+ return true;