2 * Copyright (c) 2015 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 <events/event-handler.h>
23 #include <Ecore_Input.h>
24 #include <ecore-wl-render-surface.h>
29 #ifndef DALI_PROFILE_UBUNTU
31 #include <vconf-keys.h>
32 #endif // DALI_PROFILE_UBUNTU
34 #ifdef DALI_ELDBUS_AVAILABLE
36 #endif // DALI_ELDBUS_AVAILABLE
38 #include <dali/public-api/common/vector-wrapper.h>
39 #include <dali/public-api/events/touch-point.h>
40 #include <dali/public-api/events/key-event.h>
41 #include <dali/public-api/events/wheel-event.h>
42 #include <dali/integration-api/debug.h>
43 #include <dali/integration-api/events/key-event-integ.h>
44 #include <dali/integration-api/events/touch-event-integ.h>
45 #include <dali/integration-api/events/hover-event-integ.h>
46 #include <dali/integration-api/events/wheel-event-integ.h>
47 #include <dali/devel-api/events/key-event-devel.h>
50 #include <events/gesture-manager.h>
51 #include <window-render-surface.h>
52 #include <clipboard-impl.h>
54 #include <physical-keyboard-impl.h>
55 #include <style-monitor-impl.h>
56 #include <base/core-event-interface.h>
57 #include <virtual-keyboard.h>
68 #if defined(DEBUG_ENABLED)
71 Integration::Log::Filter* gTouchEventLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_TOUCH");
72 Integration::Log::Filter* gDragAndDropLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_DND");
73 Integration::Log::Filter* gImfLogging = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_IMF");
74 Integration::Log::Filter* gSelectionEventLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_SELECTION");
75 } // unnamed namespace
83 const char* BUS = "org.enlightenment.wm-screen-reader";
84 const char* INTERFACE = "org.tizen.GestureNavigation";
85 const char* PATH = "/org/tizen/GestureNavigation";
87 const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
89 const unsigned int BYTES_PER_CHARACTER_FOR_ATTRIBUTES = 3;
91 #ifdef DALI_ELDBUS_AVAILABLE
92 // DBus gesture string matching lists.
93 // TODO: This needs moving to its own module.
94 const char * ElDBusAccessibilityFingerCountStrings[] =
100 const unsigned int FingerCountStringsTotal = sizeof( ElDBusAccessibilityFingerCountStrings ) / sizeof( ElDBusAccessibilityFingerCountStrings[0] );
105 GESTURE_TYPE_SINGLE_TAP,
106 GESTURE_TYPE_DOUBLE_TAP,
107 GESTURE_TYPE_TRIPLE_TAP
109 struct GestureTypeTable
112 const GestureType type;
114 GestureTypeTable ElDBusAccessibilityFullEventTypeStrings[] =
116 { "Hover", GESTURE_TYPE_HOVER },
117 { "SingleTap", GESTURE_TYPE_SINGLE_TAP },
118 { "DoubleTap", GESTURE_TYPE_DOUBLE_TAP },
119 { "TripleTap", GESTURE_TYPE_TRIPLE_TAP }
121 const unsigned int FullEventTypeStringsTotal = sizeof( ElDBusAccessibilityFullEventTypeStrings ) / sizeof( ElDBusAccessibilityFullEventTypeStrings[0] );
124 SUB_GESTURE_TYPE_NONE,
125 SUB_GESTURE_TYPE_FLICK
127 struct SubGestureTypeTable
130 const SubGestureType type;
132 SubGestureTypeTable ElDBusAccessibilityDirectionalEventTypeStrings[] =
134 { "Flick", SUB_GESTURE_TYPE_FLICK }
136 const unsigned int DirectionalEventTypeStringsTotal = sizeof( ElDBusAccessibilityDirectionalEventTypeStrings ) / sizeof( ElDBusAccessibilityDirectionalEventTypeStrings[0] );
137 enum GestureDirection
139 GESTURE_DIRECTION_NONE,
140 GESTURE_DIRECTION_UP,
141 GESTURE_DIRECTION_DOWN,
142 GESTURE_DIRECTION_LEFT,
143 GESTURE_DIRECTION_RIGHT,
144 GESTURE_DIRECTION_UP_RETURN,
145 GESTURE_DIRECTION_DOWN_RETURN,
146 GESTURE_DIRECTION_LEFT_RETURN,
147 GESTURE_DIRECTION_RIGHT_RETURN
149 struct GestureDirectionTable
152 const GestureDirection direction;
154 GestureDirectionTable ElDBusAccessibilityDirectionStrings[] =
156 { "Up", GESTURE_DIRECTION_UP },
157 { "Down", GESTURE_DIRECTION_DOWN },
158 { "Left", GESTURE_DIRECTION_LEFT },
159 { "Right", GESTURE_DIRECTION_RIGHT },
160 { "UpReturn", GESTURE_DIRECTION_UP_RETURN },
161 { "DownReturn", GESTURE_DIRECTION_DOWN_RETURN },
162 { "LeftReturn", GESTURE_DIRECTION_LEFT_RETURN },
163 { "RightReturn", GESTURE_DIRECTION_RIGHT_RETURN }
165 const unsigned int DirectionStringsTotal = sizeof( ElDBusAccessibilityDirectionStrings ) / sizeof( ElDBusAccessibilityDirectionStrings[0] );
166 #endif // DALI_ELDBUS_AVAILABLE
169 * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
170 * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
171 * @param[in] ecoreModifier the Ecore_Event_Modifier input.
172 * @return the Ecore_IMF_Keyboard_Modifiers output.
174 Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier(unsigned int ecoreModifier)
176 int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE ); // If no other matches returns NONE.
179 if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT ) // enums from ecore_input/Ecore_Input.h
181 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT; // enums from ecore_imf/ecore_imf.h
184 if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALT )
186 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
189 if ( ecoreModifier & ECORE_EVENT_MODIFIER_CTRL )
191 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
194 if ( ecoreModifier & ECORE_EVENT_MODIFIER_WIN )
196 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
199 if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALTGR )
201 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR;
204 return static_cast<Ecore_IMF_Keyboard_Modifiers>( modifier );
208 // Copied from x server
209 static unsigned int GetCurrentMilliSeconds(void)
214 static clockid_t clockid;
218 #ifdef CLOCK_MONOTONIC_COARSE
219 if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 &&
220 (tp.tv_nsec / 1000) <= 1000 && clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0)
222 clockid = CLOCK_MONOTONIC_COARSE;
226 if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
228 clockid = CLOCK_MONOTONIC;
235 if (clockid != ~0L && clock_gettime(clockid, &tp) == 0)
237 return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
240 gettimeofday(&tv, NULL);
241 return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
244 #ifndef DALI_PROFILE_UBUNTU
245 const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
246 #endif // DALI_PROFILE_UBUNTU
249 * Get the device name from the provided ecore key event
251 void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
253 const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
255 if ( ecoreDeviceName )
257 result = ecoreDeviceName;
262 * Get the device class from the provided ecore key event
264 void GetDeviceClass( Ecore_Event_Key* keyEvent, DevelKeyEvent::DeviceClass::Type& deviceClass )
266 Ecore_Device_Class ecoreDeviceClass = ecore_device_class_get( keyEvent->dev );
268 switch( ecoreDeviceClass )
270 case ECORE_DEVICE_CLASS_SEAT:
272 deviceClass = DevelKeyEvent::DeviceClass::USER;
275 case ECORE_DEVICE_CLASS_KEYBOARD:
277 deviceClass = DevelKeyEvent::DeviceClass::KEYBOARD;
280 case ECORE_DEVICE_CLASS_MOUSE:
282 deviceClass = DevelKeyEvent::DeviceClass::MOUSE;
285 case ECORE_DEVICE_CLASS_TOUCH:
287 deviceClass = DevelKeyEvent::DeviceClass::TOUCH;
290 case ECORE_DEVICE_CLASS_PEN:
292 deviceClass = DevelKeyEvent::DeviceClass::PEN;
295 case ECORE_DEVICE_CLASS_POINTER:
297 deviceClass = DevelKeyEvent::DeviceClass::POINTER;
300 case ECORE_DEVICE_CLASS_GAMEPAD:
302 deviceClass = DevelKeyEvent::DeviceClass::GAMEPAD;
307 deviceClass = DevelKeyEvent::DeviceClass::NONE;
313 } // unnamed namespace
315 // Impl to hide EFL implementation.
316 struct EventHandler::Impl
318 // Construction & Destruction
323 Impl( EventHandler* handler, Ecore_Wl_Window* window )
324 : mHandler( handler ),
325 mEcoreEventHandler(),
327 #ifdef DALI_ELDBUS_AVAILABLE
328 , mSystemConnection( NULL )
329 #endif // DALI_ELDBUS_AVAILABLE
331 // Only register for touch and key events if we have a window
334 // Register Touch events
335 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, handler ) );
336 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, handler ) );
337 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, handler ) );
338 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, handler ) ); // process mouse out event like up event
340 // Register Mouse wheel events
341 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, handler ) );
343 // Register Focus events
344 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, handler ) );
345 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, handler ) );
347 // Register Key events
348 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, handler ) );
349 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, handler ) );
351 // Register Selection event - clipboard selection
352 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, handler ) );
353 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, handler ) );
355 // Register Rotate event
356 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ROTATE, EcoreEventRotate, handler) );
358 // Register Detent event
359 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetent, handler) );
361 #ifndef DALI_PROFILE_UBUNTU
362 // Register Vconf notify - font name and size
363 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged, handler );
364 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, handler );
365 #endif // DALI_PROFILE_UBUNTU
367 #ifdef DALI_ELDBUS_AVAILABLE
368 // Initialize ElDBus.
369 DALI_LOG_INFO( gImfLogging, Debug::General, "Starting DBus Initialization\n" );
372 EcoreElDBusInitialisation( handler );
374 DALI_LOG_INFO( gImfLogging, Debug::General, "Finished DBus Initialization\n" );
375 #endif // DALI_ELDBUS_AVAILABLE
384 #ifndef DALI_PROFILE_UBUNTU
385 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
386 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged );
387 #endif // DALI_PROFILE_UBUNTU
389 for( std::vector<Ecore_Event_Handler*>::iterator iter = mEcoreEventHandler.begin(), endIter = mEcoreEventHandler.end(); iter != endIter; ++iter )
391 ecore_event_handler_del( *iter );
394 #ifdef DALI_ELDBUS_AVAILABLE
395 // Close down ElDBus connections.
396 if( mSystemConnection )
398 eldbus_connection_unref( mSystemConnection );
400 #endif // DALI_ELDBUS_AVAILABLE
405 /////////////////////////////////////////////////////////////////////////////////////////////////
407 /////////////////////////////////////////////////////////////////////////////////////////////////
410 * Called when a touch down is received.
412 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
414 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
415 EventHandler* handler( (EventHandler*)data );
417 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
419 PointState::Type state ( PointState::DOWN );
421 // Check if the buttons field is set and ensure it's the primary touch button.
422 // If this event was triggered by buttons other than the primary button (used for touch), then
423 // just send an interrupted event to Core.
424 if ( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
426 state = PointState::INTERRUPTED;
429 Integration::Point point;
430 point.SetDeviceId( touchEvent->multi.device );
431 point.SetState( state );
432 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
433 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
434 point.SetPressure( touchEvent->multi.pressure );
435 point.SetAngle( Degree( touchEvent->multi.angle ) );
436 handler->SendEvent( point, touchEvent->timestamp );
439 return ECORE_CALLBACK_PASS_ON;
443 * Called when a touch up is received.
445 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
447 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
448 EventHandler* handler( (EventHandler*)data );
450 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
452 Integration::Point point;
453 point.SetDeviceId( touchEvent->multi.device );
454 point.SetState( PointState::UP );
455 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
456 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
457 point.SetPressure( touchEvent->multi.pressure );
458 point.SetAngle( Degree( touchEvent->multi.angle ) );
459 handler->SendEvent( point, touchEvent->timestamp );
462 return ECORE_CALLBACK_PASS_ON;
466 * Called when a touch up is received.
468 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
470 Ecore_Event_Mouse_Wheel *mouseWheelEvent( (Ecore_Event_Mouse_Wheel*)event );
472 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);
474 EventHandler* handler( (EventHandler*)data );
475 if ( mouseWheelEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
477 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp );
478 handler->SendWheelEvent( wheelEvent );
480 return ECORE_CALLBACK_PASS_ON;
484 * Called when a touch motion is received.
486 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
488 Ecore_Event_Mouse_Move *touchEvent( (Ecore_Event_Mouse_Move*)event );
489 EventHandler* handler( (EventHandler*)data );
491 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
493 Integration::Point point;
494 point.SetDeviceId( touchEvent->multi.device );
495 point.SetState( PointState::MOTION );
496 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
497 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
498 point.SetPressure( touchEvent->multi.pressure );
499 point.SetAngle( Degree( touchEvent->multi.angle ) );
500 handler->SendEvent( point, touchEvent->timestamp );
503 return ECORE_CALLBACK_PASS_ON;
506 /////////////////////////////////////////////////////////////////////////////////////////////////
508 /////////////////////////////////////////////////////////////////////////////////////////////////
511 * Called when a key down is received.
513 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
515 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyDown \n" );
517 EventHandler* handler( (EventHandler*)data );
518 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
519 bool eventHandled( false );
521 // If a device key then skip ecore_imf_context_filter_event.
522 if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
524 Ecore_IMF_Context* imfContext = NULL;
525 Dali::ImfManager imfManager( ImfManager::Get() );
528 imfContext = ImfManager::GetImplementation( imfManager ).GetContext();
533 // We're consuming key down event so we have to pass to IMF so that it can parse it as well.
534 Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
535 ecoreKeyDownEvent.keyname = keyEvent->keyname;
536 ecoreKeyDownEvent.key = keyEvent->key;
537 ecoreKeyDownEvent.string = keyEvent->string;
538 ecoreKeyDownEvent.compose = keyEvent->compose;
539 ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
540 ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
541 ecoreKeyDownEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
542 #ifdef ECORE_IMF_1_13
543 ecoreKeyDownEvent.dev_name = "";
544 ecoreKeyDownEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
545 ecoreKeyDownEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
546 #endif // ECORE_IMF_1_13
548 eventHandled = ecore_imf_context_filter_event( imfContext,
549 ECORE_IMF_EVENT_KEY_DOWN,
550 (Ecore_IMF_Event *) &ecoreKeyDownEvent );
552 // If the event has not been handled by IMF then check if we should reset our IMF context
555 if ( !strcmp( keyEvent->keyname, "Escape" ) ||
556 !strcmp( keyEvent->keyname, "Return" ) ||
557 !strcmp( keyEvent->keyname, "KP_Enter" ) )
559 ecore_imf_context_reset( imfContext );
565 // If the event wasn't handled then we should send a key event.
568 if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
570 std::string keyName( keyEvent->keyname );
571 std::string keyString( "" );
572 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
573 keyCode = (keyCode == -1) ? 0 : keyCode;
574 int modifier( keyEvent->modifiers );
575 unsigned long time = keyEvent->timestamp;
576 if (!strncmp(keyEvent->keyname, "Keycode-", 8))
577 keyCode = atoi(keyEvent->keyname + 8);
579 // Ensure key event string is not NULL as keys like SHIFT have a null string.
580 if ( keyEvent->string )
582 keyString = keyEvent->string;
585 std::string deviceName;
586 DevelKeyEvent::DeviceClass::Type deviceClass;
588 GetDeviceName( keyEvent, deviceName );
589 GetDeviceClass( keyEvent, deviceClass );
591 DALI_LOG_INFO( gImfLogging, Debug::Verbose, "EVENT EcoreEventKeyDown - >>EcoreEventKeyDown deviceName(%s) deviceClass(%d)\n", deviceName.c_str(), deviceClass );
593 Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, deviceName, deviceClass );
594 handler->SendEvent( keyEvent );
598 return ECORE_CALLBACK_PASS_ON;
602 * Called when a key up is received.
604 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
606 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyUp\n" );
608 EventHandler* handler( (EventHandler*)data );
609 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
610 bool eventHandled( false );
612 // Device keys like Menu, home, back button must skip ecore_imf_context_filter_event.
613 if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
615 Ecore_IMF_Context* imfContext = NULL;
616 Dali::ImfManager imfManager( ImfManager::Get() );
619 imfContext = ImfManager::GetImplementation( imfManager ).GetContext();
624 // We're consuming key up event so we have to pass to IMF so that it can parse it as well.
625 Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
626 ecoreKeyUpEvent.keyname = keyEvent->keyname;
627 ecoreKeyUpEvent.key = keyEvent->key;
628 ecoreKeyUpEvent.string = keyEvent->string;
629 ecoreKeyUpEvent.compose = keyEvent->compose;
630 ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
631 ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
632 ecoreKeyUpEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
633 #ifdef ECORE_IMF_1_13
634 ecoreKeyUpEvent.dev_name = "";
635 ecoreKeyUpEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
636 ecoreKeyUpEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
637 #endif // ECORE_IMF_1_13
639 eventHandled = ecore_imf_context_filter_event( imfContext,
640 ECORE_IMF_EVENT_KEY_UP,
641 (Ecore_IMF_Event *) &ecoreKeyUpEvent );
645 // If the event wasn't handled then we should send a key event.
648 if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
650 std::string keyName( keyEvent->keyname );
651 std::string keyString( "" );
652 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
653 keyCode = (keyCode == -1) ? 0 : keyCode;
654 int modifier( keyEvent->modifiers );
655 unsigned long time = keyEvent->timestamp;
656 if (!strncmp(keyEvent->keyname, "Keycode-", 8))
657 keyCode = atoi(keyEvent->keyname + 8);
659 // Ensure key event string is not NULL as keys like SHIFT have a null string.
660 if ( keyEvent->string )
662 keyString = keyEvent->string;
665 std::string deviceName;
666 DevelKeyEvent::DeviceClass::Type deviceClass;
668 GetDeviceName( keyEvent, deviceName );
669 GetDeviceClass( keyEvent, deviceClass );
671 Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, deviceName, deviceClass );
672 handler->SendEvent( keyEvent );
676 return ECORE_CALLBACK_PASS_ON;
679 /////////////////////////////////////////////////////////////////////////////////////////////////
681 /////////////////////////////////////////////////////////////////////////////////////////////////
684 * Called when the window gains focus.
686 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
688 Ecore_Wl_Event_Focus_In* focusInEvent( (Ecore_Wl_Event_Focus_In*)event );
689 EventHandler* handler( (EventHandler*)data );
691 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusIn \n" );
693 // If the window gains focus and we hid the keyboard then show it again.
694 if ( focusInEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
696 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventWindowFocusIn - >>WindowFocusGained \n" );
698 if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
700 Dali::ImfManager imfManager( ImfManager::Get() );
703 ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
704 if( imfManagerImpl.RestoreAfterFocusLost() )
706 imfManagerImpl.Activate();
710 Dali::Clipboard clipboard = Clipboard::Get();
711 clipboard.HideClipboard();
714 return ECORE_CALLBACK_PASS_ON;
718 * Called when the window loses focus.
720 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
722 Ecore_Wl_Event_Focus_Out* focusOutEvent( (Ecore_Wl_Event_Focus_Out*)event );
723 EventHandler* handler( (EventHandler*)data );
725 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusOut \n" );
727 // If the window loses focus then hide the keyboard.
728 if ( focusOutEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
730 if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
732 Dali::ImfManager imfManager( ImfManager::Get() );
735 ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
736 if( imfManagerImpl.RestoreAfterFocusLost() )
738 imfManagerImpl.Deactivate();
743 // Hiding clipboard event will be ignored once because window focus out event is always received on showing clipboard
744 Dali::Clipboard clipboard = Clipboard::Get();
747 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
748 clipBoardImpl.HideClipboard(true);
752 return ECORE_CALLBACK_PASS_ON;
756 * Called when the window is damaged.
758 static Eina_Bool EcoreEventWindowDamaged(void *data, int type, void *event)
760 return ECORE_CALLBACK_PASS_ON;
764 * Called when the window properties are changed.
765 * We are only interested in the font change.
769 /////////////////////////////////////////////////////////////////////////////////////////////////
770 // Drag & Drop Callbacks
771 /////////////////////////////////////////////////////////////////////////////////////////////////
774 * Called when a dragged item enters our window's bounds.
775 * This is when items are dragged INTO our window.
777 static Eina_Bool EcoreEventDndEnter( void* data, int type, void* event )
779 DALI_LOG_INFO( gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndEnter\n" );
781 return ECORE_CALLBACK_PASS_ON;
785 * Called when a dragged item is moved within our window.
786 * This is when items are dragged INTO our window.
788 static Eina_Bool EcoreEventDndPosition( void* data, int type, void* event )
790 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndPosition\n" );
792 return ECORE_CALLBACK_PASS_ON;
796 * Called when a dragged item leaves our window's bounds.
797 * This is when items are dragged INTO our window.
799 static Eina_Bool EcoreEventDndLeave( void* data, int type, void* event )
801 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndLeave\n" );
803 return ECORE_CALLBACK_PASS_ON;
807 * Called when the dragged item is dropped within our window's bounds.
808 * This is when items are dragged INTO our window.
810 static Eina_Bool EcoreEventDndDrop( void* data, int type, void* event )
812 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndDrop\n" );
814 return ECORE_CALLBACK_PASS_ON;
818 * Called when a dragged item is moved from our window and the target window has done processing it.
819 * This is when items are dragged FROM our window.
821 static Eina_Bool EcoreEventDndFinished( void* data, int type, void* event )
823 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndFinished\n" );
824 return ECORE_CALLBACK_PASS_ON;
828 * Called when a dragged item is moved from our window and the target window has sent us a status.
829 * This is when items are dragged FROM our window.
831 static Eina_Bool EcoreEventDndStatus( void* data, int type, void* event )
833 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndStatus\n" );
834 return ECORE_CALLBACK_PASS_ON;
838 * Called when the client messages (i.e. the accessibility events) are received.
840 static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
842 return ECORE_CALLBACK_PASS_ON;
846 /////////////////////////////////////////////////////////////////////////////////////////////////
847 // ElDBus Accessibility Callbacks
848 /////////////////////////////////////////////////////////////////////////////////////////////////
850 #ifdef DALI_ELDBUS_AVAILABLE
851 // Callback for Ecore ElDBus accessibility events.
852 static void OnEcoreElDBusAccessibilityNotification( void *context EINA_UNUSED, const Eldbus_Message *message )
854 EventHandler* handler = static_cast< EventHandler* >( context );
855 // Ignore any accessibility events when paused.
856 if( handler->mPaused )
861 if( !handler->mAccessibilityAdaptor )
863 DALI_LOG_ERROR( "Invalid accessibility adaptor\n" );
867 AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( handler->mAccessibilityAdaptor ) );
868 if( !accessibilityAdaptor )
870 DALI_LOG_ERROR( "Cannot access accessibility adaptor\n" );
876 int state; // 0 - begin, 1 - ongoing, 2 - ended, 3 - aborted
879 // The string defines the arg-list's respective types.
880 if( !eldbus_message_arguments_get( message, "iiiiiiu", &gestureValue, &xS, &yS, &xE, &yE, &state, &eventTime ) )
882 DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
885 DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Name: %d Args: %d,%d,%d,%d State: %d\n", gestureValue, xS, yS, xE, yE );
887 // Create a touch point object.
888 TouchPoint::State touchPointState( TouchPoint::Down );
891 touchPointState = TouchPoint::Down; // Mouse down.
893 else if( state == 1 )
895 touchPointState = TouchPoint::Motion; // Mouse move.
897 else if( state == 2 )
899 touchPointState = TouchPoint::Up; // Mouse up.
903 touchPointState = TouchPoint::Interrupted; // Error.
906 // Send touch event to accessibility adaptor.
907 TouchPoint point( 0, touchPointState, (float)xS, (float)yS );
909 // Perform actions based on received gestures.
910 // Note: This is seperated from the reading so we can have other input readers without changing the below code.
911 switch( gestureValue )
913 case 0: // OneFingerHover
916 accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
919 case 1: // TwoFingersHover
921 // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control
922 accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() );
925 case 2: // ThreeFingersHover
927 // Read from top item on screen continuously.
928 accessibilityAdaptor->HandleActionReadFromTopEvent();
931 case 3: // OneFingerFlickLeft
933 // Move to previous item.
934 accessibilityAdaptor->HandleActionReadPreviousEvent();
937 case 4: // OneFingerFlickRight
939 // Move to next item.
940 accessibilityAdaptor->HandleActionReadNextEvent();
943 case 5: // OneFingerFlickUp
945 // Move to previous item.
946 accessibilityAdaptor->HandleActionPreviousEvent();
949 case 6: // OneFingerFlickDown
951 // Move to next item.
952 accessibilityAdaptor->HandleActionNextEvent();
955 case 7: // TwoFingersFlickUp
957 // Scroll up the list.
958 accessibilityAdaptor->HandleActionScrollUpEvent();
961 case 8: // TwoFingersFlickDown
963 // Scroll down the list.
964 accessibilityAdaptor->HandleActionScrollDownEvent();
967 case 9: // TwoFingersFlickLeft
969 // Scroll left to the previous page
970 accessibilityAdaptor->HandleActionPageLeftEvent();
973 case 10: // TwoFingersFlickRight
975 // Scroll right to the next page
976 accessibilityAdaptor->HandleActionPageRightEvent();
979 case 11: // ThreeFingersFlickLeft
984 case 12: // ThreeFingersFlickRight
989 case 13: // ThreeFingersFlickUp
994 case 14: // ThreeFingersFlickDown
999 case 15: // OneFingerSingleTap
1002 accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
1005 case 16: // OneFingerDoubleTap
1007 // Activate selected item / active edit mode.
1008 accessibilityAdaptor->HandleActionActivateEvent();
1011 case 17: // OneFingerTripleTap
1014 accessibilityAdaptor->HandleActionZoomEvent();
1017 case 18: // TwoFingersSingleTap
1019 // Pause/Resume current speech
1020 accessibilityAdaptor->HandleActionReadPauseResumeEvent();
1023 case 19: // TwoFingersDoubleTap
1025 // Start/Stop current action
1026 accessibilityAdaptor->HandleActionStartStopEvent();
1029 case 20: // TwoFingersTripleTap
1031 // Read information from indicator
1032 accessibilityAdaptor->HandleActionReadIndicatorInformationEvent();
1035 case 21: // ThreeFingersSingleTap
1037 // Read from top item on screen continuously.
1038 accessibilityAdaptor->HandleActionReadFromTopEvent();
1041 case 22: // ThreeFingersDoubleTap
1043 // Read from next item continuously.
1044 accessibilityAdaptor->HandleActionReadFromNextEvent();
1047 case 23: // ThreeFingersTripleTap
1052 case 24: // OneFingerFlickLeftReturn
1054 // Scroll up to the previous page
1055 accessibilityAdaptor->HandleActionPageUpEvent();
1058 case 25: // OneFingerFlickRightReturn
1060 // Scroll down to the next page
1061 accessibilityAdaptor->HandleActionPageDownEvent();
1064 case 26: // OneFingerFlickUpReturn
1066 // Move to the first item on screen
1067 accessibilityAdaptor->HandleActionMoveToFirstEvent();
1070 case 27: // OneFingerFlickDownReturn
1072 // Move to the last item on screen
1073 accessibilityAdaptor->HandleActionMoveToLastEvent();
1076 case 28: // TwoFingersFlickLeftReturn
1081 case 29: // TwoFingersFlickRightReturn
1086 case 30: // TwoFingersFlickUpReturn
1091 case 31: // TwoFingersFlickDownReturn
1096 case 32: // ThreeFingersFlickLeftReturn
1101 case 33: // ThreeFingersFlickRightReturn
1106 case 34: // ThreeFingersFlickUpReturn
1111 case 35: // ThreeFingersFlickDownReturn
1119 void EcoreElDBusInitialisation( void *handle )
1121 Eldbus_Object *object;
1122 Eldbus_Proxy *manager;
1124 if( !( mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM) ) )
1126 DALI_LOG_ERROR( "Unable to get system bus\n" );
1129 object = eldbus_object_get( mSystemConnection, BUS, PATH );
1132 DALI_LOG_ERROR( "Getting object failed\n" );
1136 manager = eldbus_proxy_get( object, INTERFACE );
1139 DALI_LOG_ERROR( "Getting proxy failed\n" );
1143 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", OnEcoreElDBusAccessibilityNotification, handle ) )
1145 DALI_LOG_ERROR( "No signal handler returned\n" );
1148 #endif // DALI_ELDBUS_AVAILABLE
1151 * Called when the source window notifies us the content in clipboard is selected.
1153 static Eina_Bool EcoreEventSelectionClear( void* data, int type, void* event )
1155 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionClear\n" );
1156 return ECORE_CALLBACK_PASS_ON;
1160 * Called when the source window sends us about the selected content.
1161 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
1163 static Eina_Bool EcoreEventSelectionNotify( void* data, int type, void* event )
1165 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionNotify\n" );
1166 return ECORE_CALLBACK_PASS_ON;
1170 * Called when the source window notifies us the content in clipboard is selected.
1172 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
1174 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataSend\n" );
1176 Dali::Clipboard clipboard = Clipboard::Get();
1179 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
1180 clipBoardImpl.ExcuteBuffered( true, event );
1182 return ECORE_CALLBACK_PASS_ON;
1186 * Called when the source window sends us about the selected content.
1187 * For example, when item is selected in the clipboard.
1189 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
1191 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataReceive\n" );
1193 EventHandler* handler( (EventHandler*)data );
1194 Dali::Clipboard clipboard = Clipboard::Get();
1195 char *selectionData = NULL;
1198 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
1199 selectionData = clipBoardImpl.ExcuteBuffered( false, event );
1201 if ( selectionData && handler->mClipboardEventNotifier )
1203 ClipboardEventNotifier& clipboardEventNotifier( ClipboardEventNotifier::GetImplementation( handler->mClipboardEventNotifier ) );
1204 std::string content( selectionData, strlen(selectionData) );
1206 clipboardEventNotifier.SetContent( content );
1207 clipboardEventNotifier.EmitContentSelectedSignal();
1209 return ECORE_CALLBACK_PASS_ON;
1213 * Called when rotate event is recevied
1215 static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
1217 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::Concise, "EcoreEventRotate\n" );
1219 EventHandler* handler( (EventHandler*)data );
1220 Ecore_Wl_Event_Window_Rotate* ev( (Ecore_Wl_Event_Window_Rotate*)event );
1222 if( ev->win != (unsigned int)ecore_wl_window_id_get( handler->mImpl->mWindow ) )
1224 return ECORE_CALLBACK_PASS_ON;
1227 RotationEvent rotationEvent;
1228 rotationEvent.angle = ev->angle;
1229 rotationEvent.winResize = 0;
1230 rotationEvent.width = ev->w;
1231 rotationEvent.height = ev->h;
1232 handler->SendRotationPrepareEvent( rotationEvent );
1234 return ECORE_CALLBACK_PASS_ON;
1238 * Called when detent event is recevied
1240 static Eina_Bool EcoreEventDetent( void* data, int type, void* event )
1242 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDetent\n" );
1243 EventHandler* handler( (EventHandler*)data );
1244 Ecore_Event_Detent_Rotate *e((Ecore_Event_Detent_Rotate *)event);
1245 int direction = (e->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1246 int timeStamp = e->timestamp;
1248 WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2(0.0f, 0.0f), direction, timeStamp );
1249 handler->SendWheelEvent( wheelEvent );
1250 return ECORE_CALLBACK_PASS_ON;
1253 /////////////////////////////////////////////////////////////////////////////////////////////////
1255 /////////////////////////////////////////////////////////////////////////////////////////////////
1257 * Called when a font name is changed.
1259 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
1261 EventHandler* handler = static_cast<EventHandler*>( data );
1262 handler->SendEvent( StyleChange::DEFAULT_FONT_CHANGE );
1266 * Called when a font size is changed.
1268 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
1270 EventHandler* handler = static_cast<EventHandler*>( data );
1271 handler->SendEvent( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1275 EventHandler* mHandler;
1276 std::vector<Ecore_Event_Handler*> mEcoreEventHandler;
1277 Ecore_Wl_Window* mWindow;
1278 #ifdef DALI_ELDBUS_AVAILABLE
1279 Eldbus_Connection* mSystemConnection;
1280 #endif // DALI_ELDBUS_AVAILABLE
1283 EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector )
1284 : mCoreEventInterface( coreEventInterface ),
1285 mGestureManager( gestureManager ),
1286 mStyleMonitor( StyleMonitor::Get() ),
1287 mDamageObserver( damageObserver ),
1288 mRotationObserver( NULL ),
1289 mDragAndDropDetector( dndDetector ),
1290 mAccessibilityAdaptor( AccessibilityAdaptor::Get() ),
1291 mClipboardEventNotifier( ClipboardEventNotifier::Get() ),
1292 mClipboard( Clipboard::Get() ),
1296 Ecore_Wl_Window* window = 0;
1298 // this code only works with the Ecore RenderSurface so need to downcast
1299 ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface );
1302 window = ecoreSurface->GetWlWindow();
1305 mImpl = new Impl(this, window);
1308 EventHandler::~EventHandler()
1315 mGestureManager.Stop();
1318 void EventHandler::SendEvent(Integration::Point& point, unsigned long timeStamp)
1322 timeStamp = GetCurrentMilliSeconds();
1325 Integration::TouchEvent touchEvent;
1326 Integration::HoverEvent hoverEvent;
1327 Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent);
1328 if(type != Integration::TouchEventCombiner::DispatchNone )
1330 DALI_LOG_INFO(gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.GetDeviceId(), point.GetState(), point.GetLocalPosition().x, point.GetLocalPosition().y);
1332 // First the touch and/or hover event & related gesture events are queued
1333 if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth)
1335 mCoreEventInterface.QueueCoreEvent( touchEvent );
1336 mGestureManager.SendEvent(touchEvent);
1339 if(type == Integration::TouchEventCombiner::DispatchHover || type == Integration::TouchEventCombiner::DispatchBoth)
1341 mCoreEventInterface.QueueCoreEvent( hoverEvent );
1344 // Next the events are processed with a single call into Core
1345 mCoreEventInterface.ProcessCoreEvents();
1349 void EventHandler::SendEvent(Integration::KeyEvent& keyEvent)
1351 Dali::PhysicalKeyboard physicalKeyboard = PhysicalKeyboard::Get();
1352 if ( physicalKeyboard )
1354 if ( ! KeyLookup::IsDeviceButton( keyEvent.keyName.c_str() ) )
1356 GetImplementation( physicalKeyboard ).KeyReceived( keyEvent.time > 1 );
1360 // Create send KeyEvent to Core.
1361 mCoreEventInterface.QueueCoreEvent( keyEvent );
1362 mCoreEventInterface.ProcessCoreEvents();
1365 void EventHandler::SendWheelEvent( WheelEvent& wheelEvent )
1367 // Create WheelEvent and send to Core.
1368 Integration::WheelEvent event( static_cast< Integration::WheelEvent::Type >(wheelEvent.type), wheelEvent.direction, wheelEvent.modifiers, wheelEvent.point, wheelEvent.z, wheelEvent.timeStamp );
1369 mCoreEventInterface.QueueCoreEvent( event );
1370 mCoreEventInterface.ProcessCoreEvents();
1373 void EventHandler::SendEvent( StyleChange::Type styleChange )
1375 DALI_ASSERT_DEBUG( mStyleMonitor && "StyleMonitor Not Available" );
1376 GetImplementation( mStyleMonitor ).StyleChanged(styleChange);
1379 void EventHandler::SendEvent( const DamageArea& area )
1381 mDamageObserver.OnDamaged( area );
1384 void EventHandler::SendRotationPrepareEvent( const RotationEvent& event )
1386 if( mRotationObserver != NULL )
1388 mRotationObserver->OnRotationPrepare( event );
1389 mRotationObserver->OnRotationRequest();
1393 void EventHandler::SendRotationRequestEvent( )
1395 // No need to separate event into prepare and request in wayland
1398 void EventHandler::FeedTouchPoint( TouchPoint& point, int timeStamp)
1400 Integration::Point convertedPoint( point );
1401 SendEvent(convertedPoint, timeStamp);
1404 void EventHandler::FeedWheelEvent( WheelEvent& wheelEvent )
1406 SendWheelEvent( wheelEvent );
1409 void EventHandler::FeedKeyEvent( KeyEvent& event )
1411 Integration::KeyEvent convertedEvent( event );
1412 SendEvent( convertedEvent );
1415 void EventHandler::FeedEvent( Integration::Event& event )
1417 mCoreEventInterface.QueueCoreEvent( event );
1418 mCoreEventInterface.ProcessCoreEvents();
1421 void EventHandler::Reset()
1425 // Any touch listeners should be told of the interruption.
1426 Integration::TouchEvent event;
1427 Integration::Point point;
1428 point.SetState( PointState::INTERRUPTED );
1429 event.AddPoint( point );
1431 // First the touch event & related gesture events are queued
1432 mCoreEventInterface.QueueCoreEvent( event );
1433 mGestureManager.SendEvent( event );
1435 // Next the events are processed with a single call into Core
1436 mCoreEventInterface.ProcessCoreEvents();
1439 void EventHandler::Pause()
1445 void EventHandler::Resume()
1451 void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
1453 mDragAndDropDetector = detector;
1456 void EventHandler::SetRotationObserver( RotationObserver* observer )
1458 mRotationObserver = observer;
1461 } // namespace Adaptor
1463 } // namespace Internal