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;
65 * Construct a new ShellClient.
70 * A reference counted object may only be deleted by calling Unreference()
72 virtual ~ShellClient();
75 * Second-phase constructor. Must be called immediately after creating a new ShellClient;
77 void Initialize( Pepper::Compositor compositor, struct wl_client* client, uint32_t version, uint32_t id );
79 static void SurfaceResourceDestroy( struct wl_resource* resource );
80 static void OnSurfaceDestroy( pepper_event_listener_t* listener, pepper_object_t* surface, uint32_t id, void* info, void* data );
81 static void OnSurfaceCommit( pepper_event_listener_t* listener, pepper_object_t* surface, uint32_t id, void* info, void* data );
86 ShellClient( const ShellClient& );
89 ShellClient& operator=( const ShellClient& rhs );
93 Pepper::Compositor mCompositor;
96 wl_resource* mSurfaceResource;
98 pepper_surface_t* mSurface;
101 pepper_event_listener_t* mSurfaceDestroyListener;
102 pepper_event_listener_t* mSurfaceCommitListener;
110 ConfigureCallback mConfigureCallback;
111 void* mConfigureCallbackData;
116 } // namespace Internal
118 // Helpers for public-api forwarding methods
120 inline Pepper::Internal::ShellClient& GetImplementation( Pepper::ShellClient& shellClient )
122 DALI_ASSERT_ALWAYS( shellClient && "ShellClient handle is empty" );
124 BaseObject& handle = shellClient.GetBaseObject();
126 return static_cast< Internal::ShellClient& >( handle );
129 inline const Pepper::Internal::ShellClient& GetImplementation( const Pepper::ShellClient& shellClient )
131 DALI_ASSERT_ALWAYS( shellClient && "ShellClient handle is empty" );
133 const BaseObject& handle = shellClient.GetBaseObject();
135 return static_cast< const Internal::ShellClient& >( handle );
138 } // namespace Pepper
142 #endif // __DALI_PEPPER_INTERNAL_SHELL_CLIENT_H__