Mir
wayland_surface.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2018, 2021 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 or 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  * William Wold <william.wold@canonical.com>
18  */
19 
20 #ifndef MIRAL_WAYLAND_SURFACE_H
21 #define MIRAL_WAYLAND_SURFACE_H
22 
23 #include "wayland_app.h"
24 
25 #include "mir/geometry/size.h"
26 
28 {
29 public:
31  virtual ~WaylandSurface() = default;
32 
33  void attach_buffer(wl_buffer* buffer, int scale);
34  void commit() const;
36  void set_fullscreen(wl_output* output);
37 
38  auto app() const -> WaylandApp const* { return app_; }
39  auto surface() const -> wl_surface* { return surface_; }
40  auto configured_size() const -> mir::geometry::Size { return configured_size_; };
41 
42 protected:
44  virtual void configured() {};
45 
46 private:
47  static void handle_ping(void* data, struct wl_shell_surface* shell_surface, uint32_t serial);
48  static void handle_configure(
49  void* data,
50  wl_shell_surface* shell_surface,
51  uint32_t edges,
52  int32_t width,
53  int32_t height);
54 
55  static wl_shell_surface_listener const shell_surface_listener;
56  static mir::geometry::Size const default_size;
57 
58  WaylandApp const* const app_;
59  WaylandObject<wl_surface> const surface_;
60  WaylandObject<wl_shell_surface> const shell_surface_;
61  mir::geometry::Size configured_size_;
62  int buffer_scale{1};
63 };
64 
65 
66 #endif // MIRAL_WAYLAND_SURFACE_H
Definition: wayland_app.h:98
Definition: wayland_surface.h:28
void set_fullscreen(wl_output *output)
output can be null, user needs to commit after
Definition: wayland_surface.cpp:55
void commit() const
Definition: wayland_surface.cpp:50
virtual ~WaylandSurface()=default
auto surface() const -> wl_surface *
Definition: wayland_surface.h:39
auto app() const -> WaylandApp const *
Definition: wayland_surface.h:38
void attach_buffer(wl_buffer *buffer, int scale)
Definition: wayland_surface.cpp:40
auto configured_size() const -> mir::geometry::Size
Definition: wayland_surface.h:40
virtual void configured()
Called when the compositor configures this shell surface.
Definition: wayland_surface.h:44
WaylandSurface(WaylandApp const *app)
Definition: wayland_surface.cpp:31
Definition: splash_session.h:24
Definition: size.h:32

Copyright © 2012-2021 Canonical Ltd.
Generated on Fri Feb 26 05:03:10 UTC 2021
This documentation is licensed under the GPL version 2 or 3.