Refactor queues#411
Conversation
tsipinakis
left a comment
There was a problem hiding this comment.
Haven't yet sat down to do a detailed review of this, but here are some passing remarks after messing around for a few minutes:
Bug: xmore is displayed when there are no notifications waiting for some reason, to reproduce run dunst with the default config and send a notification via dunstify. Bisect says the bad commit is 50332b1
| g_queue_push_tail(history, n); | ||
| } | ||
|
|
||
| gint64 queues_get_next_datachange(gint64 time) |
There was a problem hiding this comment.
Why is time a paremeter? Is there a scenario where we'd need to pass a different value for it other than the result of g_get_monotonic_time?
There was a problem hiding this comment.
Yes, there seems to be no rationale for this. I don't know why I thought this would be neccessary. Maybe because I have to pass the output of x_is_idle.
| if(n->category == NULL) n->category = g_strdup(""); | ||
| n->redisplayed = false; | ||
| n->first_render = true; | ||
| n->script = NULL; |
There was a problem hiding this comment.
Nitpick but not sure these are needed, notifications should be created via create_notification which returns zero-ed out memory anyway.
There was a problem hiding this comment.
Yeah that stuff about notification_init. I only moved these values to the top of the notification to show, that these are actually not really processed in notification_init.
Yes, I know. I've currently experiencing some weird segfaults (which are actually outside of this PR). Please wait with a detailed review. I will ping you then again. |
cdd1752 to
66bfc9b
Compare
|
From IRC:
@tsipinakis I've written you a few days ago, that it's working fine and I have not found a bug for the last week. I never said it explicitly, but yes it was this type of "ping". |
|
I found another memory issue (which also is on current master): Notifications marked with |
75bba96 to
f4d3221
Compare
Decouple the x11 stuff from dunst.c, to be able to push update_lists to queues.c in the next commit
Move all id-changing functions out of notification_init and handle this in queues.c Also use stack_duplicates in combination with replacement of notifications correctly. Fixes dunst-project#404 (issue not found)
Previously for every notification (also stacked ones), a new notification id was used, even if the notification got discarded.
Hint for dbus.c lines (134,138): pause_display => (displayed->length == 0)
Also refactor the names to match the namespace.
This gives all three queues unique names makes it easier to trace back, which queue should hold which notifications.
|
Thread Bene: I started writing tests for this. But: first I refactored |
be4d0e2 to
b574834
Compare
|
From IRC
Though it looks like you also removed some bugfix commits like the notification not being freed if it isn't pushed to the history or the timeout fix as mentioned in #419 which should IMO be in this PR. |
|
Yes, I chopped off all unrelated commits. The other stuff will get merged via different PR. |
tsipinakis
left a comment
There was a problem hiding this comment.
Given the size of this PR and that you're already preparing a follow-up it seems good enough to merge for me, didn't find anything worth delaying the PR over.
Something to consider though: When a DUNST_COMMAND_* notification is sent dunst returns id 0 for the notification even though the spec makes it clear that this should never happen
The returned ID is always greater than zero. Servers must make sure not to return zero as an ID.
| 0) == settings.context_ks.sym | ||
| && settings.context_ks.mask == state) { | ||
| context_menu(); | ||
| wake_up(); |
There was a problem hiding this comment.
Is this wake_up call needed? The context menu doesn't modify anything.
Refactor queues
Ok, I'm done with the queue refactoring.
GQueueis now handled inqueues.c.queues_to resemble the namespace.waiting,displayed,history.notification_initabout closing notifications is removeddbus.c: command pause/resume interpretationqueues.c: duplicates stackingThe refactoring about splitting
notification_initis still to be done, but not part of this PR.Mostly, I have split the stuff into two commits (the first one plain moving code from
file.ctoqueues.cand the second one renaming/refactoring).All commits compile without warnings.
Albeit most of the commits are plain refactoring, two commits stand out and may need further testing:
Force management of queues to queues.cRemove command handling from notification_initMove id assignment to separate function in queues.c