extern wxList wxPendingDelete;
extern wxList wxTopLevelWindows;
extern bool g_blockEventsOnDrag;
+ bool g_capturing = FALSE;
//-----------------------------------------------------------------------------
// "expose_event" (of m_wxwindow, not of m_widget)
// Some control don't have their own X window and thus cannot get
// any events.
- wxNode *node = win->GetChildren()->First();
- while (node)
+ if (!g_capturing)
{
- wxWindow *child = (wxWindow*)node->Data();
- if ((child->m_x <= event.m_x) &&
- (child->m_y <= event.m_y) &&
- (child->m_x+child->m_width >= event.m_x) &&
- (child->m_y+child->m_height >= event.m_y))
+ wxNode *node = win->GetChildren()->First();
+ while (node)
{
- win = child;
- event.m_x -= child->m_x;
- event.m_y -= child->m_y;
- break;
+ wxWindow *child = (wxWindow*)node->Data();
+ if ((child->m_x <= event.m_x) &&
+ (child->m_y <= event.m_y) &&
+ (child->m_x+child->m_width >= event.m_x) &&
+ (child->m_y+child->m_height >= event.m_y))
+ {
+ win = child;
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
+ break;
+ }
+ node = node->Next();
}
- node = node->Next();
}
event.SetEventObject( win );
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
+
if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
// Some control don't have their own X window and thus cannot get
// any events.
- wxNode *node = win->GetChildren()->First();
- while (node)
+ if (!g_capturing)
{
- wxWindow *child = (wxWindow*)node->Data();
- if ((child->m_x <= event.m_x) &&
- (child->m_y <= event.m_y) &&
- (child->m_x+child->m_width >= event.m_x) &&
- (child->m_y+child->m_height >= event.m_y))
+ wxNode *node = win->GetChildren()->First();
+ while (node)
{
- win = child;
- event.m_x -= child->m_x;
- event.m_y -= child->m_y;
- break;
+ wxWindow *child = (wxWindow*)node->Data();
+ if ((child->m_x <= event.m_x) &&
+ (child->m_y <= event.m_y) &&
+ (child->m_x+child->m_width >= event.m_x) &&
+ (child->m_y+child->m_height >= event.m_y))
+ {
+ win = child;
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
+ break;
+ }
+ node = node->Next();
}
- node = node->Next();
}
event.SetEventObject( win );
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
+
if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
// Some control don't have their own X window and thus cannot get
// any events.
- wxNode *node = win->GetChildren()->First();
- while (node)
+ if (!g_capturing)
{
- wxWindow *child = (wxWindow*)node->Data();
- if ((child->m_x <= event.m_x) &&
- (child->m_y <= event.m_y) &&
- (child->m_x+child->m_width >= event.m_x) &&
- (child->m_y+child->m_height >= event.m_y))
+ wxNode *node = win->GetChildren()->First();
+ while (node)
{
- win = child;
- event.m_x -= child->m_x;
- event.m_y -= child->m_y;
- break;
+ wxWindow *child = (wxWindow*)node->Data();
+ if ((child->m_x <= event.m_x) &&
+ (child->m_y <= event.m_y) &&
+ (child->m_x+child->m_width >= event.m_x) &&
+ (child->m_y+child->m_height >= event.m_y))
+ {
+ win = child;
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
+ break;
+ }
+ node = node->Next();
}
- node = node->Next();
}
event.SetEventObject( win );
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
+
if (g_blockEventsOnDrag) return TRUE;
+
if (!win->HasVMT()) return TRUE;
if (widget->window)
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
- if (!win->HasVMT()) return TRUE;
+
if (g_blockEventsOnDrag) return TRUE;
+ if (!win->HasVMT()) return TRUE;
+
if (widget->window)
gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
{
GtkWidget *dnd_widget = GetConnectWidget();
- if (m_pDropTarget)
- {
- gtk_signal_disconnect_by_func( GTK_OBJECT(dnd_widget),
- GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
+ DisconnectDnDWidget( dnd_widget );
- m_pDropTarget->UnregisterWidget( dnd_widget );
- delete m_pDropTarget;
- }
+ if (m_pDropTarget) delete m_pDropTarget;
m_pDropTarget = dropTarget;
- if (m_pDropTarget)
- {
- m_pDropTarget->RegisterWidget( dnd_widget );
-
- gtk_signal_connect( GTK_OBJECT(dnd_widget), "drop_data_available_event",
- GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
- }
+
+ ConnectDnDWidget( dnd_widget );
}
wxDropTarget *wxWindow::GetDropTarget() const
return m_pDropTarget;
}
+void wxWindow::ConnectDnDWidget( GtkWidget *widget )
+{
+ if (!m_pDropTarget) return;
+
+ m_pDropTarget->RegisterWidget( widget );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "drop_data_available_event",
+ GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
+}
+
+void wxWindow::DisconnectDnDWidget( GtkWidget *widget )
+{
+ if (!m_pDropTarget) return;
+
+ gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
+ GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
+
+ m_pDropTarget->UnregisterWidget( widget );
+}
+
GtkWidget* wxWindow::GetConnectWidget(void)
{
GtkWidget *connect_widget = m_widget;
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK),
(GdkWindow *) NULL, (GdkCursor *) NULL, GDK_CURRENT_TIME );
+ g_capturing = TRUE;
}
void wxWindow::ReleaseMouse(void)
GtkWidget *connect_widget = GetConnectWidget();
gtk_grab_remove( connect_widget );
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
+ g_capturing = FALSE;
}
void wxWindow::SetTitle( const wxString &WXUNUSED(title) )