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 );
56 * @copydoc Dali::Pepper::Compositor::GetName()
58 const std::string& GetName() const;
60 void* GetCompositorHandle();
64 Pepper::Compositor::CompositorSignalType& ObjectViewAddedSignal();
65 Pepper::Compositor::CompositorSignalType& ObjectViewDeletedSignal();
70 * Construct a new Compositor.
75 * A reference counted object may only be deleted by calling Unreference()
77 virtual ~Compositor();
80 * Second-phase constructor. Must be called immediately after creating a new Compositor;
82 void Initialize( Application application, const std::string& name );
84 int GetSocketFdFromServer();
86 void OnObjectViewAdded( Pepper::Output output, Pepper::ObjectView obejctView );
87 void OnObjectViewDeleted( Pepper::Output output, Pepper::ObjectView objectView );
89 static Eina_Bool FdReadCallback( void* data, Ecore_Fd_Handler* handler );
90 static void FdPrepareCallback( void* data, Ecore_Fd_Handler* handler );
95 Compositor( const Compositor& );
98 Compositor& operator=( const Compositor& rhs );
102 pepper_compositor_t* mCompositor;
103 wl_display* mDisplay;
104 wl_event_loop* mEventLoop;
105 Ecore_Fd_Handler* mFdHandler;
106 wayland_tbm_server* mTbmServer;
108 Pepper::Shell mShell;
109 Pepper::Input mInput;
110 Pepper::Output mOutput;
112 std::string mSocketName;
115 Pepper::Compositor::CompositorSignalType mObjectViewAddedSignal;
116 Pepper::Compositor::CompositorSignalType mObjectViewDeletedSignal;
119 } // namespace Internal
121 // Helpers for public-api forwarding methods
123 inline Pepper::Internal::Compositor& GetImplementation( Pepper::Compositor& compositor )
125 DALI_ASSERT_ALWAYS( compositor && "Compositor handle is empty" );
127 BaseObject& handle = compositor.GetBaseObject();
129 return static_cast< Internal::Compositor& >( handle );
132 inline const Pepper::Internal::Compositor& GetImplementation( const Pepper::Compositor& compositor )
134 DALI_ASSERT_ALWAYS( compositor && "Compositor handle is empty" );
136 const BaseObject& handle = compositor.GetBaseObject();
138 return static_cast< const Internal::Compositor& >( handle );
141 } // namespace Pepper
145 #endif // __DALI_PEPPER_INTERNAL_COMPOSITOR_H__