mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 13:33:50 +03:00
REFACTOR:drop DockView term,in favour of LatteView
This commit is contained in:
parent
39368a41de
commit
f74b3a4da0
@ -121,7 +121,7 @@ DockCorona::DockCorona(bool defaultLayoutOnStartup, QString layoutNameOnStartUp,
|
||||
|
||||
m_docksScreenSyncTimer.setSingleShot(true);
|
||||
m_docksScreenSyncTimer.setInterval(m_universalSettings->screenTrackerInterval());
|
||||
connect(&m_docksScreenSyncTimer, &QTimer::timeout, this, &DockCorona::syncDockViewsToScreens);
|
||||
connect(&m_docksScreenSyncTimer, &QTimer::timeout, this, &DockCorona::syncLatteViewsToScreens);
|
||||
connect(m_universalSettings, &UniversalSettings::screenTrackerIntervalChanged, this, [this]() {
|
||||
m_docksScreenSyncTimer.setInterval(m_universalSettings->screenTrackerInterval());
|
||||
});
|
||||
@ -435,9 +435,9 @@ QRegion DockCorona::availableScreenRegionWithCriteria(int id, QString forLayout)
|
||||
QHash<const Plasma::Containment *, Latte::View *> *views;
|
||||
|
||||
if (forLayout.isEmpty()) {
|
||||
views = m_layoutManager->currentDockViews();
|
||||
views = m_layoutManager->currentLatteViews();
|
||||
} else {
|
||||
views = m_layoutManager->layoutDockViews(forLayout);
|
||||
views = m_layoutManager->layoutLatteViews(forLayout);
|
||||
}
|
||||
|
||||
QRegion available(screen->geometry());
|
||||
@ -563,7 +563,7 @@ QRect DockCorona::availableScreenRectWithCriteria(int id, QList<Dock::Visibility
|
||||
|
||||
auto available = screen->geometry();
|
||||
|
||||
QHash<const Plasma::Containment *, Latte::View *> *views = m_layoutManager->currentDockViews();
|
||||
QHash<const Plasma::Containment *, Latte::View *> *views = m_layoutManager->currentLatteViews();
|
||||
|
||||
if (views) {
|
||||
for (const auto *view : *views) {
|
||||
@ -647,11 +647,11 @@ void DockCorona::screenCountChanged()
|
||||
m_docksScreenSyncTimer.start();
|
||||
}
|
||||
|
||||
//! the central functions that updates loading/unloading dockviews
|
||||
//! the central functions that updates loading/unloading latteviews
|
||||
//! concerning screen changed (for multi-screen setups mainly)
|
||||
void DockCorona::syncDockViewsToScreens()
|
||||
void DockCorona::syncLatteViewsToScreens()
|
||||
{
|
||||
m_layoutManager->syncDockViewsToScreens();
|
||||
m_layoutManager->syncLatteViewsToScreens();
|
||||
}
|
||||
|
||||
int DockCorona::primaryScreenId() const
|
||||
@ -694,7 +694,7 @@ int DockCorona::screenForContainment(const Plasma::Containment *containment) con
|
||||
//FIXME: indexOf is not a proper way to support multi-screen
|
||||
// as for environment to environment the indexes change
|
||||
// also there is the following issue triggered
|
||||
// from dockView adaptToScreen()
|
||||
// from latteView adaptToScreen()
|
||||
//
|
||||
// in a multi-screen environment that
|
||||
// primary screen is not set to 0 it was
|
||||
@ -712,7 +712,7 @@ int DockCorona::screenForContainment(const Plasma::Containment *containment) con
|
||||
}
|
||||
}
|
||||
|
||||
QHash<const Plasma::Containment *, Latte::View *> *views = m_layoutManager->currentDockViews();
|
||||
QHash<const Plasma::Containment *, Latte::View *> *views = m_layoutManager->currentLatteViews();
|
||||
|
||||
//if the panel views already exist, base upon them
|
||||
|
||||
@ -749,15 +749,15 @@ void DockCorona::showAlternativesForApplet(Plasma::Applet *applet)
|
||||
return;
|
||||
}
|
||||
|
||||
QHash<const Plasma::Containment *, Latte::View *> *views = m_layoutManager->currentDockViews();
|
||||
QHash<const Plasma::Containment *, Latte::View *> *views = m_layoutManager->currentLatteViews();
|
||||
|
||||
Latte::View *dockView = (*views)[applet->containment()];
|
||||
Latte::View *latteView = (*views)[applet->containment()];
|
||||
|
||||
KDeclarative::QmlObject *qmlObj{nullptr};
|
||||
|
||||
if (dockView) {
|
||||
dockView->setAlternativesIsShown(true);
|
||||
qmlObj = new KDeclarative::QmlObject(dockView);
|
||||
if (latteView) {
|
||||
latteView->setAlternativesIsShown(true);
|
||||
qmlObj = new KDeclarative::QmlObject(latteView);
|
||||
} else {
|
||||
qmlObj = new KDeclarative::QmlObject(this);
|
||||
}
|
||||
@ -772,8 +772,8 @@ void DockCorona::showAlternativesForApplet(Plasma::Applet *applet)
|
||||
qmlObj->completeInitialization();
|
||||
|
||||
//! Alternative dialog signals
|
||||
connect(helper, &QObject::destroyed, this, [dockView]() {
|
||||
dockView->setAlternativesIsShown(false);
|
||||
connect(helper, &QObject::destroyed, this, [latteView]() {
|
||||
latteView->setAlternativesIsShown(false);
|
||||
});
|
||||
|
||||
connect(qmlObj->rootObject(), SIGNAL(visibleChanged(bool)),
|
||||
|
@ -137,7 +137,7 @@ private slots:
|
||||
void primaryOutputChanged();
|
||||
void screenRemoved(QScreen *screen);
|
||||
void screenCountChanged();
|
||||
void syncDockViewsToScreens();
|
||||
void syncLatteViewsToScreens();
|
||||
|
||||
private:
|
||||
void cleanConfig();
|
||||
|
@ -278,7 +278,7 @@ void GlobalShortcuts::init()
|
||||
//! Activate launcher menu through dbus interface
|
||||
void GlobalShortcuts::activateLauncherMenu()
|
||||
{
|
||||
QList<Latte::View *> sortedViews = sortedViewsList(m_corona->layoutManager()->currentDockViews());
|
||||
QList<Latte::View *> sortedViews = sortedViewsList(m_corona->layoutManager()->currentLatteViews());
|
||||
|
||||
foreach (auto view, sortedViews) {
|
||||
const auto applets = view->containment()->applets();
|
||||
@ -438,7 +438,7 @@ void GlobalShortcuts::activateEntry(int index, Qt::Key modifier)
|
||||
{
|
||||
m_lastInvokedAction = dynamic_cast<QAction *>(sender());
|
||||
|
||||
QList<Latte::View *> sortedViews = sortedViewsList(m_corona->layoutManager()->currentDockViews());
|
||||
QList<Latte::View *> sortedViews = sortedViewsList(m_corona->layoutManager()->currentLatteViews());
|
||||
|
||||
foreach (auto view, sortedViews) {
|
||||
if ((!view->latteTasksPresent() && view->tasksPresent() &&
|
||||
@ -502,7 +502,7 @@ void GlobalShortcuts::updateDockItemBadge(QString identifier, QString value)
|
||||
return false;
|
||||
};
|
||||
|
||||
QHash<const Plasma::Containment *, Latte::View *> *views = m_corona->layoutManager()->currentDockViews();
|
||||
QHash<const Plasma::Containment *, Latte::View *> *views = m_corona->layoutManager()->currentLatteViews();
|
||||
|
||||
// update badges in all Latte Tasks plasmoids
|
||||
for (auto it = views->constBegin(), end = views->constEnd(); it != end; ++it) {
|
||||
@ -642,7 +642,7 @@ void GlobalShortcuts::showDocks()
|
||||
return false;
|
||||
};
|
||||
|
||||
QList<Latte::View *> sortedViews = sortedViewsList(m_corona->layoutManager()->currentDockViews());
|
||||
QList<Latte::View *> sortedViews = sortedViewsList(m_corona->layoutManager()->currentLatteViews());
|
||||
|
||||
Latte::View *viewWithTasks{nullptr};
|
||||
Latte::View *viewWithMeta{nullptr};
|
||||
@ -699,7 +699,7 @@ void GlobalShortcuts::showDocks()
|
||||
bool GlobalShortcuts::docksToHideAreValid()
|
||||
{
|
||||
foreach (auto view, m_hideDocks) {
|
||||
if (!m_corona->layoutManager()->dockViewExists(view)) {
|
||||
if (!m_corona->layoutManager()->latteViewExists(view)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -779,8 +779,6 @@ QList<Latte::View *> GlobalShortcuts::sortedViewsList(QHash<const Plasma::Contai
|
||||
{
|
||||
QList<Latte::View *> docks;
|
||||
|
||||
//QHash<const Plasma::Containment *, DockView *> *views = m_corona->layoutManager()->currentDockViews();
|
||||
|
||||
//! create a docks list to sorted out
|
||||
for (auto it = views->constBegin(), end = views->constEnd(); it != end; ++it) {
|
||||
docks.append(it.value());
|
||||
@ -833,7 +831,7 @@ QList<Latte::View *> GlobalShortcuts::sortedViewsList(QHash<const Plasma::Contai
|
||||
|
||||
void GlobalShortcuts::showSettings()
|
||||
{
|
||||
QList<Latte::View *> docks = sortedViewsList(m_corona->layoutManager()->currentDockViews());
|
||||
QList<Latte::View *> docks = sortedViewsList(m_corona->layoutManager()->currentLatteViews());
|
||||
|
||||
//! find which is the next dock to show its settings
|
||||
if (docks.count() > 0) {
|
||||
@ -874,8 +872,8 @@ void GlobalShortcuts::hideDocksTimerSlot()
|
||||
m_lastInvokedAction = Q_NULLPTR;
|
||||
|
||||
if (docksToHideAreValid()) {
|
||||
foreach (auto dockView, m_hideDocks) {
|
||||
dockView->visibility()->setBlockHiding(false);
|
||||
foreach (auto latteView, m_hideDocks) {
|
||||
latteView->visibility()->setBlockHiding(false);
|
||||
}
|
||||
|
||||
if (m_calledItems.count() > 0) {
|
||||
@ -898,8 +896,8 @@ void GlobalShortcuts::hideDocksTimerSlot()
|
||||
m_lastInvokedAction = Q_NULLPTR;
|
||||
|
||||
if (docksToHideAreValid()) {
|
||||
foreach (auto dockView, m_hideDocks) {
|
||||
dockView->visibility()->setBlockHiding(false);
|
||||
foreach (auto latteView, m_hideDocks) {
|
||||
latteView->visibility()->setBlockHiding(false);
|
||||
}
|
||||
|
||||
if (m_calledItems.count() > 0) {
|
||||
|
146
app/layout.cpp
146
app/layout.cpp
@ -114,14 +114,14 @@ void Layout::unloadContainments()
|
||||
disconnect(this, &Layout::viewsCountChanged, m_corona, &Plasma::Corona::availableScreenRegionChanged);
|
||||
|
||||
qDebug() << "Layout - " + name() + " unload: containments ... size ::: " << m_containments.size()
|
||||
<< " ,dockViews in memory ::: " << m_dockViews.size()
|
||||
<< " ,hidden dockViews in memory ::: " << m_waitingDockViews.size();
|
||||
<< " ,latteViews in memory ::: " << m_latteViews.size()
|
||||
<< " ,hidden latteViews in memory ::: " << m_waitingLatteViews.size();
|
||||
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
view->disconnectSensitiveSignals();
|
||||
}
|
||||
|
||||
foreach (auto view, m_waitingDockViews) {
|
||||
foreach (auto view, m_waitingLatteViews) {
|
||||
view->disconnectSensitiveSignals();
|
||||
}
|
||||
|
||||
@ -152,18 +152,18 @@ void Layout::unloadContainments()
|
||||
}
|
||||
}
|
||||
|
||||
void Layout::unloadDockViews()
|
||||
void Layout::unloadLatteViews()
|
||||
{
|
||||
if (!m_corona) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Layout - " + name() + " unload: dockViews ... size: " << m_dockViews.size();
|
||||
qDebug() << "Layout - " + name() + " unload: latteViews ... size: " << m_latteViews.size();
|
||||
|
||||
qDeleteAll(m_dockViews);
|
||||
qDeleteAll(m_waitingDockViews);
|
||||
m_dockViews.clear();
|
||||
m_waitingDockViews.clear();
|
||||
qDeleteAll(m_latteViews);
|
||||
qDeleteAll(m_waitingLatteViews);
|
||||
m_latteViews.clear();
|
||||
m_waitingLatteViews.clear();
|
||||
}
|
||||
|
||||
void Layout::init()
|
||||
@ -249,18 +249,18 @@ void Layout::setVersion(int ver)
|
||||
emit versionChanged();
|
||||
}
|
||||
|
||||
bool Layout::blockAutomaticDockViewCreation() const
|
||||
bool Layout::blockAutomaticLatteViewCreation() const
|
||||
{
|
||||
return m_blockAutomaticDockViewCreation;
|
||||
return m_blockAutomaticLatteViewCreation;
|
||||
}
|
||||
|
||||
void Layout::setBlockAutomaticDockViewCreation(bool block)
|
||||
void Layout::setBlockAutomaticLatteViewCreation(bool block)
|
||||
{
|
||||
if (m_blockAutomaticDockViewCreation == block) {
|
||||
if (m_blockAutomaticLatteViewCreation == block) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_blockAutomaticDockViewCreation = block;
|
||||
m_blockAutomaticLatteViewCreation = block;
|
||||
}
|
||||
|
||||
bool Layout::disableBordersForMaximizedWindows() const
|
||||
@ -739,19 +739,19 @@ void Layout::addContainment(Plasma::Containment *containment)
|
||||
}
|
||||
|
||||
if (containmentInLayout) {
|
||||
if (!blockAutomaticDockViewCreation()) {
|
||||
if (!blockAutomaticLatteViewCreation()) {
|
||||
addDock(containment);
|
||||
} else {
|
||||
qDebug() << "delaying DockView creation for containment :: " << containment->id();
|
||||
qDebug() << "delaying LatteView creation for containment :: " << containment->id();
|
||||
}
|
||||
|
||||
connect(containment, &QObject::destroyed, this, &Layout::containmentDestroyed);
|
||||
}
|
||||
}
|
||||
|
||||
QHash<const Plasma::Containment *, Latte::View *> *Layout::dockViews()
|
||||
QHash<const Plasma::Containment *, Latte::View *> *Layout::latteViews()
|
||||
{
|
||||
return &m_dockViews;
|
||||
return &m_latteViews;
|
||||
}
|
||||
|
||||
QList<Plasma::Containment *> *Layout::containments()
|
||||
@ -826,9 +826,9 @@ void Layout::destroyedChanged(bool destroyed)
|
||||
}
|
||||
|
||||
if (destroyed) {
|
||||
m_waitingDockViews[sender] = m_dockViews.take(static_cast<Plasma::Containment *>(sender));
|
||||
m_waitingLatteViews[sender] = m_latteViews.take(static_cast<Plasma::Containment *>(sender));
|
||||
} else {
|
||||
m_dockViews[sender] = m_waitingDockViews.take(static_cast<Plasma::Containment *>(sender));
|
||||
m_latteViews[sender] = m_waitingLatteViews.take(static_cast<Plasma::Containment *>(sender));
|
||||
}
|
||||
|
||||
emit viewsCountChanged();
|
||||
@ -850,10 +850,10 @@ void Layout::containmentDestroyed(QObject *cont)
|
||||
}
|
||||
|
||||
qDebug() << "Layout " << name() << " :: containment destroyed!!!!";
|
||||
auto view = m_dockViews.take(containment);
|
||||
auto view = m_latteViews.take(containment);
|
||||
|
||||
if (!view) {
|
||||
view = m_waitingDockViews.take(containment);
|
||||
view = m_waitingLatteViews.take(containment);
|
||||
}
|
||||
|
||||
if (view) {
|
||||
@ -883,7 +883,7 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int
|
||||
|
||||
qDebug() << "step 2...";
|
||||
|
||||
for (auto *dock : m_dockViews) {
|
||||
for (auto *dock : m_latteViews) {
|
||||
if (dock->containment() == containment)
|
||||
return;
|
||||
}
|
||||
@ -936,7 +936,7 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int
|
||||
QString connector = m_corona->screenPool()->connector(id);
|
||||
qDebug() << "add dock - connector : " << connector;
|
||||
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
auto testContainment = view->containment();
|
||||
|
||||
int testScreenId = testContainment->screen();
|
||||
@ -949,8 +949,8 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int
|
||||
Plasma::Types::Location testLocation = static_cast<Plasma::Types::Location>((int)testContainment->config().readEntry("location", (int)Plasma::Types::BottomEdge));
|
||||
|
||||
if (!testOnPrimary && m_corona->screenPool()->primaryScreenId() == testScreenId && testLocation == containment->location()) {
|
||||
qDebug() << "Rejected explicit dockView and removing it in order add an onPrimary with higher priority at screen: " << connector;
|
||||
auto viewToDelete = m_dockViews.take(testContainment);
|
||||
qDebug() << "Rejected explicit latteView and removing it in order add an onPrimary with higher priority at screen: " << connector;
|
||||
auto viewToDelete = m_latteViews.take(testContainment);
|
||||
viewToDelete->disconnectSensitiveSignals();
|
||||
viewToDelete->deleteLater();
|
||||
}
|
||||
@ -982,17 +982,17 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int
|
||||
dockWin = containment->config().readEntry("dockWindowBehavior", true);
|
||||
}
|
||||
|
||||
auto dockView = new Latte::View(m_corona, nextScreen, dockWin);
|
||||
auto latteView = new Latte::View(m_corona, nextScreen, dockWin);
|
||||
|
||||
dockView->init();
|
||||
dockView->setContainment(containment);
|
||||
dockView->setManagedLayout(this);
|
||||
latteView->init();
|
||||
latteView->setContainment(containment);
|
||||
latteView->setManagedLayout(this);
|
||||
|
||||
//! force this special dock case to become primary
|
||||
//! even though it isnt
|
||||
if (forceOnPrimary) {
|
||||
qDebug() << "Enforcing onPrimary:true as requested for DockView...";
|
||||
dockView->setOnPrimary(true);
|
||||
qDebug() << "Enforcing onPrimary:true as requested for LatteView...";
|
||||
latteView->setOnPrimary(true);
|
||||
}
|
||||
|
||||
// connect(containment, &QObject::destroyed, this, &Layout::containmentDestroyed);
|
||||
@ -1005,16 +1005,16 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int
|
||||
connect(containment, &Plasma::Containment::appletCreated, this, &Layout::appletCreated);
|
||||
}
|
||||
|
||||
connect(dockView->effects(), &ViewPart::Effects::colorizerEnabledChanged, this, &Layout::viewColorizerChanged);
|
||||
connect(latteView->effects(), &ViewPart::Effects::colorizerEnabledChanged, this, &Layout::viewColorizerChanged);
|
||||
|
||||
//! Qt 5.9 creates a crash for this in wayland, that is why the check is used
|
||||
//! but on the other hand we need this for copy to work correctly and show
|
||||
//! the copied dock under X11
|
||||
//if (!KWindowSystem::isPlatformWayland()) {
|
||||
dockView->show();
|
||||
latteView->show();
|
||||
//}
|
||||
|
||||
m_dockViews[containment] = dockView;
|
||||
m_latteViews[containment] = latteView;
|
||||
|
||||
emit viewColorizerChanged();
|
||||
emit viewsCountChanged();
|
||||
@ -1098,9 +1098,9 @@ void Layout::copyDock(Plasma::Containment *containment)
|
||||
QString temp2File = newUniqueIdsLayoutFromFile(temp1File);
|
||||
|
||||
|
||||
//! Don't create DockView when the containment is created because we must update
|
||||
//! Don't create LatteView when the containment is created because we must update
|
||||
//! its screen settings first
|
||||
setBlockAutomaticDockViewCreation(true);
|
||||
setBlockAutomaticLatteViewCreation(true);
|
||||
//! Finally import the configuration
|
||||
QList<Plasma::Containment *> importedDocks = importLayoutFile(temp2File);
|
||||
|
||||
@ -1119,7 +1119,7 @@ void Layout::copyDock(Plasma::Containment *containment)
|
||||
|
||||
//in multi-screen environment the copied dock is moved to alternative screens first
|
||||
const auto screens = qGuiApp->screens();
|
||||
auto dock = m_dockViews[containment];
|
||||
auto dock = m_latteViews[containment];
|
||||
|
||||
bool setOnExplicitScreen = false;
|
||||
|
||||
@ -1178,7 +1178,7 @@ void Layout::copyDock(Plasma::Containment *containment)
|
||||
addDock(newContainment, false, dockScrId);
|
||||
}
|
||||
|
||||
setBlockAutomaticDockViewCreation(false);
|
||||
setBlockAutomaticLatteViewCreation(false);
|
||||
}
|
||||
|
||||
void Layout::appletCreated(Plasma::Applet *applet)
|
||||
@ -1482,17 +1482,17 @@ void Layout::recreateDock(Plasma::Containment *containment)
|
||||
}
|
||||
|
||||
//! give the time to config window to close itself first and then recreate the dock
|
||||
//! step:1 remove the dockview
|
||||
//! step:1 remove the latteview
|
||||
QTimer::singleShot(350, [this, containment]() {
|
||||
auto view = m_dockViews.take(containment);
|
||||
auto view = m_latteViews.take(containment);
|
||||
|
||||
if (view) {
|
||||
qDebug() << "recreate - step 1: removing dock for containment:" << containment->id();
|
||||
|
||||
//! step:2 add the new dockview
|
||||
//! step:2 add the new latteview
|
||||
connect(view, &QObject::destroyed, this, [this, containment]() {
|
||||
QTimer::singleShot(250, this, [this, containment]() {
|
||||
if (!m_dockViews.contains(containment)) {
|
||||
if (!m_latteViews.contains(containment)) {
|
||||
qDebug() << "recreate - step 2: adding dock for containment:" << containment->id();
|
||||
addDock(containment);
|
||||
}
|
||||
@ -1505,15 +1505,15 @@ void Layout::recreateDock(Plasma::Containment *containment)
|
||||
});
|
||||
}
|
||||
|
||||
//! the central functions that updates loading/unloading dockviews
|
||||
//! the central functions that updates loading/unloading latteviews
|
||||
//! concerning screen changed (for multi-screen setups mainly)
|
||||
void Layout::syncDockViewsToScreens()
|
||||
void Layout::syncLatteViewsToScreens()
|
||||
{
|
||||
if (!m_corona) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "start of, syncDockViewsToScreens ....";
|
||||
qDebug() << "start of, syncLatteViewsToScreens ....";
|
||||
qDebug() << "LAYOUT ::: " << name();
|
||||
qDebug() << "screen count changed -+-+ " << qGuiApp->screens().size();
|
||||
|
||||
@ -1564,7 +1564,7 @@ void Layout::syncDockViewsToScreens()
|
||||
}
|
||||
|
||||
qDebug() << "PRIMARY SCREEN :: " << prmScreenName;
|
||||
qDebug() << "DOCKVIEWS MUST BE PRESENT AT :: " << futureDocksLocations;
|
||||
qDebug() << "LATTEVIEWS MUST BE PRESENT AT :: " << futureDocksLocations;
|
||||
qDebug() << "FUTURESHOWNVIEWS MUST BE :: " << futureShownViews;
|
||||
|
||||
//! add views
|
||||
@ -1575,24 +1575,24 @@ void Layout::syncDockViewsToScreens()
|
||||
screenId = containment->lastScreen();
|
||||
}
|
||||
|
||||
if (!dockViewExists(containment) && futureShownViews.contains(containment->id())) {
|
||||
qDebug() << "syncDockViewsToScreens: view must be added... for containment:" << containment->id() << " at screen:" << m_corona->screenPool()->connector(screenId);
|
||||
if (!latteViewExists(containment) && futureShownViews.contains(containment->id())) {
|
||||
qDebug() << "syncLatteViewsToScreens: view must be added... for containment:" << containment->id() << " at screen:" << m_corona->screenPool()->connector(screenId);
|
||||
addDock(containment);
|
||||
}
|
||||
}
|
||||
|
||||
//! remove views
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
if (view->containment() && !futureShownViews.contains(view->containment()->id())) {
|
||||
qDebug() << "syncDockViewsToScreens: view must be deleted... for containment:" << view->containment()->id() << " at screen:" << view->positioner()->currentScreenName();
|
||||
auto viewToDelete = m_dockViews.take(view->containment());
|
||||
qDebug() << "syncLatteViewsToScreens: view must be deleted... for containment:" << view->containment()->id() << " at screen:" << view->positioner()->currentScreenName();
|
||||
auto viewToDelete = m_latteViews.take(view->containment());
|
||||
viewToDelete->disconnectSensitiveSignals();
|
||||
viewToDelete->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
//! reconsider views
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
if (view->containment() && futureShownViews.contains(view->containment()->id())) {
|
||||
//! if the dock will not be deleted its a very good point to reconsider
|
||||
//! if the screen in which is running is the correct one
|
||||
@ -1600,17 +1600,17 @@ void Layout::syncDockViewsToScreens()
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "end of, syncDockViewsToScreens ....";
|
||||
qDebug() << "end of, syncLatteViewsToScreens ....";
|
||||
}
|
||||
|
||||
void Layout::assignToLayout(Latte::View *dockView, QList<Plasma::Containment *> containments)
|
||||
void Layout::assignToLayout(Latte::View *latteView, QList<Plasma::Containment *> containments)
|
||||
{
|
||||
if (!m_corona) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dockView) {
|
||||
m_dockViews[dockView->containment()] = dockView;
|
||||
if (latteView) {
|
||||
m_latteViews[latteView->containment()] = latteView;
|
||||
m_containments << containments;
|
||||
|
||||
foreach (auto containment, containments) {
|
||||
@ -1621,7 +1621,7 @@ void Layout::assignToLayout(Latte::View *dockView, QList<Plasma::Containment *>
|
||||
connect(containment, &Plasma::Containment::appletCreated, this, &Layout::appletCreated);
|
||||
}
|
||||
|
||||
dockView->setManagedLayout(this);
|
||||
latteView->setManagedLayout(this);
|
||||
|
||||
emit viewsCountChanged();
|
||||
}
|
||||
@ -1632,7 +1632,7 @@ void Layout::assignToLayout(Latte::View *dockView, QList<Plasma::Containment *>
|
||||
}
|
||||
}
|
||||
|
||||
QList<Plasma::Containment *> Layout::unassignFromLayout(Latte::View *dockView)
|
||||
QList<Plasma::Containment *> Layout::unassignFromLayout(Latte::View *latteView)
|
||||
{
|
||||
QList<Plasma::Containment *> containments;
|
||||
|
||||
@ -1640,13 +1640,13 @@ QList<Plasma::Containment *> Layout::unassignFromLayout(Latte::View *dockView)
|
||||
return containments;
|
||||
}
|
||||
|
||||
containments << dockView->containment();
|
||||
containments << latteView->containment();
|
||||
|
||||
foreach (auto containment, m_containments) {
|
||||
Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(containment->parent());
|
||||
|
||||
//! add systrays from that dockView
|
||||
if (parentApplet && parentApplet->containment() && parentApplet->containment() == dockView->containment()) {
|
||||
//! add systrays from that latteView
|
||||
if (parentApplet && parentApplet->containment() && parentApplet->containment() == latteView->containment()) {
|
||||
containments << containment;
|
||||
disconnect(containment, &QObject::destroyed, this, &Layout::containmentDestroyed);
|
||||
disconnect(containment, &Plasma::Applet::destroyedChanged, this, &Layout::destroyedChanged);
|
||||
@ -1659,7 +1659,7 @@ QList<Plasma::Containment *> Layout::unassignFromLayout(Latte::View *dockView)
|
||||
}
|
||||
|
||||
if (containments.size() > 0) {
|
||||
m_dockViews.remove(dockView->containment());
|
||||
m_latteViews.remove(latteView->containment());
|
||||
}
|
||||
|
||||
//! sync the original layout file for integrity
|
||||
@ -1670,13 +1670,13 @@ QList<Plasma::Containment *> Layout::unassignFromLayout(Latte::View *dockView)
|
||||
return containments;
|
||||
}
|
||||
|
||||
bool Layout::dockViewExists(Plasma::Containment *containment)
|
||||
bool Layout::latteViewExists(Plasma::Containment *containment)
|
||||
{
|
||||
if (!m_corona) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_dockViews.keys().contains(containment);
|
||||
return m_latteViews.keys().contains(containment);
|
||||
}
|
||||
|
||||
QList<Plasma::Types::Location> Layout::availableEdgesForView(QScreen *scr, Latte::View *forView) const
|
||||
@ -1689,7 +1689,7 @@ QList<Plasma::Types::Location> Layout::availableEdgesForView(QScreen *scr, Latte
|
||||
return edges;
|
||||
}
|
||||
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
//! make sure that availabe edges takes into account only views that should be excluded,
|
||||
//! this is why the forView should not be excluded
|
||||
if (view && view != forView && view->positioner()->currentScreenName() == scr->name()) {
|
||||
@ -1727,7 +1727,7 @@ QList<Plasma::Types::Location> Layout::freeEdges(QScreen *scr) const
|
||||
return edges;
|
||||
}
|
||||
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
if (view && view->positioner()->currentScreenName() == scr->name()) {
|
||||
edges.removeOne(view->location());
|
||||
}
|
||||
@ -1748,7 +1748,7 @@ QList<Plasma::Types::Location> Layout::freeEdges(int screen) const
|
||||
|
||||
QScreen *scr = m_corona->screenPool()->screenForId(screen);
|
||||
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
if (view && scr && view->positioner()->currentScreenName() == scr->name()) {
|
||||
edges.removeOne(view->location());
|
||||
}
|
||||
@ -1819,7 +1819,7 @@ int Layout::viewsWithTasks() const
|
||||
|
||||
int result = 0;
|
||||
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
if (view->tasksPresent()) {
|
||||
result++;
|
||||
}
|
||||
@ -1838,7 +1838,7 @@ int Layout::viewsCount(int screen) const
|
||||
|
||||
int docks{0};
|
||||
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
if (view && view->screen() == scr && !view->containment()->destroyed()) {
|
||||
++docks;
|
||||
}
|
||||
@ -1855,7 +1855,7 @@ int Layout::viewsCount(QScreen *screen) const
|
||||
|
||||
int docks{0};
|
||||
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
if (view && view->screen() == screen && !view->containment()->destroyed()) {
|
||||
++docks;
|
||||
}
|
||||
@ -1872,7 +1872,7 @@ int Layout::viewsCount() const
|
||||
|
||||
int docks{0};
|
||||
|
||||
foreach (auto view, m_dockViews) {
|
||||
foreach (auto view, m_latteViews) {
|
||||
if (view && view->containment() && !view->containment()->destroyed()) {
|
||||
++docks;
|
||||
}
|
||||
|
22
app/layout.h
22
app/layout.h
@ -72,7 +72,7 @@ public:
|
||||
void initToCorona(DockCorona *corona);
|
||||
void syncToLayoutFile(bool removeLayoutId = false);
|
||||
void unloadContainments();
|
||||
void unloadDockViews();
|
||||
void unloadLatteViews();
|
||||
|
||||
bool disableBordersForMaximizedWindows() const;
|
||||
void setDisableBordersForMaximizedWindows(bool disable);
|
||||
@ -89,7 +89,7 @@ public:
|
||||
|
||||
bool isWritable() const;
|
||||
|
||||
bool dockViewExists(Plasma::Containment *containment);
|
||||
bool latteViewExists(Plasma::Containment *containment);
|
||||
|
||||
int version() const;
|
||||
void setVersion(int ver);
|
||||
@ -126,22 +126,22 @@ public:
|
||||
void copyDock(Plasma::Containment *containment);
|
||||
void recreateDock(Plasma::Containment *containment);
|
||||
|
||||
void syncDockViewsToScreens();
|
||||
void syncLatteViewsToScreens();
|
||||
void importToCorona();
|
||||
|
||||
const QStringList appliedActivities();
|
||||
|
||||
QList<Plasma::Containment *> *containments();
|
||||
QHash<const Plasma::Containment *, Latte::View *> *dockViews();
|
||||
QHash<const Plasma::Containment *, Latte::View *> *latteViews();
|
||||
|
||||
//! Bind this latteView and its relevant containments(including systrays)
|
||||
//! to this layout. It is used for moving a Latte::View from layout to layout)
|
||||
void assignToLayout(Latte::View *dockView, QList<Plasma::Containment *> containments);
|
||||
void assignToLayout(Latte::View *latteView, QList<Plasma::Containment *> containments);
|
||||
|
||||
//! Unassign that latteView from this layout (this is used for moving a latteView
|
||||
//! from layout to layout) and returns all the containments relevant to
|
||||
//! that latteView
|
||||
QList<Plasma::Containment *> unassignFromLayout(Latte::View *dockView);
|
||||
QList<Plasma::Containment *> unassignFromLayout(Latte::View *latteView);
|
||||
|
||||
//! Available edges for specific view in that screen
|
||||
QList<Plasma::Types::Location> availableEdgesForView(QScreen *scr, Latte::View *forView) const;
|
||||
@ -204,8 +204,8 @@ private:
|
||||
|
||||
//! It can be used in order for LatteViews to not be created automatically when
|
||||
//! their corresponding containments are created e.g. copyDock functionality
|
||||
bool blockAutomaticDockViewCreation() const;
|
||||
void setBlockAutomaticDockViewCreation(bool block);
|
||||
bool blockAutomaticLatteViewCreation() const;
|
||||
void setBlockAutomaticLatteViewCreation(bool block);
|
||||
|
||||
bool explicitDockOccupyEdge(int screen, Plasma::Types::Location location) const;
|
||||
bool primaryDockOccupyEdge(Plasma::Types::Location location) const;
|
||||
@ -225,7 +225,7 @@ private:
|
||||
QList<Plasma::Containment *> importLayoutFile(QString file);
|
||||
|
||||
private:
|
||||
bool m_blockAutomaticDockViewCreation{false};
|
||||
bool m_blockAutomaticLatteViewCreation{false};
|
||||
bool m_disableBordersForMaximizedWindows{false};
|
||||
bool m_showInMenu{false};
|
||||
//if version doesn't exist it is and old layout file
|
||||
@ -247,8 +247,8 @@ private:
|
||||
|
||||
QList<Plasma::Containment *> m_containments;
|
||||
|
||||
QHash<const Plasma::Containment *, Latte::View *> m_dockViews;
|
||||
QHash<const Plasma::Containment *, Latte::View *> m_waitingDockViews;
|
||||
QHash<const Plasma::Containment *, Latte::View *> m_latteViews;
|
||||
QHash<const Plasma::Containment *, Latte::View *> m_waitingLatteViews;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ LayoutManager::~LayoutManager()
|
||||
Layout *layout = m_activeLayouts.at(0);
|
||||
m_activeLayouts.removeFirst();
|
||||
layout->unloadContainments();
|
||||
layout->unloadDockViews();
|
||||
layout->unloadLatteViews();
|
||||
layout->deleteLater();
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ void LayoutManager::unload()
|
||||
}
|
||||
|
||||
layout->unloadContainments();
|
||||
layout->unloadDockViews();
|
||||
layout->unloadLatteViews();
|
||||
|
||||
if (memoryUsage() == Dock::MultipleLayouts && layout->isOriginalLayout()) {
|
||||
clearUnloadedContainmentsFromLinkedFile(layout->unloadedContainmentsIds());
|
||||
@ -204,7 +204,7 @@ QString LayoutManager::defaultLayoutName() const
|
||||
bool LayoutManager::hasColorizer() const
|
||||
{
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (const auto *view : *layout->dockViews()) {
|
||||
for (const auto *view : *layout->latteViews()) {
|
||||
if (view->effects()->colorizerEnabled()) {
|
||||
return true;
|
||||
}
|
||||
@ -324,10 +324,10 @@ void LayoutManager::addDock(Plasma::Containment *containment, bool forceLoading,
|
||||
}
|
||||
}
|
||||
|
||||
bool LayoutManager::dockViewExists(Latte::View *view) const
|
||||
bool LayoutManager::latteViewExists(Latte::View *view) const
|
||||
{
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
for (auto it = layout->dockViews()->constBegin(), end = layout->dockViews()->constEnd(); it != end; ++it) {
|
||||
for (auto it = layout->latteViews()->constBegin(), end = layout->latteViews()->constEnd(); it != end; ++it) {
|
||||
if (it.value() == view) {
|
||||
return true;
|
||||
}
|
||||
@ -337,20 +337,20 @@ bool LayoutManager::dockViewExists(Latte::View *view) const
|
||||
return false;
|
||||
}
|
||||
|
||||
QHash<const Plasma::Containment *, Latte::View *> *LayoutManager::currentDockViews() const
|
||||
QHash<const Plasma::Containment *, Latte::View *> *LayoutManager::currentLatteViews() const
|
||||
{
|
||||
if (memoryUsage() == Dock::SingleLayout) {
|
||||
return m_activeLayouts.at(0)->dockViews();
|
||||
return m_activeLayouts.at(0)->latteViews();
|
||||
} else {
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
if (layout->activities().contains(m_corona->m_activityConsumer->currentActivity())) {
|
||||
return layout->dockViews();
|
||||
return layout->latteViews();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
if ((layout->name() != Layout::MultipleLayoutsName) && (layout->activities().isEmpty())) {
|
||||
return layout->dockViews();
|
||||
return layout->latteViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -358,12 +358,12 @@ QHash<const Plasma::Containment *, Latte::View *> *LayoutManager::currentDockVie
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QHash<const Plasma::Containment *, Latte::View *> *LayoutManager::layoutDockViews(const QString &layoutName) const
|
||||
QHash<const Plasma::Containment *, Latte::View *> *LayoutManager::layoutLatteViews(const QString &layoutName) const
|
||||
{
|
||||
Layout *layout = activeLayout(layoutName);
|
||||
|
||||
if (layout) {
|
||||
return layout->dockViews();
|
||||
return layout->latteViews();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@ -571,7 +571,7 @@ void LayoutManager::loadLatteLayout(QString layoutPath)
|
||||
qDebug() << "LOADING CORONA LAYOUT:" << layoutPath;
|
||||
m_corona->loadLayout(layoutPath);
|
||||
|
||||
//! ~~~ ADDING DOCKVIEWS AND ENFORCE LOADING IF TASKS ARENT PRESENT BASED ON SCREENS ~~~ !//
|
||||
//! ~~~ ADDING LATTEVIEWS AND ENFORCE LOADING IF TASKS ARENT PRESENT BASED ON SCREENS ~~~ !//
|
||||
|
||||
//! this is used to record the first dock having tasks in it. It is used
|
||||
//! to specify which dock will be loaded on startup if a case that no "dock
|
||||
@ -758,7 +758,7 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
}
|
||||
|
||||
layout->unloadContainments();
|
||||
layout->unloadDockViews();
|
||||
layout->unloadLatteViews();
|
||||
|
||||
if (layout->isOriginalLayout() && previousMemoryUsage == Dock::MultipleLayouts) {
|
||||
clearUnloadedContainmentsFromLinkedFile(layout->unloadedContainmentsIds(), true);
|
||||
@ -911,7 +911,7 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
}
|
||||
|
||||
layout->unloadContainments();
|
||||
layout->unloadDockViews();
|
||||
layout->unloadLatteViews();
|
||||
clearUnloadedContainmentsFromLinkedFile(layout->unloadedContainmentsIds());
|
||||
delete layout;
|
||||
}
|
||||
@ -1002,10 +1002,10 @@ void LayoutManager::clearUnloadedContainmentsFromLinkedFile(QStringList containm
|
||||
}
|
||||
|
||||
|
||||
void LayoutManager::syncDockViewsToScreens()
|
||||
void LayoutManager::syncLatteViewsToScreens()
|
||||
{
|
||||
foreach (auto layout, m_activeLayouts) {
|
||||
layout->syncDockViewsToScreens();
|
||||
layout->syncLatteViewsToScreens();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,10 +78,10 @@ public:
|
||||
void addDock(Plasma::Containment *containment, bool forceLoading = false, int expDockScreen = -1);
|
||||
void hideAllDocks();
|
||||
void pauseLayout(QString layoutName);
|
||||
void syncDockViewsToScreens();
|
||||
void syncLatteViewsToScreens();
|
||||
void syncActiveLayoutsToOriginalFiles();
|
||||
|
||||
bool dockViewExists(Latte::View *view) const;
|
||||
bool latteViewExists(Latte::View *view) const;
|
||||
bool hasColorizer() const;
|
||||
bool layoutExists(QString layoutName) const;
|
||||
|
||||
@ -97,8 +97,8 @@ public:
|
||||
Dock::LayoutsMemoryUsage memoryUsage() const;
|
||||
void setMemoryUsage(Dock::LayoutsMemoryUsage memoryUsage);
|
||||
|
||||
QHash<const Plasma::Containment *, Latte::View *> *currentDockViews() const;
|
||||
QHash<const Plasma::Containment *, Latte::View *> *layoutDockViews(const QString &layoutName) const;
|
||||
QHash<const Plasma::Containment *, Latte::View *> *currentLatteViews() const;
|
||||
QHash<const Plasma::Containment *, Latte::View *> *layoutLatteViews(const QString &layoutName) const;
|
||||
//! returns an active layout with that #id (name), it returns null if such
|
||||
//! layout cant be found
|
||||
Layout *activeLayout(QString id) const;
|
||||
|
@ -46,7 +46,7 @@ namespace ViewPart {
|
||||
|
||||
ContextMenu::ContextMenu(Latte::View *view) :
|
||||
QObject(view),
|
||||
m_dockView(view)
|
||||
m_latteView(view)
|
||||
{
|
||||
}
|
||||
|
||||
@ -61,14 +61,14 @@ QMenu *ContextMenu::menu()
|
||||
|
||||
void ContextMenu::menuAboutToHide()
|
||||
{
|
||||
if (!m_dockView) {
|
||||
if (!m_latteView) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_contextMenu = 0;
|
||||
|
||||
if (!m_dockView->containment()->isUserConfiguring()) {
|
||||
m_dockView->visibility()->setBlockHiding(false);
|
||||
if (!m_latteView->containment()->isUserConfiguring()) {
|
||||
m_latteView->visibility()->setBlockHiding(false);
|
||||
}
|
||||
|
||||
emit menuChanged();
|
||||
@ -78,7 +78,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
//qDebug() << "Step -1 ...";
|
||||
|
||||
if (!event || !m_dockView->containment()) {
|
||||
if (!event || !m_latteView->containment()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
QString trigger = Plasma::ContainmentActions::eventToString(event);
|
||||
|
||||
if (trigger == "RightButton;NoModifier") {
|
||||
Plasma::ContainmentActions *plugin = m_dockView->containment()->containmentActions().value(trigger);
|
||||
Plasma::ContainmentActions *plugin = m_latteView->containment()->containmentActions().value(trigger);
|
||||
|
||||
if (!plugin || plugin->contextualActions().isEmpty()) {
|
||||
event->setAccepted(false);
|
||||
@ -126,7 +126,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
updateAppletContainsMethod();
|
||||
}
|
||||
|
||||
foreach (Plasma::Applet *appletTemp, m_dockView->containment()->applets()) {
|
||||
foreach (Plasma::Applet *appletTemp, m_latteView->containment()->applets()) {
|
||||
PlasmaQuick::AppletQuickItem *ai = appletTemp->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
|
||||
bool appletContainsMouse = false;
|
||||
@ -137,7 +137,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
, Q_ARG(QVariant, appletTemp->id()), Q_ARG(QVariant, event->pos()));
|
||||
appletContainsMouse = retVal.toBool();
|
||||
} else {
|
||||
appletContainsMouse = ai->contains(ai->mapFromItem(m_dockView->contentItem(), event->pos()));
|
||||
appletContainsMouse = ai->contains(ai->mapFromItem(m_latteView->contentItem(), event->pos()));
|
||||
}
|
||||
|
||||
if (ai && ai->isVisible() && appletContainsMouse) {
|
||||
@ -156,7 +156,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
foreach (Plasma::Applet *appletCont, cont->applets()) {
|
||||
PlasmaQuick::AppletQuickItem *ai2 = appletCont->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
|
||||
if (ai2 && ai2->isVisible() && ai2->contains(ai2->mapFromItem(m_dockView->contentItem(), event->pos()))) {
|
||||
if (ai2 && ai2->isVisible() && ai2->contains(ai2->mapFromItem(m_latteView->contentItem(), event->pos()))) {
|
||||
applet = ai2->applet();
|
||||
break;
|
||||
}
|
||||
@ -171,7 +171,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
if (!applet && !inSystray) {
|
||||
applet = m_dockView->containment();
|
||||
applet = m_latteView->containment();
|
||||
}
|
||||
|
||||
//qDebug() << "3 ...";
|
||||
@ -191,7 +191,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
//end workaround
|
||||
|
||||
if (desktopMenu->winId()) {
|
||||
desktopMenu->windowHandle()->setTransientParent(m_dockView);
|
||||
desktopMenu->windowHandle()->setTransientParent(m_latteView);
|
||||
}
|
||||
|
||||
desktopMenu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
@ -199,9 +199,9 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
//! deprecated old code that can be removed if the following plasma approach doesn't
|
||||
//! create any issues with context menu creation in Latte
|
||||
/*if (m_dockView->mouseGrabberItem()) {
|
||||
/*if (m_latteView->mouseGrabberItem()) {
|
||||
//workaround, this fixes for me most of the right click menu behavior
|
||||
m_dockView->mouseGrabberItem()->ungrabMouse();
|
||||
m_latteView->mouseGrabberItem()->ungrabMouse();
|
||||
return;
|
||||
}*/
|
||||
|
||||
@ -215,8 +215,8 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
//by releasing manually we avoid that situation
|
||||
auto ungrabMouseHack = [this]() {
|
||||
if (m_dockView->mouseGrabberItem()) {
|
||||
m_dockView->mouseGrabberItem()->ungrabMouse();
|
||||
if (m_latteView->mouseGrabberItem()) {
|
||||
m_latteView->mouseGrabberItem()->ungrabMouse();
|
||||
}
|
||||
};
|
||||
|
||||
@ -233,13 +233,13 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
//qDebug() << "5 ...";
|
||||
|
||||
if (applet && applet != m_dockView->containment()) {
|
||||
if (applet && applet != m_latteView->containment()) {
|
||||
//qDebug() << "5.3 ...";
|
||||
emit applet->contextualActionsAboutToShow();
|
||||
addAppletActions(desktopMenu, applet, event);
|
||||
} else {
|
||||
//qDebug() << "5.6 ...";
|
||||
emit m_dockView->containment()->contextualActionsAboutToShow();
|
||||
emit m_latteView->containment()->contextualActionsAboutToShow();
|
||||
addContainmentActions(desktopMenu, event);
|
||||
}
|
||||
|
||||
@ -253,8 +253,8 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
//qDebug() << "6 ...";
|
||||
desktopMenu->adjustSize();
|
||||
|
||||
if (m_dockView->screen()) {
|
||||
const QRect scr = m_dockView->screen()->geometry();
|
||||
if (m_latteView->screen()) {
|
||||
const QRect scr = m_latteView->screen()->geometry();
|
||||
int smallStep = 3;
|
||||
int x = event->globalPos().x() + smallStep;
|
||||
int y = event->globalPos().y() + smallStep;
|
||||
@ -283,7 +283,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
connect(desktopMenu, SIGNAL(aboutToHide()), this, SLOT(menuAboutToHide()));
|
||||
m_dockView->visibility()->setBlockHiding(true);
|
||||
m_latteView->visibility()->setBlockHiding(true);
|
||||
desktopMenu->popup(pos);
|
||||
event->setAccepted(true);
|
||||
emit menuChanged();
|
||||
@ -305,7 +305,7 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
||||
//! update the appletContainsPos method from Panel view
|
||||
void ContextMenu::updateAppletContainsMethod()
|
||||
{
|
||||
for (QQuickItem *item : m_dockView->contentItem()->childItems()) {
|
||||
for (QQuickItem *item : m_latteView->contentItem()->childItems()) {
|
||||
if (auto *metaObject = item->metaObject()) {
|
||||
// not using QMetaObject::invokeMethod to avoid warnings when calling
|
||||
// this on applets that don't have it or other child items since this
|
||||
@ -326,7 +326,7 @@ void ContextMenu::updateAppletContainsMethod()
|
||||
|
||||
void ContextMenu::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, QEvent *event)
|
||||
{
|
||||
if (!m_dockView->containment()) {
|
||||
if (!m_latteView->containment()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -351,13 +351,13 @@ void ContextMenu::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, Q
|
||||
|
||||
QAction *appletAlternatives = applet->actions()->action(QStringLiteral("alternatives"));
|
||||
|
||||
if (appletAlternatives && appletAlternatives->isEnabled() && m_dockView->containment()->isUserConfiguring()) {
|
||||
if (appletAlternatives && appletAlternatives->isEnabled() && m_latteView->containment()->isUserConfiguring()) {
|
||||
desktopMenu->addAction(appletAlternatives);
|
||||
}
|
||||
}
|
||||
|
||||
QAction *containmentAction = desktopMenu->menuAction();
|
||||
containmentAction->setText(i18nc("%1 is the name of the containment", "%1 Options", m_dockView->containment()->title()));
|
||||
containmentAction->setText(i18nc("%1 is the name of the containment", "%1 Options", m_latteView->containment()->title()));
|
||||
|
||||
addContainmentActions(containmentAction->menu(), event);
|
||||
|
||||
@ -391,8 +391,8 @@ void ContextMenu::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, Q
|
||||
}
|
||||
}
|
||||
|
||||
if (m_dockView->containment()->immutability() == Plasma::Types::Mutable &&
|
||||
(m_dockView->containment()->containmentType() != Plasma::Types::PanelContainment || m_dockView->containment()->isUserConfiguring())) {
|
||||
if (m_latteView->containment()->immutability() == Plasma::Types::Mutable &&
|
||||
(m_latteView->containment()->containmentType() != Plasma::Types::PanelContainment || m_latteView->containment()->isUserConfiguring())) {
|
||||
QAction *closeApplet = applet->actions()->action(QStringLiteral("remove"));
|
||||
|
||||
//qDebug() << "checking for removal" << closeApplet;
|
||||
@ -409,11 +409,11 @@ void ContextMenu::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, Q
|
||||
|
||||
void ContextMenu::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
||||
{
|
||||
if (!m_dockView->containment()) {
|
||||
if (!m_latteView->containment()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_dockView->containment()->corona()->immutability() != Plasma::Types::Mutable &&
|
||||
if (m_latteView->containment()->corona()->immutability() != Plasma::Types::Mutable &&
|
||||
!KAuthorized::authorizeAction(QStringLiteral("plasma/containment_actions"))) {
|
||||
//qDebug() << "immutability";
|
||||
return;
|
||||
@ -422,17 +422,17 @@ void ContextMenu::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
||||
//this is what ContainmentPrivate::prepareContainmentActions was
|
||||
const QString trigger = Plasma::ContainmentActions::eventToString(event);
|
||||
//"RightButton;NoModifier"
|
||||
Plasma::ContainmentActions *plugin = m_dockView->containment()->containmentActions().value(trigger);
|
||||
Plasma::ContainmentActions *plugin = m_latteView->containment()->containmentActions().value(trigger);
|
||||
|
||||
if (!plugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin->containment() != m_dockView->containment()) {
|
||||
plugin->setContainment(m_dockView->containment());
|
||||
if (plugin->containment() != m_latteView->containment()) {
|
||||
plugin->setContainment(m_latteView->containment());
|
||||
// now configure it
|
||||
KConfigGroup cfg(m_dockView->containment()->corona()->config(), "ActionPlugins");
|
||||
cfg = KConfigGroup(&cfg, QString::number(m_dockView->containment()->containmentType()));
|
||||
KConfigGroup cfg(m_latteView->containment()->corona()->config(), "ActionPlugins");
|
||||
cfg = KConfigGroup(&cfg, QString::number(m_latteView->containment()->containmentType()));
|
||||
KConfigGroup pluginConfig = KConfigGroup(&cfg, trigger);
|
||||
plugin->restore(pluginConfig);
|
||||
}
|
||||
@ -447,7 +447,7 @@ void ContextMenu::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
||||
//end workaround
|
||||
|
||||
if (act->menu()->winId()) {
|
||||
act->menu()->windowHandle()->setTransientParent(m_dockView);
|
||||
act->menu()->windowHandle()->setTransientParent(m_latteView);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -459,7 +459,7 @@ void ContextMenu::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
||||
|
||||
Plasma::Containment *ContextMenu::containmentById(uint id)
|
||||
{
|
||||
foreach (auto containment, m_dockView->corona()->containments()) {
|
||||
foreach (auto containment, m_latteView->corona()->containments()) {
|
||||
if (id == containment->id()) {
|
||||
return containment;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ private:
|
||||
QMetaMethod m_appletContainsMethod;
|
||||
QQuickItem *m_appletContainsMethodItem{nullptr};
|
||||
|
||||
Latte::View *m_dockView;
|
||||
Latte::View *m_latteView;
|
||||
|
||||
friend class Latte::View;
|
||||
};
|
||||
|
@ -49,13 +49,13 @@ namespace Latte {
|
||||
|
||||
DockConfigView::DockConfigView(Plasma::Containment *containment, Latte::View *view, QWindow *parent)
|
||||
: PlasmaQuick::ConfigView(containment, parent),
|
||||
m_dockView(view)
|
||||
m_latteView(view)
|
||||
{
|
||||
m_corona = qobject_cast<DockCorona *>(m_dockView->containment()->corona());
|
||||
m_corona = qobject_cast<DockCorona *>(m_latteView->containment()->corona());
|
||||
|
||||
setupWaylandIntegration();
|
||||
|
||||
setScreen(m_dockView->screen());
|
||||
setScreen(m_latteView->screen());
|
||||
|
||||
if (containment) {
|
||||
setIcon(qGuiApp->windowIcon());
|
||||
@ -65,12 +65,12 @@ DockConfigView::DockConfigView(Plasma::Containment *containment, Latte::View *vi
|
||||
m_screenSyncTimer.setInterval(100);
|
||||
|
||||
connections << connect(&m_screenSyncTimer, &QTimer::timeout, this, [this]() {
|
||||
setScreen(m_dockView->screen());
|
||||
setScreen(m_latteView->screen());
|
||||
setFlags(wFlags());
|
||||
syncGeometry();
|
||||
syncSlideEffect();
|
||||
});
|
||||
connections << connect(m_dockView->visibility(), &VisibilityManager::modeChanged, this, &DockConfigView::syncGeometry);
|
||||
connections << connect(m_latteView->visibility(), &VisibilityManager::modeChanged, this, &DockConfigView::syncGeometry);
|
||||
connections << connect(containment, &Plasma::Containment::immutabilityChanged, this, &DockConfigView::immutabilityChanged);
|
||||
|
||||
m_thicknessSyncTimer.setSingleShot(true);
|
||||
@ -79,7 +79,7 @@ DockConfigView::DockConfigView(Plasma::Containment *containment, Latte::View *vi
|
||||
syncGeometry();
|
||||
});
|
||||
|
||||
connections << connect(m_dockView, &Latte::View::normalThicknessChanged, [&]() {
|
||||
connections << connect(m_latteView, &Latte::View::normalThicknessChanged, [&]() {
|
||||
m_thicknessSyncTimer.start();
|
||||
});
|
||||
|
||||
@ -112,7 +112,7 @@ void DockConfigView::init()
|
||||
setDefaultAlphaBuffer(true);
|
||||
setColor(Qt::transparent);
|
||||
PanelShadows::self()->addWindow(this);
|
||||
rootContext()->setContextProperty(QStringLiteral("dock"), m_dockView);
|
||||
rootContext()->setContextProperty(QStringLiteral("dock"), m_latteView);
|
||||
rootContext()->setContextProperty(QStringLiteral("dockConfig"), this);
|
||||
|
||||
if (m_corona) {
|
||||
@ -129,7 +129,7 @@ void DockConfigView::init()
|
||||
|
||||
updateEnabledBorders();
|
||||
|
||||
auto source = QUrl::fromLocalFile(m_dockView->containment()->corona()->kPackage().filePath(tempFilePath));
|
||||
auto source = QUrl::fromLocalFile(m_latteView->containment()->corona()->kPackage().filePath(tempFilePath));
|
||||
setSource(source);
|
||||
syncGeometry();
|
||||
syncSlideEffect();
|
||||
@ -171,9 +171,9 @@ void DockConfigView::createSecondaryWindow()
|
||||
return;
|
||||
}
|
||||
|
||||
QRect geometry = m_dockView->screenGeometry();
|
||||
QRect geometry = m_latteView->screenGeometry();
|
||||
|
||||
m_secConfigView = new DockSecConfigView(m_dockView, this);
|
||||
m_secConfigView = new DockSecConfigView(m_latteView, this);
|
||||
m_secConfigView->init();
|
||||
|
||||
if (m_secConfigView->geometryWhenVisible().intersects(geometryWhenVisible())) {
|
||||
@ -206,7 +206,7 @@ QRect DockConfigView::geometryWhenVisible() const
|
||||
|
||||
void DockConfigView::syncGeometry()
|
||||
{
|
||||
if (!m_dockView->managedLayout() || !m_dockView->containment() || !rootObject())
|
||||
if (!m_latteView->managedLayout() || !m_latteView->containment() || !rootObject())
|
||||
return;
|
||||
|
||||
const QSize size(rootObject()->width(), rootObject()->height());
|
||||
@ -214,14 +214,14 @@ void DockConfigView::syncGeometry()
|
||||
setMinimumSize(size);
|
||||
resize(size);
|
||||
|
||||
const auto location = m_dockView->containment()->location();
|
||||
const auto sGeometry = m_dockView->screenGeometry();
|
||||
const auto location = m_latteView->containment()->location();
|
||||
const auto sGeometry = m_latteView->screenGeometry();
|
||||
|
||||
int clearThickness = m_dockView->normalThickness() + m_dockView->fontPixelSize();
|
||||
int clearThickness = m_latteView->normalThickness() + m_latteView->fontPixelSize();
|
||||
|
||||
QPoint position{0, 0};
|
||||
|
||||
switch (m_dockView->containment()->formFactor()) {
|
||||
switch (m_latteView->containment()->formFactor()) {
|
||||
case Plasma::Types::Horizontal: {
|
||||
if (location == Plasma::Types::TopEdge) {
|
||||
position = {sGeometry.center().x() - size.width() / 2
|
||||
@ -273,12 +273,12 @@ void DockConfigView::syncGeometry()
|
||||
|
||||
void DockConfigView::syncSlideEffect()
|
||||
{
|
||||
if (!m_dockView->containment())
|
||||
if (!m_latteView->containment())
|
||||
return;
|
||||
|
||||
auto slideLocation = WindowSystem::Slide::None;
|
||||
|
||||
switch (m_dockView->containment()->location()) {
|
||||
switch (m_latteView->containment()->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
slideLocation = WindowSystem::Slide::Top;
|
||||
break;
|
||||
@ -315,8 +315,8 @@ void DockConfigView::showEvent(QShowEvent *ev)
|
||||
syncGeometry();
|
||||
syncSlideEffect();
|
||||
|
||||
if (m_dockView && m_dockView->containment())
|
||||
m_dockView->containment()->setUserConfiguring(true);
|
||||
if (m_latteView && m_latteView->containment())
|
||||
m_latteView->containment()->setUserConfiguring(true);
|
||||
|
||||
m_screenSyncTimer.start();
|
||||
QTimer::singleShot(400, this, &DockConfigView::syncGeometry);
|
||||
@ -326,25 +326,25 @@ void DockConfigView::showEvent(QShowEvent *ev)
|
||||
|
||||
void DockConfigView::hideEvent(QHideEvent *ev)
|
||||
{
|
||||
if (!m_dockView) {
|
||||
if (!m_latteView) {
|
||||
QQuickWindow::hideEvent(ev);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_dockView->containment())
|
||||
m_dockView->containment()->setUserConfiguring(false);
|
||||
if (m_latteView->containment())
|
||||
m_latteView->containment()->setUserConfiguring(false);
|
||||
|
||||
QQuickWindow::hideEvent(ev);
|
||||
|
||||
const auto mode = m_dockView->visibility()->mode();
|
||||
const auto previousDockWinBehavior = (m_dockView->flags() & Qt::BypassWindowManagerHint) ? false : true;
|
||||
const auto mode = m_latteView->visibility()->mode();
|
||||
const auto previousDockWinBehavior = (m_latteView->flags() & Qt::BypassWindowManagerHint) ? false : true;
|
||||
|
||||
if (mode == Dock::AlwaysVisible || mode == Dock::WindowsGoBelow) {
|
||||
if (!previousDockWinBehavior) {
|
||||
m_dockView->managedLayout()->recreateDock(m_dockView->containment());
|
||||
m_latteView->managedLayout()->recreateDock(m_latteView->containment());
|
||||
}
|
||||
} else if (m_dockView->dockWinBehavior() != previousDockWinBehavior) {
|
||||
m_dockView->managedLayout()->recreateDock(m_dockView->containment());
|
||||
} else if (m_latteView->dockWinBehavior() != previousDockWinBehavior) {
|
||||
m_latteView->managedLayout()->recreateDock(m_latteView->containment());
|
||||
}
|
||||
|
||||
deleteLater();
|
||||
@ -367,7 +367,7 @@ void DockConfigView::focusOutEvent(QFocusEvent *ev)
|
||||
|
||||
void DockConfigView::setupWaylandIntegration()
|
||||
{
|
||||
if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_dockView || !m_dockView->containment()) {
|
||||
if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_latteView || !m_latteView->containment()) {
|
||||
// already setup
|
||||
return;
|
||||
}
|
||||
@ -461,8 +461,8 @@ void DockConfigView::setShowInlineProperties(bool show)
|
||||
|
||||
void DockConfigView::addPanelSpacer()
|
||||
{
|
||||
if (m_dockView && m_dockView->containment()) {
|
||||
m_dockView->containment()->createApplet(QStringLiteral("org.kde.latte.spacer"));
|
||||
if (m_latteView && m_latteView->containment()) {
|
||||
m_latteView->containment()->createApplet(QStringLiteral("org.kde.latte.spacer"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,11 +482,11 @@ void DockConfigView::updateLaunchersForGroup(int groupInt)
|
||||
|
||||
//! when the layout/global launchers list is empty then the current dock launchers are used for them
|
||||
//! as a start point
|
||||
if (m_corona && m_dockView->managedLayout()) {
|
||||
if ((group == Dock::LayoutLaunchers && m_dockView->managedLayout()->launchers().isEmpty())
|
||||
if (m_corona && m_latteView->managedLayout()) {
|
||||
if ((group == Dock::LayoutLaunchers && m_latteView->managedLayout()->launchers().isEmpty())
|
||||
|| (group == Dock::GlobalLaunchers && m_corona->universalSettings()->launchers().isEmpty())) {
|
||||
|
||||
Plasma::Containment *c = m_dockView->containment();
|
||||
Plasma::Containment *c = m_latteView->containment();
|
||||
|
||||
const auto &applets = c->applets();
|
||||
|
||||
@ -520,7 +520,7 @@ void DockConfigView::updateLaunchersForGroup(int groupInt)
|
||||
|
||||
if (method.invoke(item, Q_RETURN_ARG(QVariant, launchers))) {
|
||||
if (group == Dock::LayoutLaunchers) {
|
||||
m_dockView->managedLayout()->setLaunchers(launchers.toStringList());
|
||||
m_latteView->managedLayout()->setLaunchers(launchers.toStringList());
|
||||
} else if (group == Dock::GlobalLaunchers) {
|
||||
m_corona->universalSettings()->setLaunchers(launchers.toStringList());
|
||||
}
|
||||
@ -549,7 +549,7 @@ void DockConfigView::updateEnabledBorders()
|
||||
|
||||
Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders;
|
||||
|
||||
switch (m_dockView->location()) {
|
||||
switch (m_latteView->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
borders &= m_inReverse ? ~Plasma::FrameSvg::BottomBorder : ~Plasma::FrameSvg::TopBorder;
|
||||
break;
|
||||
|
@ -128,7 +128,7 @@ private:
|
||||
|
||||
QRect m_geometryWhenVisible;
|
||||
|
||||
QPointer<Latte::View> m_dockView;
|
||||
QPointer<Latte::View> m_latteView;
|
||||
QPointer<DockSecConfigView> m_secConfigView;
|
||||
QTimer m_screenSyncTimer;
|
||||
QTimer m_thicknessSyncTimer;
|
||||
|
@ -48,16 +48,16 @@ namespace Latte {
|
||||
DockSecConfigView::DockSecConfigView(Latte::View *view, QWindow *parent)
|
||||
: QQuickView(nullptr),
|
||||
m_parent(parent),
|
||||
m_dockView(view)
|
||||
m_latteView(view)
|
||||
{
|
||||
m_corona = qobject_cast<DockCorona *>(m_dockView->containment()->corona());
|
||||
m_corona = qobject_cast<DockCorona *>(m_latteView->containment()->corona());
|
||||
|
||||
setupWaylandIntegration();
|
||||
|
||||
setResizeMode(QQuickView::SizeViewToRootObject);
|
||||
setScreen(m_dockView->screen());
|
||||
setScreen(m_latteView->screen());
|
||||
|
||||
if (m_dockView && m_dockView->containment()) {
|
||||
if (m_latteView && m_latteView->containment()) {
|
||||
setIcon(qGuiApp->windowIcon());
|
||||
}
|
||||
|
||||
@ -65,12 +65,12 @@ DockSecConfigView::DockSecConfigView(Latte::View *view, QWindow *parent)
|
||||
m_screenSyncTimer.setInterval(100);
|
||||
|
||||
connections << connect(&m_screenSyncTimer, &QTimer::timeout, this, [this]() {
|
||||
setScreen(m_dockView->screen());
|
||||
setScreen(m_latteView->screen());
|
||||
setFlags(wFlags());
|
||||
syncGeometry();
|
||||
syncSlideEffect();
|
||||
});
|
||||
connections << connect(m_dockView->visibility(), &VisibilityManager::modeChanged, this, &DockSecConfigView::syncGeometry);
|
||||
connections << connect(m_latteView->visibility(), &VisibilityManager::modeChanged, this, &DockSecConfigView::syncGeometry);
|
||||
|
||||
m_thicknessSyncTimer.setSingleShot(true);
|
||||
m_thicknessSyncTimer.setInterval(200);
|
||||
@ -78,7 +78,7 @@ DockSecConfigView::DockSecConfigView(Latte::View *view, QWindow *parent)
|
||||
syncGeometry();
|
||||
});
|
||||
|
||||
connections << connect(m_dockView, &Latte::View::normalThicknessChanged, [&]() {
|
||||
connections << connect(m_latteView, &Latte::View::normalThicknessChanged, [&]() {
|
||||
m_thicknessSyncTimer.start();
|
||||
});
|
||||
}
|
||||
@ -105,9 +105,9 @@ void DockSecConfigView::init()
|
||||
setDefaultAlphaBuffer(true);
|
||||
setColor(Qt::transparent);
|
||||
PanelShadows::self()->addWindow(this);
|
||||
rootContext()->setContextProperty(QStringLiteral("dock"), m_dockView);
|
||||
rootContext()->setContextProperty(QStringLiteral("dock"), m_latteView);
|
||||
rootContext()->setContextProperty(QStringLiteral("dockConfig"), this);
|
||||
rootContext()->setContextProperty(QStringLiteral("plasmoid"), m_dockView->containment()->property("_plasma_graphicObject").value<QObject *>());
|
||||
rootContext()->setContextProperty(QStringLiteral("plasmoid"), m_latteView->containment()->property("_plasma_graphicObject").value<QObject *>());
|
||||
|
||||
KDeclarative::KDeclarative kdeclarative;
|
||||
kdeclarative.setDeclarativeEngine(engine());
|
||||
@ -118,7 +118,7 @@ void DockSecConfigView::init()
|
||||
|
||||
updateEnabledBorders();
|
||||
|
||||
auto source = QUrl::fromLocalFile(m_dockView->containment()->corona()->kPackage().filePath(tempFilePath));
|
||||
auto source = QUrl::fromLocalFile(m_latteView->containment()->corona()->kPackage().filePath(tempFilePath));
|
||||
setSource(source);
|
||||
syncGeometry();
|
||||
syncSlideEffect();
|
||||
@ -139,7 +139,7 @@ QRect DockSecConfigView::geometryWhenVisible() const
|
||||
|
||||
void DockSecConfigView::syncGeometry()
|
||||
{
|
||||
if (!m_dockView->managedLayout() || !m_dockView->containment() || !rootObject())
|
||||
if (!m_latteView->managedLayout() || !m_latteView->containment() || !rootObject())
|
||||
return;
|
||||
|
||||
const QSize size(rootObject()->width(), rootObject()->height());
|
||||
@ -147,27 +147,27 @@ void DockSecConfigView::syncGeometry()
|
||||
setMinimumSize(size);
|
||||
resize(size);
|
||||
|
||||
const auto location = m_dockView->containment()->location();
|
||||
const auto sGeometry = m_dockView->screenGeometry();
|
||||
const auto location = m_latteView->containment()->location();
|
||||
const auto sGeometry = m_latteView->screenGeometry();
|
||||
|
||||
int clearThickness = m_dockView->normalThickness() + m_dockView->fontPixelSize();
|
||||
int clearThickness = m_latteView->normalThickness() + m_latteView->fontPixelSize();
|
||||
|
||||
int secondaryConfigSpacing = 2 * m_dockView->fontPixelSize();
|
||||
int secondaryConfigSpacing = 2 * m_latteView->fontPixelSize();
|
||||
|
||||
QPoint position{0, 0};
|
||||
|
||||
switch (m_dockView->containment()->formFactor()) {
|
||||
switch (m_latteView->containment()->formFactor()) {
|
||||
case Plasma::Types::Horizontal: {
|
||||
if (location == Plasma::Types::TopEdge) {
|
||||
int yPos = m_dockView->y() + clearThickness;
|
||||
int yPos = m_latteView->y() + clearThickness;
|
||||
|
||||
position = {m_dockView->x() + secondaryConfigSpacing, yPos};
|
||||
position = {m_latteView->x() + secondaryConfigSpacing, yPos};
|
||||
} else if (location == Plasma::Types::BottomEdge) {
|
||||
|
||||
int yPos;
|
||||
yPos = sGeometry.y() + sGeometry.height() - clearThickness - size.height();
|
||||
|
||||
position = {m_dockView->x() + m_dockView->width() - secondaryConfigSpacing - size.width(), yPos};
|
||||
position = {m_latteView->x() + m_latteView->width() - secondaryConfigSpacing - size.width(), yPos};
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -175,11 +175,11 @@ void DockSecConfigView::syncGeometry()
|
||||
case Plasma::Types::Vertical: {
|
||||
if (location == Plasma::Types::LeftEdge) {
|
||||
position = {sGeometry.x() + clearThickness
|
||||
, m_dockView->y() + secondaryConfigSpacing
|
||||
, m_latteView->y() + secondaryConfigSpacing
|
||||
};
|
||||
} else if (location == Plasma::Types::RightEdge) {
|
||||
position = {sGeometry.x() + sGeometry.width() - clearThickness - size.width()
|
||||
, m_dockView->y() + secondaryConfigSpacing
|
||||
, m_latteView->y() + secondaryConfigSpacing
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -203,12 +203,12 @@ void DockSecConfigView::syncGeometry()
|
||||
|
||||
void DockSecConfigView::syncSlideEffect()
|
||||
{
|
||||
if (!m_dockView->containment())
|
||||
if (!m_latteView->containment())
|
||||
return;
|
||||
|
||||
auto slideLocation = WindowSystem::Slide::None;
|
||||
|
||||
switch (m_dockView->containment()->location()) {
|
||||
switch (m_latteView->containment()->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
slideLocation = WindowSystem::Slide::Top;
|
||||
break;
|
||||
@ -270,7 +270,7 @@ void DockSecConfigView::focusOutEvent(QFocusEvent *ev)
|
||||
|
||||
void DockSecConfigView::setupWaylandIntegration()
|
||||
{
|
||||
if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_dockView || !m_dockView->containment()) {
|
||||
if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_latteView || !m_latteView->containment()) {
|
||||
// already setup
|
||||
return;
|
||||
}
|
||||
@ -352,7 +352,7 @@ void DockSecConfigView::updateEnabledBorders()
|
||||
|
||||
Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders;
|
||||
|
||||
switch (m_dockView->location()) {
|
||||
switch (m_latteView->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
borders &= ~Plasma::FrameSvg::TopBorder;
|
||||
break;
|
||||
|
@ -93,7 +93,7 @@ private:
|
||||
|
||||
QRect m_geometryWhenVisible;
|
||||
|
||||
QPointer<Latte::View> m_dockView;
|
||||
QPointer<Latte::View> m_latteView;
|
||||
QPointer<QWindow> m_parent;
|
||||
QTimer m_screenSyncTimer;
|
||||
QTimer m_thicknessSyncTimer;
|
||||
|
@ -589,7 +589,7 @@ void Positioner::initSignalingForLocationChangeSliding()
|
||||
m_view->showSettingsWindow();
|
||||
|
||||
if (m_view->managedLayout()) {
|
||||
m_view->managedLayout()->syncDockViewsToScreens();
|
||||
m_view->managedLayout()->syncLatteViewsToScreens();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -607,7 +607,7 @@ void Positioner::initSignalingForLocationChangeSliding()
|
||||
m_view->showSettingsWindow();
|
||||
|
||||
if (m_view->managedLayout()) {
|
||||
m_view->managedLayout()->syncDockViewsToScreens();
|
||||
m_view->managedLayout()->syncLatteViewsToScreens();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -40,7 +40,7 @@
|
||||
namespace Latte {
|
||||
|
||||
ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
|
||||
m_dockView(view)
|
||||
m_latteView(view)
|
||||
{
|
||||
setColor(QColor(Qt::transparent));
|
||||
setDefaultAlphaBuffer(true);
|
||||
@ -59,11 +59,11 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
|
||||
connect(this, &QQuickView::widthChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer);
|
||||
connect(this, &QQuickView::heightChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer);
|
||||
|
||||
connect(m_dockView, &Latte::View::absGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
|
||||
connect(m_dockView, &Latte::View::screenGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
|
||||
connect(m_dockView, &Latte::View::locationChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
|
||||
connect(m_dockView, &QQuickView::screenChanged, this, [this]() {
|
||||
setScreen(m_dockView->screen());
|
||||
connect(m_latteView, &Latte::View::absGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
|
||||
connect(m_latteView, &Latte::View::screenGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
|
||||
connect(m_latteView, &Latte::View::locationChanged, this, &ScreenEdgeGhostWindow::updateGeometry);
|
||||
connect(m_latteView, &QQuickView::screenChanged, this, [this]() {
|
||||
setScreen(m_latteView->screen());
|
||||
updateGeometry();
|
||||
});
|
||||
|
||||
@ -72,16 +72,16 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
|
||||
connect(this, &QWindow::visibleChanged, this, [&]() {
|
||||
//! IMPORTANT!!! ::: This fixes a bug when closing an Activity all docks from all Activities are
|
||||
//! disappearing! With this they reappear!!!
|
||||
if (m_dockView && m_dockView->managedLayout()) {
|
||||
if (m_latteView && m_latteView->managedLayout()) {
|
||||
if (!isVisible()) {
|
||||
QTimer::singleShot(100, [this]() {
|
||||
if (!m_inDelete && m_dockView && m_dockView->managedLayout() && !isVisible()) {
|
||||
if (!m_inDelete && m_latteView && m_latteView->managedLayout() && !isVisible()) {
|
||||
setVisible(true);
|
||||
}
|
||||
});
|
||||
|
||||
QTimer::singleShot(1500, [this]() {
|
||||
if (!m_inDelete && m_dockView && m_dockView->managedLayout() && !isVisible()) {
|
||||
if (!m_inDelete && m_latteView && m_latteView->managedLayout() && !isVisible()) {
|
||||
setVisible(true);
|
||||
}
|
||||
});
|
||||
@ -100,7 +100,7 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
|
||||
|
||||
setupWaylandIntegration();
|
||||
|
||||
setScreen(m_dockView->screen());
|
||||
setScreen(m_latteView->screen());
|
||||
setVisible(true);
|
||||
updateGeometry();
|
||||
hideWithMask();
|
||||
@ -109,7 +109,7 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(Latte::View *view) :
|
||||
ScreenEdgeGhostWindow::~ScreenEdgeGhostWindow()
|
||||
{
|
||||
m_inDelete = true;
|
||||
m_dockView = nullptr;
|
||||
m_latteView = nullptr;
|
||||
|
||||
if (m_shellSurface) {
|
||||
delete m_shellSurface;
|
||||
@ -118,12 +118,12 @@ ScreenEdgeGhostWindow::~ScreenEdgeGhostWindow()
|
||||
|
||||
int ScreenEdgeGhostWindow::location()
|
||||
{
|
||||
return (int)m_dockView->location();
|
||||
return (int)m_latteView->location();
|
||||
}
|
||||
|
||||
Latte::View *ScreenEdgeGhostWindow::parentDock()
|
||||
{
|
||||
return m_dockView;
|
||||
return m_latteView;
|
||||
}
|
||||
|
||||
KWayland::Client::PlasmaShellSurface *ScreenEdgeGhostWindow::surface()
|
||||
@ -136,26 +136,26 @@ void ScreenEdgeGhostWindow::updateGeometry()
|
||||
QRect newGeometry;
|
||||
int thickness{1};
|
||||
|
||||
if (m_dockView->location() == Plasma::Types::BottomEdge) {
|
||||
newGeometry.setX(m_dockView->absGeometry().left());
|
||||
newGeometry.setY(m_dockView->screenGeometry().bottom() - thickness);
|
||||
} else if (m_dockView->location() == Plasma::Types::TopEdge) {
|
||||
newGeometry.setX(m_dockView->absGeometry().left());
|
||||
newGeometry.setY(m_dockView->screenGeometry().top());
|
||||
} else if (m_dockView->location() == Plasma::Types::LeftEdge) {
|
||||
newGeometry.setX(m_dockView->screenGeometry().left());
|
||||
newGeometry.setY(m_dockView->absGeometry().top());
|
||||
} else if (m_dockView->location() == Plasma::Types::RightEdge) {
|
||||
newGeometry.setX(m_dockView->screenGeometry().right() - thickness);
|
||||
newGeometry.setY(m_dockView->absGeometry().top());
|
||||
if (m_latteView->location() == Plasma::Types::BottomEdge) {
|
||||
newGeometry.setX(m_latteView->absGeometry().left());
|
||||
newGeometry.setY(m_latteView->screenGeometry().bottom() - thickness);
|
||||
} else if (m_latteView->location() == Plasma::Types::TopEdge) {
|
||||
newGeometry.setX(m_latteView->absGeometry().left());
|
||||
newGeometry.setY(m_latteView->screenGeometry().top());
|
||||
} else if (m_latteView->location() == Plasma::Types::LeftEdge) {
|
||||
newGeometry.setX(m_latteView->screenGeometry().left());
|
||||
newGeometry.setY(m_latteView->absGeometry().top());
|
||||
} else if (m_latteView->location() == Plasma::Types::RightEdge) {
|
||||
newGeometry.setX(m_latteView->screenGeometry().right() - thickness);
|
||||
newGeometry.setY(m_latteView->absGeometry().top());
|
||||
}
|
||||
|
||||
if (m_dockView->formFactor() == Plasma::Types::Horizontal) {
|
||||
newGeometry.setWidth(qMin(m_dockView->absGeometry().width(), m_dockView->screenGeometry().width() - 1));
|
||||
if (m_latteView->formFactor() == Plasma::Types::Horizontal) {
|
||||
newGeometry.setWidth(qMin(m_latteView->absGeometry().width(), m_latteView->screenGeometry().width() - 1));
|
||||
newGeometry.setHeight(thickness + 1);
|
||||
} else {
|
||||
newGeometry.setWidth(thickness + 1);
|
||||
newGeometry.setHeight(qMin(m_dockView->absGeometry().height(), m_dockView->screenGeometry().height() - 1));
|
||||
newGeometry.setHeight(qMin(m_latteView->absGeometry().height(), m_latteView->screenGeometry().height() - 1));
|
||||
}
|
||||
|
||||
m_calculatedGeometry = newGeometry;
|
||||
@ -186,12 +186,12 @@ void ScreenEdgeGhostWindow::startGeometryTimer()
|
||||
|
||||
void ScreenEdgeGhostWindow::setupWaylandIntegration()
|
||||
{
|
||||
if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_dockView || !m_dockView->containment()) {
|
||||
if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_latteView || !m_latteView->containment()) {
|
||||
// already setup
|
||||
return;
|
||||
}
|
||||
|
||||
if (DockCorona *c = qobject_cast<DockCorona *>(m_dockView->containment()->corona())) {
|
||||
if (DockCorona *c = qobject_cast<DockCorona *>(m_latteView->containment()->corona())) {
|
||||
using namespace KWayland::Client;
|
||||
|
||||
PlasmaShell *interface = c->waylandDockCoronaInterface();
|
||||
|
@ -91,7 +91,7 @@ private:
|
||||
|
||||
QTimer m_fixGeometryTimer;
|
||||
|
||||
Latte::View *m_dockView{nullptr};
|
||||
Latte::View *m_latteView{nullptr};
|
||||
|
||||
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
|
||||
};
|
||||
|
@ -44,13 +44,13 @@ namespace Latte {
|
||||
VisibilityManagerPrivate::VisibilityManagerPrivate(PlasmaQuick::ContainmentView *view, VisibilityManager *q)
|
||||
: QObject(nullptr), q(q), view(view)
|
||||
{
|
||||
dockView = qobject_cast<Latte::View *>(view);
|
||||
m_latteView = qobject_cast<Latte::View *>(view);
|
||||
dockCorona = qobject_cast<DockCorona *>(view->corona());
|
||||
wm = dockCorona->wm();
|
||||
|
||||
if (dockView) {
|
||||
connect(dockView, &Latte::View::eventTriggered, this, &VisibilityManagerPrivate::viewEventManager);
|
||||
connect(dockView, &Latte::View::absGeometryChanged, this, &VisibilityManagerPrivate::setDockGeometry);
|
||||
if (m_latteView) {
|
||||
connect(m_latteView, &Latte::View::eventTriggered, this, &VisibilityManagerPrivate::viewEventManager);
|
||||
connect(m_latteView, &Latte::View::absGeometryChanged, this, &VisibilityManagerPrivate::setDockGeometry);
|
||||
}
|
||||
|
||||
timerStartUp.setInterval(5000);
|
||||
@ -129,22 +129,22 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
||||
switch (this->mode) {
|
||||
case Dock::AlwaysVisible: {
|
||||
//set wayland visibility mode
|
||||
if (dockView->surface()) {
|
||||
dockView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow);
|
||||
if (m_latteView->surface()) {
|
||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow);
|
||||
}
|
||||
|
||||
if (view->containment() && !dockView->inEditMode() && view->screen()) {
|
||||
if (view->containment() && !m_latteView->inEditMode() && view->screen()) {
|
||||
updateStrutsBasedOnLayoutsAndActivities();
|
||||
}
|
||||
|
||||
connections[0] = connect(view->containment(), &Plasma::Containment::locationChanged
|
||||
, this, [&]() {
|
||||
if (dockView->inEditMode())
|
||||
if (m_latteView->inEditMode())
|
||||
wm->removeDockStruts(*view);
|
||||
});
|
||||
connections[1] = connect(dockView, &Latte::View::inEditModeChanged
|
||||
connections[1] = connect(m_latteView, &Latte::View::inEditModeChanged
|
||||
, this, [&]() {
|
||||
if (!dockView->inEditMode() && !dockView->positioner()->inLocationChangeAnimation() && view->screen())
|
||||
if (!m_latteView->inEditMode() && !m_latteView->positioner()->inLocationChangeAnimation() && view->screen())
|
||||
wm->setDockStruts(*view, dockGeometry, view->containment()->location());
|
||||
});
|
||||
|
||||
@ -153,7 +153,7 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
||||
updateStrutsBasedOnLayoutsAndActivities();
|
||||
});
|
||||
|
||||
connections[3] = connect(dockView, &Latte::View::activitiesChanged, this, [&]() {
|
||||
connections[3] = connect(m_latteView, &Latte::View::activitiesChanged, this, [&]() {
|
||||
updateStrutsBasedOnLayoutsAndActivities();
|
||||
});
|
||||
}
|
||||
@ -164,8 +164,8 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
||||
|
||||
case Dock::AutoHide: {
|
||||
//set wayland visibility mode
|
||||
if (dockView->surface()) {
|
||||
dockView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||
if (m_latteView->surface()) {
|
||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||
}
|
||||
|
||||
raiseDock(containsMouse);
|
||||
@ -174,8 +174,8 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
||||
|
||||
case Dock::DodgeActive: {
|
||||
//set wayland visibility mode
|
||||
if (dockView->surface()) {
|
||||
dockView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||
if (m_latteView->surface()) {
|
||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||
}
|
||||
|
||||
connections[0] = connect(wm, &WindowSystem::activeWindowChanged
|
||||
@ -188,8 +188,8 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
||||
|
||||
case Dock::DodgeMaximized: {
|
||||
//set wayland visibility mode
|
||||
if (dockView->surface()) {
|
||||
dockView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||
if (m_latteView->surface()) {
|
||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||
}
|
||||
|
||||
connections[0] = connect(wm, &WindowSystem::activeWindowChanged
|
||||
@ -202,8 +202,8 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
||||
|
||||
case Dock::DodgeAllWindows: {
|
||||
//set wayland visibility mode
|
||||
if (dockView->surface()) {
|
||||
dockView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||
if (m_latteView->surface()) {
|
||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||
}
|
||||
|
||||
for (const auto &wid : wm->windows()) {
|
||||
@ -230,8 +230,8 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
||||
case Dock::WindowsGoBelow:
|
||||
|
||||
//set wayland visibility mode
|
||||
if (dockView->surface()) {
|
||||
dockView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow);
|
||||
if (m_latteView->surface()) {
|
||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -250,8 +250,8 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
||||
void VisibilityManagerPrivate::updateStrutsBasedOnLayoutsAndActivities()
|
||||
{
|
||||
bool multipleLayoutsAndCurrent = (dockCorona->layoutManager()->memoryUsage() == Dock::MultipleLayouts
|
||||
&& dockView->managedLayout() && !dockView->positioner()->inLocationChangeAnimation()
|
||||
&& dockView->managedLayout()->name() == dockCorona->layoutManager()->currentLayoutName());
|
||||
&& m_latteView->managedLayout() && !m_latteView->positioner()->inLocationChangeAnimation()
|
||||
&& m_latteView->managedLayout()->name() == dockCorona->layoutManager()->currentLayoutName());
|
||||
|
||||
if (dockCorona->layoutManager()->memoryUsage() == Dock::SingleLayout || multipleLayoutsAndCurrent) {
|
||||
wm->setDockStruts(*view, dockGeometry, view->location());
|
||||
@ -293,8 +293,8 @@ inline void VisibilityManagerPrivate::setIsHidden(bool isHidden)
|
||||
if (q->supportsKWinEdges()) {
|
||||
bool inCurrentLayout = (dockCorona->layoutManager()->memoryUsage() == Dock::SingleLayout ||
|
||||
(dockCorona->layoutManager()->memoryUsage() == Dock::MultipleLayouts
|
||||
&& dockView->managedLayout() && !dockView->positioner()->inLocationChangeAnimation()
|
||||
&& dockView->managedLayout()->name() == dockCorona->layoutManager()->currentLayoutName()));
|
||||
&& m_latteView->managedLayout() && !m_latteView->positioner()->inLocationChangeAnimation()
|
||||
&& m_latteView->managedLayout()->name() == dockCorona->layoutManager()->currentLayoutName()));
|
||||
|
||||
if (inCurrentLayout) {
|
||||
wm->setEdgeStateFor(edgeGhostWindow, isHidden);
|
||||
@ -415,7 +415,7 @@ inline void VisibilityManagerPrivate::setDockGeometry(const QRect &geometry)
|
||||
|
||||
this->dockGeometry = geometry;
|
||||
|
||||
if (mode == Dock::AlwaysVisible && !dockView->inEditMode() && view->screen()) {
|
||||
if (mode == Dock::AlwaysVisible && !m_latteView->inEditMode() && view->screen()) {
|
||||
updateStrutsBasedOnLayoutsAndActivities();
|
||||
}
|
||||
}
|
||||
@ -803,7 +803,7 @@ void VisibilityManagerPrivate::updateAvailableScreenGeometry()
|
||||
return;
|
||||
}
|
||||
|
||||
int currentScrId = dockView->positioner()->currentScreenId();
|
||||
int currentScrId = m_latteView->positioner()->currentScreenId();
|
||||
QRect tempAvailableScreenGeometry = dockCorona->availableScreenRectWithCriteria(currentScrId, {Dock::AlwaysVisible}, {});
|
||||
|
||||
if (tempAvailableScreenGeometry != availableScreenGeometry) {
|
||||
@ -885,7 +885,7 @@ bool VisibilityManagerPrivate::isTouchingPanelEdge(const WindowInfoWrap &winfo)
|
||||
if (winfo.isValid() && !winfo.isMinimized() && wm->isOnCurrentDesktop(winfo.wid()) && wm->isOnCurrentActivity(winfo.wid())) {
|
||||
bool touchingPanelEdge{false};
|
||||
|
||||
QRect screenGeometry = dockView->screenGeometry();
|
||||
QRect screenGeometry = m_latteView->screenGeometry();
|
||||
bool inCurrentScreen{screenGeometry.contains(winfo.geometry().topLeft()) || screenGeometry.contains(winfo.geometry().bottomRight())};
|
||||
|
||||
if (inCurrentScreen) {
|
||||
@ -1008,7 +1008,7 @@ void VisibilityManagerPrivate::updateKWinEdgesSupport()
|
||||
void VisibilityManagerPrivate::createEdgeGhostWindow()
|
||||
{
|
||||
if (!edgeGhostWindow) {
|
||||
edgeGhostWindow = new ScreenEdgeGhostWindow(dockView);
|
||||
edgeGhostWindow = new ScreenEdgeGhostWindow(m_latteView);
|
||||
|
||||
wm->setDockExtraFlags(*edgeGhostWindow);
|
||||
|
||||
@ -1022,8 +1022,8 @@ void VisibilityManagerPrivate::createEdgeGhostWindow()
|
||||
this, [&]() {
|
||||
bool inCurrentLayout = (dockCorona->layoutManager()->memoryUsage() == Dock::SingleLayout ||
|
||||
(dockCorona->layoutManager()->memoryUsage() == Dock::MultipleLayouts
|
||||
&& dockView->managedLayout() && !dockView->positioner()->inLocationChangeAnimation()
|
||||
&& dockView->managedLayout()->name() == dockCorona->layoutManager()->currentLayoutName()));
|
||||
&& m_latteView->managedLayout() && !m_latteView->positioner()->inLocationChangeAnimation()
|
||||
&& m_latteView->managedLayout()->name() == dockCorona->layoutManager()->currentLayoutName()));
|
||||
|
||||
if (edgeGhostWindow) {
|
||||
if (inCurrentLayout) {
|
||||
@ -1058,7 +1058,7 @@ void VisibilityManagerPrivate::requestToggleMaximizeForActiveWindow()
|
||||
WindowInfoWrap actInfo = wm->requestInfoActive();
|
||||
|
||||
//active window can be toggled only when it is in the same screen
|
||||
if (actInfo.isValid() && !actInfo.geometry().isNull() && dockView->screenGeometry().contains(actInfo.geometry().center())) {
|
||||
if (actInfo.isValid() && !actInfo.geometry().isNull() && m_latteView->screenGeometry().contains(actInfo.geometry().center())) {
|
||||
wm->requestToggleMaximized(actInfo.wid());
|
||||
}
|
||||
}
|
||||
@ -1068,8 +1068,8 @@ void VisibilityManagerPrivate::requestMoveActiveWindow(int localX, int localY)
|
||||
WindowInfoWrap actInfo = wm->requestInfoActive();
|
||||
|
||||
//active window can be dragged only when it is in the same screen
|
||||
if (actInfo.isValid() && !actInfo.geometry().isNull() && dockView->screenGeometry().contains(actInfo.geometry().center())) {
|
||||
QPoint globalPoint{dockView->x() + localX, dockView->y() + localY};
|
||||
if (actInfo.isValid() && !actInfo.geometry().isNull() && m_latteView->screenGeometry().contains(actInfo.geometry().center())) {
|
||||
QPoint globalPoint{m_latteView->x() + localX, m_latteView->y() + localY};
|
||||
wm->requestMoveWindow(actInfo.wid(), globalPoint);
|
||||
}
|
||||
}
|
||||
@ -1079,7 +1079,7 @@ bool VisibilityManagerPrivate::activeWindowCanBeDragged()
|
||||
WindowInfoWrap actInfo = wm->requestInfoActive();
|
||||
|
||||
//active window can be dragged only when it is in the same screen
|
||||
if (actInfo.isValid() && !actInfo.geometry().isNull() && dockView->screenGeometry().contains(actInfo.geometry().center())) {
|
||||
if (actInfo.isValid() && !actInfo.geometry().isNull() && m_latteView->screenGeometry().contains(actInfo.geometry().center())) {
|
||||
return wm->windowCanBeDragged(actInfo.wid());
|
||||
}
|
||||
|
||||
@ -1093,10 +1093,10 @@ bool VisibilityManagerPrivate::activeWindowCanBeDragged()
|
||||
VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
|
||||
: d(new VisibilityManagerPrivate(view, this))
|
||||
{
|
||||
Latte::View *dockView = qobject_cast<Latte::View *>(view);
|
||||
Latte::View *m_latteView = qobject_cast<Latte::View *>(view);
|
||||
|
||||
if (dockView) {
|
||||
connect(this, &VisibilityManager::modeChanged, dockView->corona(), &Plasma::Corona::availableScreenRectChanged);
|
||||
if (m_latteView) {
|
||||
connect(this, &VisibilityManager::modeChanged, m_latteView->corona(), &Plasma::Corona::availableScreenRectChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public:
|
||||
ScreenEdgeGhostWindow *edgeGhostWindow{nullptr};
|
||||
|
||||
DockCorona *dockCorona{nullptr};
|
||||
Latte::View *dockView{nullptr};
|
||||
Latte::View *m_latteView{nullptr};
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user