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

Enable build without libxau and libxcb dependencies #1895

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

Conversation

LittleHuba
Copy link

This PR enables building SDDM without dependencies on libxcb and libxau by setting the CMake flag BUILD_WITH_X11 =OFF. This way, it is possible to build and use SDDM on Wayland-only systems. By default this flag is set to ON.

I kept preprocessor flags in the code to a minimum by using runtime polymorphism wherever feasible. In a few places runtime polymorphism would have caused a high overhead. That is where I fell back on the preprocessor flag. I see those as future places for refactoring.

Fixes: #1420

This allows a better abstraction of the used display server.
This allows a better abstraction of the used display server.
This allows a better abstraction of the used display server.
src/daemon/Display.cpp Outdated Show resolved Hide resolved
src/daemon/Display.cpp Outdated Show resolved Hide resolved
@@ -12,7 +12,7 @@ message(STATUS "Building greeter for Qt ${QT_MAJOR_VERSION} as ${GREETER_TARGET}
include_directories(
"${CMAKE_SOURCE_DIR}/src/common"
"${CMAKE_BINARY_DIR}/src/common"
"${LIBXCB_INCLUDE_DIR}"
${LIBXCB_INCLUDE_DIR}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this correct? If it can't include multiple dirs it should probably remain quoted

Copy link
Author

Choose a reason for hiding this comment

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

The empty string fails when building with BUILD_WITH_X11=OFF. The variable itself should be either a string or a list. In both cases, it requires no quoting. But I'm not too deep into CMake...

src/greeter/KeyboardModel.cpp Outdated Show resolved Hide resolved
@@ -34,7 +37,8 @@ target_link_libraries(sddm-helper
Qt${QT_MAJOR_VERSION}::Network
Qt${QT_MAJOR_VERSION}::DBus
Qt${QT_MAJOR_VERSION}::Qml
${LIBXAU_LINK_LIBRARIES})
${LIBXAU_LINK_LIBRARIES}
${JOURNALD_LIBRARIES})
Copy link
Contributor

Choose a reason for hiding this comment

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

Unconditional?

Copy link
Author

Choose a reason for hiding this comment

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

As far as I know, by not doing the find_package those variables should be empty. Hence, including them unconditionally would have no effect.

@Vogtinator
Copy link
Contributor

I'm not sure how valuable it is to avoid libxau and libxcb considering they will stay for the foreseeable future for Xwayland anyway.

@LittleHuba
Copy link
Author

I'm not sure how valuable it is to avoid libxau and libxcb considering they will stay for the foreseeable future for Xwayland anyway.

Yes, I agree that those libraries will stay around for some time. But to get rid of them, people must stop using them. So with this, it is one less usage and a little bit more pressure on other applications to do the same.

CMakeLists.txt Outdated Show resolved Hide resolved
src/daemon/Display.cpp Outdated Show resolved Hide resolved
@LittleHuba LittleHuba force-pushed the sddm-pure-wayland branch 2 times, most recently from 5b597f4 to 842d343 Compare March 16, 2024 22:06
@@ -24,8 +24,10 @@
#include "Configuration.h"
#include "DaemonApp.h"
#include "DisplayManager.h"
#if BUILD_WITH_X11 == 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#if BUILD_WITH_X11 == 1
#if BUILD_WITH_X11

break;
#else
case X11DisplayServerType:
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation looks wrong

Copy link
Contributor

@Vogtinator Vogtinator left a comment

Choose a reason for hiding this comment

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

Looks ok from a quick view, needs a closer look at some point later

case X11DisplayServerType:
case X11UserDisplayServerType:
// Reset type to Wayland and fall through to initialization
qWarning("Built without X11 support. Trying Wayland display server.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
qWarning("Built without X11 support. Trying Wayland display server.");
qWarning() << "Built without X11 support. Trying Wayland display server.";

Copy link
Author

Choose a reason for hiding this comment

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

Also fixed now.

@LittleHuba
Copy link
Author

Fixed some formatting issues. All your comments should be fixed.

@LittleHuba
Copy link
Author

Missed one. Also fixed now.

@Conan-Kudo
Copy link
Contributor

Could we split out the automatic failover stuff to a separate pull request? That's useful even in the current setup.

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: Remove all remaining X11 dependencies
3 participants