1 #ifndef __DALI_PEPPER_INTERNAL_COMPOSITOR_H__
2 #define __DALI_PEPPER_INTERNAL_COMPOSITOR_H__
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <pepper-dali/public-api/compositor/compositor.h>
23 #include <pepper-dali/internal/shell.h>
24 #include <pepper-dali/internal/input.h>
25 #include <pepper-dali/internal/output.h>
28 #include <dali/public-api/object/base-object.h>
29 #include <dali/public-api/signals/connection-tracker.h>
31 #include <wayland-tbm-server.h>
44 typedef IntrusivePtr<Compositor> CompositorPtr;
46 class Compositor : public BaseObject, public ConnectionTracker
51 * @copydoc Dali::Pepper::Compositor::New()
53 static CompositorPtr New( Application application, const std::string& name );
55 void* GetCompositorHandle();
59 Pepper::Compositor::CompositorSignalType& ObjectViewAddedSignal();
60 Pepper::Compositor::CompositorSignalType& ObjectViewDeletedSignal();
65 * Construct a new Compositor.
70 * A reference counted object may only be deleted by calling Unreference()
72 virtual ~Compositor();
75 * Second-phase constructor. Must be called immediately after creating a new Compositor;
77 void Initialize( Application application, const std::string& name );
79 int GetSocketFdFromServer();
81 void OnObjectViewAdded( Pepper::Output output, Pepper::ObjectView obejctView );
82 void OnObjectViewDeleted( Pepper::Output output, Pepper::ObjectView objectView );
84 static Eina_Bool FdReadCallback( void* data, Ecore_Fd_Handler* handler );
85 static void FdPrepareCallback( void* data, Ecore_Fd_Handler* handler );
90 Compositor( const Compositor& );
93 Compositor& operator=( const Compositor& rhs );
97 pepper_compositor_t* mCompositor;
99 wl_event_loop* mEventLoop;
100 Ecore_Fd_Handler* mFdHandler;
101 wayland_tbm_server* mTbmServer;
103 Pepper::Shell mShell;
104 Pepper::Input mInput;
105 Pepper::Output mOutput;
107 std::string mSocketName;
110 Pepper::Compositor::CompositorSignalType mObjectViewAddedSignal;
111 Pepper::Compositor::CompositorSignalType mObjectViewDeletedSignal;
114 } // namespace Internal
116 // Helpers for public-api forwarding methods
118 inline Pepper::Internal::Compositor& GetImplementation( Pepper::Compositor& compositor )
120 DALI_ASSERT_ALWAYS( compositor && "Compositor handle is empty" );
122 BaseObject& handle = compositor.GetBaseObject();
124 return static_cast< Internal::Compositor& >( handle );
127 inline const Pepper::Internal::Compositor& GetImplementation( const Pepper::Compositor& compositor )
129 DALI_ASSERT_ALWAYS( compositor && "Compositor handle is empty" );
131 const BaseObject& handle = compositor.GetBaseObject();
133 return static_cast< const Internal::Compositor& >( handle );
136 } // namespace Pepper
140 #endif // __DALI_PEPPER_INTERNAL_COMPOSITOR_H__