Commit fcba2780 authored by Adriaan de Groot's avatar Adriaan de Groot 💬
Browse files

Handle differences in paths for Linux vs FreeBSD

- The name of tty devices is different; put detection into
  the CMakeLists and pass that as a define when building
  virtual_terminal.cpp -- this means no ifdeffery for the path.
- The name of dri devices is different; FreeBSD just has one.
parent 8826c7ff
......@@ -584,6 +584,7 @@ if (HAVE_LINUX_VT_H)
set(kwin_SRCS ${kwin_SRCS}
virtual_terminal.cpp
)
set(KWIN_TTY_PREFIX "/dev/tty")
endif()
if(CMAKE_SYSTEM MATCHES "FreeBSD")
......@@ -591,7 +592,11 @@ if(CMAKE_SYSTEM MATCHES "FreeBSD")
set(kwin_SRCS ${kwin_SRCS}
virtual_terminal.cpp
)
set(KWIN_TTY_PREFIX "/dev/ttyv")
endif()
if(KWIN_TTY_PREFIX)
set_source_files_properties(virtual_terminal.cpp PROPERTIES COMPILE_DEFINITIONS KWIN_TTY_PREFIX="${KWIN_TTY_PREFIX}")
endif()
kconfig_add_kcfg_files(kwin_SRCS settings.kcfgc)
kconfig_add_kcfg_files(kwin_SRCS colorcorrection/colorcorrect_settings.kcfgc)
......
......@@ -139,6 +139,9 @@ UdevDevice::Ptr Udev::primaryGpu()
if (!m_udev) {
return UdevDevice::Ptr();
}
#if defined(Q_OS_FREEBSD)
return deviceFromSyspath("/dev/dri/card0");
#else
UdevEnumerate enumerate(this);
enumerate.addMatch(UdevEnumerate::Match::SubSystem, "drm");
enumerate.addMatch(UdevEnumerate::Match::SysName, "card[0-9]*");
......@@ -154,6 +157,7 @@ UdevDevice::Ptr Udev::primaryGpu()
}
return false;
});
#endif
}
UdevDevice::Ptr Udev::primaryFramebuffer()
......
......@@ -106,7 +106,7 @@ void VirtualTerminal::setup(int vtNr)
// error condition
return;
}
QString ttyName = QStringLiteral("/dev/tty%1").arg(vtNr);
QString ttyName = QStringLiteral(KWIN_TTY_PREFIX "%1").arg(vtNr);
m_vt = open(ttyName.toUtf8().constData(), O_RDWR|O_CLOEXEC|O_NONBLOCK);
if (m_vt < 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment