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 <events/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-wl-render-surface.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/touch-point.h>
43 #include <dali/public-api/events/key-event.h>
44 #include <dali/public-api/events/wheel-event.h>
45 #include <dali/integration-api/debug.h>
46 #include <dali/integration-api/events/key-event-integ.h>
47 #include <dali/integration-api/events/touch-event-integ.h>
48 #include <dali/integration-api/events/hover-event-integ.h>
49 #include <dali/integration-api/events/wheel-event-integ.h>
50 #include <dali/devel-api/events/key-event-devel.h>
53 #include <events/gesture-manager.h>
54 #include <window-render-surface.h>
55 #include <clipboard-impl.h>
57 #include <physical-keyboard-impl.h>
58 #include <style-monitor-impl.h>
59 #include <base/core-event-interface.h>
60 #include <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;
95 * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
96 * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
97 * @param[in] ecoreModifier the Ecore_Event_Modifier input.
98 * @return the Ecore_IMF_Keyboard_Modifiers output.
100 Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier(unsigned int ecoreModifier)
102 int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE ); // If no other matches returns NONE.
105 if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT ) // enums from ecore_input/Ecore_Input.h
107 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT; // enums from ecore_imf/ecore_imf.h
110 if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALT )
112 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
115 if ( ecoreModifier & ECORE_EVENT_MODIFIER_CTRL )
117 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
120 if ( ecoreModifier & ECORE_EVENT_MODIFIER_WIN )
122 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
125 if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALTGR )
127 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR;
130 return static_cast<Ecore_IMF_Keyboard_Modifiers>( modifier );
134 // Copied from x server
135 static unsigned int GetCurrentMilliSeconds(void)
140 static clockid_t clockid;
144 #ifdef CLOCK_MONOTONIC_COARSE
145 if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 &&
146 (tp.tv_nsec / 1000) <= 1000 && clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0)
148 clockid = CLOCK_MONOTONIC_COARSE;
152 if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
154 clockid = CLOCK_MONOTONIC;
161 if (clockid != ~0L && clock_gettime(clockid, &tp) == 0)
163 return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
166 gettimeofday(&tv, NULL);
167 return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
170 #ifndef DALI_PROFILE_UBUNTU
171 const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
172 #endif // DALI_PROFILE_UBUNTU
175 * Get the device name from the provided ecore key event
177 void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
179 const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
181 if ( ecoreDeviceName )
183 result = ecoreDeviceName;
188 * Get the device class from the provided ecore key event
190 void GetDeviceClass( Ecore_Event_Key* keyEvent, DevelKeyEvent::DeviceClass::Type& deviceClass )
192 Ecore_Device_Class ecoreDeviceClass = ecore_device_class_get( keyEvent->dev );
194 switch( ecoreDeviceClass )
196 case ECORE_DEVICE_CLASS_SEAT:
198 deviceClass = DevelKeyEvent::DeviceClass::USER;
201 case ECORE_DEVICE_CLASS_KEYBOARD:
203 deviceClass = DevelKeyEvent::DeviceClass::KEYBOARD;
206 case ECORE_DEVICE_CLASS_MOUSE:
208 deviceClass = DevelKeyEvent::DeviceClass::MOUSE;
211 case ECORE_DEVICE_CLASS_TOUCH:
213 deviceClass = DevelKeyEvent::DeviceClass::TOUCH;
216 case ECORE_DEVICE_CLASS_PEN:
218 deviceClass = DevelKeyEvent::DeviceClass::PEN;
221 case ECORE_DEVICE_CLASS_POINTER:
223 deviceClass = DevelKeyEvent::DeviceClass::POINTER;
226 case ECORE_DEVICE_CLASS_GAMEPAD:
228 deviceClass = DevelKeyEvent::DeviceClass::GAMEPAD;
233 deviceClass = DevelKeyEvent::DeviceClass::NONE;
239 } // unnamed namespace
241 // Impl to hide EFL implementation.
242 struct EventHandler::Impl
244 // Construction & Destruction
249 Impl( EventHandler* handler, Ecore_Wl_Window* window )
250 : mHandler( handler ),
251 mEcoreEventHandler(),
253 #ifdef DALI_ELDBUS_AVAILABLE
254 , mSystemConnection( NULL )
255 #endif // DALI_ELDBUS_AVAILABLE
257 // Only register for touch and key events if we have a window
260 // Register Touch events
261 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, handler ) );
262 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, handler ) );
263 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, handler ) );
264 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, handler ) ); // process mouse out event like up event
265 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, handler ) );
267 // Register Mouse wheel events
268 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, handler ) );
270 // Register Focus events
271 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, handler ) );
272 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, handler ) );
274 // Register Key events
275 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, handler ) );
276 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, handler ) );
278 // Register Selection event - clipboard selection
279 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, handler ) );
280 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, handler ) );
282 // Register Rotate event
283 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ROTATE, EcoreEventRotate, handler) );
285 // Register Detent event
286 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetent, handler) );
288 #ifndef DALI_PROFILE_UBUNTU
289 // Register Vconf notify - font name and size
290 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged, handler );
291 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, handler );
292 #endif // DALI_PROFILE_UBUNTU
294 #ifdef DALI_ELDBUS_AVAILABLE
295 // Initialize ElDBus.
296 DALI_LOG_INFO( gImfLogging, Debug::General, "Starting DBus Initialization\n" );
299 EcoreElDBusInitialisation( handler );
301 DALI_LOG_INFO( gImfLogging, Debug::General, "Finished DBus Initialization\n" );
302 #endif // DALI_ELDBUS_AVAILABLE
311 #ifndef DALI_PROFILE_UBUNTU
312 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
313 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged );
314 #endif // DALI_PROFILE_UBUNTU
316 for( std::vector<Ecore_Event_Handler*>::iterator iter = mEcoreEventHandler.begin(), endIter = mEcoreEventHandler.end(); iter != endIter; ++iter )
318 ecore_event_handler_del( *iter );
321 #ifdef DALI_ELDBUS_AVAILABLE
322 // Close down ElDBus connections.
323 if( mSystemConnection )
325 eldbus_connection_unref( mSystemConnection );
327 #endif // DALI_ELDBUS_AVAILABLE
332 /////////////////////////////////////////////////////////////////////////////////////////////////
334 /////////////////////////////////////////////////////////////////////////////////////////////////
337 * Called when a touch down is received.
339 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
341 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
342 EventHandler* handler( (EventHandler*)data );
344 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
346 PointState::Type state ( PointState::DOWN );
348 // Check if the buttons field is set and ensure it's the primary touch button.
349 // If this event was triggered by buttons other than the primary button (used for touch), then
350 // just send an interrupted event to Core.
351 if ( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
353 state = PointState::INTERRUPTED;
356 Integration::Point point;
357 point.SetDeviceId( touchEvent->multi.device );
358 point.SetState( state );
359 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
360 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
361 point.SetPressure( touchEvent->multi.pressure );
362 point.SetAngle( Degree( touchEvent->multi.angle ) );
363 handler->SendEvent( point, touchEvent->timestamp );
366 return ECORE_CALLBACK_PASS_ON;
370 * Called when a touch up is received.
372 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
374 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
375 EventHandler* handler( (EventHandler*)data );
377 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
379 Integration::Point point;
380 point.SetDeviceId( touchEvent->multi.device );
381 point.SetState( PointState::UP );
382 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
383 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
384 point.SetPressure( touchEvent->multi.pressure );
385 point.SetAngle( Degree( touchEvent->multi.angle ) );
386 handler->SendEvent( point, touchEvent->timestamp );
389 return ECORE_CALLBACK_PASS_ON;
393 * Called when a touch motion is received.
395 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
397 Ecore_Event_Mouse_Move *touchEvent( (Ecore_Event_Mouse_Move*)event );
398 EventHandler* handler( (EventHandler*)data );
400 if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
402 Integration::Point point;
403 point.SetDeviceId( touchEvent->multi.device );
404 point.SetState( PointState::MOTION );
405 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
406 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
407 point.SetPressure( touchEvent->multi.pressure );
408 point.SetAngle( Degree( touchEvent->multi.angle ) );
409 handler->SendEvent( point, touchEvent->timestamp );
412 return ECORE_CALLBACK_PASS_ON;
416 * Called when a touch is canceled.
418 static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
420 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
421 EventHandler* handler( (EventHandler*)data );
423 if( touchEvent->window == (unsigned int)ecore_wl_window_id_get( handler->mImpl->mWindow ) )
425 Integration::Point point;
426 point.SetDeviceId( touchEvent->multi.device );
427 point.SetState( PointState::INTERRUPTED );
428 point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
429 handler->SendEvent( point, touchEvent->timestamp );
431 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventMouseButtonCancel\n" );
434 return ECORE_CALLBACK_PASS_ON;
438 * Called when a mouse wheel is received.
440 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
442 Ecore_Event_Mouse_Wheel *mouseWheelEvent( (Ecore_Event_Mouse_Wheel*)event );
444 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);
446 EventHandler* handler( (EventHandler*)data );
447 if ( mouseWheelEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
449 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp );
450 handler->SendWheelEvent( wheelEvent );
452 return ECORE_CALLBACK_PASS_ON;
455 /////////////////////////////////////////////////////////////////////////////////////////////////
457 /////////////////////////////////////////////////////////////////////////////////////////////////
460 * Called when a key down is received.
462 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
464 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyDown \n" );
466 EventHandler* handler( (EventHandler*)data );
467 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
468 bool eventHandled( false );
470 // If a device key then skip ecore_imf_context_filter_event.
471 if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
473 Ecore_IMF_Context* imfContext = NULL;
474 Dali::ImfManager imfManager( ImfManager::Get() );
477 imfContext = ImfManager::GetImplementation( imfManager ).GetContext();
482 // We're consuming key down event so we have to pass to IMF so that it can parse it as well.
483 Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
484 ecoreKeyDownEvent.keyname = keyEvent->keyname;
485 ecoreKeyDownEvent.key = keyEvent->key;
486 ecoreKeyDownEvent.string = keyEvent->string;
487 ecoreKeyDownEvent.compose = keyEvent->compose;
488 ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
489 ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
490 ecoreKeyDownEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
491 #ifdef ECORE_IMF_1_13
492 ecoreKeyDownEvent.dev_name = "";
493 ecoreKeyDownEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
494 ecoreKeyDownEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
495 #endif // ECORE_IMF_1_13
497 eventHandled = ecore_imf_context_filter_event( imfContext,
498 ECORE_IMF_EVENT_KEY_DOWN,
499 (Ecore_IMF_Event *) &ecoreKeyDownEvent );
501 // If the event has not been handled by IMF then check if we should reset our IMF context
504 if ( !strcmp( keyEvent->keyname, "Escape" ) ||
505 !strcmp( keyEvent->keyname, "Return" ) ||
506 !strcmp( keyEvent->keyname, "KP_Enter" ) )
508 ecore_imf_context_reset( imfContext );
514 // If the event wasn't handled then we should send a key event.
517 if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
519 std::string keyName( keyEvent->keyname );
520 std::string keyString( "" );
521 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
522 keyCode = (keyCode == -1) ? 0 : keyCode;
523 int modifier( keyEvent->modifiers );
524 unsigned long time = keyEvent->timestamp;
525 if (!strncmp(keyEvent->keyname, "Keycode-", 8))
526 keyCode = atoi(keyEvent->keyname + 8);
528 // Ensure key event string is not NULL as keys like SHIFT have a null string.
529 if ( keyEvent->string )
531 keyString = keyEvent->string;
534 std::string deviceName;
535 DevelKeyEvent::DeviceClass::Type deviceClass;
537 GetDeviceName( keyEvent, deviceName );
538 GetDeviceClass( keyEvent, deviceClass );
540 DALI_LOG_INFO( gImfLogging, Debug::Verbose, "EVENT EcoreEventKeyDown - >>EcoreEventKeyDown deviceName(%s) deviceClass(%d)\n", deviceName.c_str(), deviceClass );
542 Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, deviceName, deviceClass );
543 handler->SendEvent( keyEvent );
547 return ECORE_CALLBACK_PASS_ON;
551 * Called when a key up is received.
553 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
555 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyUp\n" );
557 EventHandler* handler( (EventHandler*)data );
558 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
559 bool eventHandled( false );
561 // Device keys like Menu, home, back button must skip ecore_imf_context_filter_event.
562 if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
564 Ecore_IMF_Context* imfContext = NULL;
565 Dali::ImfManager imfManager( ImfManager::Get() );
568 imfContext = ImfManager::GetImplementation( imfManager ).GetContext();
573 // We're consuming key up event so we have to pass to IMF so that it can parse it as well.
574 Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
575 ecoreKeyUpEvent.keyname = keyEvent->keyname;
576 ecoreKeyUpEvent.key = keyEvent->key;
577 ecoreKeyUpEvent.string = keyEvent->string;
578 ecoreKeyUpEvent.compose = keyEvent->compose;
579 ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
580 ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
581 ecoreKeyUpEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
582 #ifdef ECORE_IMF_1_13
583 ecoreKeyUpEvent.dev_name = "";
584 ecoreKeyUpEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
585 ecoreKeyUpEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
586 #endif // ECORE_IMF_1_13
588 eventHandled = ecore_imf_context_filter_event( imfContext,
589 ECORE_IMF_EVENT_KEY_UP,
590 (Ecore_IMF_Event *) &ecoreKeyUpEvent );
594 // If the event wasn't handled then we should send a key event.
597 if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
599 std::string keyName( keyEvent->keyname );
600 std::string keyString( "" );
601 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
602 keyCode = (keyCode == -1) ? 0 : keyCode;
603 int modifier( keyEvent->modifiers );
604 unsigned long time = keyEvent->timestamp;
605 if (!strncmp(keyEvent->keyname, "Keycode-", 8))
606 keyCode = atoi(keyEvent->keyname + 8);
608 // Ensure key event string is not NULL as keys like SHIFT have a null string.
609 if ( keyEvent->string )
611 keyString = keyEvent->string;
614 std::string deviceName;
615 DevelKeyEvent::DeviceClass::Type deviceClass;
617 GetDeviceName( keyEvent, deviceName );
618 GetDeviceClass( keyEvent, deviceClass );
620 Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, deviceName, deviceClass );
621 handler->SendEvent( keyEvent );
625 return ECORE_CALLBACK_PASS_ON;
628 /////////////////////////////////////////////////////////////////////////////////////////////////
630 /////////////////////////////////////////////////////////////////////////////////////////////////
633 * Called when the window gains focus.
635 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
637 Ecore_Wl_Event_Focus_In* focusInEvent( (Ecore_Wl_Event_Focus_In*)event );
638 EventHandler* handler( (EventHandler*)data );
640 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusIn \n" );
642 // If the window gains focus and we hid the keyboard then show it again.
643 if ( focusInEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
645 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventWindowFocusIn - >>WindowFocusGained \n" );
647 if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
649 Dali::ImfManager imfManager( ImfManager::Get() );
652 ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
653 if( imfManagerImpl.RestoreAfterFocusLost() )
655 imfManagerImpl.Activate();
659 Dali::Clipboard clipboard = Clipboard::Get();
660 clipboard.HideClipboard();
663 return ECORE_CALLBACK_PASS_ON;
667 * Called when the window loses focus.
669 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
671 Ecore_Wl_Event_Focus_Out* focusOutEvent( (Ecore_Wl_Event_Focus_Out*)event );
672 EventHandler* handler( (EventHandler*)data );
674 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusOut \n" );
676 // If the window loses focus then hide the keyboard.
677 if ( focusOutEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
679 if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
681 Dali::ImfManager imfManager( ImfManager::Get() );
684 ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
685 if( imfManagerImpl.RestoreAfterFocusLost() )
687 imfManagerImpl.Deactivate();
692 // Hiding clipboard event will be ignored once because window focus out event is always received on showing clipboard
693 Dali::Clipboard clipboard = Clipboard::Get();
696 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
697 clipBoardImpl.HideClipboard(true);
701 return ECORE_CALLBACK_PASS_ON;
705 * Called when the window is damaged.
707 static Eina_Bool EcoreEventWindowDamaged(void *data, int type, void *event)
709 return ECORE_CALLBACK_PASS_ON;
713 * Called when the window properties are changed.
714 * We are only interested in the font change.
718 /////////////////////////////////////////////////////////////////////////////////////////////////
719 // Drag & Drop Callbacks
720 /////////////////////////////////////////////////////////////////////////////////////////////////
723 * Called when a dragged item enters our window's bounds.
724 * This is when items are dragged INTO our window.
726 static Eina_Bool EcoreEventDndEnter( void* data, int type, void* event )
728 DALI_LOG_INFO( gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndEnter\n" );
730 return ECORE_CALLBACK_PASS_ON;
734 * Called when a dragged item is moved within our window.
735 * This is when items are dragged INTO our window.
737 static Eina_Bool EcoreEventDndPosition( void* data, int type, void* event )
739 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndPosition\n" );
741 return ECORE_CALLBACK_PASS_ON;
745 * Called when a dragged item leaves our window's bounds.
746 * This is when items are dragged INTO our window.
748 static Eina_Bool EcoreEventDndLeave( void* data, int type, void* event )
750 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndLeave\n" );
752 return ECORE_CALLBACK_PASS_ON;
756 * Called when the dragged item is dropped within our window's bounds.
757 * This is when items are dragged INTO our window.
759 static Eina_Bool EcoreEventDndDrop( void* data, int type, void* event )
761 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndDrop\n" );
763 return ECORE_CALLBACK_PASS_ON;
767 * Called when a dragged item is moved from our window and the target window has done processing it.
768 * This is when items are dragged FROM our window.
770 static Eina_Bool EcoreEventDndFinished( void* data, int type, void* event )
772 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndFinished\n" );
773 return ECORE_CALLBACK_PASS_ON;
777 * Called when a dragged item is moved from our window and the target window has sent us a status.
778 * This is when items are dragged FROM our window.
780 static Eina_Bool EcoreEventDndStatus( void* data, int type, void* event )
782 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndStatus\n" );
783 return ECORE_CALLBACK_PASS_ON;
787 * Called when the client messages (i.e. the accessibility events) are received.
789 static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
791 return ECORE_CALLBACK_PASS_ON;
795 /////////////////////////////////////////////////////////////////////////////////////////////////
796 // ElDBus Accessibility Callbacks
797 /////////////////////////////////////////////////////////////////////////////////////////////////
799 #ifdef DALI_ELDBUS_AVAILABLE
800 // Callback for Ecore ElDBus accessibility events.
801 static void OnEcoreElDBusAccessibilityNotification( void *context EINA_UNUSED, const Eldbus_Message *message )
803 EventHandler* handler = static_cast< EventHandler* >( context );
804 // Ignore any accessibility events when paused.
805 if( handler->mPaused )
810 if( !handler->mAccessibilityAdaptor )
812 DALI_LOG_ERROR( "Invalid accessibility adaptor\n" );
816 AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( handler->mAccessibilityAdaptor ) );
817 if( !accessibilityAdaptor )
819 DALI_LOG_ERROR( "Cannot access accessibility adaptor\n" );
825 int state; // 0 - begin, 1 - ongoing, 2 - ended, 3 - aborted
828 // The string defines the arg-list's respective types.
829 if( !eldbus_message_arguments_get( message, "iiiiiiu", &gestureValue, &xS, &yS, &xE, &yE, &state, &eventTime ) )
831 DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
834 DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Name: %d Args: %d,%d,%d,%d State: %d\n", gestureValue, xS, yS, xE, yE );
836 // Create a touch point object.
837 TouchPoint::State touchPointState( TouchPoint::Down );
840 touchPointState = TouchPoint::Down; // Mouse down.
842 else if( state == 1 )
844 touchPointState = TouchPoint::Motion; // Mouse move.
846 else if( state == 2 )
848 touchPointState = TouchPoint::Up; // Mouse up.
852 touchPointState = TouchPoint::Interrupted; // Error.
855 // Send touch event to accessibility adaptor.
856 TouchPoint point( 0, touchPointState, (float)xS, (float)yS );
858 // Perform actions based on received gestures.
859 // Note: This is seperated from the reading so we can have other input readers without changing the below code.
860 switch( gestureValue )
862 case 0: // OneFingerHover
865 accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
868 case 1: // TwoFingersHover
870 // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control
871 accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() );
874 case 2: // ThreeFingersHover
876 // Read from top item on screen continuously.
877 accessibilityAdaptor->HandleActionReadFromTopEvent();
880 case 3: // OneFingerFlickLeft
882 // Move to previous item.
883 accessibilityAdaptor->HandleActionReadPreviousEvent();
886 case 4: // OneFingerFlickRight
888 // Move to next item.
889 accessibilityAdaptor->HandleActionReadNextEvent();
892 case 5: // OneFingerFlickUp
894 // Move to previous item.
895 accessibilityAdaptor->HandleActionPreviousEvent();
898 case 6: // OneFingerFlickDown
900 // Move to next item.
901 accessibilityAdaptor->HandleActionNextEvent();
904 case 7: // TwoFingersFlickUp
906 // Scroll up the list.
907 accessibilityAdaptor->HandleActionScrollUpEvent();
910 case 8: // TwoFingersFlickDown
912 // Scroll down the list.
913 accessibilityAdaptor->HandleActionScrollDownEvent();
916 case 9: // TwoFingersFlickLeft
918 // Scroll left to the previous page
919 accessibilityAdaptor->HandleActionPageLeftEvent();
922 case 10: // TwoFingersFlickRight
924 // Scroll right to the next page
925 accessibilityAdaptor->HandleActionPageRightEvent();
928 case 11: // ThreeFingersFlickLeft
933 case 12: // ThreeFingersFlickRight
938 case 13: // ThreeFingersFlickUp
943 case 14: // ThreeFingersFlickDown
948 case 15: // OneFingerSingleTap
951 accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
954 case 16: // OneFingerDoubleTap
956 // Activate selected item / active edit mode.
957 accessibilityAdaptor->HandleActionActivateEvent();
960 case 17: // OneFingerTripleTap
963 accessibilityAdaptor->HandleActionZoomEvent();
966 case 18: // TwoFingersSingleTap
968 // Pause/Resume current speech
969 accessibilityAdaptor->HandleActionReadPauseResumeEvent();
972 case 19: // TwoFingersDoubleTap
974 // Start/Stop current action
975 accessibilityAdaptor->HandleActionStartStopEvent();
978 case 20: // TwoFingersTripleTap
980 // Read information from indicator
981 accessibilityAdaptor->HandleActionReadIndicatorInformationEvent();
984 case 21: // ThreeFingersSingleTap
986 // Read from top item on screen continuously.
987 accessibilityAdaptor->HandleActionReadFromTopEvent();
990 case 22: // ThreeFingersDoubleTap
992 // Read from next item continuously.
993 accessibilityAdaptor->HandleActionReadFromNextEvent();
996 case 23: // ThreeFingersTripleTap
1001 case 24: // OneFingerFlickLeftReturn
1003 // Scroll up to the previous page
1004 accessibilityAdaptor->HandleActionPageUpEvent();
1007 case 25: // OneFingerFlickRightReturn
1009 // Scroll down to the next page
1010 accessibilityAdaptor->HandleActionPageDownEvent();
1013 case 26: // OneFingerFlickUpReturn
1015 // Move to the first item on screen
1016 accessibilityAdaptor->HandleActionMoveToFirstEvent();
1019 case 27: // OneFingerFlickDownReturn
1021 // Move to the last item on screen
1022 accessibilityAdaptor->HandleActionMoveToLastEvent();
1025 case 28: // TwoFingersFlickLeftReturn
1030 case 29: // TwoFingersFlickRightReturn
1035 case 30: // TwoFingersFlickUpReturn
1040 case 31: // TwoFingersFlickDownReturn
1045 case 32: // ThreeFingersFlickLeftReturn
1050 case 33: // ThreeFingersFlickRightReturn
1055 case 34: // ThreeFingersFlickUpReturn
1060 case 35: // ThreeFingersFlickDownReturn
1068 void EcoreElDBusInitialisation( void *handle )
1070 Eldbus_Object *object;
1071 Eldbus_Proxy *manager;
1073 if( !( mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM) ) )
1075 DALI_LOG_ERROR( "Unable to get system bus\n" );
1078 object = eldbus_object_get( mSystemConnection, BUS, PATH );
1081 DALI_LOG_ERROR( "Getting object failed\n" );
1085 manager = eldbus_proxy_get( object, INTERFACE );
1088 DALI_LOG_ERROR( "Getting proxy failed\n" );
1092 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", OnEcoreElDBusAccessibilityNotification, handle ) )
1094 DALI_LOG_ERROR( "No signal handler returned\n" );
1097 #endif // DALI_ELDBUS_AVAILABLE
1100 * Called when the source window notifies us the content in clipboard is selected.
1102 static Eina_Bool EcoreEventSelectionClear( void* data, int type, void* event )
1104 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionClear\n" );
1105 return ECORE_CALLBACK_PASS_ON;
1109 * Called when the source window sends us about the selected content.
1110 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
1112 static Eina_Bool EcoreEventSelectionNotify( void* data, int type, void* event )
1114 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionNotify\n" );
1115 return ECORE_CALLBACK_PASS_ON;
1119 * Called when the source window notifies us the content in clipboard is selected.
1121 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
1123 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataSend\n" );
1125 Dali::Clipboard clipboard = Clipboard::Get();
1128 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
1129 clipBoardImpl.ExcuteBuffered( true, event );
1131 return ECORE_CALLBACK_PASS_ON;
1135 * Called when the source window sends us about the selected content.
1136 * For example, when item is selected in the clipboard.
1138 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
1140 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataReceive\n" );
1142 EventHandler* handler( (EventHandler*)data );
1143 Dali::Clipboard clipboard = Clipboard::Get();
1144 char *selectionData = NULL;
1147 Clipboard& clipBoardImpl( GetImplementation( clipboard ) );
1148 selectionData = clipBoardImpl.ExcuteBuffered( false, event );
1150 if ( selectionData && handler->mClipboardEventNotifier )
1152 ClipboardEventNotifier& clipboardEventNotifier( ClipboardEventNotifier::GetImplementation( handler->mClipboardEventNotifier ) );
1153 std::string content( selectionData, strlen(selectionData) );
1155 clipboardEventNotifier.SetContent( content );
1156 clipboardEventNotifier.EmitContentSelectedSignal();
1158 return ECORE_CALLBACK_PASS_ON;
1162 * Called when rotate event is recevied
1164 static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
1166 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::Concise, "EcoreEventRotate\n" );
1168 EventHandler* handler( (EventHandler*)data );
1169 Ecore_Wl_Event_Window_Rotate* ev( (Ecore_Wl_Event_Window_Rotate*)event );
1171 if( ev->win != (unsigned int)ecore_wl_window_id_get( handler->mImpl->mWindow ) )
1173 return ECORE_CALLBACK_PASS_ON;
1176 RotationEvent rotationEvent;
1177 rotationEvent.angle = ev->angle;
1178 rotationEvent.winResize = 0;
1179 rotationEvent.width = ev->w;
1180 rotationEvent.height = ev->h;
1181 handler->SendRotationPrepareEvent( rotationEvent );
1183 return ECORE_CALLBACK_PASS_ON;
1187 * Called when detent event is recevied
1189 static Eina_Bool EcoreEventDetent( void* data, int type, void* event )
1191 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDetent\n" );
1192 EventHandler* handler( (EventHandler*)data );
1193 Ecore_Event_Detent_Rotate *e((Ecore_Event_Detent_Rotate *)event);
1194 int direction = (e->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1195 int timeStamp = e->timestamp;
1197 WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2(0.0f, 0.0f), direction, timeStamp );
1198 handler->SendWheelEvent( wheelEvent );
1199 return ECORE_CALLBACK_PASS_ON;
1202 /////////////////////////////////////////////////////////////////////////////////////////////////
1204 /////////////////////////////////////////////////////////////////////////////////////////////////
1206 * Called when a font name is changed.
1208 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
1210 EventHandler* handler = static_cast<EventHandler*>( data );
1211 handler->SendEvent( StyleChange::DEFAULT_FONT_CHANGE );
1215 * Called when a font size is changed.
1217 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
1219 EventHandler* handler = static_cast<EventHandler*>( data );
1220 handler->SendEvent( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1224 EventHandler* mHandler;
1225 std::vector<Ecore_Event_Handler*> mEcoreEventHandler;
1226 Ecore_Wl_Window* mWindow;
1227 #ifdef DALI_ELDBUS_AVAILABLE
1228 Eldbus_Connection* mSystemConnection;
1229 #endif // DALI_ELDBUS_AVAILABLE
1232 EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector )
1233 : mCoreEventInterface( coreEventInterface ),
1234 mGestureManager( gestureManager ),
1235 mStyleMonitor( StyleMonitor::Get() ),
1236 mDamageObserver( damageObserver ),
1237 mRotationObserver( NULL ),
1238 mDragAndDropDetector( dndDetector ),
1239 mAccessibilityAdaptor( AccessibilityAdaptor::Get() ),
1240 mClipboardEventNotifier( ClipboardEventNotifier::Get() ),
1241 mClipboard( Clipboard::Get() ),
1245 Ecore_Wl_Window* window = 0;
1247 // this code only works with the Ecore RenderSurface so need to downcast
1248 ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface );
1251 window = ecoreSurface->GetWlWindow();
1254 mImpl = new Impl(this, window);
1257 EventHandler::~EventHandler()
1264 mGestureManager.Stop();
1267 void EventHandler::SendEvent(Integration::Point& point, unsigned long timeStamp)
1271 timeStamp = GetCurrentMilliSeconds();
1274 Integration::TouchEvent touchEvent;
1275 Integration::HoverEvent hoverEvent;
1276 Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent);
1277 if(type != Integration::TouchEventCombiner::DispatchNone )
1279 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);
1281 // First the touch and/or hover event & related gesture events are queued
1282 if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth)
1284 mCoreEventInterface.QueueCoreEvent( touchEvent );
1285 mGestureManager.SendEvent(touchEvent);
1288 if(type == Integration::TouchEventCombiner::DispatchHover || type == Integration::TouchEventCombiner::DispatchBoth)
1290 mCoreEventInterface.QueueCoreEvent( hoverEvent );
1293 // Next the events are processed with a single call into Core
1294 mCoreEventInterface.ProcessCoreEvents();
1298 void EventHandler::SendEvent(Integration::KeyEvent& keyEvent)
1300 Dali::PhysicalKeyboard physicalKeyboard = PhysicalKeyboard::Get();
1301 if ( physicalKeyboard )
1303 if ( ! KeyLookup::IsDeviceButton( keyEvent.keyName.c_str() ) )
1305 GetImplementation( physicalKeyboard ).KeyReceived( keyEvent.time > 1 );
1309 // Create send KeyEvent to Core.
1310 mCoreEventInterface.QueueCoreEvent( keyEvent );
1311 mCoreEventInterface.ProcessCoreEvents();
1314 void EventHandler::SendWheelEvent( WheelEvent& wheelEvent )
1316 // Create WheelEvent and send to Core.
1317 Integration::WheelEvent event( static_cast< Integration::WheelEvent::Type >(wheelEvent.type), wheelEvent.direction, wheelEvent.modifiers, wheelEvent.point, wheelEvent.z, wheelEvent.timeStamp );
1318 mCoreEventInterface.QueueCoreEvent( event );
1319 mCoreEventInterface.ProcessCoreEvents();
1322 void EventHandler::SendEvent( StyleChange::Type styleChange )
1324 DALI_ASSERT_DEBUG( mStyleMonitor && "StyleMonitor Not Available" );
1325 GetImplementation( mStyleMonitor ).StyleChanged(styleChange);
1328 void EventHandler::SendEvent( const DamageArea& area )
1330 mDamageObserver.OnDamaged( area );
1333 void EventHandler::SendRotationPrepareEvent( const RotationEvent& event )
1335 if( mRotationObserver != NULL )
1337 mRotationObserver->OnRotationPrepare( event );
1338 mRotationObserver->OnRotationRequest();
1342 void EventHandler::SendRotationRequestEvent( )
1344 // No need to separate event into prepare and request in wayland
1347 void EventHandler::FeedTouchPoint( TouchPoint& point, int timeStamp)
1349 Integration::Point convertedPoint( point );
1350 SendEvent(convertedPoint, timeStamp);
1353 void EventHandler::FeedWheelEvent( WheelEvent& wheelEvent )
1355 SendWheelEvent( wheelEvent );
1358 void EventHandler::FeedKeyEvent( KeyEvent& event )
1360 Integration::KeyEvent convertedEvent( event );
1361 SendEvent( convertedEvent );
1364 void EventHandler::FeedEvent( Integration::Event& event )
1366 mCoreEventInterface.QueueCoreEvent( event );
1367 mCoreEventInterface.ProcessCoreEvents();
1370 void EventHandler::Reset()
1374 // Any touch listeners should be told of the interruption.
1375 Integration::TouchEvent event;
1376 Integration::Point point;
1377 point.SetState( PointState::INTERRUPTED );
1378 event.AddPoint( point );
1380 // First the touch event & related gesture events are queued
1381 mCoreEventInterface.QueueCoreEvent( event );
1382 mGestureManager.SendEvent( event );
1384 // Next the events are processed with a single call into Core
1385 mCoreEventInterface.ProcessCoreEvents();
1388 void EventHandler::Pause()
1394 void EventHandler::Resume()
1400 void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
1402 mDragAndDropDetector = detector;
1405 void EventHandler::SetRotationObserver( RotationObserver* observer )
1407 mRotationObserver = observer;
1410 } // namespace Adaptor
1412 } // namespace Internal
1416 #pragma GCC diagnostic pop