Set 4 modes to synchronize the current state

This commit is contained in:
peijiankang 2022-07-13 17:40:09 +08:00
parent 8ac32aa0e0
commit e769d978ac
2 changed files with 110 additions and 3 deletions

View File

@ -0,0 +1,102 @@
From a12c1bd8864b29f11ec299eb180891143616b553 Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Wed, 13 Jul 2022 17:36:14 +0800
Subject: [PATCH] Set 4 modes to synchronize the current state
---
kds/widget.cpp | 14 ++++++++++++++
kds/widget.h | 4 ++++
2 files changed, 18 insertions(+)
diff --git a/kds/widget.cpp b/kds/widget.cpp
index 6231623..ef45758 100644
--- a/kds/widget.cpp
+++ b/kds/widget.cpp
@@ -22,6 +22,7 @@
#include <QDebug>
#include <QScreen>
+#include <QDBusInterface>
#include <QDBusConnection>
#include <kwindowsystem.h>
@@ -50,6 +51,7 @@ Widget::Widget(QWidget *parent) :
Widget::~Widget()
{
delete ui;
+ delete ukcciface;
}
void Widget::beginSetup(){
@@ -57,6 +59,11 @@ void Widget::beginSetup(){
setAttribute(Qt::WA_TranslucentBackground, true);
+ ukcciface = new QDBusInterface("org.ukui.ukcc.session",
+ "/",
+ "org.ukui.ukcc.session.interface",
+ QDBusConnection::sessionBus());
+
/* 不在任务栏显示图标 */
KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager);
@@ -442,6 +449,8 @@ void Widget::closeApp(){
MateRRConfig * Widget::makeCloneSetup() {
+ ukcciface->call("setScreenMode", "copy");
+
MateRRConfig * current;
MateRROutputInfo ** outputs;
@@ -496,6 +505,8 @@ MateRRConfig * Widget::makeCloneSetup() {
MateRRConfig * Widget::makePrimarySetup(){
+ ukcciface->call("setScreenMode", "first");
+
char * firstName;
/* Turn on the first screen, disable everything else */
@@ -532,6 +543,7 @@ MateRRConfig * Widget::makePrimarySetup(){
}
MateRRConfig * Widget::makeOtherSetup(){
+ ukcciface->call("setScreenMode", "second");
char * firstName;
@@ -568,6 +580,8 @@ MateRRConfig * Widget::makeOtherSetup(){
}
MateRRConfig * Widget::makeXineramaSetup(){
+
+ ukcciface->call("setScreenMode", "expand");
/* Turn on everything that has a preferred mode, and position it from left to right */
MateRRConfig * current = mate_rr_config_new_current(kScreen, NULL);
diff --git a/kds/widget.h b/kds/widget.h
index 8947a16..e033365 100644
--- a/kds/widget.h
+++ b/kds/widget.h
@@ -36,6 +36,8 @@ extern "C" {
#include <gtk/gtk.h>
}
+class QDBusInterface;
+
namespace Ui {
class Widget;
@@ -66,6 +68,8 @@ public:
void initCurrentStatus(int id);
void setCurrentFirstOutputTip();
+ QDBusInterface * ukcciface;
+
private:
Ui::Widget *ui;
QButtonGroup * btnsGroup;
--
2.33.0

View File

@ -1,12 +1,13 @@
%define debug_package %{nil}
Name: kylin-display-switch
Version: 3.0.13
Release: 2
Release: 3
Summary: Gui tool for display switching
License: GPL-3
URL: https://github.com/ukui/kylin-display-switch
Source0: %{name}-%{version}.tar.gz
Patch1: 0001-Touch-hotkeys-touch-pad-without-customized-driver.patch
Patch2: 0002-Set-4-modes-to-synchronize-the-current-state.patch
BuildRequires: python3-rpm-macros
BuildRequires: python-rpm-macros
@ -30,9 +31,10 @@ BuildRequires: libxkbcommon-devel
buttons are clicked, corresponding reminder will popper up.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%build
%{qmake_qt5} %{_qt5_qmake_flags} CONFIG+=enable-by-default kylin-display-switch.pro
%{make_build}
@ -61,7 +63,10 @@ make INSTALL_ROOT=%{buildroot} install
%{_datadir}/glib-2.0/schemas/org.ukui.kds.gschema.xml
%changelog
* Tue Jul 12 2022 peijiankang <tanyulong@kylinos.cn> - 3.0.13-2
* Wed Jul 13 2022 peijiankang <peijiankang@kylinos.cn> - 3.0.13-3
- 设置4种模式前调用控制面板的dbus以便告知控制面板同步当前状态
* Tue Jul 12 2022 peijiankang <peijiankang@kylinos.cn> - 3.0.13-2
- Touch hotkeys touch pad without customized driver
* Wed Mar 02 2022 tanyulong <tanyulong@kylinos.cn> - 3.0.13-1