X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0edbdf6a45beed571efa0f6f1b5b4396d8932d36..74a8f67d96591cec101def2a7d47c64072aff7fd:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 23c4a3cbb9..ed62554673 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -682,12 +682,6 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event, wxWindowGTK *win, GdkEventKey *gdk_event) { - int x = 0; - int y = 0; - GdkModifierType state; - if (gdk_event->window) - gdk_window_get_pointer(gdk_event->window, &x, &y, &state); - event.SetTimestamp( gdk_event->time ); event.SetId(win->GetId()); @@ -741,10 +735,8 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event, event.m_rawCode = (wxUint32) gdk_event->keyval; event.m_rawFlags = gdk_event->hardware_keycode; - wxGetMousePosition( &x, &y ); - win->ScreenToClient( &x, &y ); - event.m_x = x; - event.m_y = y; + wxGetMousePosition(&event.m_x, &event.m_y); + win->ScreenToClient(&event.m_x, &event.m_y); event.SetEventObject( win ); } @@ -1145,6 +1137,10 @@ template void InitMouseEvent(wxWindowGTK *win, event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK) != 0; event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK) != 0; event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK) != 0; + + // In gdk/win32 VK_XBUTTON1 is translated to GDK_BUTTON4_MASK + // and VK_XBUTTON2 to GDK_BUTTON5_MASK. In x11/gdk buttons 4/5 + // are wheel rotation and buttons 8/9 don't change the state. event.m_aux1Down = (gdk_event->state & GDK_BUTTON4_MASK) != 0; event.m_aux2Down = (gdk_event->state & GDK_BUTTON5_MASK) != 0; @@ -1196,6 +1192,20 @@ static void AdjustEventButtonState(wxMouseEvent& event) event.m_rightDown = !event.m_rightDown; return; } + + if ((event.GetEventType() == wxEVT_AUX1_DOWN) || + (event.GetEventType() == wxEVT_AUX1_DCLICK)) + { + event.m_aux1Down = true; + return; + } + + if ((event.GetEventType() == wxEVT_AUX2_DOWN) || + (event.GetEventType() == wxEVT_AUX2_DCLICK)) + { + event.m_aux2Down = true; + return; + } } // find the window to send the mouse event too @@ -1425,6 +1435,42 @@ gtk_window_button_press_callback( GtkWidget *widget, } } + else if (gdk_event->button == 8) + { + switch (gdk_event->type) + { + case GDK_3BUTTON_PRESS: + case GDK_BUTTON_PRESS: + event_type = wxEVT_AUX1_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_AUX1_DCLICK; + break; + + default: + ; + } + } + + else if (gdk_event->button == 9) + { + switch (gdk_event->type) + { + case GDK_3BUTTON_PRESS: + case GDK_BUTTON_PRESS: + event_type = wxEVT_AUX2_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_AUX2_DCLICK; + break; + + default: + ; + } + } + if ( event_type == wxEVT_NULL ) { // unknown mouse button or click type @@ -1508,6 +1554,14 @@ gtk_window_button_release_callback( GtkWidget *WXUNUSED(widget), event_type = wxEVT_RIGHT_UP; break; + case 8: + event_type = wxEVT_AUX1_UP; + break; + + case 9: + event_type = wxEVT_AUX2_UP; + break; + default: // unknown button, don't process return FALSE; @@ -2038,6 +2092,7 @@ wxMouseState wxGetMouseState() ms.SetLeftDown((mask & GDK_BUTTON1_MASK) != 0); ms.SetMiddleDown((mask & GDK_BUTTON2_MASK) != 0); ms.SetRightDown((mask & GDK_BUTTON3_MASK) != 0); + // see the comment in InitMouseEvent() ms.SetAux1Down((mask & GDK_BUTTON4_MASK) != 0); ms.SetAux2Down((mask & GDK_BUTTON5_MASK) != 0); @@ -3380,9 +3435,11 @@ void wxWindowGTK::RealizeTabOrder() { wxWindowGTK *win = *i; + bool focusableFromKeyboard = win->AcceptsFocusFromKeyboard(); + if ( mnemonicWindow ) { - if ( win->AcceptsFocusFromKeyboard() ) + if ( focusableFromKeyboard ) { // wxComboBox et al. needs to focus on on a different // widget than m_widget, so if the main widget isn't @@ -3407,7 +3464,8 @@ void wxWindowGTK::RealizeTabOrder() mnemonicWindow = win; } - chain = g_list_prepend(chain, win->m_widget); + if ( focusableFromKeyboard ) + chain = g_list_prepend(chain, win->m_widget); } chain = g_list_reverse(chain);