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

Fix float windows #3942

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix float windows #3942

wants to merge 1 commit into from

Conversation

h0tc0d3
Copy link

@h0tc0d3 h0tc0d3 commented Nov 25, 2023

Changelog:

  • Add vector2 parameter general:float_min_crop for support minimal cropping size
    for windows that cannot transition to float. If 0 < value < 1.0 then use part of windows size, else pixel size. Example: 0.1 0.2, 400 300
  • Add parameter general:float_center_screen to control spawn new float windows.
    1 - New float windows spawn in center screen.
    0 - Сonsider the trimming at the top and bottom to calculate the center of the screen.
    For example, consider the size of the waybar.
  • Fix float windows
  • Fix togglefloat. Window did not return to the center of the screen,
    for example, if there are two windows on the desktop, then the float window is
    positioned in the center of half the screen.
  • Fix windows that start float and then go into a normal window, aka
    program launchers. Example: Blizzard battle.net client.
    The bug render full-screen programs partially behind the screen.
    Now the xwayland games launch normally.
  • Code cleanup and refactoring.
  • Replaced vec() with goalv() in logic other than animation,
    it seemed to me more correct because goalv() is used in many places.
    Not sure if this is correct.

Related bug reports: #3029

Tested programs: Blender, Jetbrains IDEs, Blizzard battle.net client, qt float program.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
No

Is it ready for merging, or does it need work?
Yes.

Fix this:
screenshot_1700794200
screenshot_1700799073

@h0tc0d3 h0tc0d3 changed the title Draft: Fix xwayland windows Fix xwayland windows Nov 26, 2023
@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 26, 2023

@vaxerski I solved the problem with xwayland windows. I replaced vec() with goalv() in logic other than animation, it seemed to me more correct because goalv() is used in many places. Not sure if this is correct. There is also a bug that the xwayland window changes size and does not center the window, but as soon as you move the mouse, the window moves to the center and my code centers the window. I have not yet figured out where the window resize event occurs, this bug is not critical, but it will need to be fixed in the future. Tested only with wlroots 0.18.0 and revert patch 2e8446c

@h0tc0d3 h0tc0d3 changed the title Fix xwayland windows Draft: Fix xwayland windows Nov 26, 2023
@vaxerski
Copy link
Member

I have not yet figured out where the window resize event occurs

configureX11 and unmanagedSetGeometry

@vaxerski
Copy link
Member

tag me when ready to review

@h0tc0d3 h0tc0d3 changed the title Draft: Fix xwayland windows Fix float windows Nov 27, 2023
@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 27, 2023

@vaxerski done. The problem turned out to be more widespread, i.e. there were several different bugs and the solution took longer. There is only one float window left, which is not positioned in the center, and the reason seems to be specific: pWindow->m_uSurface.xwayland->window_type. In all the programs I tested, now all float windows are displayed correctly.

src/managers/XWaylandManager.cpp Outdated Show resolved Hide resolved
src/layout/IHyprLayout.cpp Outdated Show resolved Hide resolved
src/layout/IHyprLayout.cpp Outdated Show resolved Hide resolved
@h0tc0d3 h0tc0d3 changed the title Fix float windows Draft: Fix float windows Nov 28, 2023
@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 28, 2023

At the moment I decided to rework the float code and add more flexible cropping tile to float window.

@h0tc0d3 h0tc0d3 changed the title Draft: Fix float windows Fix float windows Nov 28, 2023
@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 28, 2023

@vaxerski I reworked the code and improved the floating windows. But I encountered a bug that the config manager does not always change the value, only after a restart.

@vaxerski
Copy link
Member

what value

@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 28, 2023

@vaxerski

IHyprLayout::changeWindowFloatingMode(CWindow* pWindow)
static auto* const FLOATCENTERSCREEN = &g_pConfigManager->getConfigValuePtr("general:float_center_screen")->intValue;
static auto* const FLOATMINCROP = &g_pConfigManager->getConfigValuePtr("general:float_min_crop")->vecValue;

@vaxerski
Copy link
Member

vaxerski commented Nov 28, 2023

fwiw both options will not pass review, extremely bad ideas

@h0tc0d3 h0tc0d3 force-pushed the xwayland-fix branch 3 times, most recently from 7441f0f to b8367d4 Compare November 29, 2023 07:16
@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 29, 2023

@vaxerski This is the last version of the changes, there will be no more changes.

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.

also no need to ping me all the time, I get notifications regardless

src/config/ConfigManager.cpp Show resolved Hide resolved
 - Add parameter general:float_min_crop for support minimal size window
   cropping for windows that cannot transition to float.
 - Add parameter general:float_center_screen to control spawn new float windows.
   1 - New float windows spawn in center screen.
   0 - Сonsider the trimming at the top and bottom to calculate the center of the screen.
   For example, consider the size of the waybar.
 - Fix float windows
 - Fix togglefloat
 - Fix windows that start float and then go into a normal window, aka
   program launchers. Example: Blizzard battle.net client.
   The bug render full-screen programs partially behind the screen.
   Now the xwayland games launch normally.
 - Code cleanup and refactoring.
 - Replaced vec() with goalv() in logic other than animation,
   it seemed to me more correct because goalv() is used in many places.
   Not sure if this is correct.
@vaxerski vaxerski force-pushed the main branch 9 times, most recently from 7110a04 to 25aec3a Compare April 27, 2024 02:17
@vaxerski vaxerski force-pushed the main branch 2 times, most recently from fb471b8 to 1237732 Compare May 3, 2024 21:40
@vaxerski vaxerski force-pushed the main branch 2 times, most recently from 358e59e to 3fd6c1b Compare June 3, 2024 16:46
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.

None yet

2 participants