1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-14 09:18:06 +03:00

remove View from TrackedGeneralInfo

This commit is contained in:
Michail Vourlakos 2019-06-08 11:12:25 +03:00
parent 6d1ac0bfe2
commit 96c081e076
9 changed files with 31 additions and 23 deletions

View File

@ -165,5 +165,10 @@ void WindowsTracker::setWindowOnActivities(QWindow &window, const QStringList &a
m_wm->setWindowOnActivities(window, activities);
}
void WindowsTracker::requestMoveLastWindowFromCurrentScreen(int localX, int localY)
{
m_wm->windowsTracker()->lastActiveWindow(m_latteView)->requestMove(m_latteView, localX, localY);
}
}
}

View File

@ -75,6 +75,9 @@ public:
void setWindowOnActivities(QWindow &window, const QStringList &activities);
public slots:
Q_INVOKABLE void requestMoveLastWindowFromCurrentScreen(int localX, int localY);
signals:
void enabledChanged();
void activeWindowDraggingStarted();

View File

@ -25,7 +25,6 @@
#include "../abstractwindowinterface.h"
#include "../tasktools.h"
#include "../../view/view.h"
#include "../../view/visibilitymanager.h"
// Qt
#include <QDebug>
@ -322,16 +321,18 @@ void LastActiveWindow::requestClose()
m_wm->requestClose(m_winId);
}
void LastActiveWindow::requestMove(int localX, int localY)
void LastActiveWindow::requestMove(Latte::View *fromView, int localX, int localY)
{
QPoint globalPoint{m_trackedInfo->view()->x() + localX, m_trackedInfo->view()->y() + localY};
QPoint globalPoint{fromView->x() + localX, fromView->y() + localY};
m_wm->requestMoveWindow(m_winId, globalPoint);
auto viewId = m_winId;
//! This timer is needed because otherwise the mouse position
//! in the dragged window changes to TopLeft corner
QTimer::singleShot(250, this, [&]() {
m_wm->releaseMouseEventFor(m_trackedInfo->view()->winId());
QTimer::singleShot(250, this, [&, viewId]() {
m_wm->releaseMouseEventFor(viewId);
});
emit draggingStarted();

View File

@ -88,7 +88,6 @@ public:
public slots:
Q_INVOKABLE void requestActivate();
Q_INVOKABLE void requestClose();
Q_INVOKABLE void requestMove(int localX, int localY);
Q_INVOKABLE void requestToggleIsOnAllDesktops();
Q_INVOKABLE void requestToggleKeepAbove();
Q_INVOKABLE void requestToggleMinimized();
@ -96,6 +95,7 @@ public slots:
Q_INVOKABLE bool canBeDragged();
void requestMove(Latte::View *fromView, int localX, int localY);
private slots:
void windowChanged(const WindowId &wid);

View File

@ -22,17 +22,15 @@
//local
#include "trackerwindows.h"
#include "../schemecolors.h"
#include "../../view/view.h"
namespace Latte {
namespace WindowSystem {
namespace Tracker {
TrackedGeneralInfo::TrackedGeneralInfo(Tracker::Windows *tracker, Latte::View *view)
TrackedGeneralInfo::TrackedGeneralInfo(Tracker::Windows *tracker)
: QObject(tracker) ,
m_wm(tracker->wm()),
m_view(view),
m_tracker(tracker)
{
m_lastActiveWindow = new LastActiveWindow(this);
@ -126,17 +124,11 @@ void TrackedGeneralInfo::setActiveWindowScheme(SchemeColors *scheme)
m_activeWindowScheme = scheme;
}
Latte::View *TrackedGeneralInfo::view()
{
return m_view;
}
AbstractWindowInterface *TrackedGeneralInfo::wm()
{
return m_wm;
}
void TrackedGeneralInfo::setActiveWindow(const WindowId &wid)
{
m_lastActiveWindow->setInformation(m_tracker->infoFor(wid));
@ -148,8 +140,8 @@ bool TrackedGeneralInfo::isTracking(const WindowInfoWrap &winfo) const
&& !winfo.isPlasmaDesktop()
&& !winfo.isMinimized()
&& winfo.isOnDesktop(m_wm->currentDesktop())
&& winfo.isOnActivity(m_wm->currentActivity())
&& m_view->isOnActivity(m_wm->currentActivity()));
&& winfo.isOnActivity(m_wm->currentActivity()));
/*&& m_view->isOnActivity(m_wm->currentActivity()));*/
}
}

View File

@ -28,7 +28,6 @@
#include <QObject>
namespace Latte {
class View;
namespace WindowSystem {
class SchemeColors;
namespace Tracker {
@ -48,7 +47,7 @@ class TrackedGeneralInfo : public QObject {
Q_PROPERTY(Latte::WindowSystem::Tracker::LastActiveWindow *activeWindow READ lastActiveWindow NOTIFY lastActiveWindowChanged)
public:
TrackedGeneralInfo(Tracker::Windows *tracker, Latte::View *view);
TrackedGeneralInfo(Tracker::Windows *tracker);
~TrackedGeneralInfo() override;
bool enabled() const;
@ -68,7 +67,6 @@ public:
SchemeColors *activeWindowScheme() const;
void setActiveWindowScheme(SchemeColors *scheme);
Latte::View *view();
AbstractWindowInterface *wm();
void setActiveWindow(const WindowId &wid);
@ -84,7 +82,6 @@ private:
bool m_existsWindowActive;
bool m_existsWindowMaximized;
Latte::View *m_view{nullptr};
LastActiveWindow *m_lastActiveWindow{nullptr};
SchemeColors *m_activeWindowScheme{nullptr};

View File

@ -31,7 +31,8 @@ namespace Tracker {
TrackedViewInfo::TrackedViewInfo(Tracker::Windows *tracker, Latte::View *view)
: TrackedGeneralInfo(tracker, view)
: TrackedGeneralInfo(tracker) ,
m_view(view)
{
}
@ -95,6 +96,11 @@ void TrackedViewInfo::setTouchingWindowScheme(SchemeColors *scheme)
m_touchingWindowScheme = scheme;
}
Latte::View *TrackedViewInfo::view() const
{
return m_view;
}
bool TrackedViewInfo::isTracking(const WindowInfoWrap &winfo) const
{
return TrackedGeneralInfo::isTracking(winfo)

View File

@ -62,6 +62,8 @@ public:
SchemeColors *touchingWindowScheme() const;
void setTouchingWindowScheme(SchemeColors *scheme);
Latte::View *view() const;
bool isTracking(const WindowInfoWrap &winfo) const override;
private:
@ -71,6 +73,8 @@ private:
QRect m_availableScreenGeometry;
SchemeColors *m_touchingWindowScheme{nullptr};
Latte::View *m_view{nullptr};
};
}

View File

@ -169,7 +169,7 @@ Loader {
function activateDragging(){
latteView.disableGrabItemBehavior();
latteView.windowsTracker.lastActiveWindow.requestMove(mainArea.mouseX, mainArea.mouseY);
latteView.windowsTracker.requestMoveLastWindowFromCurrentScreen(mainArea.mouseX, mainArea.mouseY);
restoreGrabberTimer.start();
}