mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-10-29 21:41:37 +00:00
touch up the clang format and format all files
This commit is contained in:
parent
3e2785b970
commit
4fd90144d1
@ -60,6 +60,6 @@ AllowShortEnumsOnASingleLine: false
|
||||
BraceWrapping:
|
||||
AfterEnum: false
|
||||
|
||||
AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments
|
||||
AlignConsecutiveDeclarations: AcrossEmptyLines
|
||||
|
||||
NamespaceIndentation: All
|
||||
|
@ -44,7 +44,7 @@ flags:
|
||||
--batch -> execute a batch of commands, separated by ';'
|
||||
)#";
|
||||
|
||||
void request(std::string arg, int minArgs = 0) {
|
||||
void request(std::string arg, int minArgs = 0) {
|
||||
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
const auto ARGS = std::count(arg.begin(), arg.end(), ' ');
|
||||
@ -59,7 +59,6 @@ void request(std::string arg, int minArgs = 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// get the instance signature
|
||||
auto instanceSig = getenv("HYPRLAND_INSTANCE_SIGNATURE");
|
||||
|
||||
@ -71,7 +70,7 @@ void request(std::string arg, int minArgs = 0) {
|
||||
std::string instanceSigStr = std::string(instanceSig);
|
||||
|
||||
sockaddr_un serverAddress = {0};
|
||||
serverAddress.sun_family = AF_UNIX;
|
||||
serverAddress.sun_family = AF_UNIX;
|
||||
|
||||
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.socket.sock";
|
||||
|
||||
@ -89,8 +88,8 @@ void request(std::string arg, int minArgs = 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string reply = "";
|
||||
char buffer[8192] = {0};
|
||||
std::string reply = "";
|
||||
char buffer[8192] = {0};
|
||||
|
||||
sizeWritten = read(SERVERSOCKET, buffer, 8192);
|
||||
|
||||
@ -134,7 +133,7 @@ void requestHyprpaper(std::string arg) {
|
||||
std::string instanceSigStr = std::string(instanceSig);
|
||||
|
||||
sockaddr_un serverAddress = {0};
|
||||
serverAddress.sun_family = AF_UNIX;
|
||||
serverAddress.sun_family = AF_UNIX;
|
||||
|
||||
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.hyprpaper.sock";
|
||||
|
||||
@ -176,7 +175,7 @@ int dispatchRequest(int argc, char** argv) {
|
||||
|
||||
std::string rq = "/dispatch";
|
||||
|
||||
for(int i = 2; i < argc; i++) {
|
||||
for (int i = 2; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "--"))
|
||||
continue;
|
||||
rq += " " + std::string(argv[i]);
|
||||
@ -195,7 +194,7 @@ int keywordRequest(int argc, char** argv) {
|
||||
|
||||
std::string rq = "/keyword";
|
||||
|
||||
for(int i = 2; i < argc; i++)
|
||||
for (int i = 2; i < argc; i++)
|
||||
rq += " " + std::string(argv[i]);
|
||||
|
||||
request(rq);
|
||||
@ -265,7 +264,7 @@ bool isNumber(const std::string& str, bool allowfloat) {
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int bflag = 0, sflag = 0, index, c;
|
||||
int bflag = 0, sflag = 0, index, c;
|
||||
bool parseArgs = true;
|
||||
|
||||
if (argc < 2) {
|
||||
@ -274,8 +273,8 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
std::string fullRequest = "";
|
||||
std::string fullArgs = "";
|
||||
const auto ARGS = splitArgs(argc, argv);
|
||||
std::string fullArgs = "";
|
||||
const auto ARGS = splitArgs(argc, argv);
|
||||
|
||||
for (auto i = 0; i < ARGS.size(); ++i) {
|
||||
if (ARGS[i] == "--") {
|
||||
@ -308,29 +307,49 @@ int main(int argc, char** argv) {
|
||||
fullRequest.pop_back(); // remove trailing space
|
||||
|
||||
fullRequest = fullArgs + "/" + fullRequest;
|
||||
|
||||
|
||||
int exitStatus = 0;
|
||||
|
||||
if (fullRequest.contains("/--batch")) batchRequest(fullRequest);
|
||||
else if (fullRequest.contains("/monitors")) request(fullRequest);
|
||||
else if (fullRequest.contains("/clients")) request(fullRequest);
|
||||
else if (fullRequest.contains("/workspaces")) request(fullRequest);
|
||||
else if (fullRequest.contains("/activewindow")) request(fullRequest);
|
||||
else if (fullRequest.contains("/layers")) request(fullRequest);
|
||||
else if (fullRequest.contains("/version")) request(fullRequest);
|
||||
else if (fullRequest.contains("/kill")) request(fullRequest);
|
||||
else if (fullRequest.contains("/splash")) request(fullRequest);
|
||||
else if (fullRequest.contains("/devices")) request(fullRequest);
|
||||
else if (fullRequest.contains("/reload")) request(fullRequest);
|
||||
else if (fullRequest.contains("/getoption")) request(fullRequest);
|
||||
else if (fullRequest.contains("/cursorpos")) request(fullRequest);
|
||||
else if (fullRequest.contains("/switchxkblayout")) request(fullRequest, 2);
|
||||
else if (fullRequest.contains("/output")) exitStatus = outputRequest(argc, argv);
|
||||
else if (fullRequest.contains("/setcursor")) exitStatus = setcursorRequest(argc, argv);
|
||||
else if (fullRequest.contains("/dispatch")) exitStatus = dispatchRequest(argc, argv);
|
||||
else if (fullRequest.contains("/keyword")) exitStatus = keywordRequest(argc, argv);
|
||||
else if (fullRequest.contains("/hyprpaper")) exitStatus = hyprpaperRequest(argc, argv);
|
||||
else if (fullRequest.contains("/--help")) printf("%s", USAGE.c_str());
|
||||
if (fullRequest.contains("/--batch"))
|
||||
batchRequest(fullRequest);
|
||||
else if (fullRequest.contains("/monitors"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/clients"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/workspaces"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/activewindow"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/layers"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/version"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/kill"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/splash"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/devices"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/reload"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/getoption"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/cursorpos"))
|
||||
request(fullRequest);
|
||||
else if (fullRequest.contains("/switchxkblayout"))
|
||||
request(fullRequest, 2);
|
||||
else if (fullRequest.contains("/output"))
|
||||
exitStatus = outputRequest(argc, argv);
|
||||
else if (fullRequest.contains("/setcursor"))
|
||||
exitStatus = setcursorRequest(argc, argv);
|
||||
else if (fullRequest.contains("/dispatch"))
|
||||
exitStatus = dispatchRequest(argc, argv);
|
||||
else if (fullRequest.contains("/keyword"))
|
||||
exitStatus = keywordRequest(argc, argv);
|
||||
else if (fullRequest.contains("/hyprpaper"))
|
||||
exitStatus = hyprpaperRequest(argc, argv);
|
||||
else if (fullRequest.contains("/--help"))
|
||||
printf("%s", USAGE.c_str());
|
||||
else {
|
||||
printf("%s\n", USAGE.c_str());
|
||||
return 1;
|
||||
|
@ -704,7 +704,7 @@ wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, CWindow* pW
|
||||
double subx, suby;
|
||||
|
||||
// calc for oversized windows... fucking bullshit, again.
|
||||
wlr_box geom;
|
||||
wlr_box geom;
|
||||
wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, &geom);
|
||||
|
||||
const auto PFOUND = wlr_xdg_surface_surface_at(PSURFACE, pos.x - pWindow->m_vRealPosition.vec().x + geom.x, pos.y - pWindow->m_vRealPosition.vec().y + geom.y, &subx, &suby);
|
||||
@ -1690,7 +1690,7 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
|
||||
const bool SWITCHINGISACTIVE = POLDMON->activeWorkspace == pWorkspace->m_iID;
|
||||
|
||||
// fix old mon
|
||||
int nextWorkspaceOnMonitorID = -1;
|
||||
int nextWorkspaceOnMonitorID = -1;
|
||||
for (auto& w : m_vWorkspaces) {
|
||||
if (w->m_iMonitorID == POLDMON->ID && w->m_iID != pWorkspace->m_iID) {
|
||||
nextWorkspaceOnMonitorID = w->m_iID;
|
||||
|
@ -134,11 +134,7 @@ void CWindow::createToplevelHandle() {
|
||||
|
||||
// handle events
|
||||
hyprListener_toplevelActivate.initCallback(
|
||||
&m_phForeignToplevel->events.request_activate,
|
||||
[&](void* owner, void* data) {
|
||||
g_pCompositor->focusWindow(this);
|
||||
},
|
||||
this, "Toplevel");
|
||||
&m_phForeignToplevel->events.request_activate, [&](void* owner, void* data) { g_pCompositor->focusWindow(this); }, this, "Toplevel");
|
||||
|
||||
hyprListener_toplevelFullscreen.initCallback(
|
||||
&m_phForeignToplevel->events.request_fullscreen,
|
||||
@ -150,11 +146,7 @@ void CWindow::createToplevelHandle() {
|
||||
this, "Toplevel");
|
||||
|
||||
hyprListener_toplevelClose.initCallback(
|
||||
&m_phForeignToplevel->events.request_close,
|
||||
[&](void* owner, void* data) {
|
||||
g_pCompositor->closeWindow(this);
|
||||
},
|
||||
this, "Toplevel");
|
||||
&m_phForeignToplevel->events.request_close, [&](void* owner, void* data) { g_pCompositor->closeWindow(this); }, this, "Toplevel");
|
||||
|
||||
m_iLastToplevelMonitorID = m_iMonitorID;
|
||||
}
|
||||
|
112
src/Window.hpp
112
src/Window.hpp
@ -26,9 +26,9 @@ struct SWindowSpecialRenderData {
|
||||
int64_t inactiveBorderColor = -1; // -1 means unset
|
||||
|
||||
// set by the layout
|
||||
bool rounding = true;
|
||||
bool border = true;
|
||||
bool decorate = true;
|
||||
bool rounding = true;
|
||||
bool border = true;
|
||||
bool decorate = true;
|
||||
};
|
||||
|
||||
struct SWindowAdditionalConfigData {
|
||||
@ -88,110 +88,110 @@ class CWindow {
|
||||
} m_uSurface;
|
||||
|
||||
// this is the position and size of the "bounding box"
|
||||
Vector2D m_vPosition = Vector2D(0, 0);
|
||||
Vector2D m_vSize = Vector2D(0, 0);
|
||||
Vector2D m_vPosition = Vector2D(0, 0);
|
||||
Vector2D m_vSize = Vector2D(0, 0);
|
||||
|
||||
// this is the real position and size used to draw the thing
|
||||
CAnimatedVariable m_vRealPosition;
|
||||
CAnimatedVariable m_vRealSize;
|
||||
CAnimatedVariable m_vRealPosition;
|
||||
CAnimatedVariable m_vRealSize;
|
||||
|
||||
// for not spamming the protocols
|
||||
Vector2D m_vReportedPosition;
|
||||
Vector2D m_vReportedSize;
|
||||
Vector2D m_vReportedPosition;
|
||||
Vector2D m_vReportedSize;
|
||||
|
||||
// for restoring floating statuses
|
||||
Vector2D m_vLastFloatingSize;
|
||||
Vector2D m_vLastFloatingPosition;
|
||||
Vector2D m_vLastFloatingSize;
|
||||
Vector2D m_vLastFloatingPosition;
|
||||
|
||||
// this is used for pseudotiling
|
||||
bool m_bIsPseudotiled = false;
|
||||
Vector2D m_vPseudoSize = Vector2D(0, 0);
|
||||
bool m_bIsPseudotiled = false;
|
||||
Vector2D m_vPseudoSize = Vector2D(0, 0);
|
||||
|
||||
uint64_t m_iTags = 0;
|
||||
bool m_bIsFloating = false;
|
||||
bool m_bDraggingTiled = false; // for dragging around tiled windows
|
||||
bool m_bIsFullscreen = false;
|
||||
uint64_t m_iMonitorID = -1;
|
||||
std::string m_szTitle = "";
|
||||
int m_iWorkspaceID = -1;
|
||||
uint64_t m_iTags = 0;
|
||||
bool m_bIsFloating = false;
|
||||
bool m_bDraggingTiled = false; // for dragging around tiled windows
|
||||
bool m_bIsFullscreen = false;
|
||||
uint64_t m_iMonitorID = -1;
|
||||
std::string m_szTitle = "";
|
||||
int m_iWorkspaceID = -1;
|
||||
|
||||
bool m_bIsMapped = false;
|
||||
bool m_bIsMapped = false;
|
||||
|
||||
bool m_bRequestsFloat = false;
|
||||
bool m_bRequestsFloat = false;
|
||||
|
||||
// This is for fullscreen apps
|
||||
bool m_bCreatedOverFullscreen = false;
|
||||
bool m_bCreatedOverFullscreen = false;
|
||||
|
||||
// XWayland stuff
|
||||
bool m_bIsX11 = false;
|
||||
bool m_bMappedX11 = false;
|
||||
CWindow* m_pX11Parent = nullptr;
|
||||
uint64_t m_iX11Type = 0;
|
||||
bool m_bIsModal = false;
|
||||
bool m_bX11DoesntWantBorders = false;
|
||||
bool m_bX11ShouldntFocus = false;
|
||||
bool m_bIsX11 = false;
|
||||
bool m_bMappedX11 = false;
|
||||
CWindow* m_pX11Parent = nullptr;
|
||||
uint64_t m_iX11Type = 0;
|
||||
bool m_bIsModal = false;
|
||||
bool m_bX11DoesntWantBorders = false;
|
||||
bool m_bX11ShouldntFocus = false;
|
||||
//
|
||||
|
||||
// For nofocus
|
||||
bool m_bNoFocus = false;
|
||||
bool m_bNoInitialFocus = false;
|
||||
bool m_bNoFocus = false;
|
||||
bool m_bNoInitialFocus = false;
|
||||
|
||||
// initial fullscreen and fullscreen disabled
|
||||
bool m_bWantsInitialFullscreen = false;
|
||||
bool m_bNoFullscreenRequest = false;
|
||||
bool m_bWantsInitialFullscreen = false;
|
||||
bool m_bNoFullscreenRequest = false;
|
||||
|
||||
SSurfaceTreeNode* m_pSurfaceTree = nullptr;
|
||||
SSurfaceTreeNode* m_pSurfaceTree = nullptr;
|
||||
|
||||
// Animated border
|
||||
CGradientValueData m_cRealBorderColor = {0};
|
||||
CGradientValueData m_cRealBorderColorPrevious = {0};
|
||||
CAnimatedVariable m_fBorderAnimationProgress;
|
||||
CGradientValueData m_cRealBorderColor = {0};
|
||||
CGradientValueData m_cRealBorderColorPrevious = {0};
|
||||
CAnimatedVariable m_fBorderAnimationProgress;
|
||||
|
||||
// Fade in-out
|
||||
CAnimatedVariable m_fAlpha;
|
||||
bool m_bFadingOut = false;
|
||||
bool m_bReadyToDelete = false;
|
||||
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
|
||||
Vector2D m_vOriginalClosedSize; // drawing the closing animations
|
||||
CAnimatedVariable m_fAlpha;
|
||||
bool m_bFadingOut = false;
|
||||
bool m_bReadyToDelete = false;
|
||||
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
|
||||
Vector2D m_vOriginalClosedSize; // drawing the closing animations
|
||||
|
||||
// For pinned (sticky) windows
|
||||
bool m_bPinned = false;
|
||||
bool m_bPinned = false;
|
||||
|
||||
// for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window.
|
||||
CWindow* m_pLastCycledWindow = nullptr;
|
||||
CWindow* m_pLastCycledWindow = nullptr;
|
||||
|
||||
// Foreign Toplevel proto
|
||||
wlr_foreign_toplevel_handle_v1* m_phForeignToplevel = nullptr;
|
||||
wlr_foreign_toplevel_handle_v1* m_phForeignToplevel = nullptr;
|
||||
|
||||
// Window decorations
|
||||
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
|
||||
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
|
||||
|
||||
// Special render data, rules, etc
|
||||
SWindowSpecialRenderData m_sSpecialRenderData;
|
||||
SWindowAdditionalConfigData m_sAdditionalConfigData;
|
||||
SWindowSpecialRenderData m_sSpecialRenderData;
|
||||
SWindowAdditionalConfigData m_sAdditionalConfigData;
|
||||
|
||||
// for alpha
|
||||
CAnimatedVariable m_fActiveInactiveAlpha;
|
||||
CAnimatedVariable m_fActiveInactiveAlpha;
|
||||
|
||||
// animated shadow color
|
||||
CAnimatedVariable m_cRealShadowColor;
|
||||
CAnimatedVariable m_cRealShadowColor;
|
||||
|
||||
// animated tint
|
||||
CAnimatedVariable m_fDimPercent;
|
||||
CAnimatedVariable m_fDimPercent;
|
||||
|
||||
// swallowing
|
||||
CWindow* m_pSwallowed = nullptr;
|
||||
CWindow* m_pSwallowed = nullptr;
|
||||
|
||||
// for toplevel monitor events
|
||||
uint64_t m_iLastToplevelMonitorID = -1;
|
||||
uint64_t m_iLastSurfaceMonitorID = -1;
|
||||
uint64_t m_iLastToplevelMonitorID = -1;
|
||||
uint64_t m_iLastSurfaceMonitorID = -1;
|
||||
|
||||
// for idle inhibiting windows
|
||||
eIdleInhibitMode m_eIdleInhibitMode = IDLEINHIBIT_NONE;
|
||||
eIdleInhibitMode m_eIdleInhibitMode = IDLEINHIBIT_NONE;
|
||||
|
||||
// For the list lookup
|
||||
bool operator==(const CWindow& rhs) {
|
||||
bool operator==(const CWindow& rhs) {
|
||||
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize &&
|
||||
m_bFadingOut == rhs.m_bFadingOut;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class CGradientValueData : public ICustomConfigValueData {
|
||||
/* Float corresponding to the angle (rad) */
|
||||
float m_fAngle = 0;
|
||||
|
||||
bool operator==(const CGradientValueData& other) {
|
||||
bool operator==(const CGradientValueData& other) {
|
||||
if (other.m_vColors.size() != m_vColors.size() || m_fAngle != other.m_fAngle)
|
||||
return false;
|
||||
|
||||
|
@ -8,21 +8,21 @@ typedef struct {
|
||||
/** User specified flags */
|
||||
uint32_t flags;
|
||||
/** User-specified position */
|
||||
int32_t x, y;
|
||||
int32_t x, y;
|
||||
/** User-specified size */
|
||||
int32_t width, height;
|
||||
int32_t width, height;
|
||||
/** Program-specified minimum size */
|
||||
int32_t min_width, min_height;
|
||||
int32_t min_width, min_height;
|
||||
/** Program-specified maximum size */
|
||||
int32_t max_width, max_height;
|
||||
int32_t max_width, max_height;
|
||||
/** Program-specified resize increments */
|
||||
int32_t width_inc, height_inc;
|
||||
int32_t width_inc, height_inc;
|
||||
/** Program-specified minimum aspect ratios */
|
||||
int32_t min_aspect_num, min_aspect_den;
|
||||
int32_t min_aspect_num, min_aspect_den;
|
||||
/** Program-specified maximum aspect ratios */
|
||||
int32_t max_aspect_num, max_aspect_den;
|
||||
int32_t max_aspect_num, max_aspect_den;
|
||||
/** Program-specified base size */
|
||||
int32_t base_width, base_height;
|
||||
int32_t base_width, base_height;
|
||||
/** Program-specified window gravity */
|
||||
uint32_t win_gravity;
|
||||
} xcb_size_hints_t;
|
||||
@ -93,12 +93,12 @@ struct wlr_xwayland_surface {
|
||||
struct wl_event_source* ping_timer;
|
||||
|
||||
// _NET_WM_STATE
|
||||
bool modal;
|
||||
bool fullscreen;
|
||||
bool maximized_vert, maximized_horz;
|
||||
bool minimized;
|
||||
bool modal;
|
||||
bool fullscreen;
|
||||
bool maximized_vert, maximized_horz;
|
||||
bool minimized;
|
||||
|
||||
bool has_alpha;
|
||||
bool has_alpha;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
|
@ -431,8 +431,8 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
|
||||
const unsigned int TTY = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
|
||||
|
||||
// vtnr is bugged for some reason.
|
||||
const std::string TTYSTR = execAndGet("head -n 1 /sys/devices/virtual/tty/tty0/active").substr(3);
|
||||
unsigned int ttynum = 0;
|
||||
const std::string TTYSTR = execAndGet("head -n 1 /sys/devices/virtual/tty/tty0/active").substr(3);
|
||||
unsigned int ttynum = 0;
|
||||
try {
|
||||
ttynum = std::stoll(TTYSTR);
|
||||
} catch (std::exception& e) {
|
||||
@ -633,9 +633,9 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||
|
||||
// Flag needed so that the previous workspace is not recorded when switching
|
||||
// to a previous workspace.
|
||||
bool isSwitchingToPrevious = false;
|
||||
bool isSwitchingToPrevious = false;
|
||||
|
||||
bool internal = false;
|
||||
bool internal = false;
|
||||
|
||||
if (args.find("[internal]") == 0) {
|
||||
workspaceToChangeTo = std::stoi(args.substr(10));
|
||||
@ -885,7 +885,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||
if (!PWINDOW)
|
||||
return;
|
||||
|
||||
const auto OLDWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
||||
const auto OLDWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
||||
|
||||
// hack
|
||||
std::string workspaceName;
|
||||
|
@ -84,46 +84,46 @@ class CKeybindManager {
|
||||
bool ensureMouseBindState();
|
||||
|
||||
// -------------- Dispatchers -------------- //
|
||||
static void killActive(std::string);
|
||||
static void kill(std::string);
|
||||
static void spawn(std::string);
|
||||
static void toggleActiveFloating(std::string);
|
||||
static void toggleActivePseudo(std::string);
|
||||
static void changeworkspace(std::string);
|
||||
static void fullscreenActive(std::string);
|
||||
static void moveActiveToWorkspace(std::string);
|
||||
static void moveActiveToWorkspaceSilent(std::string);
|
||||
static void moveFocusTo(std::string);
|
||||
static void centerWindow(std::string);
|
||||
static void moveActiveTo(std::string);
|
||||
static void toggleGroup(std::string);
|
||||
static void changeGroupActive(std::string);
|
||||
static void alterSplitRatio(std::string);
|
||||
static void focusMonitor(std::string);
|
||||
static void toggleSplit(std::string);
|
||||
static void moveCursorToCorner(std::string);
|
||||
static void workspaceOpt(std::string);
|
||||
static void exitHyprland(std::string);
|
||||
static void moveCurrentWorkspaceToMonitor(std::string);
|
||||
static void moveWorkspaceToMonitor(std::string);
|
||||
static void toggleSpecialWorkspace(std::string);
|
||||
static void forceRendererReload(std::string);
|
||||
static void resizeActive(std::string);
|
||||
static void moveActive(std::string);
|
||||
static void moveWindow(std::string);
|
||||
static void resizeWindow(std::string);
|
||||
static void circleNext(std::string);
|
||||
static void focusWindow(std::string);
|
||||
static void setSubmap(std::string);
|
||||
static void pass(std::string);
|
||||
static void layoutmsg(std::string);
|
||||
static void toggleOpaque(std::string);
|
||||
static void dpms(std::string);
|
||||
static void swapnext(std::string);
|
||||
static void swapActiveWorkspaces(std::string);
|
||||
static void pinActive(std::string);
|
||||
static void mouse(std::string);
|
||||
static void bringActiveToTop(std::string);
|
||||
static void killActive(std::string);
|
||||
static void kill(std::string);
|
||||
static void spawn(std::string);
|
||||
static void toggleActiveFloating(std::string);
|
||||
static void toggleActivePseudo(std::string);
|
||||
static void changeworkspace(std::string);
|
||||
static void fullscreenActive(std::string);
|
||||
static void moveActiveToWorkspace(std::string);
|
||||
static void moveActiveToWorkspaceSilent(std::string);
|
||||
static void moveFocusTo(std::string);
|
||||
static void centerWindow(std::string);
|
||||
static void moveActiveTo(std::string);
|
||||
static void toggleGroup(std::string);
|
||||
static void changeGroupActive(std::string);
|
||||
static void alterSplitRatio(std::string);
|
||||
static void focusMonitor(std::string);
|
||||
static void toggleSplit(std::string);
|
||||
static void moveCursorToCorner(std::string);
|
||||
static void workspaceOpt(std::string);
|
||||
static void exitHyprland(std::string);
|
||||
static void moveCurrentWorkspaceToMonitor(std::string);
|
||||
static void moveWorkspaceToMonitor(std::string);
|
||||
static void toggleSpecialWorkspace(std::string);
|
||||
static void forceRendererReload(std::string);
|
||||
static void resizeActive(std::string);
|
||||
static void moveActive(std::string);
|
||||
static void moveWindow(std::string);
|
||||
static void resizeWindow(std::string);
|
||||
static void circleNext(std::string);
|
||||
static void focusWindow(std::string);
|
||||
static void setSubmap(std::string);
|
||||
static void pass(std::string);
|
||||
static void layoutmsg(std::string);
|
||||
static void toggleOpaque(std::string);
|
||||
static void dpms(std::string);
|
||||
static void swapnext(std::string);
|
||||
static void swapActiveWorkspaces(std::string);
|
||||
static void pinActive(std::string);
|
||||
static void mouse(std::string);
|
||||
static void bringActiveToTop(std::string);
|
||||
|
||||
friend class CCompositor;
|
||||
friend class CInputManager;
|
||||
|
@ -555,7 +555,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
|
||||
const auto VARIANT = HASCONFIG ? g_pConfigManager->getDeviceString(devname, "kb_variant") : g_pConfigManager->getString("input:kb_variant");
|
||||
const auto OPTIONS = HASCONFIG ? g_pConfigManager->getDeviceString(devname, "kb_options") : g_pConfigManager->getString("input:kb_options");
|
||||
|
||||
const auto ENABLED = HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "enabled") : true;
|
||||
const auto ENABLED = HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "enabled") : true;
|
||||
|
||||
pKeyboard->enabled = ENABLED;
|
||||
|
||||
|
@ -45,11 +45,11 @@ class CToplevelExportProtocolManager {
|
||||
public:
|
||||
CToplevelExportProtocolManager();
|
||||
|
||||
void bindManager(wl_client* client, void* data, uint32_t version, uint32_t id);
|
||||
void captureToplevel(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, CWindow* handle);
|
||||
void removeClient(SToplevelClient* client, bool force = false);
|
||||
void removeFrame(SToplevelFrame* frame, bool force = false);
|
||||
void copyFrame(wl_client* client, wl_resource* resource, wl_resource* buffer, int32_t ignore_damage);
|
||||
void bindManager(wl_client* client, void* data, uint32_t version, uint32_t id);
|
||||
void captureToplevel(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, CWindow* handle);
|
||||
void removeClient(SToplevelClient* client, bool force = false);
|
||||
void removeFrame(SToplevelFrame* frame, bool force = false);
|
||||
void copyFrame(wl_client* client, wl_resource* resource, wl_resource* buffer, int32_t ignore_damage);
|
||||
|
||||
void onMonitorRender(CMonitor* pMonitor);
|
||||
void displayDestroy();
|
||||
|
@ -17,147 +17,146 @@ struct wlr_pixel_format_info {
|
||||
|
||||
static const struct wlr_pixel_format_info pixel_format_info[] = {
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XRGB8888,
|
||||
.drm_format = DRM_FORMAT_XRGB8888,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ARGB8888,
|
||||
.drm_format = DRM_FORMAT_ARGB8888,
|
||||
.opaque_substitute = DRM_FORMAT_XRGB8888,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XBGR8888,
|
||||
.drm_format = DRM_FORMAT_XBGR8888,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR8888,
|
||||
.drm_format = DRM_FORMAT_ABGR8888,
|
||||
.opaque_substitute = DRM_FORMAT_XBGR8888,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBX8888,
|
||||
.drm_format = DRM_FORMAT_RGBX8888,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBA8888,
|
||||
.drm_format = DRM_FORMAT_RGBA8888,
|
||||
.opaque_substitute = DRM_FORMAT_RGBX8888,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_BGRX8888,
|
||||
.drm_format = DRM_FORMAT_BGRX8888,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_BGRA8888,
|
||||
.drm_format = DRM_FORMAT_BGRA8888,
|
||||
.opaque_substitute = DRM_FORMAT_BGRX8888,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_BGR888,
|
||||
.drm_format = DRM_FORMAT_BGR888,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 24,
|
||||
.has_alpha = false,
|
||||
.bpp = 24,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBX4444,
|
||||
.drm_format = DRM_FORMAT_RGBX4444,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 16,
|
||||
.has_alpha = false,
|
||||
.bpp = 16,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBA4444,
|
||||
.drm_format = DRM_FORMAT_RGBA4444,
|
||||
.opaque_substitute = DRM_FORMAT_RGBX4444,
|
||||
.bpp = 16,
|
||||
.has_alpha = true,
|
||||
.bpp = 16,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBX5551,
|
||||
.drm_format = DRM_FORMAT_RGBX5551,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 16,
|
||||
.has_alpha = false,
|
||||
.bpp = 16,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBA5551,
|
||||
.drm_format = DRM_FORMAT_RGBA5551,
|
||||
.opaque_substitute = DRM_FORMAT_RGBX5551,
|
||||
.bpp = 16,
|
||||
.has_alpha = true,
|
||||
.bpp = 16,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGB565,
|
||||
.drm_format = DRM_FORMAT_RGB565,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 16,
|
||||
.has_alpha = false,
|
||||
.bpp = 16,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_BGR565,
|
||||
.drm_format = DRM_FORMAT_BGR565,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 16,
|
||||
.has_alpha = false,
|
||||
.bpp = 16,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XRGB2101010,
|
||||
.drm_format = DRM_FORMAT_XRGB2101010,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ARGB2101010,
|
||||
.drm_format = DRM_FORMAT_ARGB2101010,
|
||||
.opaque_substitute = DRM_FORMAT_XRGB2101010,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XBGR2101010,
|
||||
.drm_format = DRM_FORMAT_XBGR2101010,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
.bpp = 32,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR2101010,
|
||||
.drm_format = DRM_FORMAT_ABGR2101010,
|
||||
.opaque_substitute = DRM_FORMAT_XBGR2101010,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
.bpp = 32,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XBGR16161616F,
|
||||
.drm_format = DRM_FORMAT_XBGR16161616F,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 64,
|
||||
.has_alpha = false,
|
||||
.bpp = 64,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR16161616F,
|
||||
.drm_format = DRM_FORMAT_ABGR16161616F,
|
||||
.opaque_substitute = DRM_FORMAT_XBGR16161616F,
|
||||
.bpp = 64,
|
||||
.has_alpha = true,
|
||||
.bpp = 64,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XBGR16161616,
|
||||
.drm_format = DRM_FORMAT_XBGR16161616,
|
||||
.opaque_substitute = DRM_FORMAT_INVALID,
|
||||
.bpp = 64,
|
||||
.has_alpha = false,
|
||||
.bpp = 64,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR16161616,
|
||||
.drm_format = DRM_FORMAT_ABGR16161616,
|
||||
.opaque_substitute = DRM_FORMAT_XBGR16161616,
|
||||
.bpp = 64,
|
||||
.has_alpha = true,
|
||||
.bpp = 64,
|
||||
.has_alpha = true,
|
||||
},
|
||||
};
|
||||
|
||||
static const size_t pixel_format_info_size =
|
||||
sizeof(pixel_format_info) / sizeof(pixel_format_info[0]);
|
||||
static const size_t pixel_format_info_size = sizeof(pixel_format_info) / sizeof(pixel_format_info[0]);
|
||||
|
||||
const struct wlr_pixel_format_info* drm_get_pixel_format_info(uint32_t fmt) {
|
||||
for (size_t i = 0; i < pixel_format_info_size; ++i) {
|
||||
@ -171,23 +170,17 @@ const struct wlr_pixel_format_info* drm_get_pixel_format_info(uint32_t fmt) {
|
||||
|
||||
uint32_t convert_wl_shm_format_to_drm(enum wl_shm_format fmt) {
|
||||
switch (fmt) {
|
||||
case WL_SHM_FORMAT_XRGB8888:
|
||||
return DRM_FORMAT_XRGB8888;
|
||||
case WL_SHM_FORMAT_ARGB8888:
|
||||
return DRM_FORMAT_ARGB8888;
|
||||
default:
|
||||
return (uint32_t)fmt;
|
||||
case WL_SHM_FORMAT_XRGB8888: return DRM_FORMAT_XRGB8888;
|
||||
case WL_SHM_FORMAT_ARGB8888: return DRM_FORMAT_ARGB8888;
|
||||
default: return (uint32_t)fmt;
|
||||
}
|
||||
}
|
||||
|
||||
enum wl_shm_format convert_drm_format_to_wl_shm(uint32_t fmt) {
|
||||
switch (fmt) {
|
||||
case DRM_FORMAT_XRGB8888:
|
||||
return WL_SHM_FORMAT_XRGB8888;
|
||||
case DRM_FORMAT_ARGB8888:
|
||||
return WL_SHM_FORMAT_ARGB8888;
|
||||
default:
|
||||
return (enum wl_shm_format)fmt;
|
||||
case DRM_FORMAT_XRGB8888: return WL_SHM_FORMAT_XRGB8888;
|
||||
case DRM_FORMAT_ARGB8888: return WL_SHM_FORMAT_ARGB8888;
|
||||
default: return (enum wl_shm_format)fmt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,108 +189,108 @@ struct wlr_gles2_pixel_format {
|
||||
// optional field, if empty then internalformat = format
|
||||
GLint gl_internalformat;
|
||||
GLint gl_format, gl_type;
|
||||
bool has_alpha;
|
||||
bool has_alpha;
|
||||
};
|
||||
|
||||
static const struct wlr_gles2_pixel_format formats[] = {
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ARGB8888,
|
||||
.gl_format = GL_BGRA_EXT,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = true,
|
||||
.gl_format = GL_BGRA_EXT,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XRGB8888,
|
||||
.gl_format = GL_BGRA_EXT,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = false,
|
||||
.gl_format = GL_BGRA_EXT,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XBGR8888,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = false,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR8888,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = true,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_BGR888,
|
||||
.gl_format = GL_RGB,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = false,
|
||||
.gl_format = GL_RGB,
|
||||
.gl_type = GL_UNSIGNED_BYTE,
|
||||
.has_alpha = false,
|
||||
},
|
||||
#if WLR_LITTLE_ENDIAN
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBX4444,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT_4_4_4_4,
|
||||
.has_alpha = false,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT_4_4_4_4,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBA4444,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT_4_4_4_4,
|
||||
.has_alpha = true,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT_4_4_4_4,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBX5551,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT_5_5_5_1,
|
||||
.has_alpha = false,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT_5_5_5_1,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGBA5551,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT_5_5_5_1,
|
||||
.has_alpha = true,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT_5_5_5_1,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_RGB565,
|
||||
.gl_format = GL_RGB,
|
||||
.gl_type = GL_UNSIGNED_SHORT_5_6_5,
|
||||
.has_alpha = false,
|
||||
.gl_format = GL_RGB,
|
||||
.gl_type = GL_UNSIGNED_SHORT_5_6_5,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XBGR2101010,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_INT_2_10_10_10_REV_EXT,
|
||||
.has_alpha = false,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_INT_2_10_10_10_REV_EXT,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR2101010,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_INT_2_10_10_10_REV_EXT,
|
||||
.has_alpha = true,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_INT_2_10_10_10_REV_EXT,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XBGR16161616F,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_HALF_FLOAT_OES,
|
||||
.has_alpha = false,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_HALF_FLOAT_OES,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR16161616F,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_HALF_FLOAT_OES,
|
||||
.has_alpha = true,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_HALF_FLOAT_OES,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_XBGR16161616,
|
||||
.drm_format = DRM_FORMAT_XBGR16161616,
|
||||
.gl_internalformat = GL_RGBA16_EXT,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT,
|
||||
.has_alpha = false,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT,
|
||||
.has_alpha = false,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_ABGR16161616,
|
||||
.drm_format = DRM_FORMAT_ABGR16161616,
|
||||
.gl_internalformat = GL_RGBA16_EXT,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT,
|
||||
.has_alpha = true,
|
||||
.gl_format = GL_RGBA,
|
||||
.gl_type = GL_UNSIGNED_SHORT,
|
||||
.has_alpha = true,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
@ -467,8 +467,8 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
||||
static auto* const PDIMINACTIVE = &g_pConfigManager->getConfigValuePtr("decoration:dim_inactive")->intValue;
|
||||
|
||||
// get transform
|
||||
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
|
||||
float matrix[9];
|
||||
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
|
||||
float matrix[9];
|
||||
wlr_matrix_project_box(matrix, pBox, TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix);
|
||||
|
||||
float glMatrix[9];
|
||||
@ -605,7 +605,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
||||
static auto* const PBLURPASSES = &g_pConfigManager->getConfigValuePtr("decoration:blur_passes")->intValue;
|
||||
|
||||
// prep damage
|
||||
pixman_region32_t damage;
|
||||
pixman_region32_t damage;
|
||||
pixman_region32_init(&damage);
|
||||
pixman_region32_copy(&damage, originalDamage);
|
||||
wlr_region_transform(&damage, &damage, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
|
||||
@ -619,7 +619,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
||||
CFramebuffer* currentRenderToFB = &m_RenderData.pCurrentMonData->primaryFB;
|
||||
|
||||
// declare the draw func
|
||||
auto drawPass = [&](CShader* pShader, pixman_region32_t* pDamage) {
|
||||
auto drawPass = [&](CShader* pShader, pixman_region32_t* pDamage) {
|
||||
if (currentRenderToFB == PMIRRORFB)
|
||||
PMIRRORSWAPFB->bind();
|
||||
else
|
||||
@ -823,7 +823,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
||||
static auto* const PBLURXRAY = &g_pConfigManager->getConfigValuePtr("decoration:blur_xray")->intValue;
|
||||
|
||||
// make a damage region for this window
|
||||
pixman_region32_t damage;
|
||||
pixman_region32_t damage;
|
||||
pixman_region32_init(&damage);
|
||||
pixman_region32_intersect_rect(&damage, m_RenderData.pDamage, pBox->x, pBox->y, pBox->width, pBox->height); // clip it to the box
|
||||
|
||||
@ -902,7 +902,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
|
||||
// stencil done. Render everything.
|
||||
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
||||
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
||||
// render our great blurred FB
|
||||
static auto* const PBLURIGNOREOPACITY = &g_pConfigManager->getConfigValuePtr("decoration:blur_ignore_opacity")->intValue;
|
||||
m_bEndFrame = true; // fix transformed
|
||||
@ -1219,7 +1219,7 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
|
||||
wlr_box windowBox;
|
||||
// some mafs to figure out the correct box
|
||||
// the originalClosedPos is relative to the monitor's pos
|
||||
Vector2D scaleXY = Vector2D((PMONITOR->scale * PWINDOW->m_vRealSize.vec().x / (PWINDOW->m_vOriginalClosedSize.x * PMONITOR->scale)),
|
||||
Vector2D scaleXY = Vector2D((PMONITOR->scale * PWINDOW->m_vRealSize.vec().x / (PWINDOW->m_vOriginalClosedSize.x * PMONITOR->scale)),
|
||||
(PMONITOR->scale * PWINDOW->m_vRealSize.vec().y / (PWINDOW->m_vOriginalClosedSize.y * PMONITOR->scale)));
|
||||
|
||||
windowBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x;
|
||||
@ -1394,7 +1394,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
|
||||
static auto* const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue;
|
||||
|
||||
// release the last tex if exists
|
||||
const auto PTEX = &m_mMonitorBGTextures[pMonitor];
|
||||
const auto PTEX = &m_mMonitorBGTextures[pMonitor];
|
||||
PTEX->destroyTexture();
|
||||
|
||||
PTEX->allocate();
|
||||
|
@ -38,15 +38,15 @@ struct SMonitorRenderData {
|
||||
wlr_box backgroundTexBox;
|
||||
|
||||
// Shaders
|
||||
bool m_bShadersInitialized = false;
|
||||
CShader m_shQUAD;
|
||||
CShader m_shRGBA;
|
||||
CShader m_shRGBX;
|
||||
CShader m_shEXT;
|
||||
CShader m_shBLUR1;
|
||||
CShader m_shBLUR2;
|
||||
CShader m_shSHADOW;
|
||||
CShader m_shBORDER1;
|
||||
bool m_bShadersInitialized = false;
|
||||
CShader m_shQUAD;
|
||||
CShader m_shRGBA;
|
||||
CShader m_shRGBX;
|
||||
CShader m_shEXT;
|
||||
CShader m_shBLUR1;
|
||||
CShader m_shBLUR2;
|
||||
CShader m_shSHADOW;
|
||||
CShader m_shBORDER1;
|
||||
//
|
||||
};
|
||||
|
||||
@ -143,13 +143,13 @@ class CHyprOpenGLImpl {
|
||||
void initShaders();
|
||||
|
||||
// returns the out FB, can be either Mirror or MirrorSwap
|
||||
CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage);
|
||||
CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage);
|
||||
|
||||
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, pixman_region32_t* damage, int round = 0, bool discardOpaque = false, bool noAA = false,
|
||||
bool allowCustomUV = false, bool allowDim = false);
|
||||
void renderSplash(cairo_t* const, cairo_surface_t* const, double);
|
||||
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, pixman_region32_t* damage, int round = 0, bool discardOpaque = false, bool noAA = false,
|
||||
bool allowCustomUV = false, bool allowDim = false);
|
||||
void renderSplash(cairo_t* const, cairo_surface_t* const, double);
|
||||
|
||||
void preBlurForCurrentMonitor();
|
||||
void preBlurForCurrentMonitor();
|
||||
|
||||
friend class CHyprRenderer;
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <string>
|
||||
|
||||
inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVarName) -> std::string {
|
||||
return R"#(
|
||||
return R"#(
|
||||
|
||||
// branchless baby!
|
||||
highp vec2 pixCoord = vec2(gl_FragCoord);
|
||||
@ -30,7 +30,8 @@ inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVar
|
||||
|
||||
distances /= 4.0;
|
||||
|
||||
)#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances;
|
||||
)#" +
|
||||
colorVarName + R"#( = )#" + colorVarName + R"#( * distances;
|
||||
}
|
||||
|
||||
}
|
||||
@ -66,7 +67,8 @@ void main() {
|
||||
vec4 pixColor = v_color;
|
||||
|
||||
if (radius > 0.0) {
|
||||
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
)#" +
|
||||
ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
}
|
||||
|
||||
gl_FragColor = pixColor;
|
||||
@ -114,7 +116,8 @@ void main() {
|
||||
pixColor[2] = pixColor[2] * tint[2];
|
||||
}
|
||||
|
||||
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
)#" +
|
||||
ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
|
||||
gl_FragColor = pixColor * alpha;
|
||||
})#";
|
||||
@ -149,7 +152,8 @@ void main() {
|
||||
pixColor[2] = pixColor[2] * tint[2];
|
||||
}
|
||||
|
||||
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
)#" +
|
||||
ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
|
||||
gl_FragColor = pixColor * alpha;
|
||||
})#";
|
||||
@ -234,7 +238,8 @@ void main() {
|
||||
pixColor[2] = pixColor[2] * tint[2];
|
||||
}
|
||||
|
||||
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
)#" +
|
||||
ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
|
||||
gl_FragColor = pixColor * alpha;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user