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

Support Wayland in desktop manager #4

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

Conversation

wb9688
Copy link

@wb9688 wb9688 commented Feb 5, 2021

This PR adds optional Wayland support to PCManFM's desktop manager through the GTK Layer Shell library.

Screenshot of PCManFM's desktop manager on Wayfire

To do:

  • Make X11 support optional as well
  • When starting the desktop manager, display an appropriate error message if an unsupported display protocol is used
  • Do not show desktop icons underneath e.g. panels

This PR depends on lxde/libfm#70 for right-click menus to work properly.

I set the dependency on v0.5.2 of GTK Layer Shell even though it would successfully compile with earlier versions, because that's the version some issue that would make the search_window unusable got fixed.

@wb9688 wb9688 force-pushed the gtk-layer-shell branch 5 times, most recently from f039615 to b5ca268 Compare February 8, 2021 15:40
configure.ac Outdated
[enable_x11="${enableval}"],
[enable_x11=yes])

if test "x$enable_wayland" = "xno" && test "x&$enable_x11" = "xno"; then
Copy link
Member

Choose a reason for hiding this comment

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

if test "x$enable_wayland" = "xno" -a "x&$enable_x11" = "xno"; then
is shorter


gio_modules="gthread-2.0 gio-unix-2.0 >= 2.18.0"
PKG_CHECK_MODULES(GIO, [$gio_modules])
AC_SUBST(GIO_CFLAGS)
Copy link
Member

Choose a reason for hiding this comment

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

Why do you think it's better to not separate GIO_FLAGS from the rest?

Copy link
Author

Choose a reason for hiding this comment

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

Currently we were calling e.g. PKG_CHECK_MODULES twice for those Gio packages and we aren't using just GIO_CFLAGS in a Makefile.am, but always as part of FM_CFLAGS, so I thought it might as well just be part of the rest.

dest_w, dest_h);
#endif
}
else
Copy link
Member

Choose a reason for hiding this comment

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

This else does not make sense if no wayland enabled, it newer happens in that case because IS_X11 will be TRUE.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, and the compiler will the optimize it out and #ifdef HAVE_WAYLAND isn't needed, because it's not some Wayland-specific API

Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't be so sure about compiler optimization. And even if that is the case then using #if improves the code readability not enforcing the reader to make all the logic calculations, that really helps to not spend extra time on that.

dest_w, dest_h);
if(IS_X11())
{
#ifdef HAVE_X11
Copy link
Member

Choose a reason for hiding this comment

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

Makes no sense at all. If HAVE_X11 undefined then IS_X11 is FALSE, i.e. at this point HAVE_X11 is 100% defined.

Copy link
Author

Choose a reason for hiding this comment

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

The #ifdef's inside the if(IS_X11()) make sense, because else you get compiler errors due to it using X11-specific APIs that you won't have.

Copy link
Member

Choose a reason for hiding this comment

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

Well, in such case enclose all if...else into #ifdef please.

g_signal_connect(screen, "monitors-changed", G_CALLBACK(on_screen_size_changed), self);
if(IS_X11())
{
#ifdef HAVE_X11
Copy link
Member

Choose a reason for hiding this comment

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

See my comment above, please. This #ifdef makes no sense.

@wb9688
Copy link
Author

wb9688 commented Feb 11, 2021

Everything should work now, though I want to do a bit more testing (and of course finish lxde/libfm#70). Here's a new screenshot:

Screenshot of PCManFM's desktop manager on Wayfire

@rico256-cn
Copy link

@LStranger When will this patch be merged in?

@eternal-sorrow
Copy link

Please make it possible to build with wayland-only gtk+ build. Now the build fails with error desktop.c:33:10: fatal error: gdk/gdkx.h: No such file or directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants