2 // Open Service Platform
3 // Copyright (c) 2012 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.
19 * @file FUi_UiManagerStub.cpp
20 * @brief This is the implementation for the _UiManagerStub class.
27 #include <FBaseSysLog.h>
28 #include <FBase_StringConverter.h>
29 #include <FIo_IpcServer.h>
30 #include <FSec_AccessController.h>
31 #include <FUi_UiManagerIpcMessages.h>
32 #include "FUi_UiManagerStub.h"
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Io;
38 using namespace Tizen::Security;
40 namespace Tizen { namespace Ui
45 _Z_ORDER_GROUP_HIGHEST,
47 _Z_ORDER_GROUP_NORMAL,
50 _UiManagerStub::_UiManagerStub(void)
54 _UiManagerStub::~_UiManagerStub(void)
63 _UiManagerStub::Construct(void)
65 result r = StartIpcServer();
66 SysTryReturnResult(NID_UI, r == E_SUCCESS, r, "Propagating.");
72 _UiManagerStub::StartIpcServer(void)
74 unique_ptr<_IpcServer> pIpcServer(new (std::nothrow) _IpcServer());
75 SysTryReturnResult(NID_UI, pIpcServer, E_OUT_OF_MEMORY, "Memory is insufficient.");
77 result r = pIpcServer->Construct(L"osp.ui.ipcserver.uimanager", *this, true);
78 SysTryReturnResult(NID_UI, r == E_SUCCESS, r, "Propagating.");
80 r = pIpcServer->Start();
81 SysTryReturnResult(NID_UI, r == E_SUCCESS, r, "Propagating.");
83 __pIpcServer = move(pIpcServer);
89 _UiManagerStub::OnSetZOrderGroup(unsigned int window, int windowZOrderGroup, result* pResult)
91 SysLog(NID_UI, "IPC message(0x%x, %d) is received.", window, windowZOrderGroup);
93 *pResult = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_UIMANAGER);
94 SysTryReturn(NID_UI, *pResult == E_SUCCESS, true, *pResult, "[%s] Propagating.", GetErrorMessage(*pResult));
96 Ecore_X_Window win = (Ecore_X_Window)window;
97 ecore_x_icccm_transient_for_unset(win);
99 if (windowZOrderGroup == _Z_ORDER_GROUP_NORMAL)
101 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
103 else if (windowZOrderGroup == _Z_ORDER_GROUP_HIGHEST)
105 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
106 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_HIGH);
108 else if (windowZOrderGroup == _Z_ORDER_GROUP_HIGH)
110 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
111 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_NORMAL);
118 _UiManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
120 IPC_BEGIN_MESSAGE_MAP(_UiManagerStub, message)
121 IPC_MESSAGE_HANDLER_EX(UiManager_SetZOrderGroup, &server, OnSetZOrderGroup)
122 IPC_END_MESSAGE_MAP()
126 _UiManagerStub::OnIpcServerStarted(const _IpcServer& server)
131 _UiManagerStub::OnIpcServerStopped(const _IpcServer& server)
136 _UiManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
141 _UiManagerStub::OnIpcClientDisconnected(const _IpcServer&server, int clientId)