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:
271 deviceClass = DevelKeyEvent::DeviceClass::SEAT;
274 case ECORE_DEVICE_CLASS_KEYBOARD:
275 deviceClass = DevelKeyEvent::DeviceClass::KEYBOARD;
278 case ECORE_DEVICE_CLASS_MOUSE:
279 deviceClass = DevelKeyEvent::DeviceClass::MOUSE;
282 case ECORE_DEVICE_CLASS_TOUCH:
283 deviceClass = DevelKeyEvent::DeviceClass::TOUCH;
286 case ECORE_DEVICE_CLASS_PEN:
287 deviceClass = DevelKeyEvent::DeviceClass::PEN;
290 case ECORE_DEVICE_CLASS_POINTER:
291 deviceClass = DevelKeyEvent::DeviceClass::POINTER;
294 case ECORE_DEVICE_CLASS_GAMEPAD:
295 deviceClass = DevelKeyEvent::DeviceClass::GAMEPAD;
299 deviceClass = DevelKeyEvent::DeviceClass::NONE;
304 } // unnamed namespace
306 // Impl to hide EFL implementation.
307 struct EventHandler::Impl
309 // Construction & Destruction
314 Impl( EventHandler* handler, Ecore_Wl_Window* window )
315 : mHandler( handler ),
316 mEcoreEventHandler(),
318 #ifdef DALI_ELDBUS_AVAILABLE
319 , mSystemConnection( NULL )
320 #endif // DALI_ELDBUS_AVAILABLE
322 // Only register for touch and key events if we have a window
325 // Register Touch events
326 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, handler ) );
327 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, handler ) );
328 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, handler ) );
329 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, handler ) ); // process mouse out event like up event
331 // Register Mouse wheel events
332 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, handler ) );
334 // Register Focus events
335 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, handler ) );
336 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, handler ) );
338 // Register Key events
339 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, handler ) );
340 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, handler ) );
342 // Register Selection event - clipboard selection
343 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, handler ) );
344 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, handler ) );
346 // Register Rotate event
347 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ROTATE, EcoreEventRotate, handler) );
349 // Register Detent event
350 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetent, handler) );
352 #ifndef DALI_PROFILE_UBUNTU
353 // Register Vconf notify - font name and size
354 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged, handler );
355 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, handler );
356 #endif // DALI_PROFILE_UBUNTU
358 #ifdef DALI_ELDBUS_AVAILABLE
359 // Initialize ElDBus.
360 DALI_LOG_INFO( gImfLogging, Debug::General, "Starting DBus Initialization\n" );
363 EcoreElDBusInitialisation( handler );
365 DALI_LOG_INFO( gImfLogging, Debug::General, "Finished DBus Initialization\n" );
366 #endif // DALI_ELDBUS_AVAILABLE
375 #ifndef DALI_PROFILE_UBUNTU
376 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
377 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged );
378 #endif // DALI_PROFILE_UBUNTU
380 for( std::vector<Ecore_Event_Handler*>::iterator iter = mEcoreEventHandler.begin(), endIter = mEcoreEventHandler.end(); iter != endIter; ++iter )
382 ecore_event_handler_del( *iter );
385 #ifdef DALI_ELDBUS_AVAILABLE
386 // Close down ElDBus connections.
387 if( mSystemConnection )
389 eldbus_connection_unref( mSystemConnection );
391 #endif // DALI_ELDBUS_AVAILABLE
396 /////////////////////////////////////////////////////////////////////////////////////////////////
398 /////////////////////////////////////////////////////////////////////////////////////////////////
401 * Called when a touch down is received.
403 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
405 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
406 EventHandler* handler( (EventHandler*)data );
408 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
410 PointState::Type state ( PointState::DOWN );
412 // Check if the buttons field is set and ensure it's the primary touch button.
413 // If this event was triggered by buttons other than the primary button (used for touch), then
414 // just send an interrupted event to Core.
415 if ( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
417 state = PointState::INTERRUPTED;
420 Integration::Point point;
421 point.SetDeviceId( touchEvent->multi.device );
422 point.SetState( state );
423 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
424 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
425 point.SetPressure( touchEvent->multi.pressure );
426 point.SetAngle( Degree( touchEvent->multi.angle ) );
427 handler->SendEvent( point, touchEvent->timestamp );
430 return ECORE_CALLBACK_PASS_ON;
434 * Called when a touch up is received.
436 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
438 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
439 EventHandler* handler( (EventHandler*)data );
441 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
443 Integration::Point point;
444 point.SetDeviceId( touchEvent->multi.device );
445 point.SetState( PointState::UP );
446 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
447 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
448 point.SetPressure( touchEvent->multi.pressure );
449 point.SetAngle( Degree( touchEvent->multi.angle ) );
450 handler->SendEvent( point, touchEvent->timestamp );
453 return ECORE_CALLBACK_PASS_ON;
457 * Called when a touch up is received.
459 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
461 Ecore_Event_Mouse_Wheel *mouseWheelEvent( (Ecore_Event_Mouse_Wheel*)event );
463 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);
465 EventHandler* handler( (EventHandler*)data );
466 if ( mouseWheelEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
468 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp );
469 handler->SendWheelEvent( wheelEvent );
471 return ECORE_CALLBACK_PASS_ON;
475 * Called when a touch motion is received.
477 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
479 Ecore_Event_Mouse_Move *touchEvent( (Ecore_Event_Mouse_Move*)event );
480 EventHandler* handler( (EventHandler*)data );
482 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
484 Integration::Point point;
485 point.SetDeviceId( touchEvent->multi.device );
486 point.SetState( PointState::MOTION );
487 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
488 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
489 point.SetPressure( touchEvent->multi.pressure );
490 point.SetAngle( Degree( touchEvent->multi.angle ) );
491 handler->SendEvent( point, touchEvent->timestamp );
494 return ECORE_CALLBACK_PASS_ON;
497 /////////////////////////////////////////////////////////////////////////////////////////////////
499 /////////////////////////////////////////////////////////////////////////////////////////////////
502 * Called when a key down is received.
504 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
506 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyDown \n" );
508 EventHandler* handler( (EventHandler*)data );
509 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
510 bool eventHandled( false );
512 // If a device key then skip ecore_imf_context_filter_event.
513 if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
515 Ecore_IMF_Context* imfContext = NULL;
516 Dali::ImfManager imfManager( ImfManager::Get() );
519 imfContext = ImfManager::GetImplementation( imfManager ).GetContext();
524 // We're consuming key down event so we have to pass to IMF so that it can parse it as well.
525 Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
526 ecoreKeyDownEvent.keyname = keyEvent->keyname;
527 ecoreKeyDownEvent.key = keyEvent->key;
528 ecoreKeyDownEvent.string = keyEvent->string;
529 ecoreKeyDownEvent.compose = keyEvent->compose;
530 ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
531 ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
532 ecoreKeyDownEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
533 #ifdef ECORE_IMF_1_13
534 ecoreKeyDownEvent.dev_name = "";
535 ecoreKeyDownEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
536 ecoreKeyDownEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
537 #endif // ECORE_IMF_1_13
539 eventHandled = ecore_imf_context_filter_event( imfContext,
540 ECORE_IMF_EVENT_KEY_DOWN,
541 (Ecore_IMF_Event *) &ecoreKeyDownEvent );
543 // If the event has not been handled by IMF then check if we should reset our IMF context
546 if ( !strcmp( keyEvent->keyname, "Escape" ) ||
547 !strcmp( keyEvent->keyname, "Return" ) ||
548 !strcmp( keyEvent->keyname, "KP_Enter" ) )
550 ecore_imf_context_reset( imfContext );
556 // If the event wasn't handled then we should send a key event.
559 if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
561 std::string keyName( keyEvent->keyname );
562 std::string keyString( "" );
563 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
564 keyCode = (keyCode == -1) ? 0 : keyCode;
565 int modifier( keyEvent->modifiers );
566 unsigned long time = keyEvent->timestamp;
567 if (!strncmp(keyEvent->keyname, "Keycode-", 8))
568 keyCode = atoi(keyEvent->keyname + 8);
570 // Ensure key event string is not NULL as keys like SHIFT have a null string.
571 if ( keyEvent->string )
573 keyString = keyEvent->string;
576 std::string deviceName;
577 DevelKeyEvent::DeviceClass::Type deviceClass;
579 GetDeviceName( keyEvent, deviceName );
580 GetDeviceClass( keyEvent, deviceClass );
582 DALI_LOG_INFO( gImfLogging, Debug::Verbose, "EVENT EcoreEventKeyDown - >>EcoreEventKeyDown deviceName(%s) deviceClass(%d)\n", deviceName.c_str(), deviceClass );
584 Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, deviceName, deviceClass );
585 handler->SendEvent( keyEvent );
589 return ECORE_CALLBACK_PASS_ON;
593 * Called when a key up is received.
595 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
597 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyUp\n" );
599 EventHandler* handler( (EventHandler*)data );
600 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
601 bool eventHandled( false );
603 // Device keys like Menu, home, back button must skip ecore_imf_context_filter_event.
604 if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
606 Ecore_IMF_Context* imfContext = NULL;
607 Dali::ImfManager imfManager( ImfManager::Get() );
610 imfContext = ImfManager::GetImplementation( imfManager ).GetContext();
615 // We're consuming key up event so we have to pass to IMF so that it can parse it as well.
616 Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
617 ecoreKeyUpEvent.keyname = keyEvent->keyname;
618 ecoreKeyUpEvent.key = keyEvent->key;
619 ecoreKeyUpEvent.string = keyEvent->string;
620 ecoreKeyUpEvent.compose = keyEvent->compose;
621 ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
622 ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
623 ecoreKeyUpEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
624 #ifdef ECORE_IMF_1_13
625 ecoreKeyUpEvent.dev_name = "";
626 ecoreKeyUpEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
627 ecoreKeyUpEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
628 #endif // ECORE_IMF_1_13
630 eventHandled = ecore_imf_context_filter_event( imfContext,
631 ECORE_IMF_EVENT_KEY_UP,
632 (Ecore_IMF_Event *) &ecoreKeyUpEvent );
636 // If the event wasn't handled then we should send a key event.
639 if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
641 std::string keyName( keyEvent->keyname );
642 std::string keyString( "" );
643 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
644 keyCode = (keyCode == -1) ? 0 : keyCode;
645 int modifier( keyEvent->modifiers );
646 unsigned long time = keyEvent->timestamp;
647 if (!strncmp(keyEvent->keyname, "Keycode-", 8))
648 keyCode = atoi(keyEvent->keyname + 8);
650 // Ensure key event string is not NULL as keys like SHIFT have a null string.
651 if ( keyEvent->string )
653 keyString = keyEvent->string;
656 std::string deviceName;
657 DevelKeyEvent::DeviceClass::Type deviceClass;
659 GetDeviceName( keyEvent, deviceName );
660 GetDeviceClass( keyEvent, deviceClass );
662 Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, deviceName, deviceClass );
663 handler->SendEvent( keyEvent );
667 return ECORE_CALLBACK_PASS_ON;
670 /////////////////////////////////////////////////////////////////////////////////////////////////
672 /////////////////////////////////////////////////////////////////////////////////////////////////
675 * Called when the window gains focus.
677 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
679 Ecore_Wl_Event_Focus_In* focusInEvent( (Ecore_Wl_Event_Focus_In*)event );
680 EventHandler* handler( (EventHandler*)data );
682 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusIn \n" );
684 // If the window gains focus and we hid the keyboard then show it again.
685 if ( focusInEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
687 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventWindowFocusIn - >>WindowFocusGained \n" );
689 if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
691 Dali::ImfManager imfManager( ImfManager::Get() );
694 ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
695 if( imfManagerImpl.RestoreAfterFocusLost() )
697 imfManagerImpl.Activate();
701 Dali::Clipboard clipboard = Clipboard::Get();
702 clipboard.HideClipboard();
705 return ECORE_CALLBACK_PASS_ON;
709 * Called when the window loses focus.
711 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
713 Ecore_Wl_Event_Focus_Out* focusOutEvent( (Ecore_Wl_Event_Focus_Out*)event );
714 EventHandler* handler( (EventHandler*)data );
716 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusOut \n" );
718 // If the window loses focus then hide the keyboard.
719 if ( focusOutEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
721 if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
723 Dali::ImfManager imfManager( ImfManager::Get() );
726 ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
727 if( imfManagerImpl.RestoreAfterFocusLost() )
729 imfManagerImpl.Deactivate();
734 // Hiding clipboard event will be ignored once because window focus out event is always received on showing clipboard
735 Dali::Clipboard clipboard = Clipboard::Get();
738 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
739 clipBoardImpl.HideClipboard(true);
743 return ECORE_CALLBACK_PASS_ON;
747 * Called when the window is damaged.
749 static Eina_Bool EcoreEventWindowDamaged(void *data, int type, void *event)
751 return ECORE_CALLBACK_PASS_ON;
755 * Called when the window properties are changed.
756 * We are only interested in the font change.
760 /////////////////////////////////////////////////////////////////////////////////////////////////
761 // Drag & Drop Callbacks
762 /////////////////////////////////////////////////////////////////////////////////////////////////
765 * Called when a dragged item enters our window's bounds.
766 * This is when items are dragged INTO our window.
768 static Eina_Bool EcoreEventDndEnter( void* data, int type, void* event )
770 DALI_LOG_INFO( gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndEnter\n" );
772 return ECORE_CALLBACK_PASS_ON;
776 * Called when a dragged item is moved within our window.
777 * This is when items are dragged INTO our window.
779 static Eina_Bool EcoreEventDndPosition( void* data, int type, void* event )
781 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndPosition\n" );
783 return ECORE_CALLBACK_PASS_ON;
787 * Called when a dragged item leaves our window's bounds.
788 * This is when items are dragged INTO our window.
790 static Eina_Bool EcoreEventDndLeave( void* data, int type, void* event )
792 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndLeave\n" );
794 return ECORE_CALLBACK_PASS_ON;
798 * Called when the dragged item is dropped within our window's bounds.
799 * This is when items are dragged INTO our window.
801 static Eina_Bool EcoreEventDndDrop( void* data, int type, void* event )
803 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndDrop\n" );
805 return ECORE_CALLBACK_PASS_ON;
809 * Called when a dragged item is moved from our window and the target window has done processing it.
810 * This is when items are dragged FROM our window.
812 static Eina_Bool EcoreEventDndFinished( void* data, int type, void* event )
814 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndFinished\n" );
815 return ECORE_CALLBACK_PASS_ON;
819 * Called when a dragged item is moved from our window and the target window has sent us a status.
820 * This is when items are dragged FROM our window.
822 static Eina_Bool EcoreEventDndStatus( void* data, int type, void* event )
824 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndStatus\n" );
825 return ECORE_CALLBACK_PASS_ON;
829 * Called when the client messages (i.e. the accessibility events) are received.
831 static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
833 return ECORE_CALLBACK_PASS_ON;
837 /////////////////////////////////////////////////////////////////////////////////////////////////
838 // ElDBus Accessibility Callbacks
839 /////////////////////////////////////////////////////////////////////////////////////////////////
841 #ifdef DALI_ELDBUS_AVAILABLE
842 // Callback for Ecore ElDBus accessibility events.
843 static void OnEcoreElDBusAccessibilityNotification( void *context EINA_UNUSED, const Eldbus_Message *message )
845 EventHandler* handler = static_cast< EventHandler* >( context );
846 // Ignore any accessibility events when paused.
847 if( handler->mPaused )
852 if( !handler->mAccessibilityAdaptor )
854 DALI_LOG_ERROR( "Invalid accessibility adaptor\n" );
858 AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( handler->mAccessibilityAdaptor ) );
859 if( !accessibilityAdaptor )
861 DALI_LOG_ERROR( "Cannot access accessibility adaptor\n" );
867 int state; // 0 - begin, 1 - ongoing, 2 - ended, 3 - aborted
870 // The string defines the arg-list's respective types.
871 if( !eldbus_message_arguments_get( message, "iiiiiiu", &gestureValue, &xS, &yS, &xE, &yE, &state, &eventTime ) )
873 DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
876 DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Name: %d Args: %d,%d,%d,%d State: %d\n", gestureValue, xS, yS, xE, yE );
878 // Create a touch point object.
879 TouchPoint::State touchPointState( TouchPoint::Down );
882 touchPointState = TouchPoint::Down; // Mouse down.
884 else if( state == 1 )
886 touchPointState = TouchPoint::Motion; // Mouse move.
888 else if( state == 2 )
890 touchPointState = TouchPoint::Up; // Mouse up.
894 touchPointState = TouchPoint::Interrupted; // Error.
897 // Send touch event to accessibility adaptor.
898 TouchPoint point( 0, touchPointState, (float)xS, (float)yS );
900 // Perform actions based on received gestures.
901 // Note: This is seperated from the reading so we can have other input readers without changing the below code.
902 switch( gestureValue )
904 case 0: // OneFingerHover
907 accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
910 case 1: // TwoFingersHover
912 // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control
913 accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() );
916 case 2: // ThreeFingersHover
918 // Read from top item on screen continuously.
919 accessibilityAdaptor->HandleActionReadFromTopEvent();
922 case 3: // OneFingerFlickLeft
924 // Move to previous item.
925 accessibilityAdaptor->HandleActionReadPreviousEvent();
928 case 4: // OneFingerFlickRight
930 // Move to next item.
931 accessibilityAdaptor->HandleActionReadNextEvent();
934 case 5: // OneFingerFlickUp
936 // Move to previous item.
937 accessibilityAdaptor->HandleActionPreviousEvent();
940 case 6: // OneFingerFlickDown
942 // Move to next item.
943 accessibilityAdaptor->HandleActionNextEvent();
946 case 7: // TwoFingersFlickUp
948 // Scroll up the list.
949 accessibilityAdaptor->HandleActionScrollUpEvent();
952 case 8: // TwoFingersFlickDown
954 // Scroll down the list.
955 accessibilityAdaptor->HandleActionScrollDownEvent();
958 case 9: // TwoFingersFlickLeft
960 // Scroll left to the previous page
961 accessibilityAdaptor->HandleActionPageLeftEvent();
964 case 10: // TwoFingersFlickRight
966 // Scroll right to the next page
967 accessibilityAdaptor->HandleActionPageRightEvent();
970 case 11: // ThreeFingersFlickLeft
975 case 12: // ThreeFingersFlickRight
980 case 13: // ThreeFingersFlickUp
985 case 14: // ThreeFingersFlickDown
990 case 15: // OneFingerSingleTap
993 accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
996 case 16: // OneFingerDoubleTap
998 // Activate selected item / active edit mode.
999 accessibilityAdaptor->HandleActionActivateEvent();
1002 case 17: // OneFingerTripleTap
1005 accessibilityAdaptor->HandleActionZoomEvent();
1008 case 18: // TwoFingersSingleTap
1010 // Pause/Resume current speech
1011 accessibilityAdaptor->HandleActionReadPauseResumeEvent();
1014 case 19: // TwoFingersDoubleTap
1016 // Start/Stop current action
1017 accessibilityAdaptor->HandleActionStartStopEvent();
1020 case 20: // TwoFingersTripleTap
1022 // Read information from indicator
1023 accessibilityAdaptor->HandleActionReadIndicatorInformationEvent();
1026 case 21: // ThreeFingersSingleTap
1028 // Read from top item on screen continuously.
1029 accessibilityAdaptor->HandleActionReadFromTopEvent();
1032 case 22: // ThreeFingersDoubleTap
1034 // Read from next item continuously.
1035 accessibilityAdaptor->HandleActionReadFromNextEvent();
1038 case 23: // ThreeFingersTripleTap
1043 case 24: // OneFingerFlickLeftReturn
1045 // Scroll up to the previous page
1046 accessibilityAdaptor->HandleActionPageUpEvent();
1049 case 25: // OneFingerFlickRightReturn
1051 // Scroll down to the next page
1052 accessibilityAdaptor->HandleActionPageDownEvent();
1055 case 26: // OneFingerFlickUpReturn
1057 // Move to the first item on screen
1058 accessibilityAdaptor->HandleActionMoveToFirstEvent();
1061 case 27: // OneFingerFlickDownReturn
1063 // Move to the last item on screen
1064 accessibilityAdaptor->HandleActionMoveToLastEvent();
1067 case 28: // TwoFingersFlickLeftReturn
1072 case 29: // TwoFingersFlickRightReturn
1077 case 30: // TwoFingersFlickUpReturn
1082 case 31: // TwoFingersFlickDownReturn
1087 case 32: // ThreeFingersFlickLeftReturn
1092 case 33: // ThreeFingersFlickRightReturn
1097 case 34: // ThreeFingersFlickUpReturn
1102 case 35: // ThreeFingersFlickDownReturn
1110 void EcoreElDBusInitialisation( void *handle )
1112 Eldbus_Object *object;
1113 Eldbus_Proxy *manager;
1115 if( !( mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM) ) )
1117 DALI_LOG_ERROR( "Unable to get system bus\n" );
1120 object = eldbus_object_get( mSystemConnection, BUS, PATH );
1123 DALI_LOG_ERROR( "Getting object failed\n" );
1127 manager = eldbus_proxy_get( object, INTERFACE );
1130 DALI_LOG_ERROR( "Getting proxy failed\n" );
1134 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", OnEcoreElDBusAccessibilityNotification, handle ) )
1136 DALI_LOG_ERROR( "No signal handler returned\n" );
1139 #endif // DALI_ELDBUS_AVAILABLE
1142 * Called when the source window notifies us the content in clipboard is selected.
1144 static Eina_Bool EcoreEventSelectionClear( void* data, int type, void* event )
1146 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionClear\n" );
1147 return ECORE_CALLBACK_PASS_ON;
1151 * Called when the source window sends us about the selected content.
1152 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
1154 static Eina_Bool EcoreEventSelectionNotify( void* data, int type, void* event )
1156 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionNotify\n" );
1157 return ECORE_CALLBACK_PASS_ON;
1161 * Called when the source window notifies us the content in clipboard is selected.
1163 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
1165 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataSend\n" );
1167 Dali::Clipboard clipboard = Clipboard::Get();
1170 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
1171 clipBoardImpl.ExcuteBuffered( true, event );
1173 return ECORE_CALLBACK_PASS_ON;
1177 * Called when the source window sends us about the selected content.
1178 * For example, when item is selected in the clipboard.
1180 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
1182 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataReceive\n" );
1184 EventHandler* handler( (EventHandler*)data );
1185 Dali::Clipboard clipboard = Clipboard::Get();
1186 char *selectionData = NULL;
1189 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
1190 selectionData = clipBoardImpl.ExcuteBuffered( false, event );
1192 if ( selectionData && handler->mClipboardEventNotifier )
1194 ClipboardEventNotifier& clipboardEventNotifier( ClipboardEventNotifier::GetImplementation( handler->mClipboardEventNotifier ) );
1195 std::string content( selectionData, strlen(selectionData) );
1197 clipboardEventNotifier.SetContent( content );
1198 clipboardEventNotifier.EmitContentSelectedSignal();
1200 return ECORE_CALLBACK_PASS_ON;
1204 * Called when rotate event is recevied
1206 static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
1208 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::Concise, "EcoreEventRotate\n" );
1210 EventHandler* handler( (EventHandler*)data );
1211 Ecore_Wl_Event_Window_Rotate* ev( (Ecore_Wl_Event_Window_Rotate*)event );
1213 if( ev->win != (unsigned int)ecore_wl_window_id_get( handler->mImpl->mWindow ) )
1215 return ECORE_CALLBACK_PASS_ON;
1218 RotationEvent rotationEvent;
1219 rotationEvent.angle = ev->angle;
1220 rotationEvent.winResize = 0;
1221 rotationEvent.width = ev->w;
1222 rotationEvent.height = ev->h;
1223 handler->SendRotationPrepareEvent( rotationEvent );
1225 return ECORE_CALLBACK_PASS_ON;
1229 * Called when detent event is recevied
1231 static Eina_Bool EcoreEventDetent( void* data, int type, void* event )
1233 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDetent\n" );
1234 EventHandler* handler( (EventHandler*)data );
1235 Ecore_Event_Detent_Rotate *e((Ecore_Event_Detent_Rotate *)event);
1236 int direction = (e->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1237 int timeStamp = e->timestamp;
1239 WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2(0.0f, 0.0f), direction, timeStamp );
1240 handler->SendWheelEvent( wheelEvent );
1241 return ECORE_CALLBACK_PASS_ON;
1244 /////////////////////////////////////////////////////////////////////////////////////////////////
1246 /////////////////////////////////////////////////////////////////////////////////////////////////
1248 * Called when a font name is changed.
1250 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
1252 EventHandler* handler = static_cast<EventHandler*>( data );
1253 handler->SendEvent( StyleChange::DEFAULT_FONT_CHANGE );
1257 * Called when a font size is changed.
1259 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
1261 EventHandler* handler = static_cast<EventHandler*>( data );
1262 handler->SendEvent( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1266 EventHandler* mHandler;
1267 std::vector<Ecore_Event_Handler*> mEcoreEventHandler;
1268 Ecore_Wl_Window* mWindow;
1269 #ifdef DALI_ELDBUS_AVAILABLE
1270 Eldbus_Connection* mSystemConnection;
1271 #endif // DALI_ELDBUS_AVAILABLE
1274 EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector )
1275 : mCoreEventInterface( coreEventInterface ),
1276 mGestureManager( gestureManager ),
1277 mStyleMonitor( StyleMonitor::Get() ),
1278 mDamageObserver( damageObserver ),
1279 mRotationObserver( NULL ),
1280 mDragAndDropDetector( dndDetector ),
1281 mAccessibilityAdaptor( AccessibilityAdaptor::Get() ),
1282 mClipboardEventNotifier( ClipboardEventNotifier::Get() ),
1283 mClipboard( Clipboard::Get() ),
1287 Ecore_Wl_Window* window = 0;
1289 // this code only works with the Ecore RenderSurface so need to downcast
1290 ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface );
1293 window = ecoreSurface->GetWlWindow();
1296 mImpl = new Impl(this, window);
1299 EventHandler::~EventHandler()
1306 mGestureManager.Stop();
1309 void EventHandler::SendEvent(Integration::Point& point, unsigned long timeStamp)
1313 timeStamp = GetCurrentMilliSeconds();
1316 Integration::TouchEvent touchEvent;
1317 Integration::HoverEvent hoverEvent;
1318 Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent);
1319 if(type != Integration::TouchEventCombiner::DispatchNone )
1321 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);
1323 // First the touch and/or hover event & related gesture events are queued
1324 if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth)
1326 mCoreEventInterface.QueueCoreEvent( touchEvent );
1327 mGestureManager.SendEvent(touchEvent);
1330 if(type == Integration::TouchEventCombiner::DispatchHover || type == Integration::TouchEventCombiner::DispatchBoth)
1332 mCoreEventInterface.QueueCoreEvent( hoverEvent );
1335 // Next the events are processed with a single call into Core
1336 mCoreEventInterface.ProcessCoreEvents();
1340 void EventHandler::SendEvent(Integration::KeyEvent& keyEvent)
1342 Dali::PhysicalKeyboard physicalKeyboard = PhysicalKeyboard::Get();
1343 if ( physicalKeyboard )
1345 if ( ! KeyLookup::IsDeviceButton( keyEvent.keyName.c_str() ) )
1347 GetImplementation( physicalKeyboard ).KeyReceived( keyEvent.time > 1 );
1351 // Create send KeyEvent to Core.
1352 mCoreEventInterface.QueueCoreEvent( keyEvent );
1353 mCoreEventInterface.ProcessCoreEvents();
1356 void EventHandler::SendWheelEvent( WheelEvent& wheelEvent )
1358 // Create WheelEvent and send to Core.
1359 Integration::WheelEvent event( static_cast< Integration::WheelEvent::Type >(wheelEvent.type), wheelEvent.direction, wheelEvent.modifiers, wheelEvent.point, wheelEvent.z, wheelEvent.timeStamp );
1360 mCoreEventInterface.QueueCoreEvent( event );
1361 mCoreEventInterface.ProcessCoreEvents();
1364 void EventHandler::SendEvent( StyleChange::Type styleChange )
1366 DALI_ASSERT_DEBUG( mStyleMonitor && "StyleMonitor Not Available" );
1367 GetImplementation( mStyleMonitor ).StyleChanged(styleChange);
1370 void EventHandler::SendEvent( const DamageArea& area )
1372 mDamageObserver.OnDamaged( area );
1375 void EventHandler::SendRotationPrepareEvent( const RotationEvent& event )
1377 if( mRotationObserver != NULL )
1379 mRotationObserver->OnRotationPrepare( event );
1380 mRotationObserver->OnRotationRequest();
1384 void EventHandler::SendRotationRequestEvent( )
1386 // No need to separate event into prepare and request in wayland
1389 void EventHandler::FeedTouchPoint( TouchPoint& point, int timeStamp)
1391 Integration::Point convertedPoint( point );
1392 SendEvent(convertedPoint, timeStamp);
1395 void EventHandler::FeedWheelEvent( WheelEvent& wheelEvent )
1397 SendWheelEvent( wheelEvent );
1400 void EventHandler::FeedKeyEvent( KeyEvent& event )
1402 Integration::KeyEvent convertedEvent( event );
1403 SendEvent( convertedEvent );
1406 void EventHandler::FeedEvent( Integration::Event& event )
1408 mCoreEventInterface.QueueCoreEvent( event );
1409 mCoreEventInterface.ProcessCoreEvents();
1412 void EventHandler::Reset()
1416 // Any touch listeners should be told of the interruption.
1417 Integration::TouchEvent event;
1418 Integration::Point point;
1419 point.SetState( PointState::INTERRUPTED );
1420 event.AddPoint( point );
1422 // First the touch event & related gesture events are queued
1423 mCoreEventInterface.QueueCoreEvent( event );
1424 mGestureManager.SendEvent( event );
1426 // Next the events are processed with a single call into Core
1427 mCoreEventInterface.ProcessCoreEvents();
1430 void EventHandler::Pause()
1436 void EventHandler::Resume()
1442 void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
1444 mDragAndDropDetector = detector;
1447 void EventHandler::SetRotationObserver( RotationObserver* observer )
1449 mRotationObserver = observer;
1452 } // namespace Adaptor
1454 } // namespace Internal