1 #ifndef __DALI_PEPPER_INTERNAL_SHELL_CLIENT_H__
2 #define __DALI_PEPPER_INTERNAL_SHELL_CLIENT_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/internal/shell-client.h>
25 #include <dali/public-api/common/intrusive-ptr.h>
26 #include <dali/public-api/object/base-object.h>
27 #include <wayland-server.h>
40 typedef IntrusivePtr<ShellClient> ShellClientPtr;
42 class ShellClient : public BaseObject
46 typedef void (*ConfigureCallback)( void* data, int width, int height );
48 static ShellClientPtr New( Pepper::Compositor compositor, struct wl_client* client, uint32_t version, uint32_t id );
50 void Configure( int width, int height, ConfigureCallback callback, void* data );
53 pepper_view_t* GetView();
54 void GetSurface( wl_client* client, unsigned int id, wl_resource* surfaceResource );
56 void SetTitle( const std::string& title );
57 const std::string& GetTitle() const;
59 void SetAppId( const std::string& appId );
60 const std::string& GetAppId() const;
68 * Construct a new ShellClient.
73 * A reference counted object may only be deleted by calling Unreference()
75 virtual ~ShellClient();
78 * Second-phase constructor. Must be called immediately after creating a new ShellClient;
80 void Initialize( Pepper::Compositor compositor, struct wl_client* client, uint32_t version, uint32_t id );
82 static void SurfaceResourceDestroy( struct wl_resource* resource );
83 static void OnSurfaceDestroy( pepper_event_listener_t* listener, pepper_object_t* surface, uint32_t id, void* info, void* data );
84 static void OnSurfaceCommit( pepper_event_listener_t* listener, pepper_object_t* surface, uint32_t id, void* info, void* data );
89 ShellClient( const ShellClient& );
92 ShellClient& operator=( const ShellClient& rhs );
96 Pepper::Compositor mCompositor;
99 wl_resource* mSurfaceResource;
101 pepper_surface_t* mSurface;
102 pepper_view_t* mView;
104 pepper_event_listener_t* mSurfaceDestroyListener;
105 pepper_event_listener_t* mSurfaceCommitListener;
110 bool mNeedSurfaceMap;
113 ConfigureCallback mConfigureCallback;
114 void* mConfigureCallbackData;
119 } // namespace Internal
121 // Helpers for public-api forwarding methods
123 inline Pepper::Internal::ShellClient& GetImplementation( Pepper::ShellClient& shellClient )
125 DALI_ASSERT_ALWAYS( shellClient && "ShellClient handle is empty" );
127 BaseObject& handle = shellClient.GetBaseObject();
129 return static_cast< Internal::ShellClient& >( handle );
132 inline const Pepper::Internal::ShellClient& GetImplementation( const Pepper::ShellClient& shellClient )
134 DALI_ASSERT_ALWAYS( shellClient && "ShellClient handle is empty" );
136 const BaseObject& handle = shellClient.GetBaseObject();
138 return static_cast< const Internal::ShellClient& >( handle );
141 } // namespace Pepper
145 #endif // __DALI_PEPPER_INTERNAL_SHELL_CLIENT_H__