Hyprland/src/helpers/WLClasses.hpp

272 lines
5.7 KiB
C++
Raw Normal View History

2022-03-17 18:25:16 +01:00
#pragma once
#include "../events/Events.hpp"
#include "../defines.hpp"
#include "wlr-layer-shell-unstable-v1-protocol.h"
2022-03-20 14:00:46 +01:00
#include "../Window.hpp"
2022-03-27 17:25:20 +02:00
#include "SubsurfaceTree.hpp"
#include "AnimatedVariable.hpp"
2022-03-17 18:25:16 +01:00
struct SLayerSurface {
SLayerSurface();
2022-03-17 18:25:16 +01:00
wlr_layer_surface_v1* layerSurface;
wl_list link;
DYNLISTENER(destroyLayerSurface);
DYNLISTENER(mapLayerSurface);
DYNLISTENER(unmapLayerSurface);
DYNLISTENER(commitLayerSurface);
2022-03-20 12:11:57 +01:00
DYNLISTENER(newPopup);
2022-03-17 18:25:16 +01:00
wlr_box geometry;
2022-03-27 17:25:20 +02:00
Vector2D position;
2022-03-17 18:25:16 +01:00
zwlr_layer_shell_v1_layer layer;
2022-03-18 22:35:51 +01:00
int monitorID = -1;
2022-07-06 21:57:35 +02:00
std::string szNamespace = "";
CAnimatedVariable alpha;
bool fadingOut = false;
bool readyToDelete = false;
2022-07-18 21:16:01 +02:00
bool noProcess = false;
2022-03-18 22:35:51 +01:00
2022-07-06 22:12:03 +02:00
bool forceBlur = false;
2022-03-18 22:35:51 +01:00
// For the list lookup
bool operator==(const SLayerSurface& rhs) {
return layerSurface == rhs.layerSurface && monitorID == rhs.monitorID;
}
2022-03-17 20:22:29 +01:00
};
struct SRenderData {
wlr_output* output;
timespec* when;
2022-03-21 16:13:43 +01:00
int x, y;
// for iters
void* data = nullptr;
wlr_surface* surface = nullptr;
int w, h;
2022-04-02 13:41:15 +02:00
void* pMonitor = nullptr;
// for rounding
bool dontRound = true;
2022-04-05 19:28:10 +02:00
// for fade
float fadeAlpha = 255.f;
2022-04-18 18:23:10 +02:00
// for alpha settings
2022-04-18 18:33:50 +02:00
float alpha = 1.f;
2022-05-17 13:16:37 +02:00
// for decorations (border)
bool decorate = false;
2022-05-28 17:48:01 +02:00
// for custom round values
int rounding = -1; // -1 means not set
2022-07-06 22:12:03 +02:00
// for blurring
bool blur = false;
// only for windows, not popups
bool squishOversized = true;
2022-03-17 20:22:29 +01:00
};
2022-03-17 20:55:04 +01:00
struct SExtensionFindingData {
Vector2D origin;
Vector2D vec;
wlr_surface** found;
};
struct SStringRuleNames {
std::string layout = "";
std::string model = "";
std::string variant = "";
std::string options = "";
std::string rules = "";
};
2022-03-17 20:55:04 +01:00
struct SKeyboard {
wlr_input_device* keyboard;
DYNLISTENER(keyboardMod);
DYNLISTENER(keyboardKey);
DYNLISTENER(keyboardDestroy);
2022-03-18 23:25:26 +01:00
bool active = false;
2022-06-30 21:26:00 +02:00
std::string name = "";
SStringRuleNames currentRules;
2022-06-30 21:26:00 +02:00
int repeatRate = 0;
int repeatDelay = 0;
int numlockOn = -1;
2022-06-25 11:50:09 +02:00
2022-03-18 23:25:26 +01:00
// For the list lookup
bool operator==(const SKeyboard& rhs) {
return keyboard == rhs.keyboard;
}
2022-03-20 12:11:57 +01:00
};
struct SMouse {
wlr_input_device* mouse = nullptr;
wlr_pointer_constraint_v1* currentConstraint = nullptr;
bool constraintActive = false;
pixman_region32_t confinedTo;
2022-06-30 21:26:00 +02:00
std::string name = "";
2022-07-11 20:23:16 +02:00
bool virt = false;
DYNLISTENER(commitConstraint);
2022-05-12 12:13:02 +02:00
DYNLISTENER(destroyMouse);
bool operator==(const SMouse& b) {
return mouse == b.mouse;
}
};
struct SConstraint {
SMouse* pMouse = nullptr;
wlr_pointer_constraint_v1* constraint = nullptr;
DYNLISTENER(setConstraintRegion);
DYNLISTENER(destroyConstraint);
bool operator==(const SConstraint& b) {
return constraint == b.constraint;
}
};
2022-04-02 13:41:15 +02:00
struct SMonitor;
2022-03-20 14:00:46 +01:00
struct SXDGPopup {
CWindow* parentWindow = nullptr;
2022-03-27 17:25:20 +02:00
SXDGPopup* parentPopup = nullptr;
2022-03-20 14:00:46 +01:00
wlr_xdg_popup* popup = nullptr;
2022-04-02 13:41:15 +02:00
SMonitor* monitor = nullptr;
2022-03-20 14:00:46 +01:00
DYNLISTENER(newPopupFromPopupXDG);
DYNLISTENER(destroyPopupXDG);
DYNLISTENER(mapPopupXDG);
DYNLISTENER(unmapPopupXDG);
2022-04-02 13:41:15 +02:00
double lx;
double ly;
2022-03-27 17:25:20 +02:00
SSurfaceTreeNode* pSurfaceTree = nullptr;
2022-03-20 14:00:46 +01:00
// For the list lookup
bool operator==(const SXDGPopup& rhs) {
return popup == rhs.popup;
}
2022-03-22 18:29:13 +01:00
};
struct SSeat {
wlr_seat* seat = nullptr;
wl_client* exclusiveClient = nullptr;
SMouse* mouse = nullptr;
2022-03-31 17:25:23 +02:00
};
struct SDrag {
wlr_drag* drag = nullptr;
DYNLISTENER(destroy);
// Icon
bool iconMapped = false;
wlr_drag_icon* dragIcon = nullptr;
Vector2D pos;
DYNLISTENER(destroyIcon);
DYNLISTENER(mapIcon);
DYNLISTENER(unmapIcon);
DYNLISTENER(commitIcon);
2022-06-09 12:46:55 +02:00
};
struct STablet {
DYNLISTENER(Tip);
DYNLISTENER(Axis);
DYNLISTENER(Button);
DYNLISTENER(Proximity);
DYNLISTENER(Destroy);
wlr_tablet* wlrTablet = nullptr;
wlr_tablet_v2_tablet* wlrTabletV2 = nullptr;
wlr_input_device* wlrDevice = nullptr;
2022-06-30 21:26:00 +02:00
std::string name = "";
2022-06-09 12:46:55 +02:00
bool operator==(const STablet& b) {
return wlrDevice == b.wlrDevice;
}
};
struct STabletTool {
wlr_tablet_tool* wlrTabletTool = nullptr;
wlr_tablet_v2_tablet_tool* wlrTabletToolV2 = nullptr;
wlr_tablet_v2_tablet* wlrTabletOwnerV2 = nullptr;
2022-06-09 19:47:05 +02:00
wlr_surface* pSurface = nullptr;
2022-06-09 12:46:55 +02:00
double tiltX = 0;
double tiltY = 0;
bool active = true;
2022-06-30 21:26:00 +02:00
std::string name = "";
2022-06-09 12:46:55 +02:00
DYNLISTENER(TabletToolDestroy);
DYNLISTENER(TabletToolSetCursor);
bool operator==(const STabletTool& b) {
return wlrTabletTool == b.wlrTabletTool;
}
};
struct STabletPad {
wlr_tablet_v2_tablet_pad* wlrTabletPadV2 = nullptr;
STablet* pTabletParent = nullptr;
2022-06-30 21:26:00 +02:00
std::string name = "";
2022-06-09 12:46:55 +02:00
DYNLISTENER(Attach);
DYNLISTENER(Button);
DYNLISTENER(Strip);
DYNLISTENER(Ring);
DYNLISTENER(Destroy);
bool operator==(const STabletPad& b) {
return wlrTabletPadV2 == b.wlrTabletPadV2;
}
};
struct SIdleInhibitor {
wlr_idle_inhibitor_v1* pWlrInhibitor = nullptr;
CWindow* pWindow = nullptr;
DYNLISTENER(Destroy);
bool operator==(const SIdleInhibitor& b) {
return pWlrInhibitor == b.pWlrInhibitor;
}
};
2022-07-07 11:52:12 +02:00
struct SSwipeGesture {
CWorkspace* pWorkspaceBegin = nullptr;
double delta = 0;
float avgSpeed = 0;
int speedPoints = 0;
SMonitor* pMonitor = nullptr;
};