input: use pepper-xkb api to create/set keymap instead of pepper and xkbcommon apis
[platform/core/uifw/pepper-dali.git] / pepper-dali / internal / input-impl.h
1 #ifndef __DALI_PEPPER_INTERNAL_INPUT_H__
2 #define __DALI_PEPPER_INTERNAL_INPUT_H__
3
4 /*
5  * Copyright (c) 2016 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
21 // INTERNAL INCLUDES
22 #include <pepper-dali/internal/input.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali/public-api/common/intrusive-ptr.h>
26 #include <dali/public-api/object/base-object.h>
27 #include <Ecore.h>
28
29 struct xkb_context;
30
31 namespace Dali
32 {
33
34 namespace Pepper
35 {
36
37 namespace Internal
38 {
39
40 class Input;
41 typedef IntrusivePtr<Input> InputPtr;
42
43 class Input : public BaseObject
44 {
45 public:
46
47   static InputPtr New( Pepper::Compositor compositor );
48
49   static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event );
50   static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event );
51
52   pepper_pointer_t* GetPointer();
53   pepper_keyboard_t* GetKeyboard();
54   pepper_touch_t* GetTouch();
55
56 private:
57
58   /**
59    * Construct a new Input.
60    */
61   Input();
62
63   /**
64    * A reference counted object may only be deleted by calling Unreference()
65    */
66   virtual ~Input();
67
68   /**
69    * Second-phase constructor. Must be called immediately after creating a new Input;
70    */
71   void Initialize( Pepper::Compositor& compositor );
72
73 private:
74
75   // Undefined
76   Input( const Input& );
77
78   // Undefined
79   Input& operator=( const Input& rhs );
80
81 private: // Data
82
83   Pepper::Compositor mCompositor;
84
85   pepper_seat_t* mSeat;
86   pepper_input_device_t* mDevice;
87   pepper_pointer_t* mPointer;
88   pepper_keyboard_t* mKeyboard;
89   pepper_touch_t* mTouch;
90   pepper_xkb_t *mXkb;
91
92   std::vector<Ecore_Event_Handler*> mEcoreEventHandler;
93 };
94
95 } // namespace Internal
96
97 // Helpers for public-api forwarding methods
98
99 inline Pepper::Internal::Input& GetImplementation( Pepper::Input& input )
100 {
101   DALI_ASSERT_ALWAYS( input && "Input handle is empty" );
102
103   BaseObject& handle = input.GetBaseObject();
104
105   return static_cast< Internal::Input& >( handle );
106 }
107
108 inline const Pepper::Internal::Input& GetImplementation( const Pepper::Input& input )
109 {
110   DALI_ASSERT_ALWAYS( input && "Input handle is empty" );
111
112   const BaseObject& handle = input.GetBaseObject();
113
114   return static_cast< const Internal::Input& >( handle );
115 }
116
117 } // namespace Pepper
118
119 } // namespace Dali
120
121 #endif // __DALI_PEPPER_INTERNAL_INPUT_H__