Update to latest hyprland revision

Fix resizeActiveWindow breakage
This commit is contained in:
outfoxxed 2023-07-13 12:54:47 -07:00
parent ad25bd27a2
commit e93aa49b23
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
3 changed files with 29 additions and 55 deletions

12
flake.lock generated
View file

@ -8,11 +8,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1687865038, "lastModified": 1689264334,
"narHash": "sha256-zFTxFNXmXc2XOriWtNzuznEICcSBnIbRVVR/M5w/Y40=", "narHash": "sha256-CJv3Qi00et2dFBWXTx9ysYdYauFtxxs+3pXr0gq/UX0=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "d83296c7a9029eccc04544ddf0a8387d8104b882", "rev": "f8def68e7e761e33dd51c197ac89194a51fcb60f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -44,11 +44,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1687502512, "lastModified": 1688500189,
"narHash": "sha256-dBL/01TayOSZYxtY4cMXuNCBk8UMLoqRZA+94xiFpJA=", "narHash": "sha256-djYYiY4lzJOlXOnTHytH6BUugrxHDZjuGxTSrU4gt4M=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3ae20aa58a6c0d1ca95c9b11f59a2d12eebc511f", "rev": "78419edadf0fabbe5618643bd850b2f2198ed060",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -258,42 +258,22 @@ void Hy3Layout::recalculateWindow(CWindow* window) {
node->recalcSizePosRecursive(); node->recalcSizePosRecursive();
} }
void Hy3Layout::onBeginDragWindow() { void Hy3Layout::resizeActiveWindow(const Vector2D& delta, eRectCorner corner, CWindow* pWindow) {
this->drag_flags.started = false;
IHyprLayout::onBeginDragWindow();
}
void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
auto window = pWindow ? pWindow : g_pCompositor->m_pLastWindow; auto window = pWindow ? pWindow : g_pCompositor->m_pLastWindow;
if (!g_pCompositor->windowValidMapped(window)) return; if (!g_pCompositor->windowValidMapped(window)) return;
auto* node = this->getNodeFromWindow(window); auto* node = this->getNodeFromWindow(window);
if (node == nullptr) return; if (node == nullptr) return;
if (!this->drag_flags.started) { bool drag_x;
if (g_pInputManager->currentlyDraggedWindow == window) { bool drag_y;
auto mouse = g_pInputManager->getMouseCoordsInternal();
auto mouse_offset = mouse - window->m_vPosition;
this->drag_flags = { if (corner == CORNER_NONE) {
.started = true, drag_x = delta.x > 0;
.xExtent = mouse_offset.x > window->m_vSize.x / 2, drag_y = delta.y > 0;
.yExtent = mouse_offset.y > window->m_vSize.y / 2, } else {
}; drag_x = corner == CORNER_TOPRIGHT || corner == CORNER_BOTTOMRIGHT;
drag_y = corner == CORNER_BOTTOMLEFT || corner == CORNER_BOTTOMRIGHT;
Debug::log(
LOG,
"Positive offsets - x: %d, y: %d",
this->drag_flags.xExtent,
this->drag_flags.yExtent
);
} else {
this->drag_flags = {
.started = false,
.xExtent = delta.x > 0,
.yExtent = delta.y > 0,
};
}
} }
const auto animate const auto animate
@ -330,15 +310,15 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
// treat tabbed layouts as if they dont exist during resizing // treat tabbed layouts as if they dont exist during resizing
goto cont; goto cont;
case Hy3GroupLayout::SplitH: case Hy3GroupLayout::SplitH:
if ((this->drag_flags.xExtent && group.children.back() == inner_node) if ((drag_x && group.children.back() == inner_node)
|| (!this->drag_flags.xExtent && group.children.front() == inner_node)) || (!drag_x && group.children.front() == inner_node))
{ {
goto cont; goto cont;
} }
break; break;
case Hy3GroupLayout::SplitV: case Hy3GroupLayout::SplitV:
if ((this->drag_flags.yExtent && group.children.back() == inner_node) if ((drag_y && group.children.back() == inner_node)
|| (!this->drag_flags.yExtent && group.children.front() == inner_node)) || (!drag_y && group.children.front() == inner_node))
{ {
goto cont; goto cont;
} }
@ -368,15 +348,15 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
// treat tabbed layouts as if they dont exist during resizing // treat tabbed layouts as if they dont exist during resizing
goto cont2; goto cont2;
case Hy3GroupLayout::SplitH: case Hy3GroupLayout::SplitH:
if ((this->drag_flags.xExtent && group.children.back() == outer_node) if ((drag_x && group.children.back() == outer_node)
|| (!this->drag_flags.xExtent && group.children.front() == outer_node)) || (!drag_x && group.children.front() == outer_node))
{ {
goto cont2; goto cont2;
} }
break; break;
case Hy3GroupLayout::SplitV: case Hy3GroupLayout::SplitV:
if ((this->drag_flags.yExtent && group.children.back() == outer_node) if ((drag_y && group.children.back() == outer_node)
|| (!this->drag_flags.yExtent && group.children.front() == outer_node)) || (!drag_y && group.children.front() == outer_node))
{ {
goto cont2; goto cont2;
} }
@ -399,7 +379,7 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
auto iter = std::find(inner_group.children.begin(), inner_group.children.end(), inner_node); auto iter = std::find(inner_group.children.begin(), inner_group.children.end(), inner_node);
if (this->drag_flags.xExtent) { if (drag_x) {
if (inner_node == inner_group.children.back()) break; if (inner_node == inner_group.children.back()) break;
iter = std::next(iter); iter = std::next(iter);
} else { } else {
@ -419,7 +399,7 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
auto iter = std::find(inner_group.children.begin(), inner_group.children.end(), inner_node); auto iter = std::find(inner_group.children.begin(), inner_group.children.end(), inner_node);
if (this->drag_flags.yExtent) { if (drag_y) {
if (inner_node == inner_group.children.back()) break; if (inner_node == inner_group.children.back()) break;
iter = std::next(iter); iter = std::next(iter);
} else { } else {
@ -449,7 +429,7 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
auto iter = std::find(outer_group.children.begin(), outer_group.children.end(), outer_node); auto iter = std::find(outer_group.children.begin(), outer_group.children.end(), outer_node);
if (this->drag_flags.xExtent) { if (drag_x) {
if (outer_node == inner_group.children.back()) break; if (outer_node == inner_group.children.back()) break;
iter = std::next(iter); iter = std::next(iter);
} else { } else {
@ -469,7 +449,7 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
auto iter = std::find(outer_group.children.begin(), outer_group.children.end(), outer_node); auto iter = std::find(outer_group.children.begin(), outer_group.children.end(), outer_node);
if (this->drag_flags.yExtent) { if (drag_y) {
if (outer_node == outer_group.children.back()) break; if (outer_node == outer_group.children.back()) break;
iter = std::next(iter); iter = std::next(iter);
} else { } else {

View file

@ -46,8 +46,8 @@ public:
virtual bool isWindowTiled(CWindow*); virtual bool isWindowTiled(CWindow*);
virtual void recalculateMonitor(const int& monitor_id); virtual void recalculateMonitor(const int& monitor_id);
virtual void recalculateWindow(CWindow*); virtual void recalculateWindow(CWindow*);
virtual void onBeginDragWindow(); virtual void
virtual void resizeActiveWindow(const Vector2D& delta, CWindow* pWindow = nullptr); resizeActiveWindow(const Vector2D& delta, eRectCorner corner, CWindow* pWindow = nullptr);
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool enable_fullscreen); virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool enable_fullscreen);
virtual std::any layoutMessage(SLayoutMessageHeader header, std::string content); virtual std::any layoutMessage(SLayoutMessageHeader header, std::string content);
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*); virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
@ -84,12 +84,6 @@ public:
std::list<Hy3TabGroup> tab_groups; std::list<Hy3TabGroup> tab_groups;
private: private:
struct {
bool started = false;
bool xExtent = false;
bool yExtent = false;
} drag_flags;
Hy3Node* getNodeFromWindow(CWindow*); Hy3Node* getNodeFromWindow(CWindow*);
void applyNodeDataToWindow(Hy3Node*, bool no_animation = false); void applyNodeDataToWindow(Hy3Node*, bool no_animation = false);