only do the resizing when we actually need to

svn path=/trunk/KDE/kdelibs/; revision=1110789
This commit is contained in:
Aaron J. Seigo 2010-04-04 01:55:56 +00:00
parent 46c6e72e4b
commit 8b23c1a4ab
2 changed files with 18 additions and 5 deletions

View File

@ -366,13 +366,12 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
if (gWidget) { if (gWidget) {
Corona *corona = qobject_cast<Corona *>(gWidget->scene()); Corona *corona = qobject_cast<Corona *>(gWidget->scene());
//could that cast ever fail??
if (corona) { if (corona) {
corona->addOffscreenWidget(gWidget); corona->addOffscreenWidget(gWidget);
dialog->setGraphicsWidget(gWidget);
gWidget->resize(gWidget->preferredSize());
} }
dialog->setGraphicsWidget(gWidget);
gWidget->resize(gWidget->preferredSize());
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | (gWidget->windowFlags() & Qt::X11BypassWindowManagerHint)); dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | (gWidget->windowFlags() & Qt::X11BypassWindowManagerHint));
} else if (qWidget) { } else if (qWidget) {
QVBoxLayout *l_layout = new QVBoxLayout(dialog); QVBoxLayout *l_layout = new QVBoxLayout(dialog);
@ -385,6 +384,7 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
} }
restoreDialogSize();
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager); KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
dialog->installEventFilter(q); dialog->installEventFilter(q);
@ -694,14 +694,13 @@ void PopupAppletPrivate::dialogStatusChanged(bool status)
q->popupEvent(status); q->popupEvent(status);
} }
void PopupAppletPrivate::updateDialogPosition() void PopupAppletPrivate::restoreDialogSize()
{ {
Plasma::Dialog *dialog = dialogPtr.data(); Plasma::Dialog *dialog = dialogPtr.data();
if (!dialog) { if (!dialog) {
return; return;
} }
Corona *corona = qobject_cast<Corona *>(q->scene()); Corona *corona = qobject_cast<Corona *>(q->scene());
if (!corona) { if (!corona) {
return; return;
@ -732,6 +731,19 @@ void PopupAppletPrivate::updateDialogPosition()
if (saved.width() != dialog->width() || saved.height() != dialog->height()) { if (saved.width() != dialog->width() || saved.height() != dialog->height()) {
dialog->resize(saved); dialog->resize(saved);
} }
}
void PopupAppletPrivate::updateDialogPosition()
{
Plasma::Dialog *dialog = dialogPtr.data();
if (!dialog) {
return;
}
Corona *corona = qobject_cast<Corona *>(q->scene());
if (!corona) {
return;
}
QGraphicsView *view = q->view(); QGraphicsView *view = q->view();
if (!view) { if (!view) {

View File

@ -38,6 +38,7 @@ public:
void clearPopupLostFocus(); void clearPopupLostFocus();
void dialogSizeChanged(); void dialogSizeChanged();
void dialogStatusChanged(bool status); void dialogStatusChanged(bool status);
void restoreDialogSize();
void updateDialogPosition(); void updateDialogPosition();
void popupConstraintsEvent(Plasma::Constraints constraints); void popupConstraintsEvent(Plasma::Constraints constraints);
void checkExtenderAppearance(Plasma::FormFactor f); void checkExtenderAppearance(Plasma::FormFactor f);