From f3f0d961af5454a3544a4f4f9aced750d4641d69 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 9 Feb 2004 23:28:13 +0000 Subject: [PATCH] don't just drop click events resulting from triple clicks git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25697 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/gtk/window.cpp | 50 +++++++++++++++++++++++++-------------------- src/gtk1/window.cpp | 50 +++++++++++++++++++++++++-------------------- 3 files changed, 57 insertions(+), 44 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index c23a5bb563..d98184e849 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -172,6 +172,7 @@ wxGTK: - fixed mouse wheel handling under GTK2 (Hugh Fisher) - wxNotebook::HitTest() implemented (Daniel Lundqvist) - memory leaks fixes in wxFileDialog (John Labenski) +- don't drop click events from triple clicks (Frode Solheim) wxMac: diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 303cad80ea..dc03fbe4b3 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1539,46 +1539,52 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, if (gdk_event->button == 1) { + // note that GDK generates triple click events which are not supported + // by wxWindows but still have to be passed to the app as otherwise + // clicks would simply go missing switch (gdk_event->type) { - case GDK_BUTTON_PRESS: event_type = wxEVT_LEFT_DOWN; break; - case GDK_2BUTTON_PRESS: event_type = wxEVT_LEFT_DCLICK; break; - case GDK_3BUTTON_PRESS: return FALSE; - default: break; + case GDK_3BUTTON_PRESS: // we could also map this to DCLICK... + case GDK_BUTTON_PRESS: + event_type = wxEVT_LEFT_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_LEFT_DCLICK; + break; } } else if (gdk_event->button == 2) { switch (gdk_event->type) { - case GDK_BUTTON_PRESS: event_type = wxEVT_MIDDLE_DOWN; break; - case GDK_2BUTTON_PRESS: event_type = wxEVT_MIDDLE_DCLICK; break; - default: break; + case GDK_BUTTON_PRESS: + event_type = wxEVT_MIDDLE_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_MIDDLE_DCLICK; + break; } } else if (gdk_event->button == 3) { switch (gdk_event->type) { - case GDK_BUTTON_PRESS: event_type = wxEVT_RIGHT_DOWN; break; - case GDK_2BUTTON_PRESS: event_type = wxEVT_RIGHT_DCLICK; break; - default: break; - } - } - else if (gdk_event->button == 4) - { - switch (gdk_event->type) - { - case GDK_BUTTON_PRESS: event_type = wxEVT_MOUSEWHEEL; break; - default: break; + case GDK_BUTTON_PRESS: + event_type = wxEVT_RIGHT_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_RIGHT_DCLICK; + break; } } - else if (gdk_event->button == 5) + else if (gdk_event->button == 4 || gdk_event->button == 5) { - switch (gdk_event->type) + if (gdk_event->type == GDK_BUTTON_PRESS ) { - case GDK_BUTTON_PRESS: event_type = wxEVT_MOUSEWHEEL; break; - default: break; + event_type = wxEVT_MOUSEWHEEL; } } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 303cad80ea..dc03fbe4b3 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1539,46 +1539,52 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, if (gdk_event->button == 1) { + // note that GDK generates triple click events which are not supported + // by wxWindows but still have to be passed to the app as otherwise + // clicks would simply go missing switch (gdk_event->type) { - case GDK_BUTTON_PRESS: event_type = wxEVT_LEFT_DOWN; break; - case GDK_2BUTTON_PRESS: event_type = wxEVT_LEFT_DCLICK; break; - case GDK_3BUTTON_PRESS: return FALSE; - default: break; + case GDK_3BUTTON_PRESS: // we could also map this to DCLICK... + case GDK_BUTTON_PRESS: + event_type = wxEVT_LEFT_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_LEFT_DCLICK; + break; } } else if (gdk_event->button == 2) { switch (gdk_event->type) { - case GDK_BUTTON_PRESS: event_type = wxEVT_MIDDLE_DOWN; break; - case GDK_2BUTTON_PRESS: event_type = wxEVT_MIDDLE_DCLICK; break; - default: break; + case GDK_BUTTON_PRESS: + event_type = wxEVT_MIDDLE_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_MIDDLE_DCLICK; + break; } } else if (gdk_event->button == 3) { switch (gdk_event->type) { - case GDK_BUTTON_PRESS: event_type = wxEVT_RIGHT_DOWN; break; - case GDK_2BUTTON_PRESS: event_type = wxEVT_RIGHT_DCLICK; break; - default: break; - } - } - else if (gdk_event->button == 4) - { - switch (gdk_event->type) - { - case GDK_BUTTON_PRESS: event_type = wxEVT_MOUSEWHEEL; break; - default: break; + case GDK_BUTTON_PRESS: + event_type = wxEVT_RIGHT_DOWN; + break; + + case GDK_2BUTTON_PRESS: + event_type = wxEVT_RIGHT_DCLICK; + break; } } - else if (gdk_event->button == 5) + else if (gdk_event->button == 4 || gdk_event->button == 5) { - switch (gdk_event->type) + if (gdk_event->type == GDK_BUTTON_PRESS ) { - case GDK_BUTTON_PRESS: event_type = wxEVT_MOUSEWHEEL; break; - default: break; + event_type = wxEVT_MOUSEWHEEL; } } -- 2.45.2