3 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "PlatformInputManager.h"
21 #include <Ecore_Evas.h>
22 #include <Ecore_Input.h>
25 #include "BrowserAssert.h"
26 #include "BrowserLogger.h"
28 #define E_PROP_DEVICEMGR_INPUTWIN "DeviceMgr Input Window"
29 #define E_PROP_NOT_CURSOR_HIDE "E_NOT_CURSOR_HIDE"
31 #define MOUSE_POINTER_MOVE_DELAY 0.015f
32 #define MOUSE_POINTER_STEPS 10
34 namespace tizen_browser
39 EXPORT_SERVICE(PlatformInputManager, "org.tizen.browser.platforminputmanager")
41 PlatformInputManager::PlatformInputManager()
46 void PlatformInputManager::init(Evas_Object* mainWindow)
49 //Suppress compilation warning
51 ecore_event_filter_add(NULL, __filter, NULL, this);
54 Eina_Bool PlatformInputManager::__filter(void *data, void */*loop_data*/, int type, void *event)
56 PlatformInputManager *self = static_cast<PlatformInputManager*>(data);
58 if (type == ECORE_EVENT_KEY_DOWN) {
60 Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event);
65 BROWSER_LOGD("Pressed key: %s", ev->keyname);
66 const std::string keyName = ev->keyname;
69 * Because MENU button launches org.tizen.menu
70 * we use blue 'D' button on remote control or F4 on keyboard as substitution of MENU button
72 if(!keyName.compare("KEY_MENU") || !keyName.compare("KEY_BLUE")) {
77 if(!keyName.compare("KEY_RETURN"))
78 self->returnPressed();
79 else if(!keyName.compare("KEY_LEFT"))
81 else if(!keyName.compare("KEY_RIGHT"))
83 else if(!keyName.compare("KEY_ENTER"))
85 // MERGE_ME dont know if should be commented out
86 else if(!keyName.compare("BackSpace") || !keyName.compare("XF86Back"))
88 else if(!keyName.compare("Escape"))
89 self->escapePressed();
90 } else if(type == ECORE_EVENT_KEY_UP) {
92 Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event);
97 BROWSER_LOGD("Released key: %s", ev->keyname);
98 } else if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN) {