Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: webkit/api/src/gtk/WebInputEventFactory.cpp

Issue 343080: Revert "Handle GTK enter and leave notification events and pass them to WebKit as " (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/api/public/gtk/WebInputEventFactory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006-2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (event->state & GDK_BUTTON1_MASK) 374 if (event->state & GDK_BUTTON1_MASK)
375 result.button = WebMouseEvent::ButtonLeft; 375 result.button = WebMouseEvent::ButtonLeft;
376 else if (event->state & GDK_BUTTON2_MASK) 376 else if (event->state & GDK_BUTTON2_MASK)
377 result.button = WebMouseEvent::ButtonMiddle; 377 result.button = WebMouseEvent::ButtonMiddle;
378 else if (event->state & GDK_BUTTON3_MASK) 378 else if (event->state & GDK_BUTTON3_MASK)
379 result.button = WebMouseEvent::ButtonRight; 379 result.button = WebMouseEvent::ButtonRight;
380 380
381 return result; 381 return result;
382 } 382 }
383 383
384 WebMouseEvent WebInputEventFactory::mouseEvent(const GdkEventCrossing* event)
385 {
386 WebMouseEvent result;
387
388 result.timeStampSeconds = gdkEventTimeToWebEventTime(event->time);
389 result.modifiers = gdkStateToWebEventModifiers(event->state);
390 result.x = static_cast<int>(event->x);
391 result.y = static_cast<int>(event->y);
392 result.windowX = result.x;
393 result.windowY = result.y;
394 result.globalX = static_cast<int>(event->x_root);
395 result.globalY = static_cast<int>(event->y_root);
396
397 switch (event->type) {
398 case GDK_ENTER_NOTIFY:
399 case GDK_LEAVE_NOTIFY:
400 // Note that if we sent MouseEnter or MouseLeave to WebKit, it
401 // wouldn't work - they don't result in the proper JavaScript events.
402 // MouseMove does the right thing.
403 result.type = WebInputEvent::MouseMove;
404 break;
405 default:
406 ASSERT_NOT_REACHED();
407 }
408
409 result.button = WebMouseEvent::ButtonNone;
410 if (event->state & GDK_BUTTON1_MASK)
411 result.button = WebMouseEvent::ButtonLeft;
412 else if (event->state & GDK_BUTTON2_MASK)
413 result.button = WebMouseEvent::ButtonMiddle;
414 else if (event->state & GDK_BUTTON3_MASK)
415 result.button = WebMouseEvent::ButtonRight;
416
417 return result;
418 }
419
420 // WebMouseWheelEvent --------------------------------------------------------- 384 // WebMouseWheelEvent ---------------------------------------------------------
421 385
422 WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(const GdkEventScroll* event) 386 WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(const GdkEventScroll* event)
423 { 387 {
424 WebMouseWheelEvent result; 388 WebMouseWheelEvent result;
425 389
426 result.type = WebInputEvent::MouseWheel; 390 result.type = WebInputEvent::MouseWheel;
427 result.button = WebMouseEvent::ButtonNone; 391 result.button = WebMouseEvent::ButtonNone;
428 392
429 result.timeStampSeconds = gdkEventTimeToWebEventTime(event->time); 393 result.timeStampSeconds = gdkEventTimeToWebEventTime(event->time);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 case GDK_SCROLL_RIGHT: 427 case GDK_SCROLL_RIGHT:
464 result.deltaX = -scrollbarPixelsPerTick; 428 result.deltaX = -scrollbarPixelsPerTick;
465 result.wheelTicksX = 1; 429 result.wheelTicksX = 1;
466 break; 430 break;
467 } 431 }
468 432
469 return result; 433 return result;
470 } 434 }
471 435
472 } // namespace WebKit 436 } // namespace WebKit
OLDNEW
« no previous file with comments | « webkit/api/public/gtk/WebInputEventFactory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698