1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_EXO_WAYLAND_CLIENTS_FULLSCREEN_SHELL_H_
6 #define COMPONENTS_EXO_WAYLAND_CLIENTS_FULLSCREEN_SHELL_H_
7 
8 #include "components/exo/wayland/clients/client_base.h"
9 #include "ui/gfx/geometry/point.h"
10 #include "ui/gfx/geometry/size.h"
11 
12 namespace exo {
13 namespace wayland {
14 namespace clients {
15 
16 // Sample Wayland client that uses the Fullscreen Shell protocol
17 // to display a fullscreen application with touch support.
18 class FullscreenClient : public ClientBase {
19  public:
20   FullscreenClient();
21   ~FullscreenClient() override;
22   bool Run(const InitParams& params);
23 
24  private:
25   void AllocateBuffers(const InitParams& params);
26   void Paint(const wl_callback_listener& frame_listener);
27 
28   // Overridden from ClientBase
29   void HandleDown(void* data,
30                   struct wl_touch* wl_touch,
31                   uint32_t serial,
32                   uint32_t time,
33                   struct wl_surface* surface,
34                   int32_t id,
35                   wl_fixed_t x,
36                   wl_fixed_t y) override;
37   void HandleMode(void* data,
38                   struct wl_output* wl_output,
39                   uint32_t flags,
40                   int32_t width,
41                   int32_t height,
42                   int32_t refresh) override;
43   void HandleDone(void* data, struct wl_output* wl_output) override;
44 
45   bool has_mode_ = false;
46   bool done_receiving_modes_ = false;
47   int frame_count_ = 0;
48   int frames_ = 300;
49 
50   gfx::Point point_ = {100, 100};
51   const gfx::Size square_size_ = {100, 100};
52   int dir_x_ = 1;
53   int dir_y_ = 1;
54   const int step_size_ = 20;
55   SkColor color_ = SK_ColorBLUE;
56 
57   std::unique_ptr<wl_callback> frame_callback_;
58   bool frame_callback_pending_ = false;
59 
60   DISALLOW_COPY_AND_ASSIGN(FullscreenClient);
61 };
62 
63 }  // namespace clients
64 }  // namespace wayland
65 }  // namespace exo
66 
67 #endif  // COMPONENTS_EXO_WAYLAND_CLIENTS_FULLSCREEN_SHELL_H_
68