X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/43a11e2a507fe0300ac28c0667bfbecdcc51f432..bcd846ea7191d33d86e28ee1927b461c54d2fb8f:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 48e5a7b17a..d27d7d642b 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -238,9 +238,9 @@ wxWindowGTK *g_focusWindowLast = (wxWindowGTK*) NULL; wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL; // hack: we need something to pass to gtk_menu_popup, so we store the time of -// the last click here +// the last click here (extern: used from gtk/menu.cpp) #ifndef __WXGTK20__ -static guint32 gs_timeLastClick = 0; +guint32 wxGtkTimeLastClick = 0; #endif extern bool g_mainThreadLocked; @@ -1802,7 +1802,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, win = FindWindowForMouseEvent(win, event.m_x, event.m_y); #ifndef __WXGTK20__ - gs_timeLastClick = gdk_event->time; + wxGtkTimeLastClick = gdk_event->time; if (event_type == wxEVT_LEFT_DCLICK) { @@ -2672,6 +2672,31 @@ wxWindow *wxGetActiveWindow() return wxWindow::FindFocus(); } + +wxMouseState wxGetMouseState() +{ + wxMouseState ms; + + gint x; + gint y; + GdkModifierType mask; + + gdk_window_get_pointer(NULL, &x, &y, &mask); + + ms.SetX(x); + ms.SetY(y); + ms.SetLeftDown(mask & GDK_BUTTON1_MASK); + ms.SetMiddleDown(mask & GDK_BUTTON2_MASK); + ms.SetRightDown(mask & GDK_BUTTON3_MASK); + + ms.SetControlDown(mask & GDK_CONTROL_MASK); + ms.SetShiftDown(mask & GDK_SHIFT_MASK); + ms.SetAltDown(mask & GDK_MOD1_MASK); + ms.SetMetaDown(mask & GDK_MOD2_MASK); + + return ms; +} + //----------------------------------------------------------------------------- // wxWindowGTK //----------------------------------------------------------------------------- @@ -4738,8 +4763,19 @@ wxPoint wxGetMousePosition() } +// Needed for implementing e.g. combobox on wxGTK within a modal dialog. +void wxAddGrab(wxWindow* window) +{ + gtk_grab_add( (GtkWidget*) window->GetHandle() ); +} + +void wxRemoveGrab(wxWindow* window) +{ + gtk_grab_remove( (GtkWidget*) window->GetHandle() ); +} + // ---------------------------------------------------------------------------- -// wxDCModule +// wxWinModule // ---------------------------------------------------------------------------- class wxWinModule : public wxModule @@ -4768,4 +4804,3 @@ void wxWinModule::OnExit() gdk_gc_unref( g_eraseGC ); } -// vi:sts=4:sw=4:et