[Webkit-unassigned] [Bug 31841] Linux Chromium sends too many click events

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 24 11:19:45 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=31841





--- Comment #2 from Evan Martin <evan at chromium.org>  2009-11-24 11:19:45 PST ---
(From update of attachment 43790)
> Index: WebKit/chromium/ChangeLog
> ===================================================================
> --- WebKit/chromium/ChangeLog	(revision 51343)
> +++ WebKit/chromium/ChangeLog	(working copy)
> @@ -1,3 +1,18 @@
> +2009-11-24  Evan Stade  <estade at chromium.org>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Linux Chromium sends too many click events
> +        https://bugs.webkit.org/show_bug.cgi?id=31841
> +
> +        Manually count number of clicks for double/triple click events. This
> +        makes us match firefox on http://www.quirksmode.org/js/events_mouse.html

Cap Firefox?

> +        Chromium side of this patch is here:
> +        http://codereview.chromium.org/431031/show
> +
> +        * src/gtk/WebInputEventFactory.cpp:
> +        (WebKit::WebInputEventFactory::mouseEvent):
> +
>  2009-11-24  Adam Barth  <abarth at webkit.org>
>  
>          Reviewed by Dimitri Glazkov.
> Index: WebKit/chromium/src/gtk/WebInputEventFactory.cpp
> ===================================================================
> --- WebKit/chromium/src/gtk/WebInputEventFactory.cpp	(revision 51343)
> +++ WebKit/chromium/src/gtk/WebInputEventFactory.cpp	(working copy)
> @@ -38,10 +38,22 @@
>  
>  #include <gdk/gdk.h>
>  #include <gdk/gdkkeysyms.h>
> +#include <gtk/gtk.h>
>  #include <gtk/gtkversion.h>
>  
>  #include <wtf/Assertions.h>
>  
> +namespace {
> +
> +gint GetDoubleClickTime() {
> +  static GtkSettings* settings = gtk_settings_get_default();
> +  gint double_click_time = 250;
> +  g_object_get(G_OBJECT(settings), "gtk-double-click-time", &double_click_time, NULL);
> +  return double_click_time;
> +}

Style: getDoubleClickTime, four spaces, variable naming.
Why static gobject?  Maybe the double click time should be static?
Does this work in a sandboxed renderer?  I didn't think you could get the real
gtk settings.

> +
> +}  // namespace
> +
>  namespace WebKit {
>  
>  static double gdkEventTimeToWebEventTime(guint32 time)
> @@ -321,24 +333,36 @@ WebMouseEvent WebInputEventFactory::mous
>      result.clickCount = 0;
>  
>      switch (event->type) {
> -    case GDK_3BUTTON_PRESS:
> -        ++result.clickCount;
> -        // fallthrough
> -    case GDK_2BUTTON_PRESS:
> -        ++result.clickCount;
> -        // fallthrough
>      case GDK_BUTTON_PRESS:
>          result.type = WebInputEvent::MouseDown;
> -        ++result.clickCount;
>          break;
>      case GDK_BUTTON_RELEASE:
>          result.type = WebInputEvent::MouseUp;
>          break;
> -
> +    case GDK_3BUTTON_PRESS:
> +        // fallthrough

I think the comment isn't necessary when there's no code in the case.

> +    case GDK_2BUTTON_PRESS:
> +        // fallthrough
>      default:
>          ASSERT_NOT_REACHED();
>      };
>  
> +    if (GDK_BUTTON_PRESS == event->type) {
> +        static int numClicks = 0;
> +        static GdkWindow* eventWindow = NULL;
> +        static gint lastLeftClickTime = 0;
> +
> +        gint time_diff = event->time - lastLeftClickTime;
> +        if (eventWindow == event->window && time_diff < GetDoubleClickTime())
> +            numClicks++;
> +        else
> +            numClicks = 1;
> +
> +        result.clickCount = numClicks;
> +        eventWindow = event->window;
> +        lastLeftClickTime = event->time;
> +    }
> +
>      result.button = WebMouseEvent::ButtonNone;
>      if (event->button == 1)
>          result.button = WebMouseEvent::ButtonLeft;

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list