OSDN Git Service

plasma: partially port plasma-desktop shell to QDesktopWidget
authorIvailo Monev <xakepa10@gmail.com>
Sun, 3 Apr 2022 00:40:43 +0000 (03:40 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 3 Apr 2022 00:40:43 +0000 (03:40 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
plasma/shells/plasma-desktop/controllerwindow.cpp
plasma/shells/plasma-desktop/controllerwindow.h
plasma/shells/plasma-desktop/scripting/desktopscriptengine.cpp

index 66ba1af..1af537d 100644 (file)
@@ -22,6 +22,7 @@
 #include "controllerwindow.h"
 
 #include <QApplication>
+#include <QDesktopWidget>
 #include <QBoxLayout>
 #include <QPainter>
 
@@ -40,8 +41,6 @@
 #include "widgetsexplorer/widgetexplorer.h"
 #include "panelshadows.h"
 
-#include <kephal/screens.h>
-
 ControllerWindow::ControllerWindow(QWidget* parent)
    : QWidget(parent),
      m_location(Plasma::Floating),
@@ -76,9 +75,7 @@ ControllerWindow::ControllerWindow(QWidget* parent)
 
     connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(closeIfNotFocussed()));
     connect(m_background, SIGNAL(repaintNeeded()), SLOT(backgroundChanged()));
-    Kephal::Screens *screens = Kephal::Screens::self();
-    connect(screens, SIGNAL(screenResized(Kephal::Screen*,QSize,QSize)),
-            this, SLOT(adjustAndSetMaxSize()));
+    connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(adjustAndSetMaxSize()));
     m_adjustViewTimer = new QTimer(this);
     m_adjustViewTimer->setSingleShot(true);
     connect(m_adjustViewTimer, SIGNAL(timeout()), this, SLOT(syncToGraphicsWidget()));
index 982ff64..674ff06 100644 (file)
@@ -36,11 +36,6 @@ namespace Plasma
     class Dialog;
 } // namespace Plasma
 
-namespace Kephal
-{
-    class Screen;
-}
-
 class PanelShadows;
 
 class ControllerWindow : public QWidget
index e1daacc..443efb3 100644 (file)
 
 #include "desktopscriptengine.h"
 
+#include <QApplication>
+#include <QDesktopWidget>
 #include <QCursor>
 
-#include <kephal/screens.h>
-
 #include <plasmagenericshell/scripting/containment.h>
 #include <plasmagenericshell/scripting/appinterface.h>
 
@@ -52,9 +52,8 @@ int DesktopScriptEngine::defaultPanelScreen() const
 {
     if (m_startup) {
         return ScriptEngine::defaultPanelScreen();
-    } else {
-        return Kephal::ScreenUtils::screenId(QCursor::pos());
     }
+    return QApplication::desktop()->screenNumber(QCursor::pos());
 }
 
 }