disable borders near to the edge of the screen for extenders too

svn path=/trunk/KDE/kdelibs/; revision=1206154
This commit is contained in:
Marco Martin 2010-12-13 16:15:49 +00:00
parent 6855137e40
commit e04e91e9ad
3 changed files with 32 additions and 2 deletions

View File

@ -271,7 +271,7 @@ void DialogPrivate::checkBorders(bool updateMaskIfNeeded)
}
//decide if to disable the other borders
if (!extender && q->isVisible()) {
if (q->isVisible()) {
QRect geom;
if (applet) {
geom = screenGeom;
@ -298,6 +298,15 @@ void DialogPrivate::checkBorders(bool updateMaskIfNeeded)
if (!extender) {
background->getMargins(leftWidth, topHeight, rightWidth, bottomHeight);
} else {
FrameSvg::EnabledBorders disabledBorders = FrameSvg::NoBorder;
if (!(borders & FrameSvg::LeftBorder)) {
disabledBorders |= FrameSvg::LeftBorder;
}
if (!(borders & FrameSvg::RightBorder)) {
disabledBorders |= FrameSvg::RightBorder;
}
extender->d->setDisabledBordersHint(disabledBorders);
}
//kDebug() << leftWidth << topHeight << rightWidth << bottomHeight;
@ -313,7 +322,7 @@ void DialogPrivate::checkBorders(bool updateMaskIfNeeded)
}
q->update();
}
}
resizeChecksWithBorderCheck = false;
}

View File

@ -20,6 +20,7 @@
#include "extender.h"
#include <QAction>
#include <QDesktopWidget>
#include <QLabel>
#include <QGraphicsSceneDragDropEvent>
#include <QGraphicsGridLayout>
@ -29,6 +30,7 @@
#include "applet.h"
#include "containment.h"
#include "corona.h"
#include "dialog.h"
#include "extendergroup.h"
#include "extenderitem.h"
#include "framesvg.h"
@ -626,6 +628,10 @@ FrameSvg::EnabledBorders Extender::enabledBordersForItem(ExtenderItem *item) con
}
}
//someone (i.e. a Dialog) told the extender to disable some border?
borders &= ~d->disabledBordersHint;
return borders;
}
@ -633,6 +639,7 @@ ExtenderPrivate::ExtenderPrivate(Applet *applet, Extender *extender) :
q(extender),
applet(applet),
background(new FrameSvg(extender)),
disabledBordersHint(FrameSvg::NoBorder),
currentSpacerIndex(-1),
spacerWidget(0),
emptyExtenderMessage(QString()),
@ -896,6 +903,18 @@ void ExtenderPrivate::viewportGeometryChanged(const QRectF &rect)
}
}
void ExtenderPrivate::setDisabledBordersHint(const FrameSvg::EnabledBorders borders)
{
if (disabledBordersHint == borders) {
return;
}
disabledBordersHint = borders;
foreach (Plasma::ExtenderItem *item, attachedExtenderItems) {
item->d->themeChanged();
}
}
bool Extender::isEmpty() const
{
//It's empty if it doesn't have items or has only group that are empty and autohide

View File

@ -77,6 +77,7 @@ class ExtenderPrivate
void adjustMinimumSize();
void setPositionFromDragPosition(const QPointF &pos);
ExtenderGroup *findGroup(const QString &name) const;
void setDisabledBordersHint(const FrameSvg::EnabledBorders borders);
Extender *q;
@ -85,6 +86,7 @@ class ExtenderPrivate
QGraphicsWidget *mainWidget;
QGraphicsLinearLayout *layout;
FrameSvg *background;
FrameSvg::EnabledBorders disabledBordersHint;
int currentSpacerIndex;
Spacer *spacerWidget;