2 * Copyright (c) 2014 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>
30 #ifndef DALI_PROFILE_UBUNTU
32 #include <vconf-keys.h>
33 #endif // DALI_PROFILE_UBUNTU
35 #include <dali/public-api/common/vector-wrapper.h>
36 #include <dali/public-api/events/touch-point.h>
37 #include <dali/public-api/events/key-event.h>
38 #include <dali/public-api/events/mouse-wheel-event.h>
39 #include <dali/integration-api/debug.h>
40 #include <dali/integration-api/events/key-event-integ.h>
41 #include <dali/integration-api/events/touch-event-integ.h>
42 #include <dali/integration-api/events/hover-event-integ.h>
43 #include <dali/integration-api/events/mouse-wheel-event-integ.h>
46 #include <events/gesture-manager.h>
47 #include <window-render-surface.h>
48 #include <clipboard-impl.h>
50 #include <physical-keyboard-impl.h>
51 #include <style-monitor-impl.h>
52 #include <base/core-event-interface.h>
65 #if defined(DEBUG_ENABLED)
68 Integration::Log::Filter* gTouchEventLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_TOUCH");
69 Integration::Log::Filter* gClientMessageLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_CLIENT_MESSAGE");
70 Integration::Log::Filter* gDragAndDropLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_DND");
71 Integration::Log::Filter* gImfLogging = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_IMF");
72 Integration::Log::Filter* gSelectionEventLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_SELECTION");
73 } // unnamed namespace
79 #ifndef DALI_PROFILE_UBUNTU
80 const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
81 #endif // DALI_PROFILE_UBUNTU
83 const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
85 #ifndef DALI_PROFILE_UBUNTU
86 const char * CLIPBOARD_ATOM = "CBHM_MSG";
87 const char * CLIPBOARD_SET_OWNER_MESSAGE = "SET_OWNER";
88 #endif // DALI_PROFILE_UBUNTU
90 /// The atoms required by Ecore for Drag & Drop behaviour.
91 Ecore_X_Atom DRAG_AND_DROP_ATOMS[] =
93 ECORE_X_ATOM_XDND_ACTION_COPY,
96 /// The types that we support.
97 const char * DRAG_AND_DROP_TYPES[] =
99 ECORE_X_SELECTION_TARGET_UTF8_STRING,
102 const unsigned int DRAG_AND_DROP_ATOMS_NUMBER = sizeof( DRAG_AND_DROP_ATOMS ) / sizeof( Ecore_X_Atom );
103 const unsigned int DRAG_AND_DROP_TYPES_NUMBER = sizeof( DRAG_AND_DROP_TYPES ) / sizeof( const char * );
105 const unsigned int BYTES_PER_CHARACTER_FOR_ATTRIBUTES = 3;
108 * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
109 * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
110 * @param[in] ecoreModifier the Ecore_Event_Modifier input.
111 * @return the Ecore_IMF_Keyboard_Modifiers output.
113 Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier(unsigned int ecoreModifier)
115 int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE ); // If no other matches returns NONE.
118 if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT ) // enums from ecore_input/Ecore_Input.h
120 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT; // enums from ecore_imf/ecore_imf.h
123 if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALT )
125 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
128 if ( ecoreModifier & ECORE_EVENT_MODIFIER_CTRL )
130 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
133 if ( ecoreModifier & ECORE_EVENT_MODIFIER_WIN )
135 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
138 if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALTGR )
140 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR;
143 return static_cast<Ecore_IMF_Keyboard_Modifiers>( modifier );
147 // Copied from x server
148 static unsigned int GetCurrentMilliSeconds(void)
153 static clockid_t clockid;
157 #ifdef CLOCK_MONOTONIC_COARSE
158 if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 &&
159 (tp.tv_nsec / 1000) <= 1000 && clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0)
161 clockid = CLOCK_MONOTONIC_COARSE;
165 if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
167 clockid = CLOCK_MONOTONIC;
174 if (clockid != ~0L && clock_gettime(clockid, &tp) == 0)
176 return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
179 gettimeofday(&tv, NULL);
180 return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
183 } // unnamed namespace
185 // Impl to hide EFL implementation.
186 struct EventHandler::Impl
188 // Construction & Destruction
193 Impl( EventHandler* handler, Ecore_X_Window window )
194 : mHandler( handler ),
195 mEcoreEventHandler(),
198 // Only register for touch and key events if we have a window
201 // Register Touch events
202 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, handler ) );
203 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, handler ) );
204 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, handler ) );
205 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, handler ) ); // process mouse out event like up event
207 // Register Mouse wheel events
208 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, handler ) );
210 // Register Key events
211 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, handler ) );
212 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, handler ) );
214 // Register Focus events
215 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_IN, EcoreEventWindowFocusIn, handler ) );
216 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_OUT, EcoreEventWindowFocusOut, handler ) );
218 // Register Window damage events
219 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DAMAGE, EcoreEventWindowDamaged, handler ) );
221 // Enable Drag & Drop and register DnD events
222 ecore_x_dnd_aware_set( window, EINA_TRUE );
223 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_XDND_ENTER, EcoreEventDndEnter, handler) );
224 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_XDND_POSITION, EcoreEventDndPosition, handler) );
225 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_XDND_LEAVE, EcoreEventDndLeave, handler) );
226 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_XDND_DROP, EcoreEventDndDrop, handler) );
227 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_XDND_FINISHED, EcoreEventDndFinished, handler) );
228 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_XDND_STATUS, EcoreEventDndStatus, handler) );
230 // Register Client message events - accessibility etc.
231 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_CLIENT_MESSAGE, EcoreEventClientMessage, handler ) );
233 // Register Selection event - clipboard selection, Drag & Drop selection etc.
234 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, handler ) );
235 mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, handler ) );
237 #ifndef DALI_PROFILE_UBUNTU
238 // Register Vconf notify - font name, font size and style
239 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, handler );
240 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, handler );
241 #if defined(DALI_PROFILE_MOBILE) || defined(DALI_PROFILE_LITE)
242 vconf_notify_key_changed( VCONFKEY_SETAPPL_CHANGE_UI_THEME_INT, VconfNotifyThemeChanged, handler );
244 #endif // DALI_PROFILE_UBUNTU
253 #ifndef DALI_PROFILE_UBUNTU
254 #if defined(DALI_PROFILE_MOBILE) || defined(DALI_PROFILE_LITE)
255 vconf_ignore_key_changed( VCONFKEY_SETAPPL_CHANGE_UI_THEME_INT, VconfNotifyThemeChanged );
257 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
258 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
259 #endif // DALI_PROFILE_UBUNTU
261 for( std::vector<Ecore_Event_Handler*>::iterator iter = mEcoreEventHandler.begin(), endIter = mEcoreEventHandler.end(); iter != endIter; ++iter )
263 ecore_event_handler_del( *iter );
269 /////////////////////////////////////////////////////////////////////////////////////////////////
271 /////////////////////////////////////////////////////////////////////////////////////////////////
274 * Called when a touch down is received.
276 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
278 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
279 EventHandler* handler( (EventHandler*)data );
281 if ( touchEvent->window == handler->mImpl->mWindow )
283 TouchPoint::State state ( TouchPoint::Down );
285 // Check if the buttons field is set and ensure it's the primary touch button.
286 // If this event was triggered by buttons other than the primary button (used for touch), then
287 // just send an interrupted event to Core.
288 if ( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
290 state = TouchPoint::Interrupted;
293 TouchPoint point( touchEvent->multi.device, state, touchEvent->x, touchEvent->y );
294 handler->SendEvent( point, touchEvent->timestamp );
297 return ECORE_CALLBACK_PASS_ON;
301 * Called when a touch up is received.
303 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
305 Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
306 EventHandler* handler( (EventHandler*)data );
308 if ( touchEvent->window == handler->mImpl->mWindow )
310 TouchPoint point( touchEvent->multi.device, TouchPoint::Up, touchEvent->x, touchEvent->y );
311 handler->SendEvent( point, touchEvent->timestamp );
314 return ECORE_CALLBACK_PASS_ON;
318 * Called when a touch up is received.
320 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
322 Ecore_Event_Mouse_Wheel *mouseWheelEvent( (Ecore_Event_Mouse_Wheel*)event );
324 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);
326 EventHandler* handler( (EventHandler*)data );
327 if ( mouseWheelEvent->window == handler->mImpl->mWindow )
329 MouseWheelEvent wheelEvent(mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
330 handler->SendMouseWheelEvent( wheelEvent );
332 return ECORE_CALLBACK_PASS_ON;
336 * Called when a touch motion is received.
338 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
340 Ecore_Event_Mouse_Move *touchEvent( (Ecore_Event_Mouse_Move*)event );
341 EventHandler* handler( (EventHandler*)data );
343 if ( touchEvent->window == handler->mImpl->mWindow )
345 TouchPoint point( touchEvent->multi.device, TouchPoint::Motion, touchEvent->x, touchEvent->y );
346 handler->SendEvent( point, touchEvent->timestamp );
349 return ECORE_CALLBACK_PASS_ON;
352 /////////////////////////////////////////////////////////////////////////////////////////////////
354 /////////////////////////////////////////////////////////////////////////////////////////////////
357 * Called when a key down is received.
359 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
361 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyDown \n" );
363 EventHandler* handler( (EventHandler*)data );
364 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
365 bool eventHandled( false );
367 // If a device key then skip ecore_imf_context_filter_event.
368 if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
370 Ecore_IMF_Context* imfContext = NULL;
371 Dali::ImfManager imfManager( ImfManager::Get() );
374 imfContext = reinterpret_cast<Ecore_IMF_Context*>( imfManager.GetContext() );
379 // We're consuming key down event so we have to pass to IMF so that it can parse it as well.
380 Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
381 ecoreKeyDownEvent.keyname = keyEvent->keyname;
382 ecoreKeyDownEvent.key = keyEvent->key;
383 ecoreKeyDownEvent.string = keyEvent->string;
384 ecoreKeyDownEvent.compose = keyEvent->compose;
385 ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
386 ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
387 ecoreKeyDownEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
389 eventHandled = ecore_imf_context_filter_event( imfContext,
390 ECORE_IMF_EVENT_KEY_DOWN,
391 (Ecore_IMF_Event *) &ecoreKeyDownEvent );
393 // If the event has not been handled by IMF then check if we should reset our IMF context
396 if ( !strcmp( keyEvent->keyname, "Escape" ) ||
397 !strcmp( keyEvent->keyname, "Return" ) ||
398 !strcmp( keyEvent->keyname, "KP_Enter" ) )
400 ecore_imf_context_reset( imfContext );
406 // If the event wasn't handled then we should send a key event.
409 if ( keyEvent->window == handler->mImpl->mWindow )
411 std::string keyName( keyEvent->keyname );
412 std::string keyString( "" );
413 int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
414 int modifier( keyEvent->modifiers );
415 unsigned long time = keyEvent->timestamp;
417 // Ensure key event string is not NULL as keys like SHIFT have a null string.
418 if ( keyEvent->string )
420 keyString = keyEvent->string;
423 KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Down);
424 handler->SendEvent( keyEvent );
428 return ECORE_CALLBACK_PASS_ON;
432 * Called when a key up is received.
434 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
436 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyUp \n" );
438 EventHandler* handler( (EventHandler*)data );
439 Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
440 bool eventHandled( false );
442 // XF86Stop and XF86Send must skip ecore_imf_context_filter_event.
443 if ( strcmp( keyEvent->keyname, "XF86Send" ) &&
444 strcmp( keyEvent->keyname, "XF86Phone" ) &&
445 strcmp( keyEvent->keyname, "XF86Stop" ) )
447 Ecore_IMF_Context* imfContext = NULL;
448 Dali::ImfManager imfManager( ImfManager::Get() );
451 imfContext = reinterpret_cast<Ecore_IMF_Context*>( imfManager.GetContext() );
456 // We're consuming key up event so we have to pass to IMF so that it can parse it as well.
457 Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
458 ecoreKeyUpEvent.keyname = keyEvent->keyname;
459 ecoreKeyUpEvent.key = keyEvent->key;
460 ecoreKeyUpEvent.string = keyEvent->string;
461 ecoreKeyUpEvent.compose = keyEvent->compose;
462 ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
463 ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
464 ecoreKeyUpEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
466 eventHandled = ecore_imf_context_filter_event( imfContext,
467 ECORE_IMF_EVENT_KEY_UP,
468 (Ecore_IMF_Event *) &ecoreKeyUpEvent );
472 // If the event wasn't handled then we should send a key event.
475 if ( keyEvent->window == handler->mImpl->mWindow )
477 std::string keyName( keyEvent->keyname );
478 std::string keyString( "" );
479 int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
480 int modifier( keyEvent->modifiers );
481 unsigned long time( keyEvent->timestamp );
483 // Ensure key event string is not NULL as keys like SHIFT have a null string.
484 if ( keyEvent->string )
486 keyString = keyEvent->string;
489 KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Up);
490 handler->SendEvent( keyEvent );
495 return ECORE_CALLBACK_PASS_ON;
498 /////////////////////////////////////////////////////////////////////////////////////////////////
500 /////////////////////////////////////////////////////////////////////////////////////////////////
503 * Called when the window gains focus.
505 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
507 Ecore_X_Event_Window_Focus_In* focusInEvent( (Ecore_X_Event_Window_Focus_In*)event );
508 EventHandler* handler( (EventHandler*)data );
510 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusIn \n" );
512 // If the window gains focus and we hid the keyboard then show it again.
513 if ( focusInEvent->win == handler->mImpl->mWindow )
515 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventWindowFocusIn - >>WindowFocusGained \n" );
517 if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
519 Dali::ImfManager imfManager( ImfManager::Get() );
522 ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
523 if( imfManagerImpl.RestoreAfterFocusLost() )
525 imfManagerImpl.Activate();
529 // No need to connect callbacks as KeyboardStatusChanged will be called.
532 return ECORE_CALLBACK_PASS_ON;
536 * Called when the window loses focus.
538 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
540 Ecore_X_Event_Window_Focus_Out* focusOutEvent( (Ecore_X_Event_Window_Focus_Out*)event );
541 EventHandler* handler( (EventHandler*)data );
543 DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusOut \n" );
545 // If the window loses focus then hide the keyboard.
546 if ( focusOutEvent->win == handler->mImpl->mWindow )
548 if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
550 Dali::ImfManager imfManager( ImfManager::Get() );
553 ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
554 if( imfManagerImpl.RestoreAfterFocusLost() )
556 imfManagerImpl.Deactivate();
561 // Clipboard don't support that whether clipboard is shown or not. Hide clipboard.
562 Dali::Clipboard clipboard = Clipboard::Get();
563 clipboard.HideClipboard();
566 return ECORE_CALLBACK_PASS_ON;
570 * Called when the window is damaged.
572 static Eina_Bool EcoreEventWindowDamaged(void *data, int type, void *event)
574 Ecore_X_Event_Window_Damage* windowDamagedEvent( (Ecore_X_Event_Window_Damage*)event );
575 EventHandler* handler( (EventHandler*)data );
577 if( windowDamagedEvent->win == handler->mImpl->mWindow )
580 area.x = windowDamagedEvent->x;
581 area.y = windowDamagedEvent->y;
582 area.width = windowDamagedEvent->w;
583 area.height = windowDamagedEvent->h;
585 handler->SendEvent( area );
588 return ECORE_CALLBACK_PASS_ON;
592 * Called when the window properties are changed.
593 * We are only interested in the font change.
597 /////////////////////////////////////////////////////////////////////////////////////////////////
598 // Drag & Drop Callbacks
599 /////////////////////////////////////////////////////////////////////////////////////////////////
602 * Called when a dragged item enters our window's bounds.
603 * This is when items are dragged INTO our window.
605 static Eina_Bool EcoreEventDndEnter( void* data, int type, void* event )
607 DALI_LOG_INFO( gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndEnter\n" );
609 Ecore_X_Event_Xdnd_Enter* enterEvent( (Ecore_X_Event_Xdnd_Enter*) event );
610 EventHandler* handler( (EventHandler*)data );
611 Ecore_X_Window window ( handler->mImpl->mWindow );
613 if ( enterEvent->win == window )
615 DragAndDropDetectorPtr dndDetector( handler->mDragAndDropDetector );
617 // Check whether the Drag & Drop detector has Drag & Drop behaviour enabled before we accept.
618 if ( dndDetector && dndDetector->IsEnabled() )
620 // Tell Ecore that we want to enable drop in the entire window.
621 Ecore_X_Rectangle rect;
623 ecore_x_window_geometry_get( window, NULL, NULL, (int*)&rect.width, (int*)&rect.height );
625 // Tell Ecore that we are able to process a drop.
626 ecore_x_dnd_send_status( EINA_TRUE, EINA_FALSE, rect, ECORE_X_ATOM_XDND_DROP );
628 // Register the required atoms and types.
629 ecore_x_dnd_actions_set( window, DRAG_AND_DROP_ATOMS, DRAG_AND_DROP_ATOMS_NUMBER );
630 ecore_x_dnd_types_set( window, DRAG_AND_DROP_TYPES, DRAG_AND_DROP_TYPES_NUMBER );
632 // Request to get the content from Ecore.
633 ecore_x_selection_xdnd_request( window, ECORE_X_SELECTION_TARGET_UTF8_STRING );
635 DALI_LOG_INFO( gDragAndDropLogFilter, Debug::General, "EcoreEventDndEnter: Requesting Drag & Drop\n" );
637 // Clear the previous content
638 dndDetector->ClearContent();
640 // Emit the entered signal
641 dndDetector->EmitEnteredSignal();
645 return ECORE_CALLBACK_PASS_ON;
649 * Called when a dragged item is moved within our window.
650 * This is when items are dragged INTO our window.
652 static Eina_Bool EcoreEventDndPosition( void* data, int type, void* event )
654 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndPosition\n" );
656 Ecore_X_Event_Xdnd_Position* positionEvent( (Ecore_X_Event_Xdnd_Position*) event );
657 EventHandler* handler( (EventHandler*)data );
659 if ( positionEvent->win == handler->mImpl->mWindow )
661 DragAndDropDetectorPtr dndDetector( handler->mDragAndDropDetector );
663 // If we have a detector then update its latest position.
666 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::General, "EcoreEventDndPosition: position ( %d x %d )\n", positionEvent->position.x, positionEvent->position.y );
667 dndDetector->SetPosition( Vector2( positionEvent->position.x, positionEvent->position.y ));
668 dndDetector->EmitMovedSignal();
672 return ECORE_CALLBACK_PASS_ON;
676 * Called when a dragged item leaves our window's bounds.
677 * This is when items are dragged INTO our window.
679 static Eina_Bool EcoreEventDndLeave( void* data, int type, void* event )
681 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndLeave\n" );
683 Ecore_X_Event_Xdnd_Leave* leaveEvent( (Ecore_X_Event_Xdnd_Leave*) event );
684 EventHandler* handler( (EventHandler*)data );
686 if ( leaveEvent->win == handler->mImpl->mWindow )
688 DragAndDropDetectorPtr dndDetector( handler->mDragAndDropDetector );
690 // If we have a detector then clear its content and emit the exited-signal. Also tell Ecore that we have finished.
693 dndDetector->ClearContent();
694 dndDetector->EmitExitedSignal();
696 ecore_x_dnd_send_finished();
698 DALI_LOG_INFO( gDragAndDropLogFilter, Debug::General, "EcoreEventDndLeave: Finished\n" );
702 return ECORE_CALLBACK_PASS_ON;
706 * Called when the dragged item is dropped within our window's bounds.
707 * This is when items are dragged INTO our window.
709 static Eina_Bool EcoreEventDndDrop( void* data, int type, void* event )
711 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndDrop\n" );
713 Ecore_X_Event_Xdnd_Drop* dropEvent ( (Ecore_X_Event_Xdnd_Drop*) event);
714 EventHandler* handler( (EventHandler*)data );
716 if ( dropEvent->win == handler->mImpl->mWindow )
718 DragAndDropDetectorPtr dndDetector( handler->mDragAndDropDetector );
720 // Something has been dropped, inform the detector (if we have one) and tell Ecore that we have finished.
723 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::General, "EcoreEventDndDrop: position ( %d x %d )\n", dropEvent->position.x, dropEvent->position.y );
725 dndDetector->SetPosition( Vector2( dropEvent->position.x, dropEvent->position.y ) );
726 dndDetector->EmitDroppedSignal();
727 ecore_x_dnd_send_finished();
729 DALI_LOG_INFO( gDragAndDropLogFilter, Debug::General, "EcoreEventDndDrop: Finished\n" );
733 return ECORE_CALLBACK_PASS_ON;
737 * Called when a dragged item is moved from our window and the target window has done processing it.
738 * This is when items are dragged FROM our window.
740 static Eina_Bool EcoreEventDndFinished( void* data, int type, void* event )
742 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndFinished\n" );
743 return ECORE_CALLBACK_PASS_ON;
747 * Called when a dragged item is moved from our window and the target window has sent us a status.
748 * This is when items are dragged FROM our window.
750 static Eina_Bool EcoreEventDndStatus( void* data, int type, void* event )
752 DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndStatus\n" );
753 return ECORE_CALLBACK_PASS_ON;
757 * Called when the client messages (i.e. the accessibility events) are received.
759 static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
761 #ifndef DALI_PROFILE_UBUNTU
762 Ecore_X_Event_Client_Message* clientMessageEvent( (Ecore_X_Event_Client_Message*)event );
763 EventHandler* handler( (EventHandler*)data );
765 if (clientMessageEvent->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
767 if ( ( (unsigned int)clientMessageEvent->data.l[0] == handler->mImpl->mWindow ) && handler->mAccessibilityManager )
769 AccessibilityManager* accessibilityManager( &AccessibilityManager::GetImplementation( handler->mAccessibilityManager ) );
771 if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_SCROLL)
773 // 2 finger touch & move, 2 finger flick
775 // mouse state : e->data.l[2] (0: mouse down, 1: mouse move, 2: mouse up)
778 TouchPoint::State state(TouchPoint::Down);
780 if ((unsigned int)clientMessageEvent->data.l[2] == 0)
782 state = TouchPoint::Down; // mouse down
784 else if ((unsigned int)clientMessageEvent->data.l[2] == 1)
786 state = TouchPoint::Motion; // mouse move
788 else if ((unsigned int)clientMessageEvent->data.l[2] == 2)
790 state = TouchPoint::Up; // mouse up
794 state = TouchPoint::Interrupted; // error
797 DALI_LOG_INFO(gClientMessageLogFilter, Debug::General,
798 "[%s:%d] [%d] %d, %d\n", __FUNCTION__, __LINE__,
799 (unsigned int)clientMessageEvent->data.l[2],
800 (unsigned int)clientMessageEvent->data.l[3], (unsigned int)clientMessageEvent->data.l[4]);
802 // Send touch event to accessibility manager.
803 TouchPoint point( 0, state, (float)clientMessageEvent->data.l[3], (float)clientMessageEvent->data.l[4] );
805 // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control
806 accessibilityManager->HandleActionScrollEvent( point, GetCurrentMilliSeconds() );
808 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_MOUSE)
810 // 1 finger double tap and hold
812 // mouse state : e->data.l[2] (0: mouse down, 1: mouse move, 2: mouse up)
815 TouchPoint::State state(TouchPoint::Down);
817 if ((unsigned int)clientMessageEvent->data.l[2] == 0)
819 state = TouchPoint::Down; // mouse down
821 else if ((unsigned int)clientMessageEvent->data.l[2] == 1)
823 state = TouchPoint::Motion; // mouse move
825 else if ((unsigned int)clientMessageEvent->data.l[2] == 2)
827 state = TouchPoint::Up; // mouse up
831 state = TouchPoint::Interrupted; // error
834 DALI_LOG_INFO(gClientMessageLogFilter, Debug::General,
835 "[%s:%d] [%d] %d, %d\n", __FUNCTION__, __LINE__,
836 (unsigned int)clientMessageEvent->data.l[2],
837 (unsigned int)clientMessageEvent->data.l[3], (unsigned int)clientMessageEvent->data.l[4]);
839 // Send touch event to accessibility manager.
840 TouchPoint point( 0, state, (float)clientMessageEvent->data.l[3], (float)clientMessageEvent->data.l[4] );
842 // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control
843 accessibilityManager->HandleActionTouchEvent( point, GetCurrentMilliSeconds() );
845 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_BACK)
847 // 2 finger circle draw, do back
848 accessibilityManager->HandleActionBackEvent();
850 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
852 // one finger flick down
854 if(accessibilityManager)
856 accessibilityManager->HandleActionNextEvent();
859 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
861 // one finger flick up
862 // focus previous object
863 if(accessibilityManager)
865 accessibilityManager->HandleActionPreviousEvent();
868 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
870 // one finger double tap
871 // same as one finger tap in normal mode (i.e. execute focused actor)
872 if(accessibilityManager)
874 accessibilityManager->HandleActionActivateEvent();
877 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
880 // focus & read an actor at ( e->data.l[2], e->data.l[3] ) position according to finger
881 if(accessibilityManager)
883 accessibilityManager->HandleActionReadEvent((unsigned int)clientMessageEvent->data.l[2], (unsigned int)clientMessageEvent->data.l[3], true /* allow read again*/);
886 #if defined(DALI_PROFILE_MOBILE)
887 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_OVER)
889 // one finger tap & move
890 // mouse state : e->data.l[2] (0: mouse down, 1: mouse move, 2: mouse up)
893 // focus & read an actor at (x, y) position according to finger
894 if(accessibilityManager && (unsigned int)clientMessageEvent->data.l[2] == 1 /*only work for move event*/)
896 accessibilityManager->HandleActionReadEvent((unsigned int)clientMessageEvent->data.l[3], (unsigned int)clientMessageEvent->data.l[4], false /* not allow read again*/);
900 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
902 // one finger flick right
904 if(accessibilityManager)
906 accessibilityManager->HandleActionReadNextEvent();
909 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
911 // one finger flick left
912 // focus previous object
913 if(accessibilityManager)
915 accessibilityManager->HandleActionReadPreviousEvent();
918 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
920 // double down and move (right, up)
921 // change slider value
922 if(accessibilityManager)
924 accessibilityManager->HandleActionUpEvent();
927 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
929 // double down and move (left, down)
930 // change slider value
931 if(accessibilityManager)
933 accessibilityManager->HandleActionDownEvent();
936 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ENABLE)
938 if(accessibilityManager)
940 accessibilityManager->HandleActionEnableEvent();
943 else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DISABLE)
945 if(accessibilityManager)
947 accessibilityManager->HandleActionDisableEvent();
950 // TODO: some more actions could be added later
953 else if(clientMessageEvent->message_type == ecore_x_atom_get(CLIPBOARD_ATOM))
955 std::string message(clientMessageEvent->data.b);
956 if( message == CLIPBOARD_SET_OWNER_MESSAGE)
958 // Claim the ownership of the SECONDARY selection.
959 ecore_x_selection_secondary_set(handler->mImpl->mWindow, "", 1);
961 // Show the clipboard window
962 Dali::Clipboard clipboard = Dali::Clipboard::Get();
963 clipboard.ShowClipboard();
966 else if( clientMessageEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE )
968 RotationEvent rotationEvent;
969 rotationEvent.angle = static_cast<int>(clientMessageEvent->data.l[1]);
970 rotationEvent.winResize = static_cast<int>(clientMessageEvent->data.l[2]);
971 rotationEvent.width = static_cast<int>(clientMessageEvent->data.l[3]);
972 rotationEvent.height = static_cast<int>(clientMessageEvent->data.l[4]);
973 handler->SendRotationPrepareEvent( rotationEvent );
975 else if( clientMessageEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST )
977 handler->SendRotationRequestEvent();
980 #endif // DALI_PROFILE_UBUNTU
981 return ECORE_CALLBACK_PASS_ON;
985 * Called when the source window notifies us the content in clipboard is selected.
987 static Eina_Bool EcoreEventSelectionClear( void* data, int type, void* event )
989 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionClear\n" );
990 Ecore_X_Event_Selection_Clear* selectionClearEvent( (Ecore_X_Event_Selection_Clear*) event );
991 EventHandler* handler( (EventHandler*)data );
993 if ( selectionClearEvent->win == handler->mImpl->mWindow )
995 if ( selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY )
997 // Request to get the content from Ecore.
998 ecore_x_selection_secondary_request(selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT);
1001 return ECORE_CALLBACK_PASS_ON;
1005 * Called when the source window sends us about the selected content.
1006 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
1008 static Eina_Bool EcoreEventSelectionNotify( void* data, int type, void* event )
1010 DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventSelectionNotify\n" );
1012 Ecore_X_Event_Selection_Notify* selectionNotifyEvent( (Ecore_X_Event_Selection_Notify*) event );
1013 EventHandler* handler( (EventHandler*)data );
1015 if ( selectionNotifyEvent->win == handler->mImpl->mWindow )
1017 Ecore_X_Selection_Data* selectionData( (Ecore_X_Selection_Data*) selectionNotifyEvent->data );
1018 if ( selectionData->data )
1020 if ( selectionNotifyEvent->selection == ECORE_X_SELECTION_XDND )
1022 DragAndDropDetectorPtr dndDetector( handler->mDragAndDropDetector );
1024 // We have got the content that is to be dropped, inform the DndListener (if we have one).
1027 std::string content( (char*) selectionData->data, selectionData->length );
1028 dndDetector->SetContent( content );
1030 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "EcoreEventSelectionNotify: Content(%d):\n" , selectionData->length );
1031 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "======================================\n" );
1032 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "%s\n", selectionData->data );
1033 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "======================================\n" );
1036 else if ( selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY )
1038 // We have got the selected content, inform the clipboard event listener (if we have one).
1039 if ( handler->mClipboardEventNotifier )
1041 ClipboardEventNotifier& clipboardEventNotifier( ClipboardEventNotifier::GetImplementation( handler->mClipboardEventNotifier ) );
1042 std::string content( (char*) selectionData->data, selectionData->length );
1043 clipboardEventNotifier.SetContent( content );
1044 clipboardEventNotifier.EmitContentSelectedSignal();
1047 // Claim the ownership of the SECONDARY selection.
1048 ecore_x_selection_secondary_set(handler->mImpl->mWindow, "", 1);
1050 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "EcoreEventSelectionNotify: Content(%d):\n" , selectionData->length );
1051 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "======================================\n" );
1052 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "%s\n", selectionData->data );
1053 DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "======================================\n" );
1057 return ECORE_CALLBACK_PASS_ON;
1061 #ifndef DALI_PROFILE_UBUNTU
1062 /////////////////////////////////////////////////////////////////////////////////////////////////
1064 /////////////////////////////////////////////////////////////////////////////////////////////////
1066 * Called when a font name is changed.
1068 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
1070 EventHandler* handler = static_cast<EventHandler*>( data );
1072 StyleChange fontChange;
1073 fontChange.defaultFontChange = true;
1075 handler->SendEvent( fontChange );
1079 * Called when a font size is changed.
1081 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
1083 EventHandler* handler = static_cast<EventHandler*>( data );
1085 StyleChange fontChange;
1086 fontChange.defaultFontSizeChange = true;
1088 handler->SendEvent( fontChange );
1092 * Called when style is changed
1094 static void VconfNotifyThemeChanged( keynode_t* node, void* data )
1096 EventHandler* handler( static_cast<EventHandler*>(data) );
1098 StyleChange themeChange;
1099 themeChange.themeChange = true;
1101 handler->SendEvent( themeChange );
1103 #endif // DALI_PROFILE_UBUNTU
1106 EventHandler* mHandler;
1107 std::vector<Ecore_Event_Handler*> mEcoreEventHandler;
1108 Ecore_X_Window mWindow;
1111 EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector )
1112 : mCoreEventInterface(coreEventInterface),
1113 mGestureManager( gestureManager ),
1114 mStyleMonitor( StyleMonitor::Get() ),
1115 mDamageObserver( damageObserver ),
1116 mRotationObserver( NULL ),
1117 mDragAndDropDetector( dndDetector ),
1118 mAccessibilityManager( AccessibilityManager::Get() ),
1119 mClipboardEventNotifier( ClipboardEventNotifier::Get() ),
1120 mClipboard(Clipboard::Get()),
1123 Ecore_X_Window window = 0;
1125 if( surface->GetType() == Dali::RenderSurface::WINDOW )
1127 // this code only works with the EcoreX11 RenderSurface so need to downcast
1128 ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface );
1131 // enable multi touch
1132 window = ecoreSurface->GetXWindow();
1133 ecore_x_input_multi_select( window );
1137 mImpl = new Impl(this, window);
1140 EventHandler::~EventHandler()
1147 mGestureManager.Stop();
1150 void EventHandler::SendEvent(TouchPoint& point, unsigned long timeStamp)
1154 timeStamp = GetCurrentMilliSeconds();
1157 Integration::TouchEvent touchEvent;
1158 Integration::HoverEvent hoverEvent;
1159 Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent);
1160 if(type != Integration::TouchEventCombiner::DispatchNone )
1162 DALI_LOG_INFO(gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.deviceId, point.state, point.local.x, point.local.y);
1164 // First the touch and/or hover event & related gesture events are queued
1165 if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth)
1167 mCoreEventInterface.QueueCoreEvent( touchEvent );
1168 mGestureManager.SendEvent(touchEvent);
1171 if(type == Integration::TouchEventCombiner::DispatchHover || type == Integration::TouchEventCombiner::DispatchBoth)
1173 mCoreEventInterface.QueueCoreEvent( hoverEvent );
1176 // Next the events are processed with a single call into Core
1177 mCoreEventInterface.ProcessCoreEvents();
1181 void EventHandler::SendEvent(KeyEvent& keyEvent)
1183 Dali::PhysicalKeyboard physicalKeyboard = PhysicalKeyboard::Get();
1184 if ( physicalKeyboard )
1186 if ( ! KeyLookup::IsDeviceButton( keyEvent.keyPressedName.c_str() ) )
1188 GetImplementation( physicalKeyboard ).KeyReceived( keyEvent.time > 1 );
1192 // Create KeyEvent and send to Core.
1193 Integration::KeyEvent event(keyEvent.keyPressedName, keyEvent.keyPressed, keyEvent.keyCode,
1194 keyEvent.keyModifier, keyEvent.time, static_cast<Integration::KeyEvent::State>(keyEvent.state));
1195 mCoreEventInterface.QueueCoreEvent( event );
1196 mCoreEventInterface.ProcessCoreEvents();
1199 void EventHandler::SendMouseWheelEvent( MouseWheelEvent& wheelEvent )
1201 // Create MouseWheelEvent and send to Core.
1202 Integration::MouseWheelEvent event(wheelEvent.direction, wheelEvent.modifiers, wheelEvent.point, wheelEvent.z, wheelEvent.timeStamp);
1203 mCoreEventInterface.QueueCoreEvent( event );
1204 mCoreEventInterface.ProcessCoreEvents();
1207 void EventHandler::SendEvent(StyleChange styleChange)
1209 DALI_ASSERT_DEBUG( mStyleMonitor && "StyleMonitor Not Available" );
1210 GetImplementation( mStyleMonitor ).StyleChanged(styleChange);
1213 void EventHandler::SendEvent( const DamageArea& area )
1215 mDamageObserver.OnDamaged( area );
1218 void EventHandler::SendRotationPrepareEvent( const RotationEvent& event )
1220 if( mRotationObserver != NULL )
1222 mRotationObserver->OnRotationPrepare( event );
1226 void EventHandler::SendRotationRequestEvent( )
1228 if( mRotationObserver != NULL )
1230 mRotationObserver->OnRotationRequest( );
1234 void EventHandler::FeedTouchPoint( TouchPoint& point, int timeStamp)
1236 SendEvent(point, timeStamp);
1239 void EventHandler::FeedWheelEvent( MouseWheelEvent& wheelEvent )
1241 SendMouseWheelEvent( wheelEvent );
1244 void EventHandler::FeedKeyEvent( KeyEvent& event )
1249 void EventHandler::FeedEvent( Integration::Event& event )
1251 mCoreEventInterface.QueueCoreEvent( event );
1252 mCoreEventInterface.ProcessCoreEvents();
1255 void EventHandler::Reset()
1259 // Any touch listeners should be told of the interruption.
1260 Integration::TouchEvent event;
1261 TouchPoint point(0, TouchPoint::Interrupted, 0, 0);
1262 event.AddPoint( point );
1264 // First the touch event & related gesture events are queued
1265 mCoreEventInterface.QueueCoreEvent( event );
1266 mGestureManager.SendEvent( event );
1268 // Next the events are processed with a single call into Core
1269 mCoreEventInterface.ProcessCoreEvents();
1272 void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
1274 mDragAndDropDetector = detector;
1277 void EventHandler::SetRotationObserver( RotationObserver* observer )
1279 mRotationObserver = observer;
1282 } // namespace Adaptor
1284 } // namespace Internal