File: screensaver.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (273 lines) | stat: -rw-r--r-- 8,472 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file was automatically generated with:
// ../../ui/gfx/x/gen_xproto.py \
//    ../../third_party/xcbproto/src \
//    gen/ui/gfx/x \
//    bigreq \
//    dri3 \
//    glx \
//    randr \
//    render \
//    screensaver \
//    shape \
//    shm \
//    sync \
//    xfixes \
//    xinput \
//    xkb \
//    xproto \
//    xtest

#ifndef UI_GFX_X_GENERATED_PROTOS_SCREENSAVER_H_
#define UI_GFX_X_GENERATED_PROTOS_SCREENSAVER_H_

#include <array>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <optional>
#include <vector>

#include "base/component_export.h"
#include "base/files/scoped_file.h"
#include "base/memory/scoped_refptr.h"
#include "ui/gfx/x/error.h"
#include "ui/gfx/x/ref_counted_fd.h"
#include "ui/gfx/x/xproto_types.h"
#include "xproto.h"

namespace x11 {

class Connection;

template <typename Reply>
struct Response;

template <typename Reply>
class Future;

class COMPONENT_EXPORT(X11) ScreenSaver {
 public:
  static constexpr unsigned major_version = 1;
  static constexpr unsigned minor_version = 1;

  ScreenSaver(Connection* connection, const x11::QueryExtensionReply& info);

  uint8_t present() const { return info_.present; }
  uint8_t major_opcode() const { return info_.major_opcode; }
  uint8_t first_event() const { return info_.first_event; }
  uint8_t first_error() const { return info_.first_error; }

  Connection* connection() const { return connection_; }

  enum class Kind : int {
    Blanked = 0,
    Internal = 1,
    External = 2,
  };

  enum class Event : int {
    NotifyMask = 1 << 0,
    CycleMask = 1 << 1,
  };

  enum class State : int {
    Off = 0,
    On = 1,
    Cycle = 2,
    Disabled = 3,
  };

  struct NotifyEvent {
    static constexpr uint8_t type_id = 5;
    static constexpr uint8_t opcode = 0;
    State state{};
    uint16_t sequence{};
    Time time{};
    Window root{};
    Window window{};
    Kind kind{};
    uint8_t forced{};
  };

  struct QueryVersionRequest {
    uint8_t client_major_version{};
    uint8_t client_minor_version{};
  };

  struct QueryVersionReply {
    uint16_t sequence{};
    uint16_t server_major_version{};
    uint16_t server_minor_version{};
  };

  using QueryVersionResponse = Response<QueryVersionReply>;

  Future<QueryVersionReply> QueryVersion(const QueryVersionRequest& request);

  Future<QueryVersionReply> QueryVersion(
      const uint8_t& client_major_version = {},
      const uint8_t& client_minor_version = {});

  struct QueryInfoRequest {
    Drawable drawable{};
  };

  struct QueryInfoReply {
    uint8_t state{};
    uint16_t sequence{};
    Window saver_window{};
    uint32_t ms_until_server{};
    uint32_t ms_since_user_input{};
    uint32_t event_mask{};
    Kind kind{};
  };

  using QueryInfoResponse = Response<QueryInfoReply>;

  Future<QueryInfoReply> QueryInfo(const QueryInfoRequest& request);

  Future<QueryInfoReply> QueryInfo(const Drawable& drawable = {});

  struct SelectInputRequest {
    Drawable drawable{};
    Event event_mask{};
  };

  using SelectInputResponse = Response<void>;

  Future<void> SelectInput(const SelectInputRequest& request);

  Future<void> SelectInput(const Drawable& drawable = {},
                           const Event& event_mask = {});

  struct SetAttributesRequest {
    Drawable drawable{};
    int16_t x{};
    int16_t y{};
    uint16_t width{};
    uint16_t height{};
    uint16_t border_width{};
    WindowClass c_class{};
    uint8_t depth{};
    VisualId visual{};
    std::optional<Pixmap> background_pixmap{};
    std::optional<uint32_t> background_pixel{};
    std::optional<Pixmap> border_pixmap{};
    std::optional<uint32_t> border_pixel{};
    std::optional<Gravity> bit_gravity{};
    std::optional<Gravity> win_gravity{};
    std::optional<BackingStore> backing_store{};
    std::optional<uint32_t> backing_planes{};
    std::optional<uint32_t> backing_pixel{};
    std::optional<Bool32> override_redirect{};
    std::optional<Bool32> save_under{};
    std::optional<EventMask> event_mask{};
    std::optional<EventMask> do_not_propogate_mask{};
    std::optional<ColorMap> colormap{};
    std::optional<Cursor> cursor{};
  };

