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 ecore_event_filter_add(NULL, __filter, NULL, this);
52 Eina_Bool PlatformInputManager::__filter(void *data, void */*loop_data*/, int type, void *event)
54 PlatformInputManager *self = static_cast<PlatformInputManager*>(data);
56 if (type == ECORE_EVENT_KEY_DOWN) {
58 Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event);
63 BROWSER_LOGD("Pressed key: %s", ev->keyname);
64 const std::string keyName = ev->keyname;
67 * Because MENU button launches org.tizen.menu
68 * we use blue 'D' button on remote control or F4 on keyboard as substitution of MENU button
70 if(!keyName.compare("KEY_MENU") || !keyName.compare("KEY_BLUE")) {
75 if(!keyName.compare("KEY_RETURN"))
76 self->returnPressed();
77 else if(!keyName.compare("KEY_LEFT"))
79 else if(!keyName.compare("KEY_RIGHT"))
81 else if(!keyName.compare("KEY_ENTER"))
83 // MERGE_ME dont know if should be commented out
84 else if(!keyName.compare("BackSpace") || !keyName.compare("XF86Back"))
86 } else if(type == ECORE_EVENT_KEY_UP) {
88 Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event);
93 BROWSER_LOGD("Released key: %s", ev->keyname);
94 } else if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN) {