2022-03-17 16:56:33 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
2022-03-17 18:25:16 +01:00
|
|
|
#include <deque>
|
|
|
|
#include "WLClasses.hpp"
|
2022-07-23 15:48:08 +02:00
|
|
|
#include <vector>
|
2022-03-19 13:54:24 +01:00
|
|
|
#include <array>
|
2022-07-23 15:48:08 +02:00
|
|
|
#include <memory>
|
2022-03-17 16:56:33 +01:00
|
|
|
|
2022-09-13 15:25:42 +02:00
|
|
|
struct SMonitorRule;
|
|
|
|
|
2022-07-27 12:32:00 +02:00
|
|
|
class CMonitor {
|
|
|
|
public:
|
2022-05-29 12:27:45 +02:00
|
|
|
Vector2D vecPosition = Vector2D(0,0);
|
|
|
|
Vector2D vecSize = Vector2D(0,0);
|
|
|
|
Vector2D vecPixelSize = Vector2D(0,0);
|
|
|
|
Vector2D vecTransformedSize = Vector2D(0,0);
|
2022-03-17 16:56:33 +01:00
|
|
|
|
|
|
|
bool primary = false;
|
|
|
|
|
2022-03-20 11:14:24 +01:00
|
|
|
uint64_t ID = -1;
|
2022-03-20 15:55:47 +01:00
|
|
|
int activeWorkspace = -1;
|
2022-04-17 18:47:10 +02:00
|
|
|
float scale = 1;
|
2022-03-17 16:56:33 +01:00
|
|
|
|
|
|
|
std::string szName = "";
|
|
|
|
|
|
|
|
Vector2D vecReservedTopLeft = Vector2D(0,0);
|
|
|
|
Vector2D vecReservedBottomRight = Vector2D(0,0);
|
2022-03-17 18:25:16 +01:00
|
|
|
|
|
|
|
// WLR stuff
|
|
|
|
wlr_output* output = nullptr;
|
2022-03-19 21:46:29 +01:00
|
|
|
float refreshRate = 60;
|
2022-03-21 16:13:43 +01:00
|
|
|
wlr_output_damage* damage = nullptr;
|
2022-06-06 13:48:17 +02:00
|
|
|
int framesToSkip = 0;
|
2022-06-21 22:13:13 +02:00
|
|
|
int forceFullFrames = 0;
|
2022-06-06 13:48:17 +02:00
|
|
|
bool noFrameSchedule = false;
|
2022-07-26 18:22:34 +02:00
|
|
|
bool scheduledRecalc = false;
|
2022-05-29 12:27:45 +02:00
|
|
|
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
2022-05-31 14:01:00 +02:00
|
|
|
|
2022-09-13 15:25:42 +02:00
|
|
|
// mirroring
|
|
|
|
CMonitor* pMirrorOf = nullptr;
|
|
|
|
std::vector<CMonitor*> mirrors;
|
|
|
|
|
2022-05-31 14:01:00 +02:00
|
|
|
// for the special workspace
|
|
|
|
bool specialWorkspaceOpen = false;
|
2022-03-17 18:25:16 +01:00
|
|
|
|
2022-03-18 22:35:51 +01:00
|
|
|
// Double-linked list because we need to have constant mem addresses for signals
|
2022-03-19 14:00:24 +01:00
|
|
|
// We have to store pointers and use raw new/delete because they might be moved between them
|
|
|
|
// and I am lazy
|
2022-07-23 15:48:08 +02:00
|
|
|
std::array<std::vector<std::unique_ptr<SLayerSurface>>, 4> m_aLayerSurfaceLists;
|
2022-03-17 18:25:16 +01:00
|
|
|
|
|
|
|
DYNLISTENER(monitorFrame);
|
|
|
|
DYNLISTENER(monitorDestroy);
|
2022-04-21 18:11:28 +02:00
|
|
|
DYNLISTENER(monitorMode);
|
2022-03-18 22:35:51 +01:00
|
|
|
|
2022-04-11 19:51:37 +02:00
|
|
|
// hack: a group = workspaces on a monitor.
|
|
|
|
// I don't really care lol :P
|
|
|
|
wlr_ext_workspace_group_handle_v1* pWLRWorkspaceGroupHandle = nullptr;
|
|
|
|
|
2022-03-18 22:35:51 +01:00
|
|
|
|
2022-07-27 12:32:00 +02:00
|
|
|
// methods
|
|
|
|
void onConnect(bool noRule);
|
|
|
|
void onDisconnect();
|
2022-08-23 16:07:47 +02:00
|
|
|
void addDamage(pixman_region32_t* rg);
|
|
|
|
void addDamage(wlr_box* box);
|
2022-09-13 15:25:42 +02:00
|
|
|
void setMirror(const std::string&);
|
|
|
|
bool isMirror();
|
2022-07-27 12:32:00 +02:00
|
|
|
|
|
|
|
std::shared_ptr<CMonitor>* m_pThisWrap = nullptr;
|
|
|
|
bool m_bEnabled = false;
|
2022-08-10 13:44:04 +02:00
|
|
|
bool m_bRenderingInitPassed = false;
|
2022-07-27 12:32:00 +02:00
|
|
|
|
2022-03-18 22:35:51 +01:00
|
|
|
// For the list lookup
|
|
|
|
|
2022-07-27 12:32:00 +02:00
|
|
|
bool operator==(const CMonitor& rhs) {
|
2022-03-18 22:35:51 +01:00
|
|
|
return vecPosition == rhs.vecPosition && vecSize == rhs.vecSize && szName == rhs.szName;
|
|
|
|
}
|
2022-09-13 15:25:42 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void setupDefaultWS(const SMonitorRule&);
|
2022-03-17 16:56:33 +01:00
|
|
|
};
|