diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-04 22:20:15 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-04 22:20:15 +0000 |
commit | 95ce68cc99b05ef26aa7b54bfb08a477960220aa (patch) | |
tree | 1f4d701c74c1175a6dcdd3fddd3ef37d59150c7c /webkit/tools | |
parent | a567388b8b0aab8aa34ca4c0c419bb0604f6ec09 (diff) | |
download | chromium_src-95ce68cc99b05ef26aa7b54bfb08a477960220aa.zip chromium_src-95ce68cc99b05ef26aa7b54bfb08a477960220aa.tar.gz chromium_src-95ce68cc99b05ef26aa7b54bfb08a477960220aa.tar.bz2 |
Hook up linux test shell mouse events
- button press, release
- mouse move
- wheel scroll
Review URL: http://codereview.chromium.org/9355
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4687 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r-- | webkit/tools/test_shell/gtk/webwidget_host.cc | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/webkit/tools/test_shell/gtk/webwidget_host.cc b/webkit/tools/test_shell/gtk/webwidget_host.cc index edc0a92..78d5c67 100644 --- a/webkit/tools/test_shell/gtk/webwidget_host.cc +++ b/webkit/tools/test_shell/gtk/webwidget_host.cc @@ -19,49 +19,69 @@ namespace { // Callback functions to proxy to host... gboolean ConfigureEvent(GtkWidget* widget, GdkEventConfigure* config, - gpointer userdata) { - WebWidgetHost* host = (WebWidgetHost* ) userdata; + WebWidgetHost* host) { DLOG(INFO) << " -- Resize " << config->width << " " << config->height; host->Resize(gfx::Size(config->width, config->height)); return FALSE; } gboolean ExposeEvent(GtkWidget* widget, GdkEventExpose* expose, - gpointer userdata) { - WebWidgetHost* host = (WebWidgetHost* ) userdata; + WebWidgetHost* host) { DLOG(INFO) << " -- Expose"; host->Paint(); return FALSE; } -gboolean DestroyEvent(GtkWidget* widget, GdkEvent* event, gpointer userdata) { - WebWidgetHost* host = (WebWidgetHost* ) userdata; +gboolean DestroyEvent(GtkWidget* widget, GdkEvent* event, + WebWidgetHost* host) { DLOG(INFO) << " -- Destroy"; host->WindowDestroyed(); return FALSE; } -gboolean KeyPressEvent(GtkWidget* widget, GdkEventKey* event, - gpointer userdata) { - WebWidgetHost* host = (WebWidgetHost* ) userdata; - DLOG(INFO) << " -- Key press"; +gboolean KeyPressReleaseEvent(GtkWidget* widget, GdkEventKey* event, + WebWidgetHost* host) { + DLOG(INFO) << " -- Key press or release"; WebKeyboardEvent wke(event); host->webwidget()->HandleInputEvent(&wke); return FALSE; } -gboolean FocusIn(GtkWidget* widget, GdkEventFocus* focus, gpointer userdata) { - WebWidgetHost* host = (WebWidgetHost* ) userdata; +gboolean FocusIn(GtkWidget* widget, GdkEventFocus* focus, + WebWidgetHost* host) { host->webwidget()->SetFocus(true); return FALSE; } -gboolean FocusOut(GtkWidget* widget, GdkEventFocus* focus, gpointer userdata) { - WebWidgetHost* host = (WebWidgetHost* ) userdata; +gboolean FocusOut(GtkWidget* widget, GdkEventFocus* focus, + WebWidgetHost* host) { host->webwidget()->SetFocus(false); return FALSE; } +gboolean ButtonPressReleaseEvent(GtkWidget* widget, GdkEventButton* event, + WebWidgetHost* host) { + DLOG(INFO) << " -- mouse button press or release"; + WebMouseEvent wme(event); + host->webwidget()->HandleInputEvent(&wme); + return FALSE; +} + +gboolean MouseMoveEvent(GtkWidget* widget, GdkEventMotion* event, + WebWidgetHost* host) { + WebMouseEvent wme(event); + host->webwidget()->HandleInputEvent(&wme); + return FALSE; +} + +gboolean MouseScrollEvent(GtkWidget* widget, GdkEventScroll* event, + WebWidgetHost* host) { + WebMouseWheelEvent wmwe(event); + DLOG(INFO) << " -- mouse wheel scroll event"; + host->webwidget()->HandleInputEvent(&wmwe); + return FALSE; +} + } // anonymous namespace // ----------------------------------------------------------------------------- @@ -81,9 +101,20 @@ gfx::WindowHandle WebWidgetHost::CreateWindow(gfx::WindowHandle box, g_signal_connect(widget, "configure-event", G_CALLBACK(ConfigureEvent), host); g_signal_connect(widget, "expose-event", G_CALLBACK(ExposeEvent), host); g_signal_connect(widget, "destroy-event", G_CALLBACK(DestroyEvent), host); - g_signal_connect(widget, "key-press-event", G_CALLBACK(KeyPressEvent), host); + g_signal_connect(widget, "key-press-event", G_CALLBACK(KeyPressReleaseEvent), + host); + g_signal_connect(widget, "key-release-event", + G_CALLBACK(KeyPressReleaseEvent), host); g_signal_connect(widget, "focus-in-event", G_CALLBACK(FocusIn), host); g_signal_connect(widget, "focus-out-event", G_CALLBACK(FocusOut), host); + g_signal_connect(widget, "button-press-event", + G_CALLBACK(ButtonPressReleaseEvent), host); + g_signal_connect(widget, "button-release-event", + G_CALLBACK(ButtonPressReleaseEvent), host); + g_signal_connect(widget, "motion-notify-event", G_CALLBACK(MouseMoveEvent), + host); + g_signal_connect(widget, "scroll-event", G_CALLBACK(MouseScrollEvent), + host); return widget; } |