- wxEventType event_type = wxEVT_NULL;
- if (gdk_event->direction == GDK_SCROLL_UP)
- event_type = wxEVT_MOUSEWHEEL;
- else if (gdk_event->direction == GDK_SCROLL_DOWN)
- event_type = wxEVT_MOUSEWHEEL;
- else
- return FALSE;
-
- wxMouseEvent event( event_type );
- // Can't use InitMouse macro because scroll events don't have button
- event.SetTimestamp( gdk_event->time );
- event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
- event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
- event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
- event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
- event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
- event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
- event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
- event.m_linesPerAction = 3;
- if (gdk_event->direction == GDK_SCROLL_UP)
- event.m_wheelRotation = 120;
- else
- event.m_wheelRotation = -120;
-
- wxPoint pt = win->GetClientAreaOrigin();
- event.m_x = (wxCoord)gdk_event->x - pt.x;
- event.m_y = (wxCoord)gdk_event->y - pt.y;
-
- event.SetEventObject( win );
- event.SetId( win->GetId() );
- event.SetTimestamp( gdk_event->time );
-
- if (win->GetEventHandler()->ProcessEvent( event ))
- {
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "scroll_event" );
- return TRUE;
- }
-
- return FALSE;
-}
-#endif
-
-//-----------------------------------------------------------------------------
-// "focus_in_event"
-//-----------------------------------------------------------------------------
-
-// send the wxChildFocusEvent and wxFocusEvent, common code of
-// gtk_window_focus_in_callback() and SetFocus()
-static bool DoSendFocusEvents(wxWindow *win)
-{
- // Notify the parent keeping track of focus for the kbd navigation
- // purposes that we got it.
- wxChildFocusEvent eventChildFocus(win);
- (void)win->GetEventHandler()->ProcessEvent(eventChildFocus);
-
- wxFocusEvent eventFocus(wxEVT_SET_FOCUS, win->GetId());
- eventFocus.SetEventObject(win);
-
- return win->GetEventHandler()->ProcessEvent(eventFocus);
-}
-
-static gint gtk_window_focus_in_callback( GtkWidget *widget,
- GdkEvent *WXUNUSED(event),
- wxWindow *win )
-{
- DEBUG_MAIN_THREAD
-
- if (g_isIdle)
- wxapp_install_idle_handler();
-
- if (!win->m_hasVMT) return FALSE;
- if (g_blockEventsOnDrag) return FALSE;
-
- switch ( g_sendActivateEvent )
- {
- case -1:
- // we've got focus from outside, synthetize wxActivateEvent
- g_sendActivateEvent = 1;
- break;
-
- case 0:
- // another our window just lost focus, it was already ours before
- // - don't send any wxActivateEvent
- g_sendActivateEvent = -1;
- break;
- }
-
- g_focusWindowLast =
- g_focusWindow = win;