fix the problem that the probability window is not displayed in the center of screen

This commit is contained in:
tanyulong2021 2022-08-02 10:35:30 +08:00
parent 7f4811d119
commit 0450e5e1c4
2 changed files with 77 additions and 1 deletions

View File

@ -0,0 +1,71 @@
From 66f70196d984ce19a9f18a7ebe4ed567534aa3f6 Mon Sep 17 00:00:00 2001
From: tanyulong2021 <tanyulong@kylinos.cn>
Date: Tue, 2 Aug 2022 10:29:15 +0800
Subject: [PATCH] fix the problem that the probability window is not displayed
in the center of screen
---
.../polkit-ukui-authentication-agent-1.desktop.in | 2 +-
polkit-agent/src/PolkitListener.cpp | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/polkit-agent/data/polkit-ukui-authentication-agent-1.desktop.in b/polkit-agent/data/polkit-ukui-authentication-agent-1.desktop.in
index d9b9c45..f2f08fd 100755
--- a/polkit-agent/data/polkit-ukui-authentication-agent-1.desktop.in
+++ b/polkit-agent/data/polkit-ukui-authentication-agent-1.desktop.in
@@ -81,7 +81,7 @@ Categories=
OnlyShowIn=UKUI;MATE
X-UKUI-StartupNotify=false
X-UKUI-AutoRestart=true
-X-UKUI-Autostart-Phase=Initialization
+X-UKUI-Autostart-Phase=Application
NoDisplay=true
X-DBUS-StartupType=Unique
X-MATE-Autostart-Phase=Initialization
diff --git a/polkit-agent/src/PolkitListener.cpp b/polkit-agent/src/PolkitListener.cpp
index 634b1db..ed0f805 100755
--- a/polkit-agent/src/PolkitListener.cpp
+++ b/polkit-agent/src/PolkitListener.cpp
@@ -27,7 +27,7 @@
#include <QDebug>
#include <QDesktopWidget>
#include <QApplication>
-
+#include <QScreen>
#include <fcntl.h>
#include "PolkitListener.h"
@@ -121,8 +121,9 @@ void PolkitListener::initiateAuthentication(
actionDesc.vendorUrl());
/* set the position of the mainwindow */
- QDesktopWidget *desktop = QApplication::desktop();
- QRect desktopRect = desktop->screen(desktop->primaryScreen())->geometry();
+ //QDesktopWidget *desktop = QApplication::desktop();
+ //QRect desktopRect = desktop->screen(desktop->primaryScreen())->geometry();
+ QRect desktopRect = QApplication::primaryScreen()->geometry();
mainWindow->move(desktopRect.left() + (desktopRect.width() - mainWindow->width()) / 2,
desktopRect.top() + (desktopRect.height() - mainWindow->height()) / 2);
@@ -288,6 +289,10 @@ void PolkitListener::onShowPrompt(const QString &prompt, bool echo)
}
mainWindow->show();
+ QRect desktopRect = QApplication::primaryScreen()->geometry();
+ mainWindow->move(desktopRect.left() + (desktopRect.width() - mainWindow->width()) / 2,
+ desktopRect.top() + (desktopRect.height() - mainWindow->height()) / 2);
+
mainWindow->activateWindow();
}
@@ -296,7 +301,6 @@ void PolkitListener::onShowError(const QString &text)
qDebug() << "[Polkit]:" << "Error:" << text;
if(mainWindow){
- qDebug() << "aaaaaaaaaaaaaaaaaaaaaaaaaaa";
mainWindow->setMessage(text);
}
}
--
2.33.0

View File

@ -4,7 +4,7 @@
Name: ukui-biometric-auth
Summary: ukui-biometric-auth
Version: 1.2.1
Release: 8
Release: 9
License: GPL-3+
URL: https://github.com/ukui/ukui-biometric-auth
@ -17,6 +17,7 @@ Patch0: 0001-add-window-icon.patch
Patch1: 0002-add-and-use-attribute-of-UseHighDpiPixmaps.patch
Patch2: 0003-modify-pam-module.patch
Patch3: 0004-solve-the-problem-that-ukui-greeter-wayland-can-t-use-biometric-authentication.patch
Patch4: 0005-fix-the-problem-that-the-probability-window-is-not-displayed-in-the-center-of-screen.patch
%description
ukui-biometric-auth
@ -51,6 +52,7 @@ biometric-auth package.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
mkdir build
@ -85,6 +87,9 @@ make DESTDIR=$RPM_BUILD_ROOT install
%changelog
* Tue Aug 02 2022 tanyulong <tanyulong@kylinos.cn> - 1.2.1-9
- fix the problem that the probability window is not displayed in the center of screen
* Tue Aug 02 2022 tanyulong <tanyulong@kylinos.cn> - 1.2.1-8
- solve the problem that ukui-greeter-wayland can't use biometric authentication