2020-01-26 22:59:51 +00:00
|
|
|
#include <stdint.h>
|
2020-06-11 10:42:27 +00:00
|
|
|
|
2020-05-15 13:59:01 +00:00
|
|
|
extern "C" {
|
|
|
|
#include <wlr/types/wlr_buffer.h>
|
|
|
|
#include <wlr/render/wlr_texture.h>
|
|
|
|
}
|
|
|
|
|
2020-01-23 05:50:01 +00:00
|
|
|
extern uint32_t currentOutputWidth;
|
|
|
|
extern uint32_t currentOutputHeight;
|
|
|
|
|
2020-01-17 09:57:39 +00:00
|
|
|
unsigned int get_time_in_milliseconds(void);
|
2020-09-05 15:49:24 +00:00
|
|
|
uint64_t get_time_in_nanos();
|
2020-09-05 16:52:24 +00:00
|
|
|
void sleep_for_nanos(uint64_t nanos);
|
|
|
|
void sleep_until_nanos(uint64_t nanos);
|
2019-10-24 01:31:18 +00:00
|
|
|
|
2020-09-13 07:31:52 +00:00
|
|
|
void steamcompmgr_main(int argc, char **argv);
|
2019-10-24 01:31:18 +00:00
|
|
|
|
2020-02-24 21:19:39 +00:00
|
|
|
#include "rendervulkan.hpp"
|
2022-12-18 10:22:01 +00:00
|
|
|
#include "wlserver.hpp"
|
2020-02-24 21:19:39 +00:00
|
|
|
|
2020-01-26 22:59:51 +00:00
|
|
|
#include <mutex>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <wlr/render/dmabuf.h>
|
|
|
|
|
2020-02-24 21:19:39 +00:00
|
|
|
#include <X11/extensions/Xfixes.h>
|
|
|
|
|
|
|
|
struct _XDisplay;
|
2021-11-10 17:30:47 +00:00
|
|
|
struct win;
|
2022-01-06 04:41:54 +00:00
|
|
|
struct xwayland_ctx_t;
|
2022-01-07 03:53:03 +00:00
|
|
|
class gamescope_xwayland_server_t;
|
2020-02-24 21:19:39 +00:00
|
|
|
|
2022-02-23 04:01:58 +00:00
|
|
|
static const uint32_t g_zposBase = 0;
|
|
|
|
static const uint32_t g_zposOverride = 1;
|
|
|
|
static const uint32_t g_zposExternalOverlay = 2;
|
|
|
|
static const uint32_t g_zposOverlay = 3;
|
|
|
|
static const uint32_t g_zposCursor = 4;
|
|
|
|
|
2022-12-18 15:00:44 +00:00
|
|
|
extern bool g_bHDRForceWideGammutForSDR;
|
2023-01-17 05:37:09 +00:00
|
|
|
extern bool g_bHDRItmEnable;
|
2022-12-18 15:00:44 +00:00
|
|
|
|
2022-06-15 19:50:08 +00:00
|
|
|
extern EStreamColorspace g_ForcedNV12ColorSpace;
|
|
|
|
|
2020-02-24 21:19:39 +00:00
|
|
|
class MouseCursor
|
|
|
|
{
|
|
|
|
public:
|
2022-01-06 04:41:54 +00:00
|
|
|
explicit MouseCursor(xwayland_ctx_t *ctx);
|
2020-02-24 21:19:39 +00:00
|
|
|
|
|
|
|
int x() const;
|
|
|
|
int y() const;
|
|
|
|
|
|
|
|
void move(int x, int y);
|
|
|
|
void updatePosition();
|
|
|
|
void constrainPosition();
|
|
|
|
void resetPosition();
|
|
|
|
|
2022-05-04 20:58:20 +00:00
|
|
|
void paint(struct win *window, struct win *fit, struct FrameInfo_t *frameInfo);
|
2020-02-24 21:19:39 +00:00
|
|
|
void setDirty();
|
|
|
|
|
2021-09-01 14:03:41 +00:00
|
|
|
// Will take ownership of data.
|
2021-11-26 20:36:12 +00:00
|
|
|
bool setCursorImage(char *data, int w, int h, int hx, int hy);
|
2023-01-12 00:11:04 +00:00
|
|
|
bool setCursorImageByName(const char *name);
|
2021-09-01 14:03:41 +00:00
|
|
|
|
2021-09-13 06:19:08 +00:00
|
|
|
void hide() { m_lastMovedTime = 0; checkSuspension(); }
|
|
|
|
|
2022-09-23 20:44:51 +00:00
|
|
|
bool isHidden() { return m_hideForMovement || m_imageEmpty; }
|
2022-01-18 23:25:13 +00:00
|
|
|
|
|
|
|
void forcePosition(int x, int y)
|
|
|
|
{
|
|
|
|
warp(x, y);
|
|
|
|
m_x = x;
|
|
|
|
m_y = y;
|
|
|
|
}
|
|
|
|
|
2023-01-12 01:29:25 +00:00
|
|
|
void undirty() { getTexture(); }
|
|
|
|
|
2020-02-24 21:19:39 +00:00
|
|
|
private:
|
|
|
|
void warp(int x, int y);
|
|
|
|
void checkSuspension();
|
|
|
|
|
2020-04-01 20:41:50 +00:00
|
|
|
void queryGlobalPosition(int &x, int &y);
|
|
|
|
void queryPositions(int &rootX, int &rootY, int &winX, int &winY);
|
2020-02-24 21:19:39 +00:00
|
|
|
void queryButtonMask(unsigned int &mask);
|
|
|
|
|
|
|
|
bool getTexture();
|
|
|
|
|
2022-09-23 20:44:51 +00:00
|
|
|
void updateCursorFeedback( bool bForce = false );
|
|
|
|
|
2020-08-28 07:29:52 +00:00
|
|
|
int m_x = 0, m_y = 0;
|
|
|
|
int m_hotspotX = 0, m_hotspotY = 0;
|
2020-02-24 21:19:39 +00:00
|
|
|
|
2021-12-17 07:14:13 +00:00
|
|
|
std::shared_ptr<CVulkanTexture> m_texture;
|
2020-02-24 21:19:39 +00:00
|
|
|
bool m_dirty;
|
|
|
|
bool m_imageEmpty;
|
|
|
|
|
2020-08-28 07:29:52 +00:00
|
|
|
unsigned int m_lastMovedTime = 0;
|
2020-02-24 21:19:39 +00:00
|
|
|
bool m_hideForMovement;
|
|
|
|
|
2020-08-28 07:29:52 +00:00
|
|
|
PointerBarrier m_scaledFocusBarriers[4] = { None };
|
2020-02-24 21:19:39 +00:00
|
|
|
|
2022-01-06 04:41:54 +00:00
|
|
|
xwayland_ctx_t *m_ctx;
|
2022-01-18 23:25:13 +00:00
|
|
|
|
|
|
|
int m_lastX = 0;
|
|
|
|
int m_lastY = 0;
|
2022-09-23 20:44:51 +00:00
|
|
|
|
|
|
|
bool m_bCursorVisibleFeedback = false;
|
2020-02-24 21:19:39 +00:00
|
|
|
};
|
|
|
|
|
2020-07-03 01:45:00 +00:00
|
|
|
extern std::vector< wlr_surface * > wayland_surfaces_deleted;
|
|
|
|
|
2020-09-13 07:19:02 +00:00
|
|
|
extern bool hasFocusWindow;
|
|
|
|
|
2021-05-28 20:57:11 +00:00
|
|
|
// These are used for touch scaling, so it's really the window that's focused for touch
|
2020-07-03 00:40:31 +00:00
|
|
|
extern float focusedWindowScaleX;
|
|
|
|
extern float focusedWindowScaleY;
|
|
|
|
extern float focusedWindowOffsetX;
|
|
|
|
extern float focusedWindowOffsetY;
|
2021-06-10 12:48:09 +00:00
|
|
|
|
2022-02-12 08:50:52 +00:00
|
|
|
extern bool g_bFSRActive;
|
|
|
|
|
2021-10-18 03:17:30 +00:00
|
|
|
extern uint32_t inputCounter;
|
|
|
|
|
2021-06-10 12:48:09 +00:00
|
|
|
void nudge_steamcompmgr( void );
|
2021-07-28 08:12:04 +00:00
|
|
|
void take_screenshot( void );
|
2022-10-01 16:42:44 +00:00
|
|
|
void force_repaint( void );
|
2021-12-13 14:51:07 +00:00
|
|
|
|
2022-02-14 10:19:10 +00:00
|
|
|
extern void mangoapp_update( uint64_t visible_frametime, uint64_t app_frametime_ns, uint64_t latency_ns );
|
2022-01-07 03:53:03 +00:00
|
|
|
gamescope_xwayland_server_t *steamcompmgr_get_focused_server();
|
2022-01-31 20:37:25 +00:00
|
|
|
struct wlr_surface *steamcompmgr_get_server_input_surface( size_t idx );
|
2022-12-18 10:22:01 +00:00
|
|
|
wlserver_vk_swapchain_feedback* steamcompmgr_get_base_layer_swapchain_feedback();
|
2022-01-25 13:04:32 +00:00
|
|
|
|
2022-12-05 15:59:45 +00:00
|
|
|
struct wlserver_x11_surface_info *lookup_x11_surface_info_from_xid( gamescope_xwayland_server_t *xwayland_server, uint32_t xid );
|
|
|
|
|
2022-01-25 13:04:32 +00:00
|
|
|
extern uint64_t g_SteamCompMgrVBlankTime;
|
2022-08-24 19:57:19 +00:00
|
|
|
extern pid_t focusWindow_pid;
|
|
|
|
|
2022-09-07 11:05:35 +00:00
|
|
|
extern int g_nAsyncFlipsEnabled;
|