Skip to content

Fix high CPU usage on tiling WMs when moving windows across monitors (#706) - #737

Merged
francesca64 merged 1 commit into
rust-windowing:masterfrom
Jasu:fix-i3-cpu-usage
Dec 19, 2018
Merged

francesca64 merged 1 commit into
rust-windowing:masterfrom
Jasu:fix-i3-cpu-usage

Conversation

@Jasu

@Jasu Jasu commented Dec 7, 2018 •

Copy link
Copy Markdown
Contributor

This commit restricts an Xfwm4-specific DPI-preserving hack to Xfwm4 only, fixing #706.

The hack saves and restores the DPI-adjusted size until the actual size matches. On tiling WMs like i3 this fails, since the size is constrained by the layout. This in turn causes a never-ending XResizeWindow vs. XConfigureWindow fight between the WM and the client, making the WM, winit client, and Xorg consume all CPU cycles available.

Update: I also tested this on fluxbox, and it worked (preserved the DPI.)
Update 2: I got paranoid that I might have removed the only point where the DPI is preserved, so I tested this on one more WM, icewm, and it also worked on it.

  • Tested on all platforms changed Tested on Xfwm4, fluxbox, icewm, and i3
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior Not applicable
  • Created an example program if it would help users understand this functionality Not applicable

Comment thread src/platform/linux/x11/mod.rs Outdated
rounded_size.0 as c_uint,
rounded_size.1 as c_uint,
);
if util::wm_name_is_one_of(&["Xfwm4"]) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wonder if this should be combined with the new_inner_size == rounded_size two lines below? Any opinions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I realized that with the check here the WM name comparison would be done on every XConfigureWindow. I combined the check with the one below and force-pushed. I re-tested with Xfwm4 and i3.

This commit restricts an Xfwm4-specific DPI-preserving hack to Xfwm4
only. The hack saves and restores the DPI-adjusted size until the actual
size matches. On tiling WMs like i3 this fails, since the size is
constrained by the layout. This in turn causes a never-ending
XResizeWindow vs. XConfigureWindow fight between the WM and the client,
making the WM, winit client, and Xorg consume all CPU cycles available.

@francesca64 francesca64 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great, thanks!

@elinorbgr

elinorbgr commented Dec 15, 2018 via email

Copy link
Copy Markdown
Contributor

@francesca64 francesca64 added the DS - x11 Affects the X11 backend, or generally free Unix platforms label Dec 19, 2018
@francesca64
francesca64 merged commit 4b4c73c into rust-windowing:master Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - x11 Affects the X11 backend, or generally free Unix platforms

Development

Successfully merging this pull request may close these issues.

3 participants