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

Tray D-Bus Menu #8405

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Tray D-Bus Menu #8405

wants to merge 6 commits into from

Conversation

grazzolini
Copy link

This PR takes all the patches from #6249 and I just did some code cleanup but other than that, did not touch any of the code. Also, incorporated some patches.

emersion and others added 5 commits October 24, 2024 08:58
The header is not installed by wlroots when the DRM backend is
disabled. We don't need it here, so don't include it.

Closes: swaywm#7943
(cherry picked from commit ca40663)
Co-authored-by: Ian Fan <[email protected]>
Co-authored-by: Nathan Schulte <[email protected]>

Signed-off-by: Felix Weilbach <[email protected]>
- Rebased against master
- Made sure only the tray dbus menu patches are in
@grazzolini grazzolini mentioned this pull request Oct 24, 2024
Comment on lines +274 to +286
for (int i = 0; i < menu->items->length; ++i) {
struct swaybar_dbusmenu_menu_item *item = menu->items->items[i];
if (item->id == item_id) {
return item;
}
if (item->submenu && item->submenu->item_id != 0) {
struct swaybar_dbusmenu_menu_item *found_item =
find_item_under_menu(item->submenu, item_id);
if (found_item) {
return found_item;
}
}
}

Choose a reason for hiding this comment

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

Should there be checks to prevent excessive recursion?

Copy link
Author

Choose a reason for hiding this comment

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

To be quite honest, I've read the whole dbusmenu.c file twice and I'm still trying to understand things. I have been using the patch for a while and it works, but we need to do some more work before it can be merged against master.

swaybar/tray/dbusmenu.c Outdated Show resolved Hide resolved
Co-authored-by: Demi Marie Obenour <[email protected]>
#include <wlr/types/wlr_session_lock_v1.h>
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_text_input_v3.h>
#include <wlr/types/wlr_xdg_shell.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Those #includes seems to be a leftover from the rebase and should be dropped from the PR.

More generally, any unrelated change should be entirely dropped from the PR's commit history via rebase.

Copy link
Author

Choose a reason for hiding this comment

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

I can squash later the commits, once the PR is fully ready to be merged. But I'll remove these includes.

cairo_surface_destroy(recorder);
return;
}
int surface_x, surface_y, surface_width, surface_height = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

[Nitpick] I'd prefer surface_height to be zero-initialized inside draw_menu_items just like the other three variables are.

#include <xdg-shell-client-protocol.h>
#include <xdg-shell-protocol.h>

#include "background-image.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

This header does not exist anymore and should be changed to #include "swaybar/image.h".

list_free(icon_search_paths);

if (icon_path) {
cairo_surface_t *icon = load_background_image(icon_path);
Copy link
Contributor

Choose a reason for hiding this comment

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

This function does not exist anymore and should be changed to load_image.

}

static void wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
uint32_t serial, struct wl_surface *surface) {
#if HAVE_TRAY
struct swaybar_seat *seat = data;
Copy link

Choose a reason for hiding this comment

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

shouldn't this line be outside of the #if HAVE_TRAY part?

apart from that, nice that you've picked it up! was subscribed on the old PR and have seen this now :)

@llyyr
Copy link
Contributor

llyyr commented Nov 2, 2024

Feel free to cherry pick commits from my branch as well https://github.com/llyyr/sway/commits/dbus-tray/

Thanks for picking this up, I sort of gave up on it because the whole thing seemed very fragile to me. Menus from applications like Fcitx5 cause crashes and I didn't have time to figure out why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants