[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/desktop/shell
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2010-12-15 22:04:33
Message-ID: 20101215220433.B4F64AC8A8 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1206789 by aseigo:
there were two ways of storing/reading the offset (globally in Offset and \
per-resolution in offset) and three implementations of calculating offsets that \
respect screen boundaries (only one of which repsected panel alignment settings). \
remove all the duplication, make things consistent ... offsets now work properly and \
reliably. with 69 fewer lines of code that we started with. best kind of bug fix, \
really ;) BUG:228031
M +14 -85 panelview.cpp
--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/panelview.cpp #1206788:1206789
@@ -360,7 +360,9 @@
m_lastSeenSize = sizes.readEntry("lastsize", m_lastHorizontal ? \
screenRect.width() : screenRect.height());
m_alignment = alignmentFilter((Qt::Alignment)viewConfig.readEntry("Alignment", \
(int)Qt::AlignLeft));
- m_offset = viewConfig.readEntry("Offset", 0);
+ KConfigGroup sizeConfig(&viewConfig, (m_lastHorizontal ? "Horizontal" : \
"Vertical") + + QString::number(m_lastSeenSize));
+ m_offset = sizeConfig.readEntry("offset", 0);
setVisibilityMode((VisibilityMode)viewConfig.readEntry("panelVisibility", \
(int)m_visibilityMode));
connect(this, SIGNAL(sceneRectAboutToChange()), this, \
SLOT(pinchContainmentToCurrentScreen())); @@ -428,35 +430,6 @@
View::setContainment(containment);
- switch (location()) {
- case Plasma::LeftEdge: {
- QRect r = availGeom.intersected(QRect(0, m_offset, w, \
length)).boundingRect();
- if (m_offset != r.top()) {
- setOffset(r.top());
- }
- }
- break;
-
- case Plasma::RightEdge: {
- QRect r = availGeom.intersected(QRect(screenRect.right() - w, m_offset, \
w, length)).boundingRect();
- setOffset(r.top());
- }
- break;
-
- case Plasma::TopEdge: {
- QRect r = availGeom.intersected(QRect(m_offset, 0, length, \
h)).boundingRect();
- setOffset(r.left());
- }
- break;
-
- case Plasma::BottomEdge:
- default: {
- QRect r = availGeom.intersected(QRect(m_offset, screenRect.bottom() - h, \
length, h)).boundingRect();
- setOffset(r.left());
- }
- break;
- }
-
// pinchContainment calls updatePanelGeometry for us
pinchContainment(screenRect);
m_lastMin = containment->minimumSize();
@@ -567,7 +540,6 @@
const QRect screenRect = \
PlasmaApp::self()->corona()->screenGeometry(c->screen()); \
pinchContainment(screenRect); KWindowSystem::setOnAllDesktops(winId(), true);
- //updatePanelGeometry();
connect(this, SIGNAL(sceneRectAboutToChange()), this, \
SLOT(pinchContainmentToCurrentScreen())); }
@@ -826,6 +798,7 @@
disconnect(this, SIGNAL(sceneRectAboutToChange()), this, \
SLOT(pinchContainmentToCurrentScreen())); bool horizontal = isHorizontal();
+ const int oldOffset = m_offset;
const int sw = screenGeom.width();
const int sh = screenGeom.height();
@@ -895,57 +868,7 @@
// the minimum and maximum sizes.
//kDebug() << "checking panel" << c->geometry() << "against" << screenGeom;
- if (horizontal) {
- //kDebug() << "becoming horizontal with" << m_offset << min.width() << \
max.width() << sw;
- if (m_offset + min.width() > sw) {
- //kDebug() << "min size is too wide!";
- if (min.width() > sw) {
- c->setMinimumSize(sw, min.height());
- } else {
- m_offset = sw - int(min.width());
- }
- }
- // 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) {
- c->setMaximumSize(sw, max.height());
- } else {
- m_offset = sw - int(max.width());
- }
- }
- } else {
- if (m_offset + min.height() > sh) {
- //kDebug() << "min size is too tall!";
- if (min.height() > sh) {
- c->setMinimumSize(min.width(), sh);
- } else {
- m_offset = sh - int(min.height());
- }
- }
-
- // 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) {
- c->setMaximumSize(max.width(), sh);
- } else {
- m_offset = sh - int(max.height());
- }
- }
- }
-
// 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()) {
@@ -964,6 +887,11 @@
updatePanelGeometry();
+ if (m_offset != oldOffset) {
+ sizes.writeEntry("offset", m_lastSeenSize);
+ configNeedsSaving();
+ }
+
if (m_panelController) {
m_panelController->setOffset(m_offset);
}
@@ -976,14 +904,15 @@
void PanelView::setOffset(int newOffset)
{
m_offset = newOffset;
- KConfigGroup viewConfig = config();
- viewConfig.writeEntry("Offset", m_offset);
- containment()->update();
-
//TODO: do we ever need to worry about pinching here, or
// do we just assume that the offset is always < screenSize - \
containmentSize? updatePanelGeometry();
+
+ KConfigGroup viewConfig = config();
+ viewConfig = KConfigGroup(&viewConfig, (m_lastHorizontal ? "Horizontal" : \
"Vertical") + + QString::number(m_lastSeenSize));
+ viewConfig.writeEntry("offset", m_offset);
configNeedsSaving();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic