fce90a6bd339d44ae7cf4726160cfec495fe6a9e
[platform/core/uifw/dali-adaptor.git] / adaptors / x11 / x-events / x-event-manager.h
1 #ifndef __DALI_INTERNAL_X_EVENT_MANAGER_H__
2 #define __DALI_INTERNAL_X_EVENT_MANAGER_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 // EXTERNAL INCLUDES
21 #include <X11/X.h>
22 #include <X11/Xlib.h>
23 #include <file-descriptor-monitor.h>
24
25 // INTERNAL INCLUDES
26 #include <base/interfaces/window-event-interface.h>
27 #include "x-input2.h"
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 namespace Adaptor
36 {
37
38 /**
39  *
40  * @brief Used to handle X events.
41  * The code is mainloop agnostic, so the monitoring of the X event file descriptor
42  * for X events is external to this class.
43  *
44  */
45 class XEventManager
46 {
47
48 public:
49
50   /**
51    * Constructor
52    * @param[in] window ID
53    * @param[in] display x-connection
54    * @param[in] eventInterface window event interface
55    */
56   XEventManager( XID window, Display* display, WindowEventInterface* eventInterface );
57
58   /**
59    * @brief non virtual destructor
60    */
61   ~XEventManager();
62
63   /**
64    * @brief Initialize
65    */
66   void Initialize();
67
68 private:
69
70   /**
71    * @brief Should be called when the Event file descriptor signals data is available
72    */
73   void XEventReceived( FileDescriptorMonitor::EventType eventMask );
74
75   // Undefined copy constructor.
76   XEventManager( const XEventManager& );
77
78   // Undefined assignment operator.
79   XEventManager& operator=( const XEventManager& );
80
81 private:
82
83   XInput2 mXInput2;                                       ///< XInput2 handler
84   FileDescriptorMonitor* mFileDescriptorMonitor;          ///< File descriptor monitor for X events
85   Display* mDisplay;                                      ///< X connection
86   XID mWindow;                                            ///< Window to receive events for
87   bool mInitialized:1;
88
89 };
90
91 } // namespace Adaptor
92 } // namespace Internal
93 } // namespace Dali
94
95 #endif // __DALI_INTERNAL_X_EVENT_MANAGER_H__