From 8b23c1a4ab9b3c7350d043ee3464817541d2aac2 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Sun, 4 Apr 2010 01:55:56 +0000 Subject: [PATCH] only do the resizing when we actually need to svn path=/trunk/KDE/kdelibs/; revision=1110789 --- popupapplet.cpp | 22 +++++++++++++++++----- private/popupapplet_p.h | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/popupapplet.cpp b/popupapplet.cpp index 7f1bf9d54..d3f8276b6 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -366,13 +366,12 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints) if (gWidget) { Corona *corona = qobject_cast(gWidget->scene()); - //could that cast ever fail?? if (corona) { 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)); } else if (qWidget) { QVBoxLayout *l_layout = new QVBoxLayout(dialog); @@ -385,6 +384,7 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints) dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); } + restoreDialogSize(); KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager); dialog->installEventFilter(q); @@ -694,14 +694,13 @@ void PopupAppletPrivate::dialogStatusChanged(bool status) q->popupEvent(status); } -void PopupAppletPrivate::updateDialogPosition() +void PopupAppletPrivate::restoreDialogSize() { Plasma::Dialog *dialog = dialogPtr.data(); if (!dialog) { return; } - Corona *corona = qobject_cast(q->scene()); if (!corona) { return; @@ -732,6 +731,19 @@ void PopupAppletPrivate::updateDialogPosition() if (saved.width() != dialog->width() || saved.height() != dialog->height()) { dialog->resize(saved); } +} + +void PopupAppletPrivate::updateDialogPosition() +{ + Plasma::Dialog *dialog = dialogPtr.data(); + if (!dialog) { + return; + } + + Corona *corona = qobject_cast(q->scene()); + if (!corona) { + return; + } QGraphicsView *view = q->view(); if (!view) { diff --git a/private/popupapplet_p.h b/private/popupapplet_p.h index 7b36c16b2..9bf88feaa 100644 --- a/private/popupapplet_p.h +++ b/private/popupapplet_p.h @@ -38,6 +38,7 @@ public: void clearPopupLostFocus(); void dialogSizeChanged(); void dialogStatusChanged(bool status); + void restoreDialogSize(); void updateDialogPosition(); void popupConstraintsEvent(Plasma::Constraints constraints); void checkExtenderAppearance(Plasma::FormFactor f);