103 lines
2.4 KiB
Diff
103 lines
2.4 KiB
Diff
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
|
|
|