diff --git a/CMakeLists.txt b/CMakeLists.txt index e4ffbbc20..06cb9dd2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -432,8 +432,6 @@ install(FILES install(FILES data/knewstuff/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) -install(FILES data/kconfig_updates/plasma_popupapplet_fix_groups.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR}) -install(PROGRAMS data/kconfig_updates/plasma_popupapplet_fix_groups.pl DESTINATION ${KCONF_UPDATE_INSTALL_DIR}) install(FILES data/operations/dataengineservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) install(FILES data/operations/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) install(FILES data/operations/storage.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) diff --git a/corona.cpp b/corona.cpp index 541319981..887a02b37 100644 --- a/corona.cpp +++ b/corona.cpp @@ -112,7 +112,7 @@ void Corona::saveLayout(const QString &configName) const if (configName.isEmpty() || configName == d->configName) { c = config(); } else { - c = KSharedConfig::openConfig(configName); + c = KSharedConfig::openConfig(configName, KConfig::SimpleConfig); } d->saveLayout(c); @@ -329,7 +329,7 @@ void Corona::clearContainments() KSharedConfigPtr Corona::config() const { if (!d->config) { - d->config = KSharedConfig::openConfig(d->configName); + d->config = KSharedConfig::openConfig(d->configName, KConfig::SimpleConfig); } return d->config; @@ -595,6 +595,7 @@ QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s, Qt::Alig } pos.rx() = qMax(0, pos.x()); + pos.ry() = qMax(0, pos.y()); return pos; } diff --git a/data/kconfig_updates/plasma_popupapplet_fix_groups.pl b/data/kconfig_updates/plasma_popupapplet_fix_groups.pl deleted file mode 100755 index 4a9f0f913..000000000 --- a/data/kconfig_updates/plasma_popupapplet_fix_groups.pl +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/perl - -while(<>) { - if ($_ =~ m/^\[.*\[Configuration\]\[PopupApplet\]$/) { - print "# DELETEGROUP $_"; - $_ =~ s/\[Configuration\]\[PopupApplet\]$/[PopupApplet]/; - } - print $_; -} diff --git a/data/kconfig_updates/plasma_popupapplet_fix_groups.upd b/data/kconfig_updates/plasma_popupapplet_fix_groups.upd deleted file mode 100644 index 677288b4f..000000000 --- a/data/kconfig_updates/plasma_popupapplet_fix_groups.upd +++ /dev/null @@ -1,12 +0,0 @@ -# Fix groups of the form ...[Configuration][PopupApplet] into ...[PopupApplet] -Id=PlasmaPopupAppletFixGroups1 -File=plasma-appletsrc -Script=plasma_popupapplet_fix_groups.pl,perl -# -Id=PlasmaPopupAppletFixGroups2 -File=plasmarc -Script=plasma_popupapplet_fix_groups.pl,perl -# -Id=PlasmaPopupAppletFixGroups3 -File=plasmoidviewer-appletsrc -Script=plasma_popupapplet_fix_groups.pl,perl diff --git a/dialog.cpp b/dialog.cpp index de04d22f4..775ae6ab5 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -472,8 +472,27 @@ void Dialog::mouseMoveEvent(QMouseEvent *event) break; } - if ((newWidth >= minimumSize().width()) && (newHeight >= minimumSize().height())) { - setGeometry(QRect(position, QSize(newWidth, newHeight))); + QRect newGeom(position, QSize(newWidth, newHeight)); + + // now sanity check the resize results again min constraints, if any + if (d->leftResizeMin > -1 && newGeom.left() > d->leftResizeMin) { + newGeom.setLeft(d->leftResizeMin); + } + + if (d->topResizeMin > -1 && newGeom.top() > d->topResizeMin) { + newGeom.setTop(d->topResizeMin); + } + + if (d->rightResizeMin > -1 && newGeom.right() < d->rightResizeMin) { + newGeom.setRight(d->rightResizeMin); + } + + if (d->bottomResizeMin > -1 && newGeom.bottom() < d->bottomResizeMin) { + newGeom.setBottom(d->bottomResizeMin); + } + + if ((newGeom.width() >= minimumSize().width()) && (newGeom.height() >= minimumSize().height())) { + setGeometry(newGeom); } } @@ -500,9 +519,9 @@ void Dialog::mousePressEvent(QMouseEvent *event) void Dialog::mouseReleaseEvent(QMouseEvent *event) { if (d->resizeStartCorner != Dialog::NoCorner) { + emit dialogResized(); d->resizeStartCorner = Dialog::NoCorner; unsetCursor(); - emit dialogResized(); } QWidget::mouseReleaseEvent(event); @@ -726,6 +745,38 @@ Dialog::ResizeCorners Dialog::resizeCorners() const return d->resizeCorners; } +bool Dialog::isUserResizing() const +{ + return d->resizeStartCorner > NoCorner; +} + +void Dialog::setMinimumResizeLimits(int left, int top, int right, int bottom) +{ + d->leftResizeMin = left; + d->topResizeMin = top; + d->rightResizeMin = right; + d->bottomResizeMin = bottom; +} + +void Dialog::getMinimumResizeLimits(int *left, int *top, int *right, int *bottom) +{ + if (left) { + *left = d->leftResizeMin; + } + + if (top) { + *top = d->topResizeMin; + } + + if (right) { + *right = d->rightResizeMin; + } + + if (bottom) { + *bottom = d->bottomResizeMin; + } +} + void Dialog::animatedHide(Plasma::Direction direction) { if (!isVisible()) { diff --git a/dialog.h b/dialog.h index 53353ea91..8a0ced8e1 100644 --- a/dialog.h +++ b/dialog.h @@ -97,6 +97,31 @@ class PLASMA_EXPORT Dialog : public QWidget */ ResizeCorners resizeCorners() const; + /** + * @return true if currently being resized by the user + */ + bool isUserResizing() const; + + /** + * Sets the minimum values that each of four sides of the rect may expand to or from + * + * @param left the screen coordinate that the left may not go beyond; -1 for no limit + * @param top the screen coordinate that the top may not go beyond; -1 for no limit + * @param right the screen coordinate that the right may not go beyond; -1 for no limit + * @param bottom the screen coordinate that the bottom may not go beyond; -1 for no limit + */ + void setMinimumResizeLimits(int left, int top, int right, int bottom); + + /** + * Retrives the minimum resize limits for the dialog + * + * @param left the screen coordinate that the left may not go beyond; -1 for no limit + * @param top the screen coordinate that the top may not go beyond; -1 for no limit + * @param right the screen coordinate that the right may not go beyond; -1 for no limit + * @param bottom the screen coordinate that the bottom may not go beyond; -1 for no limit + */ + void getMinimumResizeLimits(int *left, int *top, int *right, int *bottom); + /** * Causes an animated hide; requires compositing to work, otherwise * the dialog will simply hide. diff --git a/popupapplet.cpp b/popupapplet.cpp index 27f9d1f76..abe554b6f 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -523,6 +523,9 @@ void PopupApplet::timerEvent(QTimerEvent *event) d->autohideTimer->stop(); } } + } else if (event->timerId() == d->showDialogTimer.timerId()) { + d->showDialogTimer.stop(); + d->showDialog(); } else { Applet::timerEvent(event); } @@ -530,6 +533,7 @@ void PopupApplet::timerEvent(QTimerEvent *event) void PopupApplet::hidePopup() { + d->showDialogTimer.stop(); d->delayedShowTimer.stop(); Dialog *dialog = d->dialogPtr.data(); @@ -669,24 +673,34 @@ void PopupAppletPrivate::internalTogglePopup(bool fromActivatedSignal) } ToolTipManager::self()->hide(q); - updateDialogPosition(); + showDialogTimer.start(0, q); + } +} - KWindowSystem::setOnAllDesktops(dialog->winId(), true); - KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager); +void PopupAppletPrivate::showDialog() +{ + Plasma::Dialog *dialog = dialogPtr.data(); + if (!dialog) { + return; + } - if (icon) { - dialog->setAspectRatioMode(savedAspectRatio); - } + updateDialogPosition(); - if (q->location() != Floating) { - dialog->animatedShow(locationToDirection(q->location())); - } else { - dialog->show(); - } + KWindowSystem::setOnAllDesktops(dialog->winId(), true); + KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager); - if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) { - KWindowSystem::activateWindow(dialog->winId()); - } + if (icon) { + dialog->setAspectRatioMode(savedAspectRatio); + } + + if (q->location() != Floating) { + dialog->animatedShow(locationToDirection(q->location())); + } else { + dialog->show(); + } + + if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) { + KWindowSystem::activateWindow(dialog->winId()); } } @@ -720,7 +734,7 @@ void PopupAppletPrivate::dialogSizeChanged() sizeGroup.writeEntry("DialogHeight", dialog->height()); sizeGroup.writeEntry("DialogWidth", dialog->width()); - updateDialogPosition(); + updateDialogPosition(!dialog->isUserResizing()); emit q->configNeedsSaving(); emit q->appletTransformedByUser(); @@ -810,7 +824,7 @@ void PopupAppletPrivate::restoreDialogSize() } } -void PopupAppletPrivate::updateDialogPosition() +void PopupAppletPrivate::updateDialogPosition(bool move) { Plasma::Dialog *dialog = dialogPtr.data(); if (!dialog) { @@ -827,85 +841,57 @@ void PopupAppletPrivate::updateDialogPosition() return; } - QSize s = dialog->size(); - QPoint pos = view->mapFromScene(q->scenePos()); + const QPoint appletPos = view->mapToGlobal(view->mapFromScene(q->scenePos())); + QPoint dialogPos; if (!q->containment() || view == q->containment()->view()) { - pos = corona->popupPosition(q, s, popupAlignment); + kDebug() << "requesting with" << q->scenePos(); + dialogPos = corona->popupPosition(q, dialog->size(), popupAlignment); } else { - pos = corona->popupPosition(q->parentItem(), s, popupAlignment); + kDebug() << "requesting with" << q->parentItem(); + dialogPos = corona->popupPosition(q->parentItem(), dialog->size(), popupAlignment); } + kDebug() << "dialog position is" << dialogPos <<" with location" << q->location() << "<<<<<<<<<<<<<<<<<<<<<<<<"; bool reverse = false; if (q->formFactor() == Plasma::Vertical) { - if (view->mapToGlobal(view->mapFromScene(q->scenePos())).y() + q->size().height()/2 < pos.y() + dialog->size().width()/2) { - reverse = true; - } + reverse = (appletPos.y() + (q->size().height() / 2)) < (dialogPos.y() + (dialog->size().height() / 2)); + dialog->setMinimumResizeLimits(-1, appletPos.y(), -1, appletPos.y() + q->size().height()); } else { - if (view->mapToGlobal(view->mapFromScene(q->scenePos())).x() + q->size().width()/2 < pos.x() + dialog->size().width()/2) { - reverse = true; - } + reverse = (appletPos.x() + (q->size().width() / 2)) < (dialogPos.x() + (dialog->size().width() / 2)); + dialog->setMinimumResizeLimits(appletPos.x(), -1, appletPos.x() + q->size().width(), -1); } + Dialog::ResizeCorners resizeCorners = Dialog::NoCorner; switch (q->location()) { case BottomEdge: - if (pos.x() >= q->pos().x()) { - dialog->setResizeHandleCorners(Dialog::NorthEast); - } else { - dialog->setResizeHandleCorners(Dialog::NorthWest); - } - - if (reverse) { - popupPlacement = Plasma::TopPosedLeftAlignedPopup; - } else { - popupPlacement = Plasma::TopPosedRightAlignedPopup; - } + resizeCorners = Dialog::NorthEast | Dialog::NorthWest; + popupPlacement = reverse ? TopPosedLeftAlignedPopup : TopPosedRightAlignedPopup; break; case TopEdge: - if (pos.x() >= q->pos().x()) { - dialog->setResizeHandleCorners(Dialog::SouthEast); - } else { - dialog->setResizeHandleCorners(Dialog::SouthWest); - } - - if (reverse) { - popupPlacement = Plasma::BottomPosedLeftAlignedPopup; - } else { - popupPlacement = Plasma::BottomPosedRightAlignedPopup; - } + resizeCorners = Dialog::SouthEast | Dialog::SouthWest; + popupPlacement = reverse ? Plasma::BottomPosedLeftAlignedPopup : Plasma::BottomPosedRightAlignedPopup; break; case LeftEdge: - if (pos.y() >= q->pos().y()) { - dialog->setResizeHandleCorners(Dialog::SouthEast); - } else { - dialog->setResizeHandleCorners(Dialog::NorthEast); - } - - if (reverse) { - popupPlacement = Plasma::RightPosedTopAlignedPopup; - } else { - popupPlacement = Plasma::RightPosedBottomAlignedPopup; - } + resizeCorners = Dialog::SouthEast | Dialog::NorthEast; + popupPlacement = reverse ? RightPosedTopAlignedPopup : RightPosedBottomAlignedPopup; break; case RightEdge: - if (pos.y() >= q->pos().y()) { - dialog->setResizeHandleCorners(Dialog::SouthWest); - } else { - dialog->setResizeHandleCorners(Dialog::NorthWest); - } - - if (reverse) { - popupPlacement = Plasma::LeftPosedTopAlignedPopup; - } else { - popupPlacement = Plasma::LeftPosedBottomAlignedPopup; - } + resizeCorners = Dialog::SouthWest | Dialog::NorthWest; + popupPlacement = reverse ? LeftPosedTopAlignedPopup : LeftPosedBottomAlignedPopup; break; + default: - dialog->setResizeHandleCorners(Dialog::NorthEast); + popupPlacement = FloatingPopup; + resizeCorners = Dialog::All; + break; } - dialog->move(pos); + dialog->setResizeHandleCorners(resizeCorners); + if (move) { + dialog->move(dialogPos); + } } } // Plasma namespace diff --git a/private/dialog_p.h b/private/dialog_p.h index 2a3bbda44..483c252e0 100644 --- a/private/dialog_p.h +++ b/private/dialog_p.h @@ -40,6 +40,10 @@ public: view(0), resizeCorners(Dialog::NoCorner), resizeStartCorner(Dialog::NoCorner), + leftResizeMin(-1), + topResizeMin(-1), + rightResizeMin(-1), + bottomResizeMin(-1), moveTimer(0), aspectRatioMode(Plasma::IgnoreAspectRatio), resizeChecksWithBorderCheck(false) @@ -72,6 +76,10 @@ public: Dialog::ResizeCorners resizeCorners; QMap resizeAreas; int resizeStartCorner; + int leftResizeMin; + int topResizeMin; + int rightResizeMin; + int bottomResizeMin; QTimer *moveTimer; QTimer *adjustViewTimer; QTimer *adjustSizeTimer; diff --git a/private/popupapplet_p.h b/private/popupapplet_p.h index 01eea6ccf..51947174b 100644 --- a/private/popupapplet_p.h +++ b/private/popupapplet_p.h @@ -39,12 +39,13 @@ public: void iconSizeChanged(int group); void internalTogglePopup(bool fromActivatedSignal = false); + void showDialog(); void hideTimedPopup(); void clearPopupLostFocus(); void dialogSizeChanged(); void dialogStatusChanged(bool status); void restoreDialogSize(); - void updateDialogPosition(); + void updateDialogPosition(bool move = true); void popupConstraintsEvent(Plasma::Constraints constraints); void checkExtenderAppearance(Plasma::FormFactor f); KConfigGroup popupConfigGroup(); @@ -64,6 +65,7 @@ public: Plasma::AspectRatioMode savedAspectRatio; QTimer *autohideTimer; QBasicTimer delayedShowTimer; + QBasicTimer showDialogTimer; QPoint clicked; ItemStatus preShowStatus; bool popupLostFocus : 1; diff --git a/theme.cpp b/theme.cpp index cbfcd422e..aa0d9ba23 100644 --- a/theme.cpp +++ b/theme.cpp @@ -166,7 +166,10 @@ public: static const char *defaultTheme; static const char *systemColorsTheme; static const char *themeRcFile; + static PackageStructure::Ptr packageStructure; +#ifdef Q_WS_X11 static EffectWatcher *s_blurEffectWatcher; +#endif Theme *q; QString themeName; @@ -209,7 +212,9 @@ const char *ThemePrivate::themeRcFile = "plasmarc"; // the system colors theme is used to cache unthemed svgs with colorization needs // these svgs do not follow the theme's colors, but rather the system colors const char *ThemePrivate::systemColorsTheme = "internal-system-colors"; +#ifdef Q_WS_X11 EffectWatcher *ThemePrivate::s_blurEffectWatcher = 0; +#endif bool ThemePrivate::useCache() { diff --git a/windoweffects.cpp b/windoweffects.cpp index ceac2c622..1352534f4 100644 --- a/windoweffects.cpp +++ b/windoweffects.cpp @@ -134,22 +134,19 @@ void slideWindow(QWidget *widget, Plasma::Location location) Display *dpy = QX11Info::display(); Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False ); QVarLengthArray data(2); + data[0] = -1; switch (location) { case LeftEdge: - data[0] = widget->geometry().left(); data[1] = 0; break; case TopEdge: - data[0] = widget->geometry().top(); data[1] = 1; break; case RightEdge: - data[0] = widget->geometry().right(); data[1] = 2; break; case BottomEdge: - data[0] = widget->geometry().bottom(); data[1] = 3; default: break;