Add support for horizontal mouse wheel events to wxGTK too.

Handle GDK_SCROLL_{RIGHT,LEFT} directions in scroll-event handler in wxGTK.

Closes #14221.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-04-14 22:27:34 +00:00
parent 15e42bb781
commit 4eeceb1573
2 changed files with 32 additions and 11 deletions

View File

@@ -480,6 +480,7 @@ All:
All (GUI):
- Added strike-through support to wxFont (Igor Korot).
- Add support for horizontal mouse wheel events to MSW and GTK (Lauri Nurmi).
- Fix infinite loop in wxHtmlEasyPrinting when trying to page break images
taller than the page height in wxHtmlEasyPrinting (Laurent Poujoulat).
- Added wxFilePickerCtrl::SetInitialDirectory().
@@ -521,7 +522,6 @@ MSW:
- Add wxActiveXContainer::QueryClientSiteInterface and implement it in
wxWebViewIE to improve the default behaviour (Allonii).
- Update stretchable spaces in wxToolBar after tool removal (Catalin Raceanu).
- Add support for horizontal mouse wheel events (Lauri Nurmi).
- Implement wxGraphicsContext::SetInterpolationQuality() (Eric Jensen).
- Fix coordinate handling in wxDC::Blit() when source DC is a DIB.
- Fix handling of composite windows in wxToolTip (Armel Asselin).

View File

@@ -1641,22 +1641,43 @@ window_scroll_event_hscrollbar(GtkWidget*, GdkEventScroll* gdk_event, wxWindow*
static gboolean
window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
{
if (gdk_event->direction != GDK_SCROLL_UP &&
gdk_event->direction != GDK_SCROLL_DOWN)
{
return false;
}
wxMouseEvent event(wxEVT_MOUSEWHEEL);
InitMouseEvent(win, event, gdk_event);
// FIXME: Get these values from GTK or GDK
event.m_linesPerAction = 3;
event.m_wheelDelta = 120;
if (gdk_event->direction == GDK_SCROLL_UP)
// Determine the scroll direction.
switch (gdk_event->direction)
{
case GDK_SCROLL_UP:
case GDK_SCROLL_RIGHT:
event.m_wheelRotation = 120;
else
break;
case GDK_SCROLL_DOWN:
case GDK_SCROLL_LEFT:
event.m_wheelRotation = -120;
break;
default:
return false; // Unknown/unhandled direction
}
// And the scroll axis.
switch (gdk_event->direction)
{
case GDK_SCROLL_UP:
case GDK_SCROLL_DOWN:
event.m_wheelAxis = wxMOUSE_WHEEL_VERTICAL;
break;
case GDK_SCROLL_LEFT:
case GDK_SCROLL_RIGHT:
event.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
break;
}
if (win->GTKProcessEvent(event))
return TRUE;