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

Allow running build with X11 support under Wayland #171

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

Conversation

maaarghk
Copy link

@maaarghk maaarghk commented Aug 2, 2023

Fixes: #90 / Ref: #156

Fixes segfaults under Wayland if built with X11 support.

Adds a warning when -g is used under Wayland, notifying the user that the option has no effect.

Adds a warning when x11_property calls are made under Wayland.

@maaarghk
Copy link
Author

maaarghk commented Aug 2, 2023

(Theoretically there's a world where someone has compiled GTK2 with the Wayland backend, and this also fixes that)

@maaarghk maaarghk mentioned this pull request Aug 2, 2023
display = gdk_x11_get_default_xdisplay();
window = RootWindow(display, 0);
}

void x11_property_set(const char* key, const char* value)
{
if (!display) {
g_warning("x11_property_set: call has no effect on non-X sessions");
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of printing warnings here, maybe we could just prevent calling these x11_property functions in the first place?

Copy link
Author

Choose a reason for hiding this comment

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

I definitely considered this but I don't know enough to make a change confidently and didn't have time to look into it. I could probably look into it in more detail but not particularly soon.

These functions are only used to update the PULSE_SERVER x11 property when the user selects an option under Default server in the menu. I'm not sure (a) how to locally run multiple pulse servers or make my system aware of multiple pulse servers; (b) what the equivalent concept under wayland is.

I think the way to do what you've just described would be to not add the Server menu option when Wayland is detected, but it seemed quite complicated. Any advice?

if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
settings->key_grabbing = FALSE;
}
#endif
Copy link
Owner

Choose a reason for hiding this comment

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

Since you'll need this check a couple of times, would it make sense to do it once during initialization, and store the result, then check for it wherever needed?

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

Successfully merging this pull request may close these issues.

Wayland support
2 participants