Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout: add direction parameter to onWindowCreated and friends #3269

Merged
merged 5 commits into from
Sep 13, 2023

Conversation

memchr
Copy link
Contributor

@memchr memchr commented Sep 12, 2023

Abstract

Add a direction parameter with a default value to the onWindowCreated and onWindowCreatedTiling virtual methods of IHyprLayout. This parameter allows potential control over the direction of window creation.

Currently only DWindleLayout has an existing implementation of such control.
Does not affect master layout.

Other Changes

  • Implement directional moveWindowOutOfGroup for movewindoworgroup. (augmentation of feat: add a new dispatcher that can move windows in and out of groups, or swap windows #3006)
  • Replace DWindleLayout::OneTimeFocus with IHyprLayout::eDirection.
  • Slight formatting change (clang-format).
  • Fix nullptr dereference in Dwindle window creation at
    if ((!OPENINGON || OPENINGON->pWindow == pWindow) && getNodesOnWorkspace(PNODE->workspaceID) > 1) {
    for (auto& node : m_lDwindleNodesData) {
    if (node.workspaceID == PNODE->workspaceID && node.pWindow != pWindow) {
    OPENINGON = &node;
    break;
    }
    }
    }
    // if it's the first, it's easy. Make it fullscreen.
    if (!OPENINGON || OPENINGON->pWindow == pWindow) {

The probability of this nullptr dereference being triggered is low, perhaps elucidating its belated detection.

In addition:

- Implement directional moveWindowOutOfGroup for `movewindoworgroup`
  when using dwindle layout. (augmentation of hyprwm#3006)
- Replace `DWindleLayout::OneTimeFocus` with `IHyprLayout::eDirection`.
- Slight formatting change (clang-format).
@vaxerski
Copy link
Member

I fail to see the use?

@memchr
Copy link
Contributor Author

memchr commented Sep 12, 2023

src/layout/IHyprLayout.hpp Outdated Show resolved Hide resolved
src/layout/IHyprLayout.hpp Outdated Show resolved Hide resolved
@memchr memchr changed the title feat(layout): add direction parameter to onWindowCreated and friends layout: add direction parameter to onWindowCreated and friends Sep 12, 2023
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

top g

@vaxerski vaxerski merged commit 6b1ac65 into hyprwm:main Sep 13, 2023
10 checks passed
@vaxerski
Copy link
Member

doesnt this require a wiki mr too? for movewindowoutofgroup

@memchr
Copy link
Contributor Author

memchr commented Sep 13, 2023

Probably not, I find the old behaviour unexpected (e.g. movewindoworgroup left on groups sometimes creates a new window on the right or above).
The new beehaviour should be more intuitive.

@vaxerski
Copy link
Member

okay

thejch pushed a commit to thejch/Hyprland that referenced this pull request Sep 13, 2023
…m#3269)

* feat(layout): add direction parameter to onWindowCreated and friends

In addition:

- Implement directional moveWindowOutOfGroup for `movewindoworgroup`
  when using dwindle layout. (augmentation of hyprwm#3006)
- Replace `DWindleLayout::OneTimeFocus` with `IHyprLayout::eDirection`.
- Slight formatting change (clang-format).

* fix: nullptr dereference in dwindle window creation

* refactor: generalized eDirection

* refactor: eliminate DIRECTION_NONE

* Update IHyprLayout.hpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants