1*8975f5c5SAndroid Build Coastguard Worker // 2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2022 The ANGLE Project Authors. All rights reserved. 3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file. 5*8975f5c5SAndroid Build Coastguard Worker // 6*8975f5c5SAndroid Build Coastguard Worker 7*8975f5c5SAndroid Build Coastguard Worker // WaylandWindow.h: Definition of the implementation of OSWindow for Wayland 8*8975f5c5SAndroid Build Coastguard Worker 9*8975f5c5SAndroid Build Coastguard Worker #ifndef UTIL_WAYLAND_WINDOW_H 10*8975f5c5SAndroid Build Coastguard Worker #define UTIL_WAYLAND_WINDOW_H 11*8975f5c5SAndroid Build Coastguard Worker 12*8975f5c5SAndroid Build Coastguard Worker #include <poll.h> 13*8975f5c5SAndroid Build Coastguard Worker #include <wayland-client.h> 14*8975f5c5SAndroid Build Coastguard Worker #include <wayland-egl-core.h> 15*8975f5c5SAndroid Build Coastguard Worker 16*8975f5c5SAndroid Build Coastguard Worker #include "util/OSWindow.h" 17*8975f5c5SAndroid Build Coastguard Worker #include "util/util_export.h" 18*8975f5c5SAndroid Build Coastguard Worker 19*8975f5c5SAndroid Build Coastguard Worker bool IsWaylandWindowAvailable(); 20*8975f5c5SAndroid Build Coastguard Worker 21*8975f5c5SAndroid Build Coastguard Worker class ANGLE_UTIL_EXPORT WaylandWindow : public OSWindow 22*8975f5c5SAndroid Build Coastguard Worker { 23*8975f5c5SAndroid Build Coastguard Worker public: 24*8975f5c5SAndroid Build Coastguard Worker WaylandWindow(); 25*8975f5c5SAndroid Build Coastguard Worker ~WaylandWindow() override; 26*8975f5c5SAndroid Build Coastguard Worker 27*8975f5c5SAndroid Build Coastguard Worker void disableErrorMessageDialog() override; 28*8975f5c5SAndroid Build Coastguard Worker void destroy() override; 29*8975f5c5SAndroid Build Coastguard Worker 30*8975f5c5SAndroid Build Coastguard Worker void resetNativeWindow() override; 31*8975f5c5SAndroid Build Coastguard Worker EGLNativeWindowType getNativeWindow() const override; 32*8975f5c5SAndroid Build Coastguard Worker 33*8975f5c5SAndroid Build Coastguard Worker void setNativeDisplay(EGLNativeDisplayType display) override; 34*8975f5c5SAndroid Build Coastguard Worker EGLNativeDisplayType getNativeDisplay() const override; 35*8975f5c5SAndroid Build Coastguard Worker 36*8975f5c5SAndroid Build Coastguard Worker void messageLoop() override; 37*8975f5c5SAndroid Build Coastguard Worker 38*8975f5c5SAndroid Build Coastguard Worker void setMousePosition(int x, int y) override; 39*8975f5c5SAndroid Build Coastguard Worker bool setOrientation(int width, int height) override; 40*8975f5c5SAndroid Build Coastguard Worker bool setPosition(int x, int y) override; 41*8975f5c5SAndroid Build Coastguard Worker bool resize(int width, int height) override; 42*8975f5c5SAndroid Build Coastguard Worker void setVisible(bool isVisible) override; 43*8975f5c5SAndroid Build Coastguard Worker 44*8975f5c5SAndroid Build Coastguard Worker void signalTestEvent() override; 45*8975f5c5SAndroid Build Coastguard Worker 46*8975f5c5SAndroid Build Coastguard Worker private: 47*8975f5c5SAndroid Build Coastguard Worker static void RegistryHandleGlobal(void *data, 48*8975f5c5SAndroid Build Coastguard Worker struct wl_registry *registry, 49*8975f5c5SAndroid Build Coastguard Worker uint32_t name, 50*8975f5c5SAndroid Build Coastguard Worker const char *interface, 51*8975f5c5SAndroid Build Coastguard Worker uint32_t version); 52*8975f5c5SAndroid Build Coastguard Worker static void RegistryHandleGlobalRemove(void *data, struct wl_registry *registry, uint32_t name); 53*8975f5c5SAndroid Build Coastguard Worker 54*8975f5c5SAndroid Build Coastguard Worker bool initializeImpl(const std::string &name, int width, int height) override; 55*8975f5c5SAndroid Build Coastguard Worker 56*8975f5c5SAndroid Build Coastguard Worker static const struct wl_registry_listener registryListener; 57*8975f5c5SAndroid Build Coastguard Worker 58*8975f5c5SAndroid Build Coastguard Worker struct wl_display *mDisplay; 59*8975f5c5SAndroid Build Coastguard Worker struct wl_compositor *mCompositor; 60*8975f5c5SAndroid Build Coastguard Worker struct wl_surface *mSurface; 61*8975f5c5SAndroid Build Coastguard Worker struct wl_egl_window *mWindow; 62*8975f5c5SAndroid Build Coastguard Worker 63*8975f5c5SAndroid Build Coastguard Worker struct pollfd fds[1]; 64*8975f5c5SAndroid Build Coastguard Worker }; 65*8975f5c5SAndroid Build Coastguard Worker 66*8975f5c5SAndroid Build Coastguard Worker #endif // UTIL_WAYLAND_WINDOW_H 67