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

Notification area in the Center is too small, when one of the messages is too long #40

Closed
dmigis opened this issue Apr 24, 2020 · 9 comments
Labels
Milestone

Comments

@dmigis
Copy link

dmigis commented Apr 24, 2020

There is a problem: The area in which notifications are displayed is arbitrarily clipped, if there at least one of the notifications is too long. Using deadd-notification-center-bin from AUR. Same with deadd-notification-center

@MyriaCore
Copy link
Contributor

MyriaCore commented Aug 31, 2020

I experienced this when implementing #78. I believe @phuhl did too.

@phuhl
Copy link
Owner

phuhl commented Aug 31, 2020

yeah, have that, too

@phuhl
Copy link
Owner

phuhl commented Aug 31, 2020

it is a little annoying to deal with because it is a fight against gtk but it is an annoying bug, too.

@MyriaCore
Copy link
Contributor

MyriaCore commented Sep 9, 2020

See #78 (comment):

I think, splitting this into two PRs is a good idea! Btw, I also know now, why your buttons don't appear. It is not, because they are hidden, but because of the rather hacky way that I use to set the notification size. Look at line 176 of NotificationPopup.hs. It returns the height of the notification by receiving the preferred height for a set width. I do it like that, because at the point of writing, gtk did not have a feature to set the width directly, only the height. What I did is the following: Get the "preferred height" at the desired width. Set the height to the preferred height and hope, that the width is correct then. That is also the reason why the notification center bugs arround in #40 I think.

Anyways, back to your buttons. I set the height of the notification by setting it on the label in the background (that is the only reason why it is there). Since you changed the glade's layout, the buttons are not taken into account when calculating the height so they stick out to the bottom of the notification. To prove it: return (a + 100) and find that your buttons are totally visible.

The getHeight function is what's talked about. It's called in showNotificationWindow and updateNoti':

let dispNoti = set dNotiGetHeight
(getHeight (view dContainer dispNotiWithoutHeight) config)
dispNotiWithoutHeight
lblBody = (flip view) dispNoti $ dLabelBody

height <- getHeight (view dContainer dNoti) config
widgetSetSizeRequest (_dLabelBG dNoti) (-1) height

Here is the definition for getHeight:

getHeight widget config = do
(a, b) <- widgetGetPreferredHeightForWidth widget
$ fromIntegral $ configWidthNoti config
return a

@MyriaCore
Copy link
Contributor

MyriaCore commented Sep 9, 2020

This bug appears quite frequently for me in the master branch of my fork. Not rly sure when I'll have any time to implement a fix, but I'd love any insight on how to fix this.

Do we even need to be setting the height directly? Shouldn't GTK just scale the window as needed when elements need more space? Maybe we set the width with widgetSetSizeRequest, since it's a config var, but idk if we need to set the height.

@MyriaCore
Copy link
Contributor

MyriaCore commented Sep 9, 2020

Looking into things more, it seems like this dLabelBG thing is a dummy label that's only used to size itself up so the size can propogate to the parent. I'm almost certain there's a better way to do this. Why can't we directly manipulate the size of the widget container itself?

@phuhl
Copy link
Owner

phuhl commented Sep 9, 2020

Afaik you can only set the height, but not the width with GTK. Why I used the label, I don't know anymore, but surely there was a reason

@MyriaCore
Copy link
Contributor

I don't doubt that you had your reasons, it just feels like widgetSetSizeRequest should still be able to set width. I mean, the docs say it does. Maybe you ran into a bug when doing that?

Even so, this code shouldn't rly be running for the notification center, right? Like the code in NotificationPopup is only for popups I thought. In fact, wouldn't NotificationInCenter.showNotification be called instead, via NotificationCenter.updateNotis?

I'm sure this was the source of the button bug (which would ideally be fixed in #77), but maybe the source of this bug is something else?

@phuhl
Copy link
Owner

phuhl commented Sep 9, 2020

Yeah, that particular label should not play any role in this. The notifications in center don't even have that lable iirc...

@phuhl phuhl added this to the 2021 Update milestone Dec 18, 2020
phuhl added a commit that referenced this issue Dec 19, 2020
@phuhl phuhl closed this as completed Dec 19, 2020
ahmubashshir pushed a commit to ahm-forks/linux_notification_center that referenced this issue Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants