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

swm-gaps crashes with _NET_FRAME_EXTENTS negative value #205

Open
podiki opened this issue Jul 22, 2020 · 7 comments
Open

swm-gaps crashes with _NET_FRAME_EXTENTS negative value #205

podiki opened this issue Jul 22, 2020 · 7 comments

Comments

@podiki
Copy link
Contributor

podiki commented Jul 22, 2020

I think I'm at fault for this with how I fixed #178 and #75, as I'm suddenly getting a crash with the last value of _NET_FRAME_EXTENTS negative (end of maximize-window)

(xlib:change-property (window-xwin win) :_NET_FRAME_EXTENTS

(I'm not sure why this is cropping up now, somehow changing a font in emacs...???)

The offending line causing this looks to be what I introduced to not do gap subtraction unless needed, for the height

(>= height (- (frame-height frame) oh)))

Removing that fixes it for the one crash I'm getting, but not sure why this started happening. I don't quite understand the different offsets and sizes to know what went wrong and what the proper fix is here, any ideas?

@jakecoble
Copy link

jakecoble commented Oct 14, 2020

Are you using the mode-line and getting the additive inverse of your mode-line height? (e.g. My mode line is 20 pixels high, so I was getting -20.) The frame height doesn't include the mode line, so I was getting crashes until I changed it to (stumpwm::frame-display-height (window-group win) frame) instead. Not sure why it's less consistent for you, but that might fix it.

@cspark-development
Copy link

I'd like to make a follow up, the fix listed by @jakecoble DOES WORK. However, (I'm not sure if this is related with changing a font in emacs, that may also cause it despite the supposed fix), when launching Emacs specifically, it will still crash. It seems Emacs for me is managing its size in some way, and emacs used to do this on other distributions and window managers, leaving blank space even if fullscreen in the bottom and right corners. I added a message to debug the output of the height variable once its subtracted the modeline height. As seen here:
2021-03-27-200248_750x203_scrot

The output of ANY WINDOW that is not Emacs is shown consistently as follows:
pcman

However, Emacs :

Once it is opened and not fully loaded, it gives the correct height.
emacscorrect

Fully opened and the height changes by 5 pixels for some reason.
emacsloaded

This change is I believe why Emacs is returning a negative height value.

I'm no lisp hacker, so I'm not sure how to deal with this without a hacky approach to check specifically for Emacs or something. I still have yet to check it with other windows that may change its geometry on itself. I'm curious if there are any mitigations against this, perhaps atleast putting a request on the main stumpwm repo to atleast get "(set-window-geometry win :x wx :y wy :width width :height height :border-width 0)" to exit gracefully if receives a negative value if not done already. Window Managers like AwesomeWM and such which i've tried has handled this, despite retaining the broken geometry. I'd like to repeat again that this was not a one time Emacs error with my system, I have had this issue persist across various linux distributions, and emacs distributions ranging from doom emacs, spacemacs and my own handrolled configuration.

If anyone has this problem, I hope this at least serves as useful.

@haoxiangliew
Copy link

The fix by @jakecoble works and tested in my fork of stumpwm-contrib.

As for @Spacur 's problem, I have encountered this bug in Emacs where setting certain font sizes in Emacs can cause crashes. Setting (setq frame-resize-pixelwise t) fixes all problems (including the border that appears with Emacs's window) for me, as well as trying out fractional font sizes, as I think Emacs and StumpWM is calculating font sizes incorrectly (ex. 10 -> 10.5).

@podiki
Copy link
Contributor Author

podiki commented Jan 21, 2022

Sorry I didn't follow up here (haven't used Stump in a while). I also had I think the same problem with Emacs (crashing with some fonts or font sizes). Perhaps I should come back to Stump, but unfortunately stumpwm/stumpwm#763 was a blocker (I rarely need multiple monitors, but certainly don't want it crashing when I do).

@heiwiper
Copy link

why did no one submit a PR to fix this issue ?

@podiki
Copy link
Contributor Author

podiki commented Jul 26, 2022

Happy to help debug/test, just came back to StumpWM. I haven't experienced this crash again though, but I'll be on the look out. Do we have a current reproducer?

@heiwiper
Copy link

I don't really recall what was the issue in the first place, but I remember that this is how I fixed it.

Here's the diff from the link:

-                 (>= height (- (frame-height frame) oh)))
+		  (>= height (- (stumpwm::frame-display-height (window-group win) frame) oh)))

ahmed-shariff added a commit to ahmed-shariff/stumpwm-contrib that referenced this issue Jan 10, 2023
dmb2 added a commit that referenced this issue Mar 31, 2023
Fixes swm-gaps crashing for negtive values for height (#205)
santiagopim pushed a commit to santiagopim/stumpwm-contrib that referenced this issue Apr 13, 2023
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

No branches or pull requests

5 participants