diff options
Diffstat (limited to 'kde-base/plasma-workspace/files/plasma-workspace-4.6.2-panelplacement.patch')
-rw-r--r-- | kde-base/plasma-workspace/files/plasma-workspace-4.6.2-panelplacement.patch | 350 |
1 files changed, 350 insertions, 0 deletions
diff --git a/kde-base/plasma-workspace/files/plasma-workspace-4.6.2-panelplacement.patch b/kde-base/plasma-workspace/files/plasma-workspace-4.6.2-panelplacement.patch new file mode 100644 index 000000000000..e9c049ec40d3 --- /dev/null +++ b/kde-base/plasma-workspace/files/plasma-workspace-4.6.2-panelplacement.patch @@ -0,0 +1,350 @@ +diff --git a/plasma/desktop/shell/panelview.cpp b/plasma/desktop/shell/panelview.cpp +index 9e76304..ac1425a 100644 +--- a/plasma/desktop/shell/panelview.cpp ++++ b/plasma/desktop/shell/panelview.cpp +@@ -20,6 +20,7 @@ + #include "panelview.h" + + #include <QApplication> ++#include <QDesktopWidget> + #include <QGraphicsLinearLayout> + #include <QPropertyAnimation> + #include <QTimer> +@@ -29,9 +30,8 @@ + #include <X11/extensions/shape.h> + #endif + +-#include <KDebug> +-#include <KIdleTime> + #include <KWindowSystem> ++#include <KDebug> + + #include <Plasma/Containment> + #include <Plasma/Corona> +@@ -309,7 +309,6 @@ PanelView::PanelView(Plasma::Containment *panel, int id, QWidget *parent) + m_glowBar(0), + m_mousePollTimer(0), + m_strutsTimer(new QTimer(this)), +- m_rehideAfterAutounhideTimer(new QTimer(this)), + m_spacer(0), + m_spacerIndex(-1), + m_shadowWindow(0), +@@ -319,8 +318,7 @@ PanelView::PanelView(Plasma::Containment *panel, int id, QWidget *parent) + m_visibilityMode(NormalPanel), + m_lastHorizontal(true), + m_editing(false), +- m_triggerEntered(false), +- m_respectStatus(true) ++ m_triggerEntered(false) + { + // KWin setup + KWindowSystem::setOnAllDesktops(winId(), true); +@@ -330,13 +328,11 @@ PanelView::PanelView(Plasma::Containment *panel, int id, QWidget *parent) + m_strutsTimer->setSingleShot(true); + connect(m_strutsTimer, SIGNAL(timeout()), this, SLOT(updateStruts())); + +- // this timer controls checks to re-hide a panel after it's been unhidden +- // for the user because, e.g., something is demanding attention +- m_rehideAfterAutounhideTimer->setSingleShot(true); +- connect(m_rehideAfterAutounhideTimer, SIGNAL(timeout()), this, SLOT(checkAutounhide())); +- + // Graphics view setup + setFrameStyle(QFrame::NoFrame); ++ //setAutoFillBackground(true); ++ //setDragMode(QGraphicsView::RubberBandDrag); ++ //setCacheMode(QGraphicsView::CacheBackground); + setInteractive(true); + setAcceptDrops(true); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +@@ -356,20 +352,10 @@ PanelView::PanelView(Plasma::Containment *panel, int id, QWidget *parent) + + const bool onScreen = panel->screen() < PlasmaApp::self()->corona()->numScreens(); + const QRect screenRect = onScreen ? PlasmaApp::self()->corona()->screenGeometry(panel->screen()) : QRect(); +- const int sw = screenRect.width(); +- const int sh = screenRect.height(); +- m_lastSeenSize = sizes.readEntry("lastsize", m_lastHorizontal ? sw : sh); +- +- if (onScreen) { +- const QString last = m_lastHorizontal ? "Horizontal" + QString::number(sw) : +- "Vertical" + QString::number(sh); +- if (sizes.hasGroup(last)) { +- KConfigGroup thisSize(&sizes, last); +- resize(thisSize.readEntry("size", m_lastHorizontal ? QSize(sw, 27) : QSize(27, sh))); +- } +- } else { ++ if (!onScreen) { + resize(panel->size().toSize()); + } ++ m_lastSeenSize = sizes.readEntry("lastsize", m_lastHorizontal ? screenRect.width() : screenRect.height()); + + m_alignment = alignmentFilter((Qt::Alignment)viewConfig.readEntry("Alignment", (int)Qt::AlignLeft)); + KConfigGroup sizeConfig(&viewConfig, (m_lastHorizontal ? "Horizontal" : "Vertical") + +@@ -413,7 +399,7 @@ void PanelView::setContainment(Plasma::Containment *containment) + disconnect(oldContainment); + } + +- connect(containment, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(statusUpdated(Plasma::ItemStatus))); ++ connect(containment, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(setStatus(Plasma::ItemStatus))); + connect(containment, SIGNAL(destroyed(QObject*)), this, SLOT(panelDeleted())); + connect(containment, SIGNAL(toolBoxToggled()), this, SLOT(togglePanelController())); + connect(containment, SIGNAL(appletAdded(Plasma::Applet *, const QPointF &)), this, SLOT(appletAdded(Plasma::Applet *))); +@@ -436,6 +422,10 @@ void PanelView::setContainment(Plasma::Containment *containment) + + // ensure we aren't overlapping other panels + const QRect screenRect = PlasmaApp::self()->corona()->screenGeometry(containment->screen()); ++ const QRegion availGeom = PlasmaApp::self()->corona()->availableScreenRegion(containment->screen()); ++ const int w = containment->size().width(); ++ const int h = containment->size().height(); ++ const int length = containment->formFactor() == Plasma::Horizontal ? w : h; + + View::setContainment(containment); + +@@ -448,11 +438,6 @@ void PanelView::setContainment(Plasma::Containment *containment) + + updateStruts(); + checkShadow(); +- +- // if we are an autohiding panel, then see if the status mandates we do something about it +- if (m_visibilityMode != NormalPanel && m_visibilityMode != WindowsGoBelow) { +- checkUnhide(containment->status()); +- } + } + + void PanelView::themeChanged() +@@ -463,7 +448,6 @@ void PanelView::themeChanged() + + void PanelView::checkShadow() + { +-#ifndef Q_WS_WIN + if (KWindowSystem::compositingActive() && containment()->property("shadowPath").isValid()) { + if (!m_shadowWindow) { + m_shadowWindow = new ShadowWindow(this); +@@ -478,11 +462,12 @@ void PanelView::checkShadow() + if (m_shadowWindow->isValid() && isVisible()) { + m_shadowWindow->show(); + } +- } else if (m_shadowWindow) { +- m_shadowWindow->deleteLater(); +- m_shadowWindow = 0; ++ } else { ++ if (m_shadowWindow) { ++ m_shadowWindow->deleteLater(); ++ m_shadowWindow = 0; ++ } + } +-#endif + } + + void PanelView::setPanelDragPosition(const QPoint &point) +@@ -709,6 +694,8 @@ void PanelView::updatePanelGeometry() + geom.moveTopLeft(QPoint(screenGeom.center().x() - geom.width()/2 + 1 - geom.width()%2 + m_offset, screenGeom.top())); + } + ++ //enable borders if needed ++ //c->setGeometry(QRect(geom.left(), c->geometry().top(), geom.width(), geom.height())); + break; + + case Plasma::LeftEdge: +@@ -720,6 +707,8 @@ void PanelView::updatePanelGeometry() + geom.moveTopLeft(QPoint(screenGeom.left(), screenGeom.center().y() - geom.height()/2 + 1 - geom.height()%2 + m_offset)); + } + ++ //enable borders if needed ++ //c->setGeometry(QRect(c->geometry().left(), geom.top(), geom.width(), geom.height())); + break; + + case Plasma::RightEdge: +@@ -731,6 +720,8 @@ void PanelView::updatePanelGeometry() + geom.moveTopRight(QPoint(screenGeom.right(), screenGeom.center().y() - geom.height()/2 + 1 - geom.height()%2 + m_offset)); + } + ++ //enable borders if needed ++ //c->setGeometry(QRect(c->geometry().left(), geom.top(), geom.width(), geom.height())); + break; + + case Plasma::BottomEdge: +@@ -743,6 +734,8 @@ void PanelView::updatePanelGeometry() + geom.moveBottomLeft(QPoint(screenGeom.center().x() - geom.width()/2 + 1 - geom.width()%2 + m_offset, screenGeom.bottom())); + } + ++ //enable borders if needed ++ //c->setGeometry(QRect(geom.left(), c->geometry().top(), geom.width(), geom.height())); + break; + } + +@@ -818,7 +811,8 @@ void PanelView::pinchContainment(const QRect &screenGeom) + KConfigGroup sizes = config(); + sizes = KConfigGroup(&sizes, "Sizes"); + +- if (m_lastHorizontal != horizontal || m_lastSeenSize != (horizontal ? sw : sh)) { ++ if (m_lastHorizontal != horizontal || ++ m_lastSeenSize != (horizontal ? sw : sh)) { + // we're adjusting size. store the current size now + KConfigGroup lastSize(&sizes, (m_lastHorizontal ? "Horizontal" : "Vertical") + + QString::number(m_lastSeenSize)); +@@ -1032,23 +1026,17 @@ void PanelView::togglePanelController() + } + } + +- if (m_panelController->isVisible()) { +- if (m_panelController->showingWidgetExplorer() || +- m_panelController->showingActivityManager()) { +- m_panelController->switchToController(); +- m_panelController->move(m_panelController->positionForPanelGeometry(geometry())); +- } else { +- Plasma::WindowEffects::slideWindow(m_panelController, location()); +- m_panelController->close(); +- updateStruts(); +- } +- } else { ++ if (!m_panelController->isVisible()) { + m_editing = true; + m_panelController->resize(m_panelController->sizeHint()); + m_panelController->move(m_panelController->positionForPanelGeometry(geometry())); + Plasma::WindowEffects::slideWindow(m_panelController, location()); + kDebug() << "showing panel controller!" << m_panelController->geometry(); + m_panelController->show(); ++ } else { ++ Plasma::WindowEffects::slideWindow(m_panelController, location()); ++ m_panelController->close(); ++ updateStruts(); + } + } + +@@ -1438,7 +1426,7 @@ void PanelView::unhide(bool destroyTrigger) + } + } + +-void PanelView::statusUpdated(Plasma::ItemStatus newStatus) ++void PanelView::setStatus(Plasma::ItemStatus newStatus) + { + if (newStatus == Plasma::AcceptingInputStatus) { + KWindowSystem::forceActiveWindow(winId()); +@@ -1447,50 +1435,14 @@ void PanelView::statusUpdated(Plasma::ItemStatus newStatus) + + void PanelView::checkUnhide(Plasma::ItemStatus newStatus) + { +- //kDebug() << "================= got a status: " << newStatus << Plasma::ActiveStatus; +- m_respectStatus = true; +- ++ //kDebug() << "================= got a new status: " << newStatus << Plasma::ActiveStatus; + if (newStatus > Plasma::ActiveStatus) { + unhide(); +- if (newStatus == Plasma::NeedsAttentionStatus) { +- //kDebug() << "starting the timer!"; +- // start our rehide timer, so that the panel doesn't stay up and stuck forever and a day +- m_rehideAfterAutounhideTimer->start(AUTOUNHIDE_CHECK_DELAY); +- } + } else { +- //kDebug() << "new status, just autohiding"; + startAutoHide(); + } + } + +-void PanelView::checkAutounhide() +-{ +- //kDebug() << "***************************" << KIdleTime::instance()->idleTime(); +- if (KIdleTime::instance()->idleTime() >= AUTOUNHIDE_CHECK_DELAY) { +- // the user is idle .. let's not hige the panel on them quite yet, but rather given them a +- // chance to see this thing! +- connect(KIdleTime::instance(), SIGNAL(resumingFromIdle()), this, SLOT(checkAutounhide()), +- Qt::UniqueConnection); +- KIdleTime::instance()->catchNextResumeEvent(); +- //kDebug() << "exit 1 ***************************"; +- return; +- } +- +- m_respectStatus = false; +- //kDebug() << "in to check ... who's resonsible?" << sender() << KIdleTime::instance(); +- if (sender() == KIdleTime::instance()) { +- //kDebug() << "doing a 2s wait"; +- QTimer::singleShot(2000, this, SLOT(startAutoHide())); +- } else { +- //kDebug() << "just starting autohide!"; +- startAutoHide(); +- } +- +- // this line must come after the check on sender() as it *clears* that value! +- disconnect(KIdleTime::instance(), SIGNAL(resumingFromIdle()), this, SLOT(checkAutounhide())); +- //kDebug() << "exit 0 ***************************"; +-} +- + void PanelView::unhide() + { + unhide(true); +@@ -1503,31 +1455,10 @@ void PanelView::resetTriggerEnteredSuppression() + + void PanelView::startAutoHide() + { +- /* +- kDebug() << m_editing << (containment() ? containment()->status() : 0) << Plasma::ActiveStatus +- << geometry().adjusted(-10, -10, 10, 10).contains(QCursor::pos()) << hasPopup(); +- if (containment() && containment()->status() > Plasma::ActiveStatus) { +- foreach (Plasma::Applet *applet, containment()->applets()) { +- kDebug() << " " << applet->name() << applet->status(); +- } +- } +- */ +- +- +- if (m_editing || (m_respectStatus && (containment() && containment()->status() > Plasma::ActiveStatus))) { +- if (m_mousePollTimer) { +- m_mousePollTimer->stop(); +- disconnect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(startAutoHide())); +- } +- +- return; +- } +- +- // since we've gotten this far, we don't need to worry about rehiding-after-auto-unhide, so just +- // stop the timer +- m_rehideAfterAutounhideTimer->stop(); +- +- if (geometry().adjusted(-10, -10, 10, 10).contains(QCursor::pos()) || hasPopup()) { ++ //TODO: is 5s too long? not long enough? ++ if (m_editing || (containment() && containment()->status() > Plasma::ActiveStatus) || ++ geometry().adjusted(-10, -10, 10, 10).contains(QCursor::pos()) || ++ hasPopup()) { + if (!m_mousePollTimer) { + leaveEvent(0); + } +diff --git a/plasma/desktop/shell/panelview.h b/plasma/desktop/shell/panelview.h +index 9bdf780..c4be6b4 100644 +--- a/plasma/desktop/shell/panelview.h ++++ b/plasma/desktop/shell/panelview.h +@@ -141,7 +141,7 @@ public Q_SLOTS: + /** + * Decides whether give focus to the panel + */ +- void statusUpdated(Plasma::ItemStatus newStatus); ++ void setStatus(Plasma::ItemStatus newStatus); + + /** + * Pinches the min/max sizes of the containment to the current screen resolution +@@ -240,7 +240,6 @@ private Q_SLOTS: + void overlayMoved(PanelAppletOverlay *overlay); + void panelDeleted(); + void startAutoHide(); +- void checkAutounhide(); + + /** + * update the appearance of the unhide hinter +@@ -270,7 +269,6 @@ private: + GlowBar *m_glowBar; + QTimer *m_mousePollTimer; + QTimer *m_strutsTimer; +- QTimer *m_rehideAfterAutounhideTimer; + QTimeLine *m_timeLine; + QGraphicsWidget *m_spacer; + int m_spacerIndex; +@@ -292,10 +290,7 @@ private: + + bool m_editing : 1; + bool m_triggerEntered : 1; +- bool m_respectStatus : 1; +- + static const int STRUTSTIMERDELAY = 200; +- static const int AUTOUNHIDE_CHECK_DELAY = 3000; + }; + + #endif |