Hyprland/src/helpers/WLClasses.hpp

250 lines
5.5 KiB
C++
Raw Normal View History

2022-03-17 18:25:16 +01:00
#pragma once
#include "../events/Events.hpp"
#include "../defines.hpp"
2024-03-20 02:44:51 +01:00
#include "../desktop/Window.hpp"
#include "../desktop/Subsurface.hpp"
#include "../desktop/Popup.hpp"
#include "AnimatedVariable.hpp"
#include "../desktop/WLSurface.hpp"
2023-07-19 20:09:49 +02:00
#include "Region.hpp"
2022-03-17 18:25:16 +01:00
class CMonitor;
2024-05-03 01:31:48 +02:00
class CVirtualKeyboard;
2022-03-17 20:22:29 +01:00
struct SRenderData {
2023-01-25 16:34:13 +01:00
CMonitor* pMonitor;
timespec* when;
double x, y;
2022-03-21 16:13:43 +01:00
// for iters
void* data = nullptr;
2022-03-21 16:13:43 +01:00
wlr_surface* surface = nullptr;
double w, h;
// for rounding
bool dontRound = true;
2022-04-05 19:28:10 +02:00
// for fade
float fadeAlpha = 1.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;
bool blockBlurOptimization = false;
// only for windows, not popups
bool squishOversized = true;
// for calculating UV
PHLWINDOW pWindow;
bool popup = false;
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);
2022-08-18 17:17:33 +02:00
DYNLISTENER(keyboardKeymap);
2022-03-17 20:55:04 +01:00
DYNLISTENER(keyboardDestroy);
2022-03-18 23:25:26 +01:00
2024-05-03 01:31:48 +02:00
bool isVirtual = false;
bool active = false;
bool enabled = true;
2024-05-03 01:31:48 +02:00
WP<CVirtualKeyboard> virtKeyboard;
2022-08-18 17:17:33 +02:00
2024-05-03 01:31:48 +02:00
xkb_layout_index_t activeLayout = 0;
xkb_state* xkbTranslationState = nullptr;
2022-06-30 21:26:00 +02:00
2024-05-03 01:31:48 +02:00
std::string name = "";
std::string xkbFilePath = "";
2022-06-25 11:50:09 +02:00
2024-05-03 01:31:48 +02:00
SStringRuleNames currentRules;
int repeatRate = 0;
int repeatDelay = 0;
int numlockOn = -1;
bool resolveBindsBySym = false;
void updateXKBTranslationState(xkb_keymap* const keymap = nullptr);
2022-03-18 23:25:26 +01:00
// For the list lookup
2023-01-31 01:03:23 +01:00
bool operator==(const SKeyboard& rhs) const {
2022-03-18 23:25:26 +01:00
return keyboard == rhs.keyboard;
}
2022-03-20 12:11:57 +01:00
};
struct SMouse {
wlr_input_device* mouse = nullptr;
std::string name = "";
bool virt = false;
bool connected = false; // means connected to the cursor
2022-06-30 21:26:00 +02:00
2022-05-12 12:13:02 +02:00
DYNLISTENER(destroyMouse);
2023-01-31 01:03:23 +01:00
bool operator==(const SMouse& b) const {
return mouse == b.mouse;
}
};
2022-07-27 12:36:56 +02:00
class CMonitor;
2022-04-02 13:41:15 +02:00
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;
2022-03-31 17:25:23 +02:00
DYNLISTENER(destroy);
// Icon
bool iconMapped = false;
2022-03-31 17:25:23 +02:00
wlr_drag_icon* dragIcon = nullptr;
2022-09-25 20:07:48 +02:00
Vector2D pos;
2022-03-31 17:25:23 +02:00
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;
2022-06-09 12:46:55 +02:00
wlr_tablet_v2_tablet* wlrTabletV2 = nullptr;
wlr_input_device* wlrDevice = nullptr;
2022-06-09 12:46:55 +02:00
bool relativeInput = false;
std::string name = "";
2022-06-30 21:26:00 +02:00
std::string boundOutput = "";
CBox activeArea;
//
bool operator==(const STablet& b) const {
return wlrDevice == b.wlrDevice;
2022-06-09 12:46:55 +02:00
}
};
struct STabletTool {
wlr_tablet_tool* wlrTabletTool = nullptr;
2022-06-09 12:46:55 +02:00
wlr_tablet_v2_tablet_tool* wlrTabletToolV2 = nullptr;
wlr_tablet_v2_tablet* wlrTabletOwnerV2 = nullptr;
2022-06-09 12:46:55 +02:00
wlr_surface* pSurface = nullptr;
2022-06-09 19:47:05 +02:00
double tiltX = 0;
double tiltY = 0;
2022-06-09 12:46:55 +02:00
bool active = true;
2022-06-09 12:46:55 +02:00
std::string name = "";
2022-06-30 21:26:00 +02:00
2022-06-09 12:46:55 +02:00
DYNLISTENER(TabletToolDestroy);
DYNLISTENER(TabletToolSetCursor);
2023-01-31 01:03:23 +01:00
bool operator==(const STabletTool& b) const {
2022-06-09 12:46:55 +02:00
return wlrTabletTool == b.wlrTabletTool;
}
};
struct STabletPad {
wlr_tablet_v2_tablet_pad* wlrTabletPadV2 = nullptr;
STablet* pTabletParent = nullptr;
2022-12-21 16:11:39 +01:00
wlr_input_device* pWlrDevice = nullptr;
2022-06-09 12:46:55 +02:00
std::string name = "";
2022-06-30 21:26:00 +02:00
2022-06-09 12:46:55 +02:00
DYNLISTENER(Attach);
DYNLISTENER(Button);
DYNLISTENER(Strip);
DYNLISTENER(Ring);
DYNLISTENER(Destroy);
2023-01-31 01:03:23 +01:00
bool operator==(const STabletPad& b) const {
2022-06-09 12:46:55 +02:00
return wlrTabletPadV2 == b.wlrTabletPadV2;
}
};
2022-07-07 11:52:12 +02:00
struct SSwipeGesture {
PHLWORKSPACE pWorkspaceBegin = nullptr;
2022-07-07 11:52:12 +02:00
double delta = 0;
2022-07-07 11:52:12 +02:00
int initialDirection = 0;
float avgSpeed = 0;
int speedPoints = 0;
int touch_id = 0;
2022-07-07 11:52:12 +02:00
CMonitor* pMonitor = nullptr;
2022-08-05 13:03:37 +02:00
};
struct STouchDevice {
wlr_input_device* pWlrDevice = nullptr;
std::string name = "";
std::string boundOutput = "";
2022-10-14 13:38:44 +02:00
DYNLISTENER(destroy);
2023-01-31 01:03:23 +01:00
bool operator==(const STouchDevice& other) const {
return pWlrDevice == other.pWlrDevice;
}
};
2022-10-04 21:07:21 +02:00
struct SSwitchDevice {
wlr_input_device* pWlrDevice = nullptr;
int status = -1; // uninitialized
2022-10-04 21:07:21 +02:00
DYNLISTENER(destroy);
DYNLISTENER(toggle);
2023-01-31 01:03:23 +01:00
bool operator==(const SSwitchDevice& other) const {
2022-10-04 21:07:21 +02:00
return pWlrDevice == other.pWlrDevice;
}
};