2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/window-system/common/event-handler.h>
22 // Ecore is littered with C style cast
23 #pragma GCC diagnostic push
24 #pragma GCC diagnostic ignored "-Wold-style-cast"
26 #include <Ecore_Input.h>
27 #include <Ecore_IMF.h>
32 #ifndef DALI_PROFILE_UBUNTU
34 #include <vconf-keys.h>
35 #endif // DALI_PROFILE_UBUNTU
37 #ifdef DALI_ELDBUS_AVAILABLE
39 #endif // DALI_ELDBUS_AVAILABLE
41 #include <dali/public-api/common/vector-wrapper.h>
42 #include <dali/public-api/events/device.h>
43 #include <dali/public-api/events/touch-point.h>
44 #include <dali/public-api/events/key-event.h>
45 #include <dali/public-api/events/wheel-event.h>
46 #include <dali/integration-api/debug.h>
47 #include <dali/integration-api/events/key-event-integ.h>
48 #include <dali/integration-api/events/touch-event-integ.h>
49 #include <dali/integration-api/events/hover-event-integ.h>
50 #include <dali/integration-api/events/wheel-event-integ.h>
53 #include <dali/internal/input/common/gesture-manager.h>
54 #include <dali/internal/window-system/tizen-wayland/window-render-surface-ecore-wl.h>
55 #include <dali/internal/clipboard/common/clipboard-impl.h>
56 #include <dali/internal/input/common/key-impl.h>
57 #include <dali/internal/input/common/physical-keyboard-impl.h>
58 #include <dali/internal/styling/common/style-monitor-impl.h>
59 #include <dali/internal/system/common/core-event-interface.h>
60 #include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
71 #if defined(DEBUG_ENABLED)
74 Integration::Log::Filter* gTouchEventLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_TOUCH");
75 Integration::Log::Filter* gDragAndDropLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_DND");
76 Integration::Log::Filter* gImfLogging = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_IMF");
77 Integration::Log::Filter* gSelectionEventLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_SELECTION");
78 } // unnamed namespace
86 const char* BUS = "org.enlightenment.wm-screen-reader";
87 const char* INTERFACE = "org.tizen.GestureNavigation";
88 const char* PATH = "/org/tizen/GestureNavigation";
90 const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
92 const unsigned int BYTES_PER_CHARACTER_FOR_ATTRIBUTES = 3;
94 #ifdef DALI_ELDBUS_AVAILABLE
95 // DBus gesture string matching lists.
96 // TODO: This needs moving to its own module.
97 const char * ElDBusAccessibilityFingerCountStrings[] =
103 const unsigned int FingerCountStringsTotal = sizeof( ElDBusAccessibilityFingerCountStrings ) / sizeof( ElDBusAccessibilityFingerCountStrings[0] );
108 GESTURE_TYPE_SINGLE_TAP,
109 GESTURE_TYPE_DOUBLE_TAP,
110 GESTURE_TYPE_TRIPLE_TAP
112 struct GestureTypeTable
115 const GestureType type;
117 GestureTypeTable ElDBusAccessibilityFullEventTypeStrings[] =
119 { "Hover", GESTURE_TYPE_HOVER },
120 { "SingleTap", GESTURE_TYPE_SINGLE_TAP },
121 { "DoubleTap", GESTURE_TYPE_DOUBLE_TAP },
122 { "TripleTap", GESTURE_TYPE_TRIPLE_TAP }
124 const unsigned int FullEventTypeStringsTotal = sizeof( ElDBusAccessibilityFullEventTypeStrings ) / sizeof( ElDBusAccessibilityFullEventTypeStrings[0] );
127 SUB_GESTURE_TYPE_NONE,
128 SUB_GESTURE_TYPE_FLICK
130 struct SubGestureTypeTable
133 const SubGestureType type;
135 SubGestureTypeTable ElDBusAccessibilityDirectionalEventTypeStrings[] =
137 { "Flick", SUB_GESTURE_TYPE_FLICK }
139 const unsigned int DirectionalEventTypeStringsTotal = sizeof( ElDBusAccessibilityDirectionalEventTypeStrings ) / sizeof( ElDBusAccessibilityDirectionalEventTypeStrings[0] );
140 enum GestureDirection
142 GESTURE_DIRECTION_NONE,
143 GESTURE_DIRECTION_UP,
144 GESTURE_DIRECTION_DOWN,
145 GESTURE_DIRECTION_LEFT,
146 GESTURE_DIRECTION_RIGHT,
147 GESTURE_DIRECTION_UP_RETURN,
148 GESTURE_DIRECTION_DOWN_RETURN,
149 GESTURE_DIRECTION_LEFT_RETURN,
150 GESTURE_DIRECTION_RIGHT_RETURN
152 struct GestureDirectionTable
155 const GestureDirection direction;
157 GestureDirectionTable ElDBusAccessibilityDirectionStrings[] =
159 { "Up", GESTURE_DIRECTION_UP },
160 { "Down", GESTURE_DIRECTION_DOWN },
161 { "Left", GESTURE_DIRECTION_LEFT },
162 { "Right", GESTURE_DIRECTION_RIGHT },
163 { "UpReturn", GESTURE_DIRECTION_UP_RETURN },
164 { "DownReturn", GESTURE_DIRECTION_DOWN_RETURN },
165 { "LeftReturn", GESTURE_DIRECTION_LEFT_RETURN },
166 { "RightReturn", GESTURE_DIRECTION_RIGHT_RETURN }
168 const unsigned int DirectionStringsTotal = sizeof( ElDBusAccessibilityDirectionStrings ) / sizeof( ElDBusAccessibilityDirectionStrings[0] );
169 #endif // DALI_ELDBUS_AVAILABLE
171 // Copied from x server
172 static unsigned int GetCurrentMilliSeconds(void)
177 static clockid_t clockid;
181 #ifdef CLOCK_MONOTONIC_COARSE
182 if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 &&
183 (tp.tv_nsec / 1000) <= 1000 && clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0)
185 clockid = CLOCK_MONOTONIC_COARSE;
189 if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
191 clockid = CLOCK_MONOTONIC;
198 if (clockid != ~0L && clock_gettime(clockid, &tp) == 0)
200 return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
203 gettimeofday(&tv, NULL);
204 return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
207 #ifndef DALI_PROFILE_UBUNTU
208 const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
209 #endif // DALI_PROFILE_UBUNTU
212 * Get the device name from the provided ecore key event
214 void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
216 const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
218 if ( ecoreDeviceName )
220 result = ecoreDeviceName;
225 * Get the device class from the provided ecore event
227 void GetDeviceClass( Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass )
229 switch( ecoreDeviceClass )
231 case ECORE_DEVICE_CLASS_SEAT:
233 deviceClass = Device::Class::USER;
236 case ECORE_DEVICE_CLASS_KEYBOARD:
238 deviceClass = Device::Class::KEYBOARD;
241 case ECORE_DEVICE_CLASS_MOUSE:
243 deviceClass = Device::Class::MOUSE;
246 case ECORE_DEVICE_CLASS_TOUCH:
248 deviceClass = Device::Class::TOUCH;
251 case ECORE_DEVICE_CLASS_PEN:
253 deviceClass = Device::Class::PEN;
256 case ECORE_DEVICE_CLASS_POINTER:
258 deviceClass = Device::Class::POINTER;
261 case ECORE_DEVICE_CLASS_GAMEPAD:
263 deviceClass = Device::Class::GAMEPAD;
268 deviceClass = Device::Class::NONE;
274 void GetDeviceSubclass( Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass )
276 switch( ecoreDeviceSubclass )
278 case ECORE_DEVICE_SUBCLASS_FINGER:
280 deviceSubclass = Device::Subclass::FINGER;
283 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
285 deviceSubclass = Device::Subclass::FINGERNAIL;
288 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
290 deviceSubclass = Device::Subclass::KNUCKLE;
293 case ECORE_DEVICE_SUBCLASS_PALM:
295 deviceSubclass = Device::Subclass::PALM;
298 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
300 deviceSubclass = Device::Subclass::HAND_SIDE;
303 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
305 deviceSubclass = Device::Subclass::HAND_FLAT;
308 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
310 deviceSubclass = Device::Subclass::PEN_TIP;
313 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
315 deviceSubclass = Device::Subclass::TRACKPAD;
318 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
320 deviceSubclass = Device::Subclass::TRACKPOINT;
323 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
325 deviceSubclass = Device::Subclass::TRACKBALL;
328 #ifdef OVER_TIZEN_VERSION_4
329 case ECORE_DEVICE_SUBCLASS_REMOCON:
331 deviceSubclass = Device::Subclass::REMOCON;
334 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
336 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
342 deviceSubclass = Device::Subclass::NONE;
348 } // unnamed namespace
350 // Impl to hide EFL implementation.
351 struct EventHandler::Impl
353 // Construction & Destruction
358 Impl( EventHandler* handler, Ecore_Wl_Window* window )
359 : mHandler( handler ),
360 mEcoreEventHandler(),
365 #ifdef DALI_ELDBUS_AVAILABLE
366 , mSystemConnection( NULL )
367 #endif // DALI_ELDBUS_AVAILABLE
369 // Only register for touch and key events if we have a window
372 // Register Touch events
373 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, handler ) );
374 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, handler ) );
375 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, handler ) );
376 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, handler ) );
378 // Register Mouse wheel events
379 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, handler ) );
381 // Register Focus events
382 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, handler ) );
383 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, handler ) );
385 // Register Key events
386 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, handler ) );
387 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, handler ) );
389 // Register Selection event - clipboard selection
390 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, handler ) );
391 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, handler ) );
393 // Register Rotate event
394 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ROTATE, EcoreEventRotate, handler) );
396 // Register Detent event
397 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetent, handler) );
399 #ifndef DALI_PROFILE_UBUNTU
400 // Register Vconf notify - font name and size
401 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged, handler );
402 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, handler );
403 #endif // DALI_PROFILE_UBUNTU
405 #ifdef DALI_ELDBUS_AVAILABLE
406 // Initialize ElDBus.
407 DALI_LOG_INFO( gImfLogging, Debug::General, "Starting DBus Initialization\n" );
410 EcoreElDBusInitialisation( handler );
412 DALI_LOG_INFO( gImfLogging, Debug::General, "Finished DBus Initialization\n" );
413 #endif // DALI_ELDBUS_AVAILABLE
422 #ifndef DALI_PROFILE_UBUNTU
423 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
424 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged );
425 #endif // DALI_PROFILE_UBUNTU
427 for( std::vector<Ecore_Event_Handler*>::iterator iter = mEcoreEventHandler.begin(), endIter = mEcoreEventHandler.end(); iter != endIter; ++iter )
429 ecore_event_handler_del( *iter );
432 #ifdef DALI_ELDBUS_AVAILABLE
433 // Close down ElDBus connections.
434 if( mSystemConnection )
436 eldbus_connection_unref( mSystemConnection );
438 #endif // DALI_ELDBUS_AVAILABLE
443 /////////////////////////////////////////////////////////////////////////////////////////////////
445 /////////////////////////////////////////////////////////////////////////////////////////////////
448 * Called when a touch down is received.
450 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
452 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
453 EventHandler* handler( (EventHandler*)data );
455 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
457 PointState::Type state ( PointState::DOWN );
459 // Check if the buttons field is set and ensure it's the primary touch button.
460 // If this event was triggered by buttons other than the primary button (used for touch), then
461 // just send an interrupted event to Core.
462 if ( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
464 state = PointState::INTERRUPTED;
467 Device::Class::Type deviceClass;
468 Device::Subclass::Type deviceSubclass;
470 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
471 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
473 Integration::Point point;
474 point.SetDeviceId( touchEvent->multi.device );
475 point.SetState( state );
476 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
477 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
478 point.SetPressure( touchEvent->multi.pressure );
479 point.SetAngle( Degree( touchEvent->multi.angle ) );
480 point.SetDeviceClass( deviceClass );
481 point.SetDeviceSubclass( deviceSubclass );
483 handler->SendEvent( point, touchEvent->timestamp );
486 return ECORE_CALLBACK_PASS_ON;
490 * Called when a touch up is received.
492 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
494 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
495 EventHandler* handler( (EventHandler*)data );
497 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
499 Device::Class::Type deviceClass;
500 Device::Subclass::Type deviceSubclass;
502 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
503 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
505 Integration::Point point;
506 point.SetDeviceId( touchEvent->multi.device );
507 point.SetState( PointState::UP );
508 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
509 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
510 point.SetPressure( touchEvent->multi.pressure );
511 point.SetAngle( Degree( touchEvent->multi.angle ) );
512 point.SetDeviceClass( deviceClass );
513 point.SetDeviceSubclass( deviceSubclass );
515 handler->SendEvent( point, touchEvent->timestamp );
518 return ECORE_CALLBACK_PASS_ON;
522 * Called when a touch motion is received.
524 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
526 Ecore_Event_Mouse_Move *touchEvent( (Ecore_Event_Mouse_Move*)event );
527 EventHandler* handler( (EventHandler*)data );
529 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
531 Device::Class::Type deviceClass;
532 Device::Subclass::Type deviceSubclass;
534 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
535 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
537 Integration::Point point;
538 point.SetDeviceId( touchEvent->multi.device );
539 point.SetState( PointState::MOTION );
540 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
541 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
542 point.SetPressure( touchEvent->multi.pressure );
543 point.SetAngle( Degree( touchEvent->multi.angle ) );
544 point.SetDeviceClass( deviceClass );
545 point.SetDeviceSubclass( deviceSubclass );
547 handler->SendEvent( point, touchEvent->timestamp );
550 return ECORE_CALLBACK_PASS_ON;
554 * Called when a touch is canceled.
556 static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
558 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
559 EventHandler* handler( (EventHandler*)data );
561 if( touchEvent->window == (unsigned int)ecore_wl_window_id_get( handler->mImpl->mWindow ) )
563 Integration::Point point;
564 point.SetDeviceId( touchEvent->multi.device );
565 point.SetState( PointState::INTERRUPTED );
566 point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
567 handler->SendEvent( point, touchEvent->timestamp );
569 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventMouseButtonCancel\n" );
572 return ECORE_CALLBACK_PASS_ON;
576 * Called when a mouse wheel is received.
578 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
580 Ecore_Event_Mouse_Wheel *mouseWheelEvent( (Ecore_Event_Mouse_Wheel*)event );
582 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT Ecore_Event_Mouse_Wheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
584 EventHandler* handler( (EventHandler*)data );
585 if ( mouseWheelEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
587 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp );
588 handler->SendWheelEvent( wheelEvent );
590 return ECORE_CALLBACK_PASS_ON;
593 /////////////////////////////////////////////////////////////////////////////////////////////////
595 /////////////////////////////////////////////////////////////////////////////////////////////////
598 * Called when a key down is received.
600 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
602 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyDown \n" );
604 EventHandler* handler( (EventHandler*)data );
605 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
606 bool eventHandled( false );
608 // If the event wasn't handled then we should send a key event.
611 if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
613 std::string keyName( keyEvent->keyname );
614 std::string keyString( "" );
615 std::string compose( "" );
617 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
618 if ( keyEvent->compose )
620 compose = keyEvent->compose;
623 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
624 keyCode = (keyCode == -1) ? 0 : keyCode;
625 int modifier( keyEvent->modifiers );
626 unsigned long time = keyEvent->timestamp;
627 if (!strncmp(keyEvent->keyname, "Keycode-", 8))
628 keyCode = atoi(keyEvent->keyname + 8);
630 // Ensure key event string is not NULL as keys like SHIFT have a null string.
631 if ( keyEvent->string )
633 keyString = keyEvent->string;
636 std::string deviceName;
637 Device::Class::Type deviceClass;
638 Device::Subclass::Type deviceSubclass;
640 GetDeviceName( keyEvent, deviceName );
641 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
642 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
644 DALI_LOG_INFO( gImfLogging, Debug::Verbose, "EVENT EcoreEventKeyDown - >>EcoreEventKeyDown deviceName(%s) deviceClass(%d)\n", deviceName.c_str(), deviceClass );
646 Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, deviceName, deviceClass, deviceSubclass );
647 handler->SendEvent( keyEvent );
651 return ECORE_CALLBACK_PASS_ON;
655 * Called when a key up is received.
657 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
659 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyUp\n" );
661 EventHandler* handler( (EventHandler*)data );
662 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
663 bool eventHandled( false );
665 // If the event wasn't handled then we should send a key event.
668 if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
670 std::string keyName( keyEvent->keyname );
671 std::string keyString( "" );
672 std::string compose( "" );
674 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
675 if ( keyEvent->compose )
677 compose = keyEvent->compose;
680 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
681 keyCode = (keyCode == -1) ? 0 : keyCode;
682 int modifier( keyEvent->modifiers );
683 unsigned long time = keyEvent->timestamp;
684 if (!strncmp(keyEvent->keyname, "Keycode-", 8))
685 keyCode = atoi(keyEvent->keyname + 8);
687 // Ensure key event string is not NULL as keys like SHIFT have a null string.
688 if ( keyEvent->string )
690 keyString = keyEvent->string;
693 std::string deviceName;
694 Device::Class::Type deviceClass;
695 Device::Subclass::Type deviceSubclass;
697 GetDeviceName( keyEvent, deviceName );
698 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
699 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
701 Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, deviceName, deviceClass, deviceSubclass );
702 handler->SendEvent( keyEvent );
706 return ECORE_CALLBACK_PASS_ON;
709 /////////////////////////////////////////////////////////////////////////////////////////////////
711 /////////////////////////////////////////////////////////////////////////////////////////////////
714 * Called when the window gains focus.
716 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
718 Ecore_Wl_Event_Focus_In* focusInEvent( (Ecore_Wl_Event_Focus_In*)event );
719 EventHandler* handler( (EventHandler*)data );
721 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusIn \n" );
723 // If the window gains focus and we hid the keyboard then show it again.
724 if ( focusInEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
726 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventWindowFocusIn - >>WindowFocusGained \n" );
728 Dali::Clipboard clipboard = Clipboard::Get();
729 clipboard.HideClipboard();
732 return ECORE_CALLBACK_PASS_ON;
736 * Called when the window loses focus.
738 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
740 Ecore_Wl_Event_Focus_Out* focusOutEvent( (Ecore_Wl_Event_Focus_Out*)event );
741 EventHandler* handler( (EventHandler*)data );
743 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusOut \n" );
745 // If the window loses focus then hide the keyboard.
746 if ( focusOutEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
748 // Hiding clipboard event will be ignored once because window focus out event is always received on showing clipboard
749 Dali::Clipboard clipboard = Clipboard::Get();
752 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
753 clipBoardImpl.HideClipboard(true);
757 return ECORE_CALLBACK_PASS_ON;
761 * Called when the window is damaged.
763 static Eina_Bool EcoreEventWindowDamaged(void *data, int type, void *event)
765 return ECORE_CALLBACK_PASS_ON;
769 * Called when the window properties are changed.
770 * We are only interested in the font change.
774 /////////////////////////////////////////////////////////////////////////////////////////////////
775 // Drag & Drop Callbacks
776 /////////////////////////////////////////////////////////////////////////////////////////////////
779 * Called when a dragged item enters our window's bounds.
780 * This is when items are dragged INTO our window.
782 static Eina_Bool EcoreEventDndEnter( void* data, int type, void* event )
784 DALI_LOG_INFO( gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndEnter\n" );
786 return ECORE_CALLBACK_PASS_ON;
790 * Called when a dragged item is moved within our window.
791 * This is when items are dragged INTO our window.
793 static Eina_Bool EcoreEventDndPosition( void* data, int type, void* event )
795 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndPosition\n" );
797 return ECORE_CALLBACK_PASS_ON;
801 * Called when a dragged item leaves our window's bounds.
802 * This is when items are dragged INTO our window.
804 static Eina_Bool EcoreEventDndLeave( void* data, int type, void* event )
806 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndLeave\n" );
808 return ECORE_CALLBACK_PASS_ON;
812 * Called when the dragged item is dropped within our window's bounds.
813 * This is when items are dragged INTO our window.
815 static Eina_Bool EcoreEventDndDrop( void* data, int type, void* event )
817 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndDrop\n" );
819 return ECORE_CALLBACK_PASS_ON;
823 * Called when a dragged item is moved from our window and the target window has done processing it.
824 * This is when items are dragged FROM our window.
826 static Eina_Bool EcoreEventDndFinished( void* data, int type, void* event )
828 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndFinished\n" );
829 return ECORE_CALLBACK_PASS_ON;
833 * Called when a dragged item is moved from our window and the target window has sent us a status.
834 * This is when items are dragged FROM our window.
836 static Eina_Bool EcoreEventDndStatus( void* data, int type, void* event )
838 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndStatus\n" );
839 return ECORE_CALLBACK_PASS_ON;
843 * Called when the client messages (i.e. the accessibility events) are received.
845 static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
847 return ECORE_CALLBACK_PASS_ON;
851 /////////////////////////////////////////////////////////////////////////////////////////////////
852 // ElDBus Accessibility Callbacks
853 /////////////////////////////////////////////////////////////////////////////////////////////////
855 #ifdef DALI_ELDBUS_AVAILABLE
856 // Callback for Ecore ElDBus accessibility events.
857 static void OnEcoreElDBusAccessibilityNotification( void *context EINA_UNUSED, const Eldbus_Message *message )
859 EventHandler* handler = static_cast< EventHandler* >( context );
860 // Ignore any accessibility events when paused.
861 if( handler->mPaused )
866 if( !handler->mAccessibilityAdaptor )
868 DALI_LOG_ERROR( "Invalid accessibility adaptor\n" );
872 AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( handler->mAccessibilityAdaptor ) );
873 if( !accessibilityAdaptor )
875 DALI_LOG_ERROR( "Cannot access accessibility adaptor\n" );
881 int state; // 0 - begin, 1 - ongoing, 2 - ended, 3 - aborted
884 // The string defines the arg-list's respective types.
885 if( !eldbus_message_arguments_get( message, "iiiiiiu", &gestureValue, &xS, &yS, &xE, &yE, &state, &eventTime ) )
887 DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
890 DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Name: %d Args: %d,%d,%d,%d State: %d\n", gestureValue, xS, yS, xE, yE );
892 // Create a touch point object.
893 TouchPoint::State touchPointState( TouchPoint::Down );
896 touchPointState = TouchPoint::Down; // Mouse down.
898 else if( state == 1 )
900 touchPointState = TouchPoint::Motion; // Mouse move.
902 else if( state == 2 )
904 touchPointState = TouchPoint::Up; // Mouse up.
908 touchPointState = TouchPoint::Interrupted; // Error.
911 // Send touch event to accessibility adaptor.
912 TouchPoint point( 0, touchPointState, (float)xS, (float)yS );
914 // Perform actions based on received gestures.
915 // Note: This is seperated from the reading so we can have other input readers without changing the below code.
916 switch( gestureValue )
918 case 0: // OneFingerHover
921 accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
924 case 1: // TwoFingersHover
926 // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control
927 accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() );
930 case 2: // ThreeFingersHover
932 // Read from top item on screen continuously.
933 accessibilityAdaptor->HandleActionReadFromTopEvent();
936 case 3: // OneFingerFlickLeft
938 // Move to previous item.
939 accessibilityAdaptor->HandleActionReadPreviousEvent();
942 case 4: // OneFingerFlickRight
944 // Move to next item.
945 accessibilityAdaptor->HandleActionReadNextEvent();
948 case 5: // OneFingerFlickUp
950 // Move to previous item.
951 accessibilityAdaptor->HandleActionPreviousEvent();
954 case 6: // OneFingerFlickDown
956 // Move to next item.
957 accessibilityAdaptor->HandleActionNextEvent();
960 case 7: // TwoFingersFlickUp
962 // Scroll up the list.
963 accessibilityAdaptor->HandleActionScrollUpEvent();
966 case 8: // TwoFingersFlickDown
968 // Scroll down the list.
969 accessibilityAdaptor->HandleActionScrollDownEvent();
972 case 9: // TwoFingersFlickLeft
974 // Scroll left to the previous page
975 accessibilityAdaptor->HandleActionPageLeftEvent();
978 case 10: // TwoFingersFlickRight
980 // Scroll right to the next page
981 accessibilityAdaptor->HandleActionPageRightEvent();
984 case 11: // ThreeFingersFlickLeft
989 case 12: // ThreeFingersFlickRight
994 case 13: // ThreeFingersFlickUp
999 case 14: // ThreeFingersFlickDown
1004 case 15: // OneFingerSingleTap
1007 accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
1010 case 16: // OneFingerDoubleTap
1012 // Activate selected item / active edit mode.
1013 accessibilityAdaptor->HandleActionActivateEvent();
1016 case 17: // OneFingerTripleTap
1019 accessibilityAdaptor->HandleActionZoomEvent();
1022 case 18: // TwoFingersSingleTap
1024 // Pause/Resume current speech
1025 accessibilityAdaptor->HandleActionReadPauseResumeEvent();
1028 case 19: // TwoFingersDoubleTap
1030 // Start/Stop current action
1031 accessibilityAdaptor->HandleActionStartStopEvent();
1034 case 20: // TwoFingersTripleTap
1036 // Read information from indicator
1037 accessibilityAdaptor->HandleActionReadIndicatorInformationEvent();
1040 case 21: // ThreeFingersSingleTap
1042 // Read from top item on screen continuously.
1043 accessibilityAdaptor->HandleActionReadFromTopEvent();
1046 case 22: // ThreeFingersDoubleTap
1048 // Read from next item continuously.
1049 accessibilityAdaptor->HandleActionReadFromNextEvent();
1052 case 23: // ThreeFingersTripleTap
1057 case 24: // OneFingerFlickLeftReturn
1059 // Scroll up to the previous page
1060 accessibilityAdaptor->HandleActionPageUpEvent();
1063 case 25: // OneFingerFlickRightReturn
1065 // Scroll down to the next page
1066 accessibilityAdaptor->HandleActionPageDownEvent();
1069 case 26: // OneFingerFlickUpReturn
1071 // Move to the first item on screen
1072 accessibilityAdaptor->HandleActionMoveToFirstEvent();
1075 case 27: // OneFingerFlickDownReturn
1077 // Move to the last item on screen
1078 accessibilityAdaptor->HandleActionMoveToLastEvent();
1081 case 28: // TwoFingersFlickLeftReturn
1086 case 29: // TwoFingersFlickRightReturn
1091 case 30: // TwoFingersFlickUpReturn
1096 case 31: // TwoFingersFlickDownReturn
1101 case 32: // ThreeFingersFlickLeftReturn
1106 case 33: // ThreeFingersFlickRightReturn
1111 case 34: // ThreeFingersFlickUpReturn
1116 case 35: // ThreeFingersFlickDownReturn
1124 void EcoreElDBusInitialisation( void *handle )
1126 Eldbus_Object *object;
1127 Eldbus_Proxy *manager;
1129 if( !( mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM) ) )
1131 DALI_LOG_ERROR( "Unable to get system bus\n" );
1134 object = eldbus_object_get( mSystemConnection, BUS, PATH );
1137 DALI_LOG_ERROR( "Getting object failed\n" );
1141 manager = eldbus_proxy_get( object, INTERFACE );
1144 DALI_LOG_ERROR( "Getting proxy failed\n" );
1148 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", OnEcoreElDBusAccessibilityNotification, handle ) )
1150 DALI_LOG_ERROR( "No signal handler returned\n" );
1153 #endif // DALI_ELDBUS_AVAILABLE
1156 * Called when the source window notifies us the content in clipboard is selected.
1158 static Eina_Bool EcoreEventSelectionClear( void* data, int type, void* event )
1160 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionClear\n" );
1161 return ECORE_CALLBACK_PASS_ON;
1165 * Called when the source window sends us about the selected content.
1166 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
1168 static Eina_Bool EcoreEventSelectionNotify( void* data, int type, void* event )
1170 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionNotify\n" );
1171 return ECORE_CALLBACK_PASS_ON;
1175 * Called when the source window notifies us the content in clipboard is selected.
1177 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
1179 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataSend\n" );
1181 Dali::Clipboard clipboard = Clipboard::Get();
1184 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
1185 clipBoardImpl.ExcuteBuffered( true, event );
1187 return ECORE_CALLBACK_PASS_ON;
1191 * Called when the source window sends us about the selected content.
1192 * For example, when item is selected in the clipboard.
1194 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
1196 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataReceive\n" );
1198 EventHandler* handler( (EventHandler*)data );
1199 Dali::Clipboard clipboard = Clipboard::Get();
1200 char *selectionData = NULL;
1203 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
1204 selectionData = clipBoardImpl.ExcuteBuffered( false, event );
1206 if ( selectionData && handler->mClipboardEventNotifier )
1208 ClipboardEventNotifier& clipboardEventNotifier( ClipboardEventNotifier::GetImplementation( handler->mClipboardEventNotifier ) );
1209 std::string content( selectionData, strlen(selectionData) );
1211 clipboardEventNotifier.SetContent( content );
1212 clipboardEventNotifier.EmitContentSelectedSignal();
1214 return ECORE_CALLBACK_PASS_ON;
1218 * Called when rotate event is recevied
1220 static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
1222 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::Concise, "EcoreEventRotate\n" );
1224 EventHandler* handler( (EventHandler*)data );
1225 Ecore_Wl_Event_Window_Rotate* ev( (Ecore_Wl_Event_Window_Rotate*)event );
1227 if( ev->win != (unsigned int)ecore_wl_window_id_get( handler->mImpl->mWindow ) )
1229 return ECORE_CALLBACK_PASS_ON;
1232 RotationEvent rotationEvent;
1233 rotationEvent.angle = ev->angle;
1234 rotationEvent.winResize = 0;
1236 if( ev->angle == 0 || ev->angle == 180 )
1238 rotationEvent.width = ev->w;
1239 rotationEvent.height = ev->h;
1243 rotationEvent.width = ev->h;
1244 rotationEvent.height = ev->w;
1247 handler->SendRotationPrepareEvent( rotationEvent );
1249 return ECORE_CALLBACK_PASS_ON;
1253 * Called when detent event is recevied
1255 static Eina_Bool EcoreEventDetent( void* data, int type, void* event )
1257 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDetent\n" );
1258 EventHandler* handler( (EventHandler*)data );
1259 Ecore_Event_Detent_Rotate *e((Ecore_Event_Detent_Rotate *)event);
1260 int direction = (e->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1261 int timeStamp = e->timestamp;
1263 WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2(0.0f, 0.0f), direction, timeStamp );
1264 handler->SendWheelEvent( wheelEvent );
1265 return ECORE_CALLBACK_PASS_ON;
1268 /////////////////////////////////////////////////////////////////////////////////////////////////
1270 /////////////////////////////////////////////////////////////////////////////////////////////////
1272 * Called when a font name is changed.
1274 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
1276 EventHandler* handler = static_cast<EventHandler*>( data );
1277 handler->SendEvent( StyleChange::DEFAULT_FONT_CHANGE );
1281 * Called when a font size is changed.
1283 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
1285 EventHandler* handler = static_cast<EventHandler*>( data );
1286 handler->SendEvent( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1289 void ConvertTouchPosition( Integration::Point& point )
1291 Vector2 position = point.GetScreenPosition();
1292 Vector2 convertedPosition;
1294 switch( mRotationAngle )
1298 convertedPosition.x = mWindowWidth - position.y;
1299 convertedPosition.y = position.x;
1304 convertedPosition.x = mWindowWidth - position.x;
1305 convertedPosition.y = mWindowHeight - position.y;
1310 convertedPosition.x = position.y;
1311 convertedPosition.y = mWindowHeight - position.x;
1316 convertedPosition = position;
1321 point.SetScreenPosition( convertedPosition );
1325 EventHandler* mHandler;
1326 std::vector<Ecore_Event_Handler*> mEcoreEventHandler;
1327 Ecore_Wl_Window* mWindow;
1331 #ifdef DALI_ELDBUS_AVAILABLE
1332 Eldbus_Connection* mSystemConnection;
1333 #endif // DALI_ELDBUS_AVAILABLE
1336 EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector )
1337 : mCoreEventInterface( coreEventInterface ),
1338 mGestureManager( gestureManager ),
1339 mStyleMonitor( StyleMonitor::Get() ),
1340 mDamageObserver( damageObserver ),
1341 mRotationObserver( NULL ),
1342 mDragAndDropDetector( dndDetector ),
1343 mAccessibilityAdaptor( AccessibilityAdaptor::Get() ),
1344 mClipboardEventNotifier( ClipboardEventNotifier::Get() ),
1345 mClipboard( Clipboard::Get() ),
1349 Ecore_Wl_Window* window = 0;
1351 // this code only works with the WindowRenderSurface so need to downcast
1352 WindowRenderSurfaceEcoreWl* ecoreSurface = static_cast< WindowRenderSurfaceEcoreWl* >( surface );
1355 window = ecoreSurface->GetWlWindow();
1358 mImpl = new Impl(this, window);
1361 EventHandler::~EventHandler()
1368 mGestureManager.Stop();
1371 void EventHandler::SendEvent(Integration::Point& point, unsigned long timeStamp)
1375 timeStamp = GetCurrentMilliSeconds();
1378 mImpl->ConvertTouchPosition( point );
1380 Integration::TouchEvent touchEvent;
1381 Integration::HoverEvent hoverEvent;
1382 Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent);
1383 if(type != Integration::TouchEventCombiner::DispatchNone )
1385 DALI_LOG_INFO(gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.GetDeviceId(), point.GetState(), point.GetScreenPosition().x, point.GetScreenPosition().y);
1387 // First the touch and/or hover event & related gesture events are queued
1388 if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth)
1390 mCoreEventInterface.QueueCoreEvent( touchEvent );
1391 mGestureManager.SendEvent(touchEvent);
1394 if(type == Integration::TouchEventCombiner::DispatchHover || type == Integration::TouchEventCombiner::DispatchBoth)
1396 mCoreEventInterface.QueueCoreEvent( hoverEvent );
1399 // Next the events are processed with a single call into Core
1400 mCoreEventInterface.ProcessCoreEvents();
1404 void EventHandler::SendEvent(Integration::KeyEvent& keyEvent)
1406 Dali::PhysicalKeyboard physicalKeyboard = PhysicalKeyboard::Get();
1407 if ( physicalKeyboard )
1409 if ( ! KeyLookup::IsDeviceButton( keyEvent.keyName.c_str() ) )
1411 GetImplementation( physicalKeyboard ).KeyReceived( keyEvent.time > 1 );
1415 // Create send KeyEvent to Core.
1416 mCoreEventInterface.QueueCoreEvent( keyEvent );
1417 mCoreEventInterface.ProcessCoreEvents();
1420 void EventHandler::SendWheelEvent( WheelEvent& wheelEvent )
1422 // Create WheelEvent and send to Core.
1423 Integration::WheelEvent event( static_cast< Integration::WheelEvent::Type >(wheelEvent.type), wheelEvent.direction, wheelEvent.modifiers, wheelEvent.point, wheelEvent.z, wheelEvent.timeStamp );
1424 mCoreEventInterface.QueueCoreEvent( event );
1425 mCoreEventInterface.ProcessCoreEvents();
1428 void EventHandler::SendEvent( StyleChange::Type styleChange )
1430 DALI_ASSERT_DEBUG( mStyleMonitor && "StyleMonitor Not Available" );
1431 GetImplementation( mStyleMonitor ).StyleChanged(styleChange);
1434 void EventHandler::SendEvent( const DamageArea& area )
1436 mDamageObserver.OnDamaged( area );
1439 void EventHandler::SendRotationPrepareEvent( const RotationEvent& event )
1441 if( mRotationObserver != NULL )
1443 mImpl->mRotationAngle = event.angle;
1444 mImpl->mWindowWidth = event.width;
1445 mImpl->mWindowHeight = event.height;
1447 mRotationObserver->OnRotationPrepare( event );
1448 mRotationObserver->OnRotationRequest();
1452 void EventHandler::SendRotationRequestEvent( )
1454 // No need to separate event into prepare and request in wayland
1457 void EventHandler::FeedTouchPoint( TouchPoint& point, int timeStamp)
1459 Integration::Point convertedPoint( point );
1460 SendEvent(convertedPoint, timeStamp);
1463 void EventHandler::FeedWheelEvent( WheelEvent& wheelEvent )
1465 SendWheelEvent( wheelEvent );
1468 void EventHandler::FeedKeyEvent( KeyEvent& event )
1470 Integration::KeyEvent convertedEvent( event );
1471 SendEvent( convertedEvent );
1474 void EventHandler::FeedEvent( Integration::Event& event )
1476 mCoreEventInterface.QueueCoreEvent( event );
1477 mCoreEventInterface.ProcessCoreEvents();
1480 void EventHandler::Reset()
1484 // Any touch listeners should be told of the interruption.
1485 Integration::TouchEvent event;
1486 Integration::Point point;
1487 point.SetState( PointState::INTERRUPTED );
1488 event.AddPoint( point );
1490 // First the touch event & related gesture events are queued
1491 mCoreEventInterface.QueueCoreEvent( event );
1492 mGestureManager.SendEvent( event );
1494 // Next the events are processed with a single call into Core
1495 mCoreEventInterface.ProcessCoreEvents();
1498 void EventHandler::Pause()
1504 void EventHandler::Resume()
1510 void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
1512 mDragAndDropDetector = detector;
1515 void EventHandler::SetRotationObserver( RotationObserver* observer )
1517 mRotationObserver = observer;
1520 } // namespace Adaptor
1522 } // namespace Internal
1526 #pragma GCC diagnostic pop