[FIX] scenemanager: too small buffer
[platform/core/system/swap-probe.git] / probe_event / orientation.c
1 /*
2  *  DA probe
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:
7  *
8  * Jaewon Lim <jaewon81.lim@samsung.com>
9  * Woojin Jung <woojin2.jung@samsung.com>
10  * Juyoung Kim <j0.kim@samsung.com>
11  *
12  * This library is free software; you can redistribute it and/or modify it under
13  * the terms of the GNU Lesser General Public License as published by the
14  * Free Software Foundation; either version 2.1 of the License, or (at your option)
15  * any later version.
16  *
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20  * License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * along with this library; if not, write to the Free Software Foundation, Inc., 51
24  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  *
26  * Contributors:
27  * - S-Core Co., Ltd
28  *
29  */
30
31 #include <Ecore.h>
32 #include <Ecore_X.h>
33
34 #include "daprobe.h"
35 #include "dahelper.h"
36
37 Eina_Bool _da_onclientmessagereceived(void __unused * pData, int __unused type,
38                                       void *pEvent)
39 {
40         Ecore_X_Event_Client_Message* pClientEvent;
41
42         probeBlockStart();
43         pClientEvent = (Ecore_X_Event_Client_Message*)pEvent;
44
45         if(pClientEvent != NULL)
46         {
47                 if(pClientEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
48                 {
49                         int orientation = pClientEvent->data.l[1];
50                         on_orientation_changed(orientation, false);
51                 }
52         }
53         probeBlockEnd();
54
55         return ECORE_CALLBACK_RENEW;
56 }
57
58 Ecore_Event_Handler* register_orientation_event_listener()
59 {
60         Ecore_Event_Handler* handler;
61
62         probeBlockStart();
63         ecore_init();
64         ecore_x_init(NULL);
65         handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _da_onclientmessagereceived, NULL);
66         probeBlockEnd();
67
68         return handler;
69 }
70
71 void unregister_orientation_event_listener(Ecore_Event_Handler* handler)
72 {
73         probeBlockStart();
74         if(handler)
75         {
76                 ecore_event_handler_del(handler);
77         }
78         probeBlockEnd();
79 }