  using SetAttributesResponse = Response<void>;

  Future<void> SetAttributes(const SetAttributesRequest& request);

  Future<void> SetAttributes(
      const Drawable& drawable = {},
      const int16_t& x = {},
      const int16_t& y = {},
      const uint16_t& width = {},
      const uint16_t& height = {},
      const uint16_t& border_width = {},
      const WindowClass& c_class = {},
      const uint8_t& depth = {},
      const VisualId& visual = {},
      const std::optional<Pixmap>& background_pixmap = std::nullopt,
      const std::optional<uint32_t>& background_pixel = std::nullopt,
      const std::optional<Pixmap>& border_pixmap = std::nullopt,
      const std::optional<uint32_t>& border_pixel = std::nullopt,
      const std::optional<Gravity>& bit_gravity = std::nullopt,
      const std::optional<Gravity>& win_gravity = std::nullopt,
      const std::optional<BackingStore>& backing_store = std::nullopt,
      const std::optional<uint32_t>& backing_planes = std::nullopt,
      const std::optional<uint32_t>& backing_pixel = std::nullopt,
      const std::optional<Bool32>& override_redirect = std::nullopt,
      const std::optional<Bool32>& save_under = std::nullopt,
      const std::optional<EventMask>& event_mask = std::nullopt,
      const std::optional<EventMask>& do_not_propogate_mask = std::nullopt,
      const std::optional<ColorMap>& colormap = std::nullopt,
      const std::optional<Cursor>& cursor = std::nullopt);

  struct UnsetAttributesRequest {
    Drawable drawable{};
  };

  using UnsetAttributesResponse = Response<void>;

  Future<void> UnsetAttributes(const UnsetAttributesRequest& request);

  Future<void> UnsetAttributes(const Drawable& drawable = {});

  struct SuspendRequest {
    uint32_t suspend{};
  };

  using SuspendResponse = Response<void>;

  Future<void> Suspend(const SuspendRequest& request);

  Future<void> Suspend(const uint32_t& suspend = {});

 private:
  Connection* const connection_;
  x11::QueryExtensionReply info_{};
};

}  // namespace x11

inline constexpr x11::ScreenSaver::Kind operator|(x11::ScreenSaver::Kind l,
                                                  x11::ScreenSaver::Kind r) {
  using T = std::underlying_type_t<x11::ScreenSaver::Kind>;
  return static_cast<x11::ScreenSaver::Kind>(static_cast<T>(l) |
                                             static_cast<T>(r));
}

inline constexpr x11::ScreenSaver::Kind operator&(x11::ScreenSaver::Kind l,
                                                  x11::ScreenSaver::Kind r) {
  using T = std::underlying_type_t<x11::ScreenSaver::Kind>;
  return static_cast<x11::ScreenSaver::Kind>(static_cast<T>(l) &
                                             static_cast<T>(r));
}

inline constexpr x11::ScreenSaver::Event operator|(x11::ScreenSaver::Event l,
                                                   x11::ScreenSaver::Event r) {
  using T = std::underlying_type_t<x11::ScreenSaver::Event>;
  return static_cast<x11::ScreenSaver::Event>(static_cast<T>(l) |
                                              static_cast<T>(r));
}

inline constexpr x11::ScreenSaver::Event operator&(x11::ScreenSaver::Event l,
                                                   x11::ScreenSaver::Event r) {
  using T = std::underlying_type_t<x11::ScreenSaver::Event>;
  return static_cast<x11::ScreenSaver::Event>(static_cast<T>(l) &
                                              static_cast<T>(r));
}

inline constexpr x11::ScreenSaver::State operator|(x11::ScreenSaver::State l,
                                                   x11::ScreenSaver::State r) {
  using T = std::underlying_type_t<x11::ScreenSaver::State>;
  return static_cast<x11::ScreenSaver::State>(static_cast<T>(l) |
                                              static_cast<T>(r));
}

inline constexpr x11::ScreenSaver::State operator&(x11::ScreenSaver::State l,
                                                   x11::ScreenSaver::State r) {
  using T = std::underlying_type_t<x11::ScreenSaver::State>;
  return static_cast<x11::ScreenSaver::State>(static_cast<T>(l) &
                                              static_cast<T>(r));
}

#endif  // UI_GFX_X_GENERATED_PROTOS_SCREENSAVER_H_