[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.2/kdebase/workspace/plasma/shells/desktop
From: Aike J. Sommer <dev () aikesommer ! name>
Date: 2009-03-22 19:34:55
Message-ID: 1237750495.863494.4597.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 942883 by asommer:
Backport 937003 and 938069.
- update struts when the framebuffer is resized
- create PanelView instances only when the screen they are for is active
- destroy PanelViews when their screen is deactivated
Use mouse-poll-timer for auto-hide, even if no popup is open. This makes the
panel stay, if the pointer only leaves for a few ms.
Correctly resize new panels to the screen they are created on.
BUG:181441
BUG:185471
BUG:179131
BUG:178066
M +14 -0 desktopcorona.cpp
M +34 -21 panelview.cpp
M +23 -15 plasmaapp.cpp
--- branches/KDE/4.2/kdebase/workspace/plasma/shells/desktop/desktopcorona.cpp #942882:942883
@@ -83,6 +83,20 @@
emit containmentAdded(c);
}
}
+
+ if (signalWhenExists) {
+ foreach (Plasma::Containment * c, containments()) {
+ if (c->screen() != screen) {
+ continue;
+ }
+
+ Plasma::Containment::Type t = c->containmentType();
+ if (t == Plasma::Containment::PanelContainment ||
+ t == Plasma::Containment::CustomPanelContainment) {
+ emit containmentAdded(c);
+ }
+ }
+ }
}
void DesktopCorona::addDesktopContainment(int screen, int desktop)
--- branches/KDE/4.2/kdebase/workspace/plasma/shells/desktop/panelview.cpp #942882:942883
@@ -214,7 +214,7 @@
kDebug() << "Panel geometry is" << panel->geometry();
}
- connect(this, SIGNAL(sceneRectAboutToChange()), this, SLOT(updatePanelGeometry()));
+ connect(this, SIGNAL(sceneRectAboutToChange()), this, SLOT(pinchContainmentToCurrentScreen()));
// Graphics view setup
setFrameStyle(QFrame::NoFrame);
@@ -277,6 +277,10 @@
this, SLOT(pinchContainmentToCurrentScreen()));
connect(screens, SIGNAL(screenMoved(Kephal::Screen *, QPoint, QPoint)),
this, SLOT(updatePanelGeometry()));
+ connect(screens, SIGNAL(screenAdded(Kephal::Screen *)),
+ this, SLOT(updateStruts()));
+ connect(screens, SIGNAL(screenRemoved(int)),
+ this, SLOT(updateStruts()));
}
void PanelView::setLocation(Plasma::Location location)
@@ -327,7 +331,7 @@
}
//kDebug() << "!!!!!!!!!!!!!!!!!! about to set to" << location << panelHeight << formFactor;
- disconnect(this, SIGNAL(sceneRectAboutToChange()), this, SLOT(updatePanelGeometry()));
+ disconnect(this, SIGNAL(sceneRectAboutToChange()), this, SLOT(pinchContainmentToCurrentScreen()));
c->setFormFactor(formFactor);
c->setLocation(location);
@@ -343,7 +347,7 @@
pinchContainment(screenRect);
KWindowSystem::setOnAllDesktops(winId(), true);
//updatePanelGeometry();
- connect(this, SIGNAL(sceneRectAboutToChange()), this, SLOT(updatePanelGeometry()));
+ connect(this, SIGNAL(sceneRectAboutToChange()), this, SLOT(pinchContainmentToCurrentScreen()));
}
Plasma::Location PanelView::location() const
@@ -421,9 +425,6 @@
switch (location()) {
case Plasma::TopEdge:
case Plasma::BottomEdge:
- if (m_alignment != Qt::AlignCenter) {
- m_offset = qMax(m_offset, 0);
- }
//resize the panel if is too large
if (geom.width() > screenGeom.width()) {
geom.setWidth(screenGeom.width());
@@ -449,9 +450,6 @@
case Plasma::LeftEdge:
case Plasma::RightEdge:
- if (m_alignment != Qt::AlignCenter) {
- m_offset = qMax(m_offset, 0);
- }
//resize the panel if is too tall
if (geom.height() > screenGeom.height()) {
geom.setHeight(screenGeom.height());
@@ -652,6 +650,12 @@
}
}
+ // if the maximum-size is 0, set it to 100%
+ if (max.width() <= 0) {
+ c->setMaximumSize(sw, max.height());
+ max = c->maximumSize();
+ }
+
if (m_offset + max.width() > sw) {
//kDebug() << "max size is too wide!";
if (max.width() > sw) {
@@ -670,6 +674,12 @@
}
}
+ // if the maximum-size is 0, set it to 100%
+ if (max.height() <= 0) {
+ c->setMaximumSize(max.width(), sh);
+ max = c->maximumSize();
+ }
+
if (m_offset + max.height() > sh) {
//kDebug() << "max size is too tall!";
if (max.height() > sh) {
@@ -680,6 +690,12 @@
}
}
+ // resize to max if for some reason the size is empty
+ // otherwise its not possible to interact with the panel at all
+ if (c->size().isEmpty()) {
+ c->resize(max);
+ }
+
if (m_lastHorizontal != horizontal ||
m_lastSeenSize != (horizontal ? sw : sh)) {
m_lastHorizontal = horizontal;
@@ -1118,19 +1134,16 @@
createUnhideTrigger();
}
} else if (m_visibilityMode == AutoHide && !m_editting) {
- // try not to hide if we have an associated popup or window about
- if (hasPopup()) {
- // don't hide yet, but start polling to see when we should
- if (!m_mousePollTimer) {
- m_mousePollTimer = new QTimer(this);
- }
+ // even if we dont have a popup, we'll start a timer, so
+ // that the panel stays if the mouse only leaves for a
+ // few ms
+ if (!m_mousePollTimer) {
+ m_mousePollTimer = new QTimer(this);
+ }
- disconnect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(hideMousePoll()));
- connect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(hideMousePoll()));
- m_mousePollTimer->start(200);
- } else {
- startAutoHide();
- }
+ disconnect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(hideMousePoll()));
+ connect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(hideMousePoll()));
+ m_mousePollTimer->start(200);
}
Plasma::View::leaveEvent(event);
--- branches/KDE/4.2/kdebase/workspace/plasma/shells/desktop/plasmaapp.cpp #942882:942883
@@ -470,19 +470,16 @@
}
}
- /*
- TODO: remove panels when screen goes away.
- first, however, we need to be able to reserve and restore the panelsettings
- even when the view itself goes away
- QMutableListIterator<PanelView*> it(m_panels);
- while (it.hasNext()) {
- PanelView *panel = it.next();
- if (panel->screen() == i) {
+ QMutableListIterator<PanelView*> pIt(m_panels);
+ while (pIt.hasNext()) {
+ PanelView *panel = pIt.next();
+ if (panel->screen() == id) {
+ kDebug() << "removing a panel for screen" << id;
+ panel->setContainment(0);
+ pIt.remove();
delete panel;
- it.remove();
}
}
- */
}
DesktopView* PlasmaApp::viewForScreen(int screen, int desktop) const
@@ -616,11 +613,13 @@
WId viewWindow = 0;
if (isPanelContainment(containment)) {
- PanelView *panelView = new PanelView(containment, id);
- viewWindow = panelView->winId();
- connect(panelView, SIGNAL(destroyed(QObject*)), this, SLOT(panelRemoved(QObject*)));
- m_panels << panelView;
- panelView->show();
+ if (containment->screen() < Kephal::ScreenUtils::numScreens()) {
+ PanelView *panelView = new PanelView(containment, id);
+ viewWindow = panelView->winId();
+ connect(panelView, SIGNAL(destroyed(QObject*)), this, SLOT(panelRemoved(QObject*)));
+ m_panels << panelView;
+ panelView->show();
+ }
} else if (containment->screen() > -1 &&
containment->screen() < Kephal::ScreenUtils::numScreens()) {
DesktopView *view = viewForScreen(containment->screen(), containment->desktop());
@@ -660,6 +659,15 @@
void PlasmaApp::containmentAdded(Plasma::Containment *containment)
{
+ if (isPanelContainment(containment)) {
+ foreach (PanelView * panel, m_panels) {
+ if (panel->containment() == containment) {
+ kDebug() << "not creating second PanelView with existing Containment!!";
+ return;
+ }
+ }
+ }
+
createView(containment);
disconnect(containment, 0, this, 0);
connect(containment, SIGNAL(zoomRequested(Plasma::Containment*,Plasma::ZoomDirection)),
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic