Merge pull request !85 from 杨敏/openkylin/nile
This commit is contained in:
杨敏 2024-06-03 10:08:07 +00:00 committed by Gitee
commit 371523dd53
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 27 additions and 7 deletions

1
debian/control vendored
View File

@ -35,6 +35,7 @@ Build-Depends: debhelper-compat (= 12),
libavformat-dev,
qtmultimedia5-dev,
libkysdk-systime-dev,
libkysdk-waylandhelper-dev,
liblightdm-qt5-3-dev,
libsystemd-dev,
libssl-dev,

View File

@ -9,6 +9,7 @@ pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0)
find_package(X11 REQUIRED)
pkg_check_modules(KYSDKSYSTIME REQUIRED kysdk-systime)
pkg_check_modules(KYSDKWAYLANDHELPER REQUIRED kysdk-waylandhelper)
pkg_check_modules(XTST REQUIRED xtst)
pkg_check_modules(XCB REQUIRED xcb)
pkg_check_modules(QGS REQUIRED gsettings-qt)
@ -115,8 +116,8 @@ set(dialog_SRC
)
add_executable(ukui-screensaver-dialog ${dialog_SRC})
add_definitions(-DAPP_API_MAJOR=0 -DAPP_API_MINOR=11 -DAPP_API_FUNC=0)
target_include_directories(ukui-screensaver-dialog PRIVATE ${KYSDKSYSTIME_INCLUDE_DIRS})
target_link_directories(ukui-screensaver-dialog PRIVATE ${KYSDKSYSTIME_LIBRARY_DIRS})
target_include_directories(ukui-screensaver-dialog PRIVATE ${KYSDKSYSTIME_INCLUDE_DIRS} ${KYSDKWAYLANDHELPER_INCLUDE_DIRS})
target_link_directories(ukui-screensaver-dialog PRIVATE ${KYSDKSYSTIME_LIBRARY_DIRS} ${KYSDKWAYLANDHELPER_LIBRARY_DIRS})
target_link_libraries(ukui-screensaver-dialog
Qt5::Core
Qt5::Widgets
@ -128,6 +129,7 @@ target_link_libraries(ukui-screensaver-dialog
KF5::WaylandClient
KF5::WindowSystem
${KYSDKSYSTIME_LIBRARIES}
${KYSDKWAYLANDHELPER_LIBRARIES}
${EXTRA_LIBS}
VirtualKeyboard
Screensaver

View File

@ -38,7 +38,13 @@ int main(int argc, char *argv[])
initUkuiLog4qt("ukui-screensaver-backend");
// 重启或关机时不被session关掉
qunsetenv("SESSION_MANAGER");
QString singleId = QString("ukui-screensaver-backend"+QLatin1String(getenv("DISPLAY")));
QString strDisplay = "";
if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") {
strDisplay = QLatin1String(getenv("WAYLAND_DISPLAY"));
} else {
strDisplay = QLatin1String(getenv("DISPLAY"));
}
QString singleId = QString("ukui-screensaver-backend"+strDisplay);
QtSingleCoreApplication a(singleId, argc, argv);
if (a.isRunning()) {
qDebug() << "There is an instance running";

View File

@ -77,7 +77,13 @@ int main(int argc, char *argv[])
if (isGreeterMode())
DisplayService::instance(lockDialogModel)->setCurUserName(lockDialogModel->defaultUserName());
QString id = QString("ukui-screensaver-dialog"+QLatin1String(getenv("DISPLAY")));
QString strDisplay = "";
if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") {
strDisplay = QLatin1String(getenv("WAYLAND_DISPLAY"));
} else {
strDisplay = QLatin1String(getenv("DISPLAY"));
}
QString id = QString("ukui-screensaver-dialog"+strDisplay);
QtSingleApplication app(id, argc, argv);
if (app.isRunning()) {
QString strArguments = QApplication::arguments().join(",");

View File

@ -47,6 +47,8 @@
#include "screensaverwidget.h"
#include "displayservice.h"
#include "configuration.h"
#include <windowmanager/windowmanager.h>
using namespace kdk;
FullBackgroundWidget::FullBackgroundWidget(LockDialogModel *model, QWidget *parent)
: QWidget(parent), m_modelLockDialog(model)
@ -131,7 +133,9 @@ void FullBackgroundWidget::initUI()
}
setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
KWindowSystem::setType(this->winId(), NET::ScreenLock);
QTimer::singleShot(100, this, [=]() {
WindowManager::setWindowLayer(this->windowHandle(), WindowLayer::ScreenLock);
});
// 登录模式下监听屏幕插拔
if (isGreeterMode()) {
@ -458,6 +462,7 @@ void FullBackgroundWidget::onCloseScreensaver()
Q_EMIT m_modelLockDialog->lockStateChanged(false);
stopDelayLockScreen();
screenStatus = UNDEFINED;
m_isBlank = false;
}
void FullBackgroundWidget::onDesktopResized()
@ -631,8 +636,8 @@ void FullBackgroundWidget::showEvent(QShowEvent *event)
{
if (QX11Info::isPlatformX11())
tryGrabKeyboard();
QTimer::singleShot(10, this, [=]() {
KWindowSystem::setType(this->winId(), NET::ScreenLock);
QTimer::singleShot(100, this, [=]() {
WindowManager::setWindowLayer(this->windowHandle(), WindowLayer::ScreenLock);
m_lockWidget->updateFont();
m_lockWidget->updateFontSize();
});