}
}
- if (HasFlag(wxALWAYS_SHOW_SB))
- {
- gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS );
- }
- else
- {
- gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
- }
+ // If wx[HV]SCROLL is not given, the corresponding scrollbar is not shown
+ // at all. Otherwise it may be shown only on demand (default) or always, if
+ // the wxALWAYS_SHOW_SB is specified.
+ GtkPolicyType horzPolicy = HasFlag(wxHSCROLL)
+ ? HasFlag(wxALWAYS_SHOW_SB)
+ ? GTK_POLICY_ALWAYS
+ : GTK_POLICY_AUTOMATIC
+ : GTK_POLICY_NEVER;
+ GtkPolicyType vertPolicy = HasFlag(wxVSCROLL)
+ ? HasFlag(wxALWAYS_SHOW_SB)
+ ? GTK_POLICY_ALWAYS
+ : GTK_POLICY_AUTOMATIC
+ : GTK_POLICY_NEVER;
+ gtk_scrolled_window_set_policy( scrolledWindow, horzPolicy, vertPolicy );
m_scrollBar[ScrollDir_Horz] = GTK_RANGE(gtk_scrolled_window_get_hscrollbar(scrolledWindow));
m_scrollBar[ScrollDir_Vert] = GTK_RANGE(gtk_scrolled_window_get_vscrollbar(scrolledWindow));
if ( gs_deferredFocusOut == this )
gs_deferredFocusOut = NULL;
- if (m_widget)
- GTKDisconnect(m_widget);
- if (m_wxwindow && m_wxwindow != m_widget)
+ // Unlike the above cases, which can happen in normal circumstances, a
+ // window shouldn't be destroyed while it still has capture, so even though
+ // we still reset the global pointer to avoid leaving it dangling and
+ // crashing afterwards, also complain about it.
+ if ( g_captureWindow == this )
+ {
+ wxFAIL_MSG( wxS("Destroying window with mouse capture") );
+ g_captureWindow = NULL;
+ }
+
+ if (m_wxwindow)
+ {
GTKDisconnect(m_wxwindow);
+ GtkWidget* parent = gtk_widget_get_parent(m_wxwindow);
+ if (parent)
+ GTKDisconnect(parent);
+ }
+ if (m_widget && m_widget != m_wxwindow)
+ GTKDisconnect(m_widget);
// destroy children before destroying this window itself
DestroyChildren();
}
// Get the current mouse position.
-wxPoint wxGetMousePosition()
+void wxGetMousePosition(int* x, int* y)
{
- int x, y;
GdkDisplay* display = GetDisplay();
#ifdef __WXGTK3__
GdkDeviceManager* manager = gdk_display_get_device_manager(display);
GdkDevice* device = gdk_device_manager_get_client_pointer(manager);
- gdk_device_get_position(device, NULL, &x, &y);
+ gdk_device_get_position(device, NULL, x, y);
#else
- gdk_display_get_pointer(display, NULL, &x, &y, NULL);
+ gdk_display_get_pointer(display, NULL, x, y, NULL);
#endif
- return wxPoint(x, y);
+}
+
+wxPoint wxGetMousePosition()
+{
+ wxPoint pt;
+ wxGetMousePosition(&pt.x, &pt.y);
+ return pt;
}
GdkWindow* wxWindowGTK::GTKGetDrawingWindow() const