File: vulkan_surface_x11.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 (118 lines) | stat: -rw-r--r-- 2,797 bytes parent folder | download | duplicates (3)
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
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_OZONE_PLATFORM_X11_VULKAN_SURFACE_X11_H_
#define UI_OZONE_PLATFORM_X11_VULKAN_SURFACE_X11_H_

#include <vulkan/vulkan.h>
// vulkan.h includes <X11/Xlib.h> when VK_USE_PLATFORM_XLIB_KHR is defined
// after https://github.com/KhronosGroup/Vulkan-Headers/pull/534.
// This defines some macros which break build, so undefine them here.
#undef Above
#undef AllTemporary
#undef AlreadyGrabbed
#undef Always
#undef AsyncBoth
#undef AsyncKeyboard
#undef AsyncPointer
#undef Below
#undef BottomIf
#undef Button1
#undef Button2
#undef Button3
#undef Button4
#undef Button5
#undef ButtonPress
#undef ButtonRelease
#undef ClipByChildren
#undef Complex
#undef Convex
#undef CopyFromParent
#undef CurrentTime
#undef DestroyAll
#undef DirectColor
#undef DisplayString
#undef EnterNotify
#undef GrayScale
#undef IncludeInferiors
#undef InputFocus
#undef InputOnly
#undef InputOutput
#undef KeyPress
#undef KeyRelease
#undef LSBFirst
#undef LeaveNotify
#undef LowerHighest
#undef MSBFirst
#undef Nonconvex
#undef None
#undef NotUseful
#undef Opposite
#undef ParentRelative
#undef PointerRoot
#undef PointerWindow
#undef PseudoColor
#undef RaiseLowest
#undef ReplayKeyboard
#undef ReplayPointer
#undef RetainPermanent
#undef RetainTemporary
#undef StaticColor
#undef StaticGray
#undef Success
#undef SyncBoth
#undef SyncKeyboard
#undef SyncPointer
#undef TopIf
#undef TrueColor
#undef Unsorted
#undef WhenMapped
#undef XYBitmap
#undef XYPixmap
#undef YSorted
#undef YXBanded
#undef YXSorted
#undef ZPixmap

#include "gpu/vulkan/vulkan_surface.h"
#include "ui/gfx/x/connection.h"
#include "ui/gfx/x/event.h"

namespace x11 {
class ScopedEventSelector;
}

namespace ui {

class VulkanSurfaceX11 : public gpu::VulkanSurface, public x11::EventObserver {
 public:
  static std::unique_ptr<VulkanSurfaceX11> Create(VkInstance vk_instance,
                                                  x11::Window parent_window);
  VulkanSurfaceX11(VkInstance vk_instance,
                   VkSurfaceKHR vk_surface,
                   x11::Window parent_window,
                   x11::Window window);

  VulkanSurfaceX11(const VulkanSurfaceX11&) = delete;
  VulkanSurfaceX11& operator=(const VulkanSurfaceX11&) = delete;

  ~VulkanSurfaceX11() override;

  // gpu::VulkanSurface:
  void Destroy() override;
  bool Reshape(const gfx::Size& size,
               gfx::OverlayTransform pre_transform) override;

 private:
  // x11::EventObserver:
  void OnEvent(const x11::Event& xevent) override;

  const x11::Window parent_window_;
  x11::Window window_;
  x11::ScopedEventSelector event_selector_;
};

}  // namespace ui

#endif  // UI_OZONE_PLATFORM_X11_VULKAN_SURFACE_X11_H_