Project
Loading...
Searching...
No Matches
GPUDisplayFrontendGlfw.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef GPUDISPLAYFRONTENDGLFW_H
16#define GPUDISPLAYFRONTENDGLFW_H
17
18#include "GPUDisplayFrontend.h"
19
20struct GLFWwindow;
21
22namespace o2::gpu
23{
25{
26 public:
28 ~GPUDisplayFrontendGlfw() override = default;
29
30 void StopDisplayA() override;
31 void SwitchFullscreen(bool set) override;
32 void ToggleMaximized(bool set) override;
33 void SetVSync(bool enable) override;
34 void OpenGLPrint(const char* s, float x, float y, float r, float g, float b, float a, bool fromBotton = true) override;
35 void getSize(int32_t& width, int32_t& height) override;
36 float getDisplayScale() const override { return mScale; }
37 float getRefreshRate() override;
38 bool canSetVSync() override;
39 int32_t getVulkanSurface(void* instance, void* surface) override;
40 uint32_t getReqVulkanExtensions(const char**& p) override;
41
42 private:
43 int32_t FrontendMain() override;
44 static void DisplayLoop();
45
46 static void error_callback(int32_t error, const char* description);
47 static void key_callback(GLFWwindow* mWindow, int32_t key, int32_t scancode, int32_t action, int32_t mods);
48 static void char_callback(GLFWwindow* window, uint32_t codepoint);
49 static void mouseButton_callback(GLFWwindow* mWindow, int32_t button, int32_t action, int32_t mods);
50 static void scroll_callback(GLFWwindow* mWindow, double x, double y);
51 static void cursorPos_callback(GLFWwindow* mWindow, double x, double y);
52 static void resize_callback(GLFWwindow* mWindow, int32_t width, int32_t height);
53 static void maximize_callback(GLFWwindow* mWindow, int32_t maximized);
54 static void focus_callback(GLFWwindow* mWindow, int32_t focused);
55 static void contentScale_callback(GLFWwindow* mWindow, float xscale, float yscale);
56 static int32_t GetKey(int32_t key);
57 static void GetKey(int32_t keyin, int32_t scancode, int32_t mods, int32_t& keyOut, int32_t& keyPressOut);
58
59 GLFWwindow* mWindow;
60 float mScale = 1.f; // Content scale for text / UI
61 int32_t mWindowedWidth = 0; // Window size before maximizing (Wayland)
62 int32_t mWindowedHeight = 0;
63 bool mRestoreWindowedSize = false;
64 double mPixelRatio = 1.; // Framebuffer pixels per window coordinate (1 on X11 / Win32, scale on Wayland / macOS)
65
66 int32_t mWindowX = 0;
67 int32_t mWindowY = 0;
68 int32_t mWindowWidth = INIT_WIDTH;
69 int32_t mWindowHeight = INIT_HEIGHT;
70 uint8_t mKeyDownMap[256] = {0};
71 uint8_t mLastKeyDown = 0;
72};
73} // namespace o2::gpu
74
75#endif
header::DataDescription description
char error[CURL_ERROR_SIZE]
const Acts::Surface * surface
StringRef key
void getSize(int32_t &width, int32_t &height) override
void OpenGLPrint(const char *s, float x, float y, float r, float g, float b, float a, bool fromBotton=true) override
uint32_t getReqVulkanExtensions(const char **&p) override
~GPUDisplayFrontendGlfw() override=default
int32_t getVulkanSurface(void *instance, void *surface) override
static constexpr int32_t INIT_WIDTH
static constexpr int32_t INIT_HEIGHT
GLint GLenum GLint x
Definition glcorearb.h:403
GLint GLsizei GLsizei height
Definition glcorearb.h:270
GLint GLsizei width
Definition glcorearb.h:270
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLint y
Definition glcorearb.h:270
GLboolean GLboolean g
Definition glcorearb.h:1233
GLboolean enable
Definition glcorearb.h:3991
GLboolean r
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233