File: output_metrics.h

package info (click to toggle)
chromium 139.0.7258.127-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,122,156 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (128 lines) | stat: -rw-r--r-- 4,122 bytes parent folder | download | duplicates (7)
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
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_EXO_WAYLAND_OUTPUT_METRICS_H_
#define COMPONENTS_EXO_WAYLAND_OUTPUT_METRICS_H_

#include <vector>

#include <aura-shell-server-protocol.h>
#include <wayland-server-protocol-core.h>

#include "ui/base/wayland/wayland_display_util.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/size.h"

namespace display {
class Display;
}  // namespace display

namespace exo::wayland {

// Metrics for wl_output and supported extensions.
struct OutputMetrics {
  explicit OutputMetrics(const display::Display& display);
  OutputMetrics(const OutputMetrics&);
  OutputMetrics& operator=(const OutputMetrics&);
  virtual ~OutputMetrics();

  //////////////////////////////////////////////////////////////////////////////
  // wl_output metrics

  // Textual description of the manufacturer.
  std::string make;

  // Textual description of the model.
  std::string model;

  // `origin` is used in wayland service to identify the workspace the pixel
  // size will be applied.
  gfx::Point origin;

  // `physical_size_px` is the physical resolution of the display in pixels.
  // The value should not include any overscan insets or display rotation,
  // except for any panel orientation adjustment.
  gfx::Size physical_size_px;

  // `physical_size_mm` is our best-effort approximation for the physical size
  // of the display in millimeters, given the display resolution and DPI. The
  // value should not include any overscan insets or display rotation, except
  // for any panel orientation adjustment.
  gfx::Size physical_size_mm;

  // Subpixel orientation of the output.
  wl_output_subpixel subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;

  // Transform that maps framebuffer to output.
  wl_output_transform panel_transform;

  // Bitfield of mode flags.
  uint32_t mode_flags;

  // Vertical refresh rate in mHz.
  int32_t refresh_mhz;

  // Scaling geometry information.
  int32_t scale;

  //////////////////////////////////////////////////////////////////////////////
  // xdg_output metrics

  // `logical_origin` is used in wayland service to identify the workspace
  // the pixel size will be applied.
  gfx::Point logical_origin;

  // Size of the output in the global compositor space.
  gfx::Size logical_size;

  // Human-readable description of this output.
  std::string description;

  //////////////////////////////////////////////////////////////////////////////
  // aura output metrics

  // Aura's display id associated with this output.
  ui::wayland::WaylandDisplayIdPair display_id;

  struct OutputScale {
    // Bitfield of scale flags.
    uint32_t scale_property;

    // The output scale factor.
    uint32_t scale_factor;
  };
  std::vector<OutputScale> output_scales;

  // Describes how the output is connected.
  zaura_output_connection_type connection_type;

  // Describes the insets for the output in logical screen coordinates, from
  // which the work area can be calculated.
  gfx::Insets logical_insets;

  // Describes the overscan insets for the output in physical pixels.
  gfx::Insets physical_overscan_insets;

  // A deprecated description of the device scale factor for the output. This is
  // calculated by taking `ManagedDisplayInfo::device_scale_factor_`,
  // multiplying it by 1000 and casting it to a unit32_t (truncating towards
  // zero).
  // TODO(tluk): Migrate clients to the new device_scale_factor value below and
  // remove this.
  uint32_t device_scale_factor_deprecated;

  // Describes the device scale factor for the output. Maps directly to
  // `Display::device_scale_factor_`.
  float device_scale_factor;

  // Describes the logical transform for the output. Whereas
  // wl_output.geometry's transform corresponds to the display's panel rotation,
  // the logical transform corresponds to the display's logical rotation.
  wl_output_transform logical_transform;
};

}  // namespace exo::wayland

#endif  // COMPONENTS_EXO_WAYLAND_OUTPUT_METRICS_H_