+ wxMouseCaptureLostEvent evt( win->GetId() );
+ evt.SetEventObject( win );
+ win->HandleWindowEvent( evt );
+ }
+ return false;
+}
+#endif
+
+//-----------------------------------------------------------------------------
+// "style_set"/"style_updated"
+//-----------------------------------------------------------------------------
+
+#ifdef __WXGTK3__
+static void style_updated(GtkWidget*, wxWindow* win)
+#else
+static void style_updated(GtkWidget*, GtkStyle*, wxWindow* win)
+#endif
+{
+ if (win->IsTopLevel())
+ {
+ wxSysColourChangedEvent event;
+ event.SetEventObject(win);
+ win->GTKProcessEvent(event);
+ }
+ else
+ {
+ // Border width could change, which will change client size.
+ // Make sure size event occurs for this
+ win->m_oldClientWidth = 0;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// "unrealize" from m_wxwindow
+//-----------------------------------------------------------------------------
+
+static void unrealize(GtkWidget*, wxWindow* win)
+{
+ if (win->m_imData)
+ gtk_im_context_set_client_window(win->m_imData->context, NULL);
+
+ g_signal_handlers_disconnect_by_func(
+ win->m_wxwindow, (void*)style_updated, win);
+}
+
+} // extern "C"
+
+void wxWindowGTK::GTKHandleRealized()
+{
+ if (m_imData)
+ {
+ gtk_im_context_set_client_window
+ (
+ m_imData->context,
+ m_wxwindow ? GTKGetDrawingWindow()
+ : gtk_widget_get_window(m_widget)
+ );
+ }
+
+ // Use composited window if background is transparent, if supported.
+ if (m_backgroundStyle == wxBG_STYLE_TRANSPARENT)
+ {
+#if wxGTK_HAS_COMPOSITING_SUPPORT
+ if (IsTransparentBackgroundSupported())
+ {
+ GdkWindow* const window = GTKGetDrawingWindow();
+ if (window)
+ gdk_window_set_composited(window, true);
+ }
+ else
+#endif // wxGTK_HAS_COMPOSITING_SUPPORT
+ {
+ // We revert to erase mode if transparency is not supported
+ m_backgroundStyle = wxBG_STYLE_ERASE;
+ }
+ }
+
+
+ // We cannot set colours and fonts before the widget
+ // been realized, so we do this directly after realization
+ // or otherwise in idle time
+
+ if (m_needsStyleChange)
+ {
+ SetBackgroundStyle(GetBackgroundStyle());
+ m_needsStyleChange = false;