rpms/kdebase-workspace/F-9 kdebase-workspace-4.1.2-panel-autohide-867559.patch, NONE, 1.1 kdebase-workspace-4.1.2-panel-autohide-868231.patch, NONE, 1.1 kdebase-workspace-4.1.2-panel-autohide-869277.patch, NONE, 1.1 kdebase-workspace-4.1.2-panel-autohide-fix-flicker.patch, NONE, 1.1 kdebase-workspace-4.1.2-panel-autohide.patch, NONE, 1.1 kdebase-workspace.spec, 1.106, 1.107

Kevin Kofler kkofler at fedoraproject.org
Thu Oct 9 17:49:37 UTC 2008


Author: kkofler

Update of /cvs/pkgs/rpms/kdebase-workspace/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12747/F-9

Modified Files:
	kdebase-workspace.spec 
Added Files:
	kdebase-workspace-4.1.2-panel-autohide-867559.patch 
	kdebase-workspace-4.1.2-panel-autohide-868231.patch 
	kdebase-workspace-4.1.2-panel-autohide-869277.patch 
	kdebase-workspace-4.1.2-panel-autohide-fix-flicker.patch 
	kdebase-workspace-4.1.2-panel-autohide.patch 
Log Message:
Sync from devel:

* Thu Oct 09 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.1.2-4
- backport panel autohide from 4.2 / plasma-4.1-openSUSE

kdebase-workspace-4.1.2-panel-autohide-867559.patch:

--- NEW FILE kdebase-workspace-4.1.2-panel-autohide-867559.patch ---
Index: plasma/plasma/panelappletoverlay.cpp
===================================================================
--- plasma/plasma/panelappletoverlay.cpp	(revision 867558)
+++ plasma/plasma/panelappletoverlay.cpp	(revision 867559)
@@ -135,7 +135,7 @@
 {
     Q_UNUSED(event)
 
-    //kDebug();
+    //kDebug() << m_clickDrag;
     if (m_clickDrag) {
         setMouseTracking(false);
         m_clickDrag = false;
@@ -144,7 +144,7 @@
     }
 
     if (event->button() != Qt::LeftButton) {
-        kDebug() << "sending even to" << (QWidget*)parent();
+        //kDebug() << "sending even to" << (QWidget*)parent();
         Plasma::View *view = dynamic_cast<Plasma::View*>(parent());
 
         if (view && view->containment()) {
@@ -173,6 +173,7 @@
     } else {
         m_offset = geometry().y() - m_origin.y();
     }
+
     grabMouse();
 }
 
@@ -187,6 +188,7 @@
     QPoint p = mapToParent(event->pos());
     QRect g = geometry();
 
+    //kDebug() << p << g << "<-- movin'?";
     if (m_orientation == Qt::Horizontal) {
         g.moveLeft(p.x() + m_offset);
     } else {
@@ -195,9 +197,10 @@
 
     m_applet->setGeometry(g);
 
-    // swap items if we pass completely over the next/previou item or cross
+    // swap items if we pass completely over the next/previous item or cross
     // more than halfway across it, whichever comes first
     if (m_orientation == Qt::Horizontal) {
+        //kDebug() << m_prevGeom << g << m_nextGeom;
         if (m_prevGeom.isValid() && g.left() <= m_prevGeom.left()) {
             swapWithPrevious();
         } else if (m_nextGeom.isValid() && g.right() >= m_nextGeom.right()) {
@@ -216,8 +219,8 @@
 {
     Q_UNUSED(event)
 
-    releaseMouse();
     if (!m_spacer) {
+        releaseMouse();
         return;
     }
 
@@ -237,6 +240,7 @@
         }
     }
 
+    releaseMouse();
     //kDebug();
     m_layout->removeItem(m_spacer);
     m_spacer->deleteLater();
@@ -310,6 +314,7 @@
         m_prevGeom = QRectF();
     }
 
+    //kDebug() << m_index << m_layout->count();
     if (m_index < m_layout->count() - 1) {
         m_nextGeom = m_layout->itemAt(m_index + 1)->geometry();
     } else {

kdebase-workspace-4.1.2-panel-autohide-868231.patch:

--- NEW FILE kdebase-workspace-4.1.2-panel-autohide-868231.patch ---
Index: plasma/plasma/panelview.cpp
===================================================================
--- plasma/plasma/panelview.cpp	(revision 868230)
+++ plasma/plasma/panelview.cpp	(revision 868231)
@@ -75,12 +75,12 @@
         connect(panel, SIGNAL(showAddWidgetsInterface(QPointF)), this, SLOT(showAppletBrowser()));
         connect(panel, SIGNAL(destroyed(QObject*)), this, SLOT(panelDeleted()));
         connect(panel, SIGNAL(toolBoxToggled()), this, SLOT(togglePanelController()));
+
+        kDebug() << "Panel geometry is" << panel->geometry();
     }
 
     connect(this, SIGNAL(sceneRectAboutToChange()), this, SLOT(updatePanelGeometry()));
 
-    kDebug() << "Panel geometry is" << panel->geometry();
-
     // Graphics view setup
     setFrameStyle(QFrame::NoFrame);
     //setAutoFillBackground(true);

kdebase-workspace-4.1.2-panel-autohide-869277.patch:

--- NEW FILE kdebase-workspace-4.1.2-panel-autohide-869277.patch ---
Index: plasma/plasma/panelcontroller.cpp
===================================================================
--- plasma/plasma/panelcontroller.cpp	(revision 869276)
+++ plasma/plasma/panelcontroller.cpp	(revision 869277)
@@ -437,8 +437,9 @@
     d->settingsTool = d->addTool("configure", i18n("More settings..."), this);
     d->layout->addWidget(d->settingsTool);
     connect(d->settingsTool, SIGNAL(pressed()), this, SLOT(settingsPopup()));
-    d->optionsDialog = new Plasma::Dialog(this);
+    d->optionsDialog = new Plasma::Dialog(0); // don't pass in a parent; breaks with some lesser WMs
     d->optionsDialog->installEventFilter(this);
+    KWindowSystem::setState(d->optionsDialog->winId(), NET::SkipTaskbar | NET::SkipPager | NET::Sticky);
     d->optDialogLayout = new QVBoxLayout(d->optionsDialog);
     d->optDialogLayout->setMargin(0);
     d->optDialogLayout->addWidget(alignFrame);
@@ -462,6 +463,8 @@
     //TODO: should we try and only call this when something has actually been
     //      altered that we care about?
     PlasmaApp::self()->corona()->requestConfigSync();
+    delete d->optionsDialog;
+    d->optionsDialog = 0;
     delete d;
 }
 

kdebase-workspace-4.1.2-panel-autohide-fix-flicker.patch:

--- NEW FILE kdebase-workspace-4.1.2-panel-autohide-fix-flicker.patch ---
Index: plasma/plasma/panelview.h
===================================================================
--- plasma/plasma/panelview.h	(revision 866709)
+++ plasma/plasma/panelview.h	(revision 866715)
@@ -146,6 +146,7 @@
     void leaveEvent(QEvent *event);
     void drawBackground(QPainter * painter, const QRectF & rect);
     void paintEvent(QPaintEvent *event);
+    bool event(QEvent *event);
 
 private:
     void createUnhideTrigger();
Index: plasma/plasma/panelcontroller.cpp
===================================================================
--- plasma/plasma/panelcontroller.cpp	(revision 866709)
+++ plasma/plasma/panelcontroller.cpp	(revision 866715)
@@ -328,6 +328,9 @@
 {
     Q_UNUSED(parent)
 
+    QPalette pal = palette();
+    pal.setBrush(backgroundRole(), Qt::transparent);
+    setPalette(pal);
 
     d->background = new Plasma::PanelSvg(this);
     d->background->setImagePath("dialogs/background");
Index: plasma/plasma/panelview.cpp
===================================================================
--- plasma/plasma/panelview.cpp	(revision 866709)
+++ plasma/plasma/panelview.cpp	(revision 866715)
@@ -91,6 +91,10 @@
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
+    QPalette pal = palette();
+    pal.setBrush(backgroundRole(), Qt::transparent);
+    setPalette(pal);
+
     // KWin setup
     KWindowSystem::setOnAllDesktops(winId(), true);
 
@@ -797,7 +801,7 @@
 {
     if (PlasmaApp::hasComposite()) {
         painter->setCompositionMode(QPainter::CompositionMode_Source);
-        painter->fillRect(rect, Qt::transparent);
+        painter->fillRect(rect.toAlignedRect(), Qt::transparent);
     } else {
         Plasma::View::drawBackground(painter, rect);
     }
@@ -818,6 +822,16 @@
     }
 }
 
+bool PanelView::event(QEvent *event)
+{
+    if (event->type() == QEvent::Paint) {
+        QPainter p(this);
+        p.setCompositionMode(QPainter::CompositionMode_Source);
+        p.fillRect(rect(), Qt::transparent);
+    }
+    return Plasma::View::event(event);
+}
+
 void PanelView::animateHide(qreal progress)
 {
     int margin = 0;

kdebase-workspace-4.1.2-panel-autohide.patch:

--- NEW FILE kdebase-workspace-4.1.2-panel-autohide.patch ---
Index: plasma/plasma/panelview.h
===================================================================
--- plasma/plasma/panelview.h	(revision 864492)
+++ plasma/plasma/panelview.h	(revision 864493)
@@ -27,12 +27,17 @@
 #include <plasma/plasma.h>
 #include <plasma/view.h>
 
+#ifdef Q_WS_X11
+#include <X11/Xlib.h>
+#include <fixx11h.h>
+#endif
+
 #ifdef Q_WS_WIN
 #include <windows.h>
-#include <shellapi.h>
 #endif
 
 class QWidget;
+class QTimeLine;
 
 namespace Plasma
 {
@@ -42,6 +47,7 @@
 }
 
 class PanelController;
+
 class PanelAppletOverlay;
 
 class PanelView : public Plasma::View
@@ -49,6 +55,12 @@
     Q_OBJECT
 public:
 
+    enum PanelMode {
+        NormalPanel = 0,
+        AutoHide,
+        LetWindowsCover
+    };
+
    /**
     * Constructs a new panelview.
     * @arg parent the QWidget this panel is parented to
@@ -62,11 +74,16 @@
     Plasma::Location location() const;
 
     /**
+     * @return panel behaviour
+     */
+    PanelMode panelMode() const;
+
+    /**
      * @return the Corona (scene) associated with this panel.
      */
     Plasma::Corona *corona() const;
 
-    /**
+    /*
      * @return the offset of the panel from the left screen edge
      */
     int offset() const;
@@ -80,6 +97,16 @@
      * Pinches the min/max sizes of the containment to the current screen resolution
      */
     void pinchContainment(const QRect &screenGeometry);
+#ifdef Q_WS_X11
+    /**
+     * @return the unhide trigger window id, None if there is none
+     */
+    Window unhideTrigger() { return m_unhideTrigger; }
+#endif
+    /**
+     * unhides the panel if it is hidden
+     */
+    void unhide();
 
 public Q_SLOTS:
     /**
@@ -106,15 +133,43 @@
      */
     void setLocation(Plasma::Location location);
 
+    /**
+     * Sets the panel behaviour
+     * @param mode
+     */
+    void setPanelMode(PanelView::PanelMode mode);
+
 protected:
     void updateStruts();
     void moveEvent(QMoveEvent *event);
     void resizeEvent(QResizeEvent *event);
+    void leaveEvent(QEvent *event);
+    void drawBackground(QPainter * painter, const QRectF & rect);
+    void paintEvent(QPaintEvent *event);
 
+private:
+    void createUnhideTrigger();
+    void destroyUnhideTrigger();
+    Qt::Alignment alignmentFilter(Qt::Alignment align) const;
+    bool isHorizontal() const;
+    QTimeLine *timeLine();
+
+#ifdef Q_WS_WIN
+    bool registerAccessBar(HWND hwndAccessBar, bool fRegister);
+    void appBarQuerySetPos(uint uEdge, LPRECT lprc, PAPPBARDATA pabd);
+    void appBarCallback(MSG *message, long *result);
+    void appBarPosChanged(PAPPBARDATA pabd);
+    bool winEvent(MSG *message, long *result);
+    bool m_barRegistered;
+#endif
+
 private Q_SLOTS:
+    void checkForActivation();
     void showAppletBrowser();
     void togglePanelController();
     void edittingComplete();
+    void animateHide(qreal);
+    void panelDeleted();
 
     /**
      * Updates the panel's position according to the screen and containment
@@ -123,28 +178,25 @@
     void updatePanelGeometry();
 
 private:
-    Qt::Alignment alignmentFilter(Qt::Alignment align) const;
-    bool isHorizontal() const;
-#ifdef Q_WS_WIN
-    bool registerAccessBar(HWND hwndAccessBar, bool fRegister);
-    void appBarQuerySetPos(uint uEdge, LPRECT lprc, PAPPBARDATA pabd);
-    void appBarCallback(MSG *message, long *result);
-    void appBarPosChanged(PAPPBARDATA pabd);
-    bool winEvent(MSG *message, long *result);
-    bool m_barRegistered;
-#endif
-
     Plasma::Svg *m_background;
     PanelController *m_panelController;
     QList<PanelAppletOverlay*> m_moveOverlays;
+    QTimeLine *m_timeLine;
 
     int m_offset;
     Qt::Alignment m_alignment;
+#ifdef Q_WS_X11
+    Window m_unhideTrigger;
+#endif
+
     QSizeF m_lastMin;
     QSizeF m_lastMax;
+    PanelMode m_panelMode;
     int m_lastSeenSize;
-    bool m_lastHorizontal;
-    bool m_editting;
+    bool m_lastHorizontal : 1;
+
+    bool m_editting : 1;
+    bool m_firstPaint : 1;
 };
 
 #endif
Index: plasma/plasma/panelcontroller.cpp
===================================================================
--- plasma/plasma/panelcontroller.cpp	(revision 864492)
+++ plasma/plasma/panelcontroller.cpp	(revision 864493)
@@ -1,4 +1,4 @@
- /*
+/*
  *   Copyright 2008 Marco Martin <notmart at gmail.com>
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -22,13 +22,16 @@
 #include <QAction>
 #include <QApplication>
 #include <QBoxLayout>
+#include <QVBoxLayout>
 #include <QDesktopWidget>
 #include <QFrame>
+#include <QLabel>
 #include <QMouseEvent>
 #include <QPainter>
 #include <QToolButton>
 
 #include <KColorUtils>
+#include <KIconLoader>
 #include <KIcon>
 #include <KWindowSystem>
 
@@ -36,6 +39,8 @@
 #include <plasma/corona.h>
 #include <plasma/paintutils.h>
 #include <plasma/theme.h>
+#include <plasma/svg.h>
+#include <plasma/dialog.h>
 
 #include "plasmaapp.h"
 #include "positioningruler.h"
@@ -83,89 +88,7 @@
     }
 };
 
-class PanelController::ResizeHandle: public QWidget
-{
-public:
-    ResizeHandle(QWidget *parent)
-       : QWidget(parent),
-         m_mouseOver(false)
-    {
-        setCursor(Qt::SizeVerCursor);
-    }
 
-    QSize sizeHint() const
-    {
-        return QSize(4, 4);
-    }
-
-    void paintEvent(QPaintEvent *event)
-    {
-        QPainter painter(this);
-        QColor backColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
-
-        if (m_mouseOver) {
-            backColor.setAlphaF(0.50);
-        } else {
-            backColor.setAlphaF(0.30);
-        }
-
-        painter.fillRect(event->rect(), backColor);
-
-        // draw 3 dots to resemble other resize handles
-        int diameter = qMin(width(), height());
-        QRect dotRect(QPoint(0,0), QSize(diameter, diameter));
-        dotRect.moveCenter(mapFromParent(geometry().center()));
-
-        painter.setRenderHint(QPainter::Antialiasing, true);
-
-        paintDot(&painter, dotRect);
-
-        //other two dots
-        if (size().width() > size().height()) {
-            dotRect.translate(-diameter*2, 0);
-            paintDot(&painter, dotRect);
-            dotRect.translate(diameter*4, 0);
-            paintDot(&painter, dotRect);
-        } else {
-            dotRect.translate(0, -diameter*2);
-            paintDot(&painter, dotRect);
-            dotRect.translate(0, diameter*4);
-            paintDot(&painter, dotRect);
-        }
-    }
-
-protected:
-    void enterEvent(QEvent * event)
-    {
-        m_mouseOver = true;
-        update();
-    }
-
-    void leaveEvent(QEvent * event)
-    {
-        m_mouseOver = false;
-        update();
-    }
-
-private:
-    void paintDot(QPainter *painter, QRect dotRect)
-    {
-        QLinearGradient gradient(dotRect.left(), dotRect.top(), dotRect.left(), dotRect.bottom());
-        QColor firstColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
-        firstColor.setAlphaF(0.6);
-        QColor secondColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
-        secondColor.setAlphaF(0.6);
-        gradient.setColorAt(0, firstColor);
-        gradient.setColorAt(1, secondColor);
-
-        painter->setBrush(gradient);
-        painter->setPen(Qt::NoPen);
-        painter->drawEllipse(dotRect);
-    }
-
-    bool m_mouseOver;
-};
-
 class PanelController::Private
 {
 public:
@@ -180,7 +103,8 @@
          startDragPos(0,0),
          leftAlignTool(0),
          centerAlignTool(0),
-         rightAlignTool(0)
+         rightAlignTool(0),
+         drawMoveHint(false)
     {
     }
 
@@ -242,7 +166,7 @@
             return;
          }
 
-         QSize preferredSize(containment->size().toSize());
+         QSize preferredSize(containment->preferredSize().toSize());
 
          switch (location) {
          case Plasma::LeftEdge:
@@ -284,9 +208,94 @@
         ruler->setOffset(0);
     }
 
+    void panelModeChanged(bool toggle)
+    {
+        if (!toggle) {
+            return;
+        }
+
+        if (q->sender() == normalPanelTool) {
+            emit q->panelModeChanged(PanelView::NormalPanel);
+        } else if (q->sender() == autoHideTool) {
+            emit q->panelModeChanged(PanelView::AutoHide);
+        } else if (q->sender() == underWindowsTool) {
+            emit q->panelModeChanged(PanelView::LetWindowsCover);
+        }
+    }
+
+    void settingsPopup()
+    {
+        if (optionsDialog->isVisible()) {
+            optionsDialog->hide();
+        } else {
+            KWindowSystem::setState(optionsDialog->winId(), NET::SkipTaskbar | NET::SkipPager | NET::Sticky);
+            QPoint pos = q->mapToGlobal(settingsTool->pos());
+            optionsDialog->layout()->activate();
+            optionsDialog->resize(optionsDialog->sizeHint());
+            QSize s = optionsDialog->size();
+
+            switch (location) {
+                case Plasma::BottomEdge:
+                pos = QPoint(pos.x(), pos.y() - s.height());
+                break;
+            case Plasma::TopEdge:
+                pos = QPoint(pos.x(), pos.y() + settingsTool->size().height());
+                break;
+            case Plasma::LeftEdge:
+                pos = QPoint(pos.x() + settingsTool->size().width(), pos.y());
+                break;
+            case Plasma::RightEdge:
+                pos = QPoint(pos.x() - s.width(), pos.y());
+                break;
+            default:
+                if (pos.y() - s.height() > 0) {
+                    pos = QPoint(pos.x(), pos.y() - s.height());
+                } else {
+                    pos = QPoint(pos.x(), pos.y() + settingsTool->size().height());
+                }
+            }
+
+            QRect screenRect = QApplication::desktop()->screenGeometry(containment->screen());
+
+            if (pos.rx() + s.width() > screenRect.right()) {
+                pos.rx() -= ((pos.rx() + s.width()) - screenRect.right());
+            }
+
+            if (pos.ry() + s.height() > screenRect.bottom()) {
+                pos.ry() -= ((pos.ry() + s.height()) - screenRect.bottom());
+            }
+
+            pos.rx() = qMax(0, pos.rx());
+            optionsDialog->move(pos);
+            optionsDialog->show();
+        }
+    }
+
+    void syncRuler()
+    {
+        QRect screenGeom =
+              QApplication::desktop()->screenGeometry(containment->screen());
+
+        switch (location) {
+        case Plasma::LeftEdge:
+        case Plasma::RightEdge:
+            ruler->setAvailableLength(screenGeom.height());
+            ruler->setMaxLength(qMin((int)containment->maximumSize().height(), screenGeom.height()));
+            ruler->setMinLength(containment->minimumSize().height());
+            break;
+        case Plasma::TopEdge:
+        case Plasma::BottomEdge:
+        default:
+            ruler->setAvailableLength(screenGeom.width());
+            ruler->setMaxLength(qMin((int)containment->maximumSize().width(), screenGeom.width()));
+            ruler->setMinLength(containment->minimumSize().width());
+            break;
+        }
+    }
+
      enum DragElement { NoElement = 0,
-                        ResizeHandleElement,
-                        PanelControllerElement
+                        ResizeButtonElement,
+                        MoveButtonElement
                       };
 
     PanelController *q;
@@ -295,21 +304,35 @@
     Plasma::Location location;
     QBoxLayout *extLayout;
     QBoxLayout *layout;
-    QBoxLayout *alignLayout;
+    QLabel *alignLabel;
+    QLabel *modeLabel;
     DragElement dragging;
     QPoint startDragPos;
+    Plasma::Svg *svg;
+    Plasma::Dialog *optionsDialog;
+    QBoxLayout *optDialogLayout;
+    ToolButton *settingsTool;
 
+    ToolButton *moveTool;
+    ToolButton *sizeTool;
+
     //Alignment buttons
     ToolButton *leftAlignTool;
     ToolButton *centerAlignTool;
     ToolButton *rightAlignTool;
 
+    //Panel mode buttons
+    ToolButton *normalPanelTool;
+    ToolButton *autoHideTool;
+    ToolButton *underWindowsTool;
+
     //Widgets for actions
     QList<QWidget *> actionWidgets;
 
-    ResizeHandle *panelHeightHandle;
     PositioningRuler *ruler;
 
+    bool drawMoveHint;
+
     static const int minimumHeight = 10;
 };
 
@@ -317,19 +340,23 @@
    : QWidget(0),
      d(new Private(this))
 {
+    Q_UNUSED(parent)
+
+
+    d->svg = new Plasma::Svg(this);
+    d->svg->setImagePath("widgets/containment-controls");
+    d->svg->setContainsMultipleImages(true);
+
     //setWindowFlags(Qt::Popup);
     setWindowFlags(Qt::FramelessWindowHint);
     KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager | NET::Sticky);
     setAttribute(Qt::WA_DeleteOnClose);
     setFocus(Qt::ActiveWindowFocusReason);
-    //Resize handles
-    d->panelHeightHandle = new ResizeHandle(this);
 
     //layout setup
     d->extLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
     d->extLayout->setContentsMargins(0, 1, 0, 0);
     setLayout(d->extLayout);
-    d->extLayout->addWidget(d->panelHeightHandle);
 
     d->layout = new QBoxLayout(QBoxLayout::LeftToRight);
     d->layout->setContentsMargins(4, 4, 4, 4);
@@ -339,6 +366,7 @@
         d->layout->setDirection(QBoxLayout::LeftToRight);
     }
     d->layout->setSpacing(4);
+
     d->layout->addStretch();
     d->extLayout->addLayout(d->layout);
 
@@ -347,34 +375,90 @@
     //alignment
     //first the container
     QFrame *alignFrame = new ButtonGroup(this);
-    d->alignLayout = new QBoxLayout(d->layout->direction(), alignFrame);
-    alignFrame->setLayout(d->alignLayout);
-    d->layout->addWidget(alignFrame);
-    
-    d->leftAlignTool = d->addTool("format-justify-left", i18n("Align panel to left"), alignFrame,  Qt::ToolButtonIconOnly, true);
-    d->alignLayout->addWidget(d->leftAlignTool);
+    QVBoxLayout *alignLayout = new QVBoxLayout(alignFrame);
+
+
+    d->alignLabel = new QLabel(i18n("Panel Alignment"), this);
+    alignLayout->addWidget(d->alignLabel);
+
+    d->leftAlignTool = d->addTool("format-justify-left", i18n("Left"), alignFrame,  Qt::ToolButtonTextBesideIcon, true);
+    d->leftAlignTool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+    alignLayout->addWidget(d->leftAlignTool);
     d->leftAlignTool->setChecked(true);
     connect(d->leftAlignTool, SIGNAL(toggled(bool)), this, SLOT(alignToggled(bool)));
 
-    d->centerAlignTool = d->addTool("format-justify-center", i18n("Align panel to center"), alignFrame,  Qt::ToolButtonIconOnly, true);
-    d->alignLayout->addWidget(d->centerAlignTool);
+    d->centerAlignTool = d->addTool("format-justify-center", i18n("Center"), alignFrame,  Qt::ToolButtonTextBesideIcon, true);
+    d->centerAlignTool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+    alignLayout->addWidget(d->centerAlignTool);
     connect(d->centerAlignTool, SIGNAL(clicked(bool)), this, SLOT(alignToggled(bool)));
 
-    d->rightAlignTool = d->addTool("format-justify-right", i18n("Align panel to right"), alignFrame,  Qt::ToolButtonIconOnly, true);
-    d->alignLayout->addWidget(d->rightAlignTool);
+    d->rightAlignTool = d->addTool("format-justify-right", i18n("Right"), alignFrame,  Qt::ToolButtonTextBesideIcon, true);
+    d->rightAlignTool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+    alignLayout->addWidget(d->rightAlignTool);
     connect(d->rightAlignTool, SIGNAL(clicked(bool)), this, SLOT(alignToggled(bool)));
 
+
+    //Panel mode
+    //first the container
+    QFrame *modeFrame = new ButtonGroup(this);
+    QVBoxLayout *modeLayout = new QVBoxLayout(modeFrame);
+
+    d->modeLabel = new QLabel(i18n("Visibility"), this);
+    modeLayout->addWidget(d->modeLabel);
+
+    d->normalPanelTool = d->addTool("checkmark", i18n("Always visible"), modeFrame,  Qt::ToolButtonTextBesideIcon, true);
+    d->normalPanelTool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+    modeLayout->addWidget(d->normalPanelTool);
+    connect(d->normalPanelTool, SIGNAL(toggled(bool)), this, SLOT(panelModeChanged(bool)));
+
+    d->autoHideTool = d->addTool("video-display", i18n("Auto hide"), modeFrame,  Qt::ToolButtonTextBesideIcon, true);
+    d->autoHideTool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+    modeLayout->addWidget(d->autoHideTool);
+    connect(d->autoHideTool, SIGNAL(toggled(bool)), this, SLOT(panelModeChanged(bool)));
+
+    d->underWindowsTool = d->addTool("view-fullscreen", i18n("Windows can cover"), modeFrame,  Qt::ToolButtonTextBesideIcon, true);
+    d->underWindowsTool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+    modeLayout->addWidget(d->underWindowsTool);
+    connect(d->underWindowsTool, SIGNAL(toggled(bool)), this, SLOT(panelModeChanged(bool)));
+
+
     d->layout->addStretch();
+    d->moveTool = d->addTool("transform-move", i18n("Screen Edge"), this);
+    d->moveTool->installEventFilter(this);
+    d->moveTool->setCursor(Qt::SizeAllCursor);
+    d->layout->addWidget(d->moveTool);
 
+    d->sizeTool = d->addTool("transform-scale", i18n("Height"), this);
+    d->sizeTool->installEventFilter(this);
+    d->sizeTool->setCursor(Qt::SizeVerCursor);
+    d->layout->addWidget(d->sizeTool);
+    d->layout->addStretch();
+
     //other buttons
     d->layout->addSpacing(20);
+
+    //Settings popup menu
+    d->settingsTool = d->addTool("configure", i18n("More Settings"), this);
+    d->layout->addWidget(d->settingsTool);
+    connect(d->settingsTool, SIGNAL(pressed()), this, SLOT(settingsPopup()));
+    d->optionsDialog = new Plasma::Dialog(this);
+    d->optionsDialog->installEventFilter(this);
+    d->optDialogLayout = new QVBoxLayout(d->optionsDialog);
+    d->optDialogLayout->setMargin(0);
+    d->optDialogLayout->addWidget(alignFrame);
+    d->optDialogLayout->addWidget(modeFrame);
+
+
     ToolButton *closeControllerTool = d->addTool("window-close", i18n("Close this configuration window"), this, Qt::ToolButtonIconOnly, false);
     d->layout->addWidget(closeControllerTool);
-    connect(closeControllerTool, SIGNAL(clicked()), this, SLOT(hideController()));
+    connect(closeControllerTool, SIGNAL(clicked()), this, SLOT(hide()));
 
     d->ruler = new PositioningRuler(this);
     connect(d->ruler, SIGNAL(rulersMoved(int, int, int)), this, SLOT(rulersMoved(int, int, int)));
     d->extLayout->addWidget(d->ruler);
+
+    connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), SLOT(setPalette()));
+    setPalette();
 }
 
 PanelController::~PanelController()
@@ -396,7 +480,9 @@
     QWidget *child;
     while (!d->actionWidgets.isEmpty()) {
         child = d->actionWidgets.first();
+        //try to remove from both layouts
         d->layout->removeWidget(child);
+        d->optDialogLayout->removeWidget(child);
         d->actionWidgets.removeFirst();
         child->deleteLater();
     }
@@ -408,7 +494,7 @@
         ToolButton *addWidgetTool = d->addTool(action, this);
         d->layout->insertWidget(insertIndex, addWidgetTool);
         ++insertIndex;
-        connect(addWidgetTool, SIGNAL(clicked()), this, SLOT(hideController()));
+        connect(addWidgetTool, SIGNAL(clicked()), this, SLOT(hide()));
     }
 
     action = containment->action("lock widgets");
@@ -416,34 +502,18 @@
         ToolButton *lockWidgetsTool = d->addTool(action, this);
         d->layout->insertWidget(insertIndex, lockWidgetsTool);
         ++insertIndex;
-        connect(lockWidgetsTool, SIGNAL(clicked()), this, SLOT(hideController()));
+        connect(lockWidgetsTool, SIGNAL(clicked()), this, SLOT(hide()));
     }
 
     action = containment->action("remove");
     if (action) {
         ToolButton *removePanelTool = d->addTool(action, this);
-        d->layout->insertWidget(insertIndex, removePanelTool);
-        ++insertIndex;
-        connect(removePanelTool, SIGNAL(clicked()), this, SLOT(hideController()));
+        removePanelTool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+        d->optDialogLayout->insertWidget(insertIndex, removePanelTool);
+        connect(removePanelTool, SIGNAL(clicked()), this, SLOT(hide()));
     }
 
-    QRect screenGeom = QApplication::desktop()->screenGeometry(d->containment->screen());
-
-    switch (d->location) {
-    case Plasma::LeftEdge:
-    case Plasma::RightEdge:
-        d->ruler->setAvailableLength(screenGeom.height());
-        d->ruler->setMaxLength(qMin((int)containment->maximumSize().height(), screenGeom.height()));
-        d->ruler->setMinLength(containment->minimumSize().height());
-        break;
-    case Plasma::TopEdge:
-    case Plasma::BottomEdge:
-    default:
-        d->ruler->setAvailableLength(screenGeom.width());
-        d->ruler->setMaxLength(qMin((int)containment->maximumSize().width(), screenGeom.width()));
-        d->ruler->setMinLength(containment->minimumSize().width());
-        break;
-    }
+    d->syncRuler();
 }
 
 QSize PanelController::sizeHint() const
@@ -508,8 +578,10 @@
             d->extLayout->setDirection(QBoxLayout::RightToLeft);
         }
         d->extLayout->setContentsMargins(1, 0, 0, 0);
-        d->panelHeightHandle->setCursor(Qt::SizeHorCursor);
-        d->panelHeightHandle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+        d->sizeTool->setCursor(Qt::SizeHorCursor);
+        d->sizeTool->setText(i18n("Width"));
+        d->leftAlignTool->setText(i18n("Top"));
+        d->rightAlignTool->setText(i18n("Bottom"));
 
         d->ruler->setAvailableLength(screenGeom.height());
         break;
@@ -521,8 +593,10 @@
             d->extLayout->setDirection(QBoxLayout::LeftToRight);
         }
         d->extLayout->setContentsMargins(1, 0, 0, 0);
-        d->panelHeightHandle->setCursor(Qt::SizeHorCursor);
-        d->panelHeightHandle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+        d->sizeTool->setCursor(Qt::SizeHorCursor);
+        d->sizeTool->setText(i18n("Width"));
+        d->leftAlignTool->setText(i18n("Top"));
+        d->rightAlignTool->setText(i18n("Bottom"));
 
         d->ruler->setAvailableLength(screenGeom.height());
         break;
@@ -534,8 +608,10 @@
         }
         d->extLayout->setDirection(QBoxLayout::BottomToTop);
         d->extLayout->setContentsMargins(0, 0, 0, 1);
-        d->panelHeightHandle->setCursor(Qt::SizeVerCursor);
-        d->panelHeightHandle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+        d->sizeTool->setCursor(Qt::SizeVerCursor);
+        d->sizeTool->setText(i18n("Height"));
+        d->leftAlignTool->setText(i18n("Left"));
+        d->rightAlignTool->setText(i18n("Right"));
 
         d->ruler->setAvailableLength(screenGeom.width());
         break;
@@ -548,19 +624,18 @@
         }
         d->extLayout->setDirection(QBoxLayout::TopToBottom);
         d->extLayout->setContentsMargins(0, 1, 0, 0);
-        d->panelHeightHandle->setCursor(Qt::SizeVerCursor);
-        d->panelHeightHandle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+        d->sizeTool->setCursor(Qt::SizeVerCursor);
+        d->sizeTool->setText(i18n("Height"));
+        d->leftAlignTool->setText(i18n("Left"));
+        d->rightAlignTool->setText(i18n("Right"));
 
         d->ruler->setAvailableLength(screenGeom.width());
         break;
     }
 
-    d->alignLayout->setDirection(d->layout->direction());
-    if (d->alignLayout->parentWidget()) {
-        d->alignLayout->parentWidget()->setMaximumSize(d->alignLayout->sizeHint());
-    }
+    d->ruler->setMaximumSize(d->ruler->sizeHint());
 
-    d->ruler->setMaximumSize(d->ruler->sizeHint());
+    d->syncRuler();
 }
 
 Plasma::Location PanelController::location() const
@@ -575,7 +650,7 @@
     }
 }
 
-int PanelController::offset()
+int PanelController::offset() const
 {
     return d->ruler->offset();
 }
@@ -595,67 +670,143 @@
     }
 }
 
-int PanelController::alignment()
+Qt::Alignment PanelController::alignment() const
 {
     return d->ruler->alignment();
 }
 
-void PanelController::hideController()
+void PanelController::setPanelMode(PanelView::PanelMode mode)
 {
-    hide();
+    switch (mode) {
+    case PanelView::AutoHide:
+        d->autoHideTool->setChecked(true);
+        break;
+    case PanelView::LetWindowsCover:
+        d->underWindowsTool->setChecked(true);
+        break;
+    case PanelView::NormalPanel:
+    default:
+        d->normalPanelTool->setChecked(true);
+        break;
+    }
 }
 
+
+
+PanelView::PanelMode PanelController::panelMode() const
+{
+    if (d->underWindowsTool->isChecked()) {
+        return PanelView::LetWindowsCover;
+    } else if (d->autoHideTool->isChecked()) {
+        return PanelView::AutoHide;
+    } else {
+        return PanelView::NormalPanel;
+    }
+}
+
+void PanelController::setPalette()
+{
+    QColor color = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
+    QPalette p = d->alignLabel->palette();
+    p.setColor(QPalette::Normal, QPalette::WindowText, color);
+    p.setColor(QPalette::Inactive, QPalette::WindowText, color);
+    d->alignLabel->setPalette(p);
+    d->modeLabel->setPalette(p);
+}
+
 void PanelController::paintEvent(QPaintEvent *event)
 {
     QPainter painter(this);
     painter.setCompositionMode(QPainter::CompositionMode_Source );
-    QColor backColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
+    QColor backColor = Plasma::Theme::defaultTheme() ->color(Plasma::Theme::BackgroundColor);
     backColor.setAlphaF(0.75);
     painter.fillRect(event->rect(), backColor);
-}
 
-void PanelController::mousePressEvent(QMouseEvent *event)
-{
-    if (d->panelHeightHandle->geometry().contains(event->pos()) ) {
-        d->startDragPos = event->pos();
-        d->dragging = Private::ResizeHandleElement;
-    } else if (QRect(QPoint(0, 0), size()).contains(event->pos()) && !d->ruler->geometry().contains(event->pos()) ) {
-        d->dragging = Private::PanelControllerElement;
-        setCursor(Qt::SizeAllCursor);
+    QRect borderRect;
+    QString element;
+    switch (d->location) {
+    case Plasma::LeftEdge:
+        element = "west-right";
+        borderRect = QRect(QPoint(0,0), d->svg->elementSize(element));
+        borderRect.setHeight(height());
+        borderRect.moveRight(geometry().width());
+        break;
+    case Plasma::RightEdge:
+        element = "east-left";
+        borderRect = QRect(QPoint(0,0), d->svg->elementSize(element));
+        borderRect.setHeight(height());
+        break;
+    case Plasma::TopEdge:
+        element = "north-bottom";
+        borderRect = QRect(QPoint(0,0), d->svg->elementSize(element));
+        borderRect.setWidth(width());
+        borderRect.moveBottom(geometry().height());
+        break;
+    case Plasma::BottomEdge:
+    default:
+        element = "south-top";
+        borderRect = QRect(QPoint(0, 0), d->svg->elementSize(element));
+        borderRect.setWidth(width());
+        break;
     }
 
-    QWidget::mousePressEvent(event);
+    d->svg->paint(&painter, borderRect, element);
 }
 
-void PanelController::mouseReleaseEvent(QMouseEvent *event)
+bool PanelController::eventFilter(QObject *watched, QEvent *event)
 {
-    Q_UNUSED(event)
+    if (watched == d->optionsDialog && event->type() == QEvent::WindowDeactivate) {
+        if (!d->settingsTool->underMouse()) {
+            d->optionsDialog->hide();
+        }
+        if (!isActiveWindow()) {
+            close();
+        }
+        return true;
+    } else if (watched == d->moveTool) {
+        if (event->type() == QEvent::MouseButtonPress) {
+            d->dragging = Private::MoveButtonElement;
+        } else if (event->type() == QEvent::MouseButtonRelease) {
+            d->dragging = Private::NoElement;
+        }
+    } else if (watched == d->sizeTool) {
+        if (event->type() == QEvent::MouseButtonPress) {
+            QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+            d->startDragPos = mouseEvent->pos();
+            d->dragging = Private::ResizeButtonElement;
+        } else if (event->type() == QEvent::MouseButtonRelease) {
+            //FIXME: for now resizes here instead of on mouse move, for a serious performance problem, maybe in Qt
+            QRect screenGeom =
+            QApplication::desktop()->screenGeometry(d->containment->screen());
+            if (d->dragging == Private::ResizeButtonElement) {
+                switch (location()) {
+                case Plasma::LeftEdge:
+                    d->resizePanelHeight(geometry().left() - screenGeom.left());
+                    break;
+                case Plasma::RightEdge:
+                    d->resizePanelHeight(screenGeom.right() - geometry().right());
+                    break;
+                case Plasma::TopEdge:
+                    d->resizePanelHeight(geometry().top() - screenGeom.top());
+                    break;
+                case Plasma::BottomEdge:
+                default:
+                    d->resizePanelHeight(screenGeom.bottom() - geometry().bottom());
+                    break;
+                }
+            }
 
-    //FIXME: for now resizes here instead of on mouse move, for a serious performance problem, maybe in Qt
-    QRect screenGeom =
-    QApplication::desktop()->screenGeometry(d->containment->screen());
-    if (d->dragging == Private::ResizeHandleElement) {
-        switch (location()) {
-        case Plasma::LeftEdge:
-            d->resizePanelHeight(geometry().left() - screenGeom.left());
-            break;
-        case Plasma::RightEdge:
-            d->resizePanelHeight(screenGeom.right() - geometry().right());
-            break;
-        case Plasma::TopEdge:
-            d->resizePanelHeight(geometry().top() - screenGeom.top());
-            break;
-        case Plasma::BottomEdge:
-        default:
-            d->resizePanelHeight(screenGeom.bottom() - geometry().bottom());
-            break;
+            //resets properties saved during the drag
+            d->startDragPos = QPoint(0, 0);
+            d->dragging = Private::NoElement;
+            setCursor(Qt::ArrowCursor);
+        } else if (event->type() == QEvent::MouseMove) {
+            QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+            mouseMoveEvent(mouseEvent);
         }
     }
 
-    //resets properties saved during the drag
-    d->startDragPos = QPoint(0, 0);
-    d->dragging = Private::NoElement;
-    setCursor(Qt::ArrowCursor);
+    return false;
 }
 
 void PanelController::mouseMoveEvent(QMouseEvent *event)
@@ -667,7 +818,7 @@
     QDesktopWidget *desktop = QApplication::desktop();
     QRect screenGeom = desktop->screenGeometry(d->containment->screen());
 
-    if (d->dragging == Private::PanelControllerElement) {
+    if (d->dragging == Private::MoveButtonElement) {
         //only move when the mouse cursor is out of the controller to avoid an endless reposition cycle
         if (geometry().contains(event->globalPos())) {
             return;
@@ -771,7 +922,10 @@
 void PanelController::focusOutEvent(QFocusEvent * event)
 {
     Q_UNUSED(event)
-    close();
+    if (!d->optionsDialog->isActiveWindow()) {
+        d->optionsDialog->hide();
+        close();
+    }
 }
 
 #include "panelcontroller.moc"
Index: plasma/plasma/panelappletoverlay.cpp
===================================================================
--- plasma/plasma/panelappletoverlay.cpp	(revision 864492)
+++ plasma/plasma/panelappletoverlay.cpp	(revision 864493)
@@ -19,6 +19,7 @@
 
 #include "panelappletoverlay.h"
 
+#include <QApplication>
 #include <QGraphicsLinearLayout>
 #include <QPainter>
 #include <QTimer>
@@ -30,6 +31,7 @@
 #include <plasma/containment.h>
 #include <plasma/paintutils.h>
 #include <plasma/theme.h>
+#include <plasma/view.h>
 
 class AppletMoveSpacer : public QGraphicsWidget
 {
@@ -141,6 +143,17 @@
         return;
     }
 
+    if (event->button() != Qt::LeftButton) {
+        kDebug() << "sending even to" << (QWidget*)parent();
+        Plasma::View *view = dynamic_cast<Plasma::View*>(parent());
+
+        if (view && view->containment()) {
+            view->containment()->showContextMenu(mapToParent(event->pos()), event->globalPos());
+        }
+
+        return;
+    }
+
     m_clickDrag = false;
     if (!m_spacer) {
         m_spacer = new AppletMoveSpacer(m_applet);
@@ -167,6 +180,10 @@
 {
     Q_UNUSED(event)
 
+    if (!m_spacer) {
+        return;
+    }
+
     QPoint p = mapToParent(event->pos());
     QRect g = geometry();
 
@@ -199,6 +216,11 @@
 {
     Q_UNUSED(event)
 
+    releaseMouse();
+    if (!m_spacer) {
+        return;
+    }
+
     if (!m_origin.isNull()) {
         //kDebug() << m_clickDrag << m_origin << mapToParent(event->pos());
         if (m_orientation == Qt::Horizontal) {
@@ -221,7 +243,6 @@
     m_spacer = 0;
     m_layout->insertItem(m_index, m_applet);
     m_applet->setZValue(m_applet->zValue() - 1);
-    releaseMouse();
 }
 
 void PanelAppletOverlay::enterEvent(QEvent *event)
Index: plasma/plasma/panelcontroller.h
===================================================================
--- plasma/plasma/panelcontroller.h	(revision 864492)
+++ plasma/plasma/panelcontroller.h	(revision 864493)
@@ -24,8 +24,10 @@
 
 #include <plasma/plasma.h>
 
+#include "panelview.h"
 
 
+
 namespace Plasma
 {
     class Containment;
@@ -35,6 +37,7 @@
 {
 Q_OBJECT
 public:
+
     PanelController(QWidget* parent = 0);
     ~PanelController();
 
@@ -48,18 +51,20 @@
     Plasma::Location location() const;
 
     void setOffset(int newOffset);
-    int offset();
+    int offset() const;
 
     void setAlignment(const Qt::Alignment &newAlignment);
-    int alignment();
+    Qt::Alignment alignment() const;
 
+    void setPanelMode(PanelView::PanelMode);
+    PanelView::PanelMode panelMode() const;
+
 public Q_SLOTS:
-    void hideController();
+    void setPalette();
 
 protected:
     void paintEvent(QPaintEvent *event);
-    void mousePressEvent(QMouseEvent *event);
-    void mouseReleaseEvent(QMouseEvent *event);
+    bool eventFilter(QObject *watched, QEvent *event);
     void mouseMoveEvent(QMouseEvent *event);
     void focusOutEvent(QFocusEvent * event);
 
@@ -70,10 +75,13 @@
      void offsetChanged(int offset);
      void alignmentChanged(Qt::Alignment);
      void locationChanged(Plasma::Location);
+     void panelModeChanged(PanelView::PanelMode mode);
 
 private:
     Q_PRIVATE_SLOT(d, void rulersMoved(int offset, int minLength, int minLength))
     Q_PRIVATE_SLOT(d, void alignToggled(bool toggle))
+    Q_PRIVATE_SLOT(d, void panelModeChanged(bool toggle))
+    Q_PRIVATE_SLOT(d, void settingsPopup())
 
     class ButtonGroup;
     class ResizeHandle;
Index: plasma/plasma/positioningruler.cpp
===================================================================
--- plasma/plasma/positioningruler.cpp	(revision 864492)
+++ plasma/plasma/positioningruler.cpp	(revision 864493)
@@ -70,10 +70,9 @@
             }
 
             if (alignment == Qt::AlignCenter) {
-                const int newTop = offsetSliderRect.center().y() + (offsetSliderRect.center().y() - newPos.y());
-                if (newTop < 0 || newTop > availableLength) {
-                    return false;
-                }
+                int newTop = offsetSliderRect.center().y() + (offsetSliderRect.center().y() - newPos.y());
+                newTop = qBound(0, newTop, availableLength);
+
                 symmetricSliderRect.moveCenter(QPoint(symmetricSliderRect.center().x(), newTop));
             }
             sliderRect.moveCenter(QPoint(sliderRect.center().x(), newPos.y()));
@@ -83,10 +82,9 @@
             }
 
             if (alignment == Qt::AlignCenter) {
-                const int newLeft = offsetSliderRect.center().x() + (offsetSliderRect.center().x() - newPos.x());
-                if (newLeft < 0 || newLeft > availableLength) {
-                    return false;
-                }
+                int newLeft = offsetSliderRect.center().x() + (offsetSliderRect.center().x() - newPos.x());
+                newLeft = qBound(0, newLeft, availableLength);
+
                 symmetricSliderRect.moveCenter(QPoint(newLeft, symmetricSliderRect.center().y()));
             }
             sliderRect.moveCenter(QPoint(newPos.x(), sliderRect.center().y()));
@@ -164,67 +162,67 @@
             //Here substracting one to everything because QRect.moveCenter(pos) moves the rect with
             //the width/2 th pixel at pos.x (and so for y) resulting in the painted image moved
             //one pixel to the right
-            rightMaxPos = offset + maxLength - 1;
+            rightMaxPos = offset + maxLength;
             leftMaxPos = 0;
-            rightMinPos = offset + minLength - 1;
+            rightMinPos = offset + minLength;
             leftMinPos = 0;
-            offsetPos = offset - 1;
+            offsetPos = offset;
             break;
         case Qt::AlignRight:
-            leftMaxPos = totalLength - offset - maxLength - 1;
+            leftMaxPos = totalLength - offset - maxLength;
             rightMaxPos = 0;
-            leftMinPos = totalLength - offset - minLength - 1;
+            leftMinPos = totalLength - offset - minLength;
             rightMinPos = 0;
-            offsetPos = totalLength - offset - 1;
+            offsetPos = totalLength - offset;
             break;
         case Qt::AlignCenter:
         default:
-            leftMaxPos = totalLength/2 + offset - maxLength/2 - 1;
-            rightMaxPos = totalLength/2 + offset + maxLength/2 - 1;
+            leftMaxPos = totalLength/2 + offset - maxLength/2;
+            rightMaxPos = totalLength/2 + offset + maxLength/2;
 
-            leftMinPos = totalLength/2 + offset - minLength/2 - 1;
-            rightMinPos = totalLength/2 + offset + minLength/2 - 1;
+            leftMinPos = totalLength/2 + offset - minLength/2;
+            rightMinPos = totalLength/2 + offset + minLength/2;
 
-            offsetPos = totalLength/2 + offset - 1;
+            offsetPos = totalLength/2 + offset;
             break;
         }
-    
+
         switch (location) {
         case Plasma::LeftEdge:
             leftMaxSliderRect.moveCenter(QPoint(3*(totalSize.width()/4), leftMaxPos));
             rightMaxSliderRect.moveCenter(QPoint(3*(totalSize.width()/4), rightMaxPos));
-        
+
             leftMinSliderRect.moveCenter(QPoint(totalSize.width()/4, leftMinPos));
             rightMinSliderRect.moveCenter(QPoint(totalSize.width()/4, rightMinPos));
-        
+
             offsetSliderRect.moveCenter(QPoint(3*(totalSize.width()/4), offsetPos));
             break;
         case Plasma::RightEdge:
             leftMaxSliderRect.moveCenter(QPoint(totalSize.width()/4, leftMaxPos));
             rightMaxSliderRect.moveCenter(QPoint(totalSize.width()/4, rightMaxPos));
-        
+
             leftMinSliderRect.moveCenter(QPoint(3*(totalSize.width()/4), leftMinPos));
             rightMinSliderRect.moveCenter(QPoint(3*(totalSize.width()/4), rightMinPos));
-        
+
             offsetSliderRect.moveCenter(QPoint(totalSize.width()/4, offsetPos));
             break;
         case Plasma::TopEdge:
             leftMaxSliderRect.moveCenter(QPoint(leftMaxPos, 3*(totalSize.height()/4)));
             rightMaxSliderRect.moveCenter(QPoint(rightMaxPos, 3*(totalSize.height()/4)));
-        
+
             leftMinSliderRect.moveCenter(QPoint(leftMinPos, totalSize.height()/4));
             rightMinSliderRect.moveCenter(QPoint(rightMinPos, totalSize.height()/4));
-        
+
             offsetSliderRect.moveCenter(QPoint(offsetPos, 3*(totalSize.height()/4)));
             break;
         case Plasma::BottomEdge:
         default:
             leftMaxSliderRect.moveCenter(QPoint(leftMaxPos, totalSize.height()/4));
             rightMaxSliderRect.moveCenter(QPoint(rightMaxPos, totalSize.height()/4));
-        
+
             leftMinSliderRect.moveCenter(QPoint(leftMinPos, 3*(totalSize.height()/4)));
             rightMinSliderRect.moveCenter(QPoint(rightMinPos, 3*(totalSize.height()/4)));
-        
+
             offsetSliderRect.moveCenter(QPoint(offsetPos, totalSize.height()/4));
             break;
         }
@@ -480,8 +478,11 @@
     //Draw center indicators
     if (d->alignment == Qt::AlignCenter && (d->location == Plasma::LeftEdge || d->location == Plasma::RightEdge)) {
         d->sliderGraphics->paint(&painter, QPoint(event->rect().left(), event->rect().center().y()), "vertical-centerindicator");
+        //this because rect.moveCenter will cause a rect moved one pixel off respect where we need it
+        painter.translate(0, -1);
     } else if (d->alignment == Qt::AlignCenter) {
         d->sliderGraphics->paint(&painter, QPoint(event->rect().center().x(), event->rect().top()), "horizontal-centerindicator");
+        painter.translate(-1, 0);
     }
 
     //Draw handles
@@ -633,7 +634,7 @@
             newPos.setY(d->availableLength);
         }
     }
-    
+
     switch (d->dragging) {
     case Private::LeftMaxSlider:
         //don't let the slider "cross" with the offset slider
Index: plasma/plasma/plasmaapp.cpp
===================================================================
--- plasma/plasma/plasmaapp.cpp	(revision 864492)
+++ plasma/plasma/plasmaapp.cpp	(revision 864493)
@@ -17,12 +17,16 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-// plasma.loadEngine("hardware")
-// LineGraph graph
-// plasma.connect(graph, "hardware", "cpu");
-
 #include "plasmaapp.h"
 
+#ifdef Q_WS_WIN
+#ifdef _WIN32_WINNT
+#undef _WIN32_WINNT
+#endif
+#define _WIN32_WINNT 0x0500
+#include <windows.h>
+#endif
+
 #include <unistd.h>
 
 #ifndef _SC_PHYS_PAGES
@@ -127,7 +131,8 @@
     : KUniqueApplication(),
 #endif
       m_corona(0),
-      m_appletBrowser(0)
+      m_appletBrowser(0),
+      m_panelHidden(0)
 {
     KGlobal::locale()->insertCatalog("libplasma");
 
@@ -197,7 +202,13 @@
     memorySize /= 1024;
 #endif
 #ifdef Q_WS_WIN
-    size_t memorySize = 2000000000; //FIXME: get the right memorysize instead of hardcoding it
+    size_t memorySize;
+
+    MEMORYSTATUSEX statex;
+    statex.dwLength = sizeof (statex);
+    GlobalMemoryStatusEx (&statex);
+
+    memorySize = (statex.ullTotalPhys/1024) + (statex.ullTotalPageFile/1024);
 #endif
     // If you have no suitable sysconf() interface and are not FreeBSD,
     // then you are out of luck and get a compile error.
@@ -297,13 +308,46 @@
     view->toggleDashboard();
 }
 
+void PlasmaApp::panelHidden(bool hidden)
+{
+    if (hidden) {
+        ++m_panelHidden;
+        //kDebug() << "panel hidden" << m_panelHidden;
+    } else {
+        --m_panelHidden;
+        if (m_panelHidden < 0) {
+            kDebug() << "panelHidden(false) called too many times!";
+            m_panelHidden = 0;
+        }
+        //kDebug() << "panel unhidden" << m_panelHidden;
+    }
+}
+
+#ifdef Q_WS_X11
+bool PlasmaApp::x11EventFilter(XEvent *event)
+{
+    if (m_panelHidden && event->type == EnterNotify) {
+        //kDebug();
+        foreach (PanelView *panel, m_panels) {
+            //kDebug() << panel->unhideTrigger() << event->xcrossing.window;
+            if (panel->unhideTrigger() == event->xcrossing.window) {
+                panel->unhide();
+                return true;
+            }
+        }
+    }
+
+    return KUniqueApplication::x11EventFilter(event);
+}
+#endif
+
 void PlasmaApp::setIsDesktop(bool isDesktop)
 {
     m_isDesktop = isDesktop;
     foreach (DesktopView *view, m_desktops) {
         view->setIsDesktop(isDesktop);
     }
-    
+
     if (isDesktop) {
         connect(QApplication::desktop(), SIGNAL(resized(int)), SLOT(adjustSize(int)));
     } else {
@@ -318,7 +362,6 @@
 
 void PlasmaApp::adjustSize(int screen)
 {
-    kDebug() << "adjust size for screen" << screen;
     QDesktopWidget *desktop = QApplication::desktop();
     bool screenExists = screen < desktop->numScreens();
 
@@ -329,6 +372,8 @@
 
     DesktopView *view = viewForScreen(screen);
 
+    kDebug() << "adjust size for screen" << screen << screenGeom << view;
+
     if (view) {
         if (screenExists) {
             kDebug() << "here we go ... adjusting size";
@@ -346,15 +391,14 @@
         //      perhaps we should make one.
     }
 
-    foreach (PanelView *panel, m_panels) {
-        if (panel->screen() == screen) {
-            if (screenExists) {
+    //TODO: should we remove panels when the screen
+    //      disappears? this would mean having some
+    //      way of alerting that we have a new screen
+    //      that appears
+    if (screenExists) {
+        foreach (PanelView *panel, m_panels) {
+            if (panel->screen() == screen) {
                 panel->pinchContainment(screenGeom);
-            } else {
-                //TODO: should we remove panels when the screen
-                //      disappears? this would mean having some
-                //      way of alerting that we have a new screen
-                //      that appears
             }
         }
     }
Index: plasma/plasma/plasmaapp.h
===================================================================
--- plasma/plasma/plasmaapp.h	(revision 864492)
+++ plasma/plasma/plasmaapp.h	(revision 864493)
@@ -75,11 +75,26 @@
      */
     void createDesktopView(Plasma::Containment *containment, int id = 0);
 
+    /**
+     * Should be called when a panel hides or unhides itself
+     */
+    void panelHidden(bool hidden);
+
 public Q_SLOTS:
     // DBUS interface. if you change these methods, you MUST run:
     // qdbuscpp2xml plasmaapp.h -o org.kde.plasma.App.xml
     void toggleDashboard();
 
+protected:
+#ifdef Q_WS_X11
+    bool x11EventFilter(XEvent *event);
+#endif
+
+private:
+    PlasmaApp(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap);
+    static void crashHandler(int signal);
+    DesktopView* viewForScreen(int screen) const;
+
 private Q_SLOTS:
     void setCrashHandler();
     void cleanup();
@@ -90,14 +105,11 @@
     void adjustSize(int screen);
 
 private:
-    PlasmaApp(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap);
-    static void crashHandler(int signal);
-    DesktopView* viewForScreen(int screen) const;
-
     Plasma::Corona *m_corona;
     QList<PanelView*> m_panels;
     Plasma::AppletBrowser *m_appletBrowser;
     QList<DesktopView*> m_desktops;
+    int m_panelHidden;
     bool m_isDesktop;
 };
 
Index: plasma/plasma/panelview.cpp
===================================================================
--- plasma/plasma/panelview.cpp	(revision 864492)
+++ plasma/plasma/panelview.cpp	(revision 864493)
@@ -22,7 +22,11 @@
 #include <QApplication>
 #include <QDesktopWidget>
 #include <QGraphicsLinearLayout>
+#include <QTimeLine>
 #include <QTimer>
+#ifdef Q_WS_X11
+#include <QX11Info>
+#endif
 
 #include <KWindowSystem>
 #include <KDebug>
@@ -40,15 +44,21 @@
 PanelView::PanelView(Plasma::Containment *panel, int id, QWidget *parent)
     : Plasma::View(panel, id, parent),
       m_panelController(0),
+      m_timeLine(0),
+#ifdef Q_WS_X11
+      m_unhideTrigger(None),
+#endif
+      m_panelMode(NormalPanel),
       m_lastHorizontal(true),
-      m_editting(false)
+      m_editting(false),
+      m_firstPaint(true)
 {
     Q_ASSERT(qobject_cast<Plasma::Corona*>(panel->scene()));
-
     KConfigGroup viewConfig = config();
 
     m_offset = viewConfig.readEntry("Offset", 0);
     m_alignment = alignmentFilter((Qt::Alignment)viewConfig.readEntry("Alignment", (int)Qt::AlignLeft));
+    setPanelMode((PanelMode)viewConfig.readEntry("panelMode", (int)m_panelMode));
 
     // pinchContainment calls updatePanelGeometry for us
 
@@ -63,9 +73,10 @@
 
     if (panel) {
         connect(panel, SIGNAL(showAddWidgetsInterface(QPointF)), this, SLOT(showAppletBrowser()));
-        connect(panel, SIGNAL(destroyed(QObject*)), this, SLOT(deleteLater()));
+        connect(panel, SIGNAL(destroyed(QObject*)), this, SLOT(panelDeleted()));
         connect(panel, SIGNAL(toolBoxToggled()), this, SLOT(togglePanelController()));
     }
+
     connect(this, SIGNAL(sceneRectAboutToChange()), this, SLOT(updatePanelGeometry()));
 
     kDebug() << "Panel geometry is" << panel->geometry();
@@ -81,19 +92,20 @@
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
     // KWin setup
-    KWindowSystem::setType(winId(), NET::Dock);
-    KWindowSystem::setState(winId(), NET::Sticky);
     KWindowSystem::setOnAllDesktops(winId(), true);
-    
+
 #ifdef Q_WS_WIN
     registerAccessBar(winId(), true);
-#endif        
+#endif
 
     updateStruts();
 }
 
 PanelView::~PanelView()
 {
+#ifdef Q_WS_WIN
+    registerAccessBar(winId(), false);
+#endif
 }
 
 void PanelView::setLocation(Plasma::Location location)
@@ -165,6 +177,52 @@
     return containment()->location();
 }
 
+void PanelView::checkForActivation()
+{
+    //kDebug() << "stacking order changed!" << KWindowSystem::self()->stackingOrder().last() << winId();
+    if (KWindowSystem::self()->stackingOrder().last() == winId()) {
+        destroyUnhideTrigger();
+    } else {
+        createUnhideTrigger();
+    }
+}
+
+void PanelView::setPanelMode(PanelView::PanelMode mode)
+{
+    unsigned long state = NET::Sticky;
+
+    disconnect(KWindowSystem::self(), SIGNAL(stackingOrderChanged()),
+               this, SLOT(checkForActivation()));
+
+    KWindowSystem::setType(winId(), NET::Dock);
+    if (mode == LetWindowsCover) {
+        createUnhideTrigger();
+        connect(KWindowSystem::self(), SIGNAL(stackingOrderChanged()),
+                this, SLOT(checkForActivation()));
+        KWindowSystem::clearState(winId(), NET::StaysOnTop | NET::KeepAbove);
+        state |= NET::KeepBelow;
+    } else {
+        //kDebug() << "panel shouldn't let windows cover it!";
+        state |= NET::StaysOnTop;
+    }
+
+    if (mode == NormalPanel) {
+        // we need to kill the input window if it exists!
+        destroyUnhideTrigger();
+    }
+
+    //kDebug() << "panel state set to" << state << NET::Sticky;
+    KWindowSystem::setState(winId(), state);
+
+    m_panelMode = mode;
+    config().writeEntry("panelMode", (int)mode);
+}
+
+PanelView::PanelMode PanelView::panelMode() const
+{
+    return m_panelMode;
+}
+
 Plasma::Corona *PanelView::corona() const
 {
     return qobject_cast<Plasma::Corona*>(scene());
@@ -456,7 +514,6 @@
 
     if (m_panelController) {
         m_panelController->setContainment(c);
-
         m_panelController->setOffset(m_offset);
     }
 }
@@ -512,11 +569,13 @@
         m_panelController->setLocation(containment()->location());
         m_panelController->setAlignment(m_alignment);
         m_panelController->setOffset(m_offset);
+        m_panelController->setPanelMode(m_panelMode);
 
         connect(m_panelController, SIGNAL(destroyed(QObject*)), this, SLOT(edittingComplete()));
         connect(m_panelController, SIGNAL(offsetChanged(int)), this, SLOT(setOffset(int)));
         connect(m_panelController, SIGNAL(alignmentChanged(Qt::Alignment)), this, SLOT(setAlignment(Qt::Alignment)));
         connect(m_panelController, SIGNAL(locationChanged(Plasma::Location)), this, SLOT(setLocation(Plasma::Location)));
+        connect(m_panelController, SIGNAL(panelModeChanged(PanelView::PanelMode)), this, SLOT(setPanelMode(PanelView::PanelMode)));
 
         if (dynamic_cast<QGraphicsLinearLayout*>(containment()->layout())) {
             // we only support mouse over drags for panels with linear layouts
@@ -549,6 +608,7 @@
         m_panelController->show();
     } else {
         m_panelController->close();
+        updateStruts();
     }
 }
 
@@ -560,6 +620,8 @@
     qDeleteAll(m_moveOverlays);
     m_moveOverlays.clear();
     containment()->closeToolBox();
+    updateStruts();
+    m_firstPaint = true; // triggers autohide
 }
 
 Qt::Alignment PanelView::alignmentFilter(Qt::Alignment align) const
@@ -576,47 +638,49 @@
 {
     NETExtendedStrut strut;
 
-    QRect thisScreen = QApplication::desktop()->screenGeometry(containment()->screen());
-    QRect wholeScreen = QApplication::desktop()->geometry();
+    if (m_panelMode == NormalPanel) {
+        QRect thisScreen = QApplication::desktop()->screenGeometry(containment()->screen());
+        QRect wholeScreen = QApplication::desktop()->geometry();
 
-    // extended struts are to the combined screen geoms, not the single screen
-    int leftOffset = wholeScreen.x() - thisScreen.x();
-    int rightOffset = wholeScreen.right() - thisScreen.right();
-    int bottomOffset = wholeScreen.bottom() - thisScreen.bottom();
-    int topOffset = wholeScreen.top() - thisScreen.top();
-    kDebug() << "screen l/r/b/t offsets are:" << leftOffset << rightOffset << bottomOffset << topOffset;
+        // extended struts are to the combined screen geoms, not the single screen
+        int leftOffset = wholeScreen.x() - thisScreen.x();
+        int rightOffset = wholeScreen.right() - thisScreen.right();
+        int bottomOffset = wholeScreen.bottom() - thisScreen.bottom();
+        int topOffset = wholeScreen.top() - thisScreen.top();
+        kDebug() << "screen l/r/b/t offsets are:" << leftOffset << rightOffset << bottomOffset << topOffset;
 
-    switch (location())
-    {
-        case Plasma::TopEdge:
-            strut.top_width = height() + topOffset;
-            strut.top_start = x();
-            strut.top_end = x() + width() - 1;
-            break;
+        switch (location())
+        {
+            case Plasma::TopEdge:
+                strut.top_width = height() + topOffset;
+                strut.top_start = x();
+                strut.top_end = x() + width() - 1;
+                break;
 
-        case Plasma::BottomEdge:
-            strut.bottom_width = height() + bottomOffset;
-            strut.bottom_start = x();
-            strut.bottom_end = x() + width() - 1;
-            //kDebug() << "setting bottom edge to" << strut.bottom_width
-            //         << strut.bottom_start << strut.bottom_end;
-            break;
+            case Plasma::BottomEdge:
+                strut.bottom_width = height() + bottomOffset;
+                strut.bottom_start = x();
+                strut.bottom_end = x() + width() - 1;
+                //kDebug() << "setting bottom edge to" << strut.bottom_width
+                //         << strut.bottom_start << strut.bottom_end;
+                break;
 
-        case Plasma::RightEdge:
-            strut.right_width = width() + rightOffset;
-            strut.right_start = y();
-            strut.right_end = y() + height() - 1;
-            break;
+            case Plasma::RightEdge:
+                strut.right_width = width() + rightOffset;
+                strut.right_start = y();
+                strut.right_end = y() + height() - 1;
+                break;
 
-        case Plasma::LeftEdge:
-            strut.left_width = width() + leftOffset;
-            strut.left_start = y();
-            strut.left_end = y() + height() - 1;
-            break;
+            case Plasma::LeftEdge:
+                strut.left_width = width() + leftOffset;
+                strut.left_start = y();
+                strut.left_end = y() + height() - 1;
+                break;
 
-        default:
-            //kDebug() << "where are we?";
+            default:
+                //kDebug() << "where are we?";
             break;
+        }
     }
 
     KWindowSystem::setExtendedStrut(winId(), strut.left_width,
@@ -635,15 +699,246 @@
 
 void PanelView::moveEvent(QMoveEvent *event)
 {
+    //kDebug();
     QWidget::moveEvent(event);
     updateStruts();
 }
 
 void PanelView::resizeEvent(QResizeEvent *event)
 {
+    //kDebug();
     QWidget::resizeEvent(event);
     updateStruts();
 }
 
+QTimeLine *PanelView::timeLine()
+{
+    if (!m_timeLine) {
+        m_timeLine = new QTimeLine(200, this);
+        m_timeLine->setCurveShape(QTimeLine::EaseOutCurve);
+        m_timeLine->setUpdateInterval(10);
+        connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animateHide(qreal)));
+    }
+
+    return m_timeLine;
+}
+
+void PanelView::unhide()
+{
+    //kDebug();
+    destroyUnhideTrigger();
+
+    QTimeLine * tl = timeLine();
+    tl->setDirection(QTimeLine::Backward);
+    // with composite, we can quite do some nice animations with transparent
+    // backgrounds; without it we can't so we just show/hide
+    if (PlasmaApp::hasComposite()) {
+        if (tl->state() == QTimeLine::NotRunning) {
+            tl->start();
+        }
+    }
+
+    show();
+    KWindowSystem::setOnAllDesktops(winId(), true);
+    unsigned long state = NET::Sticky;
+    KWindowSystem::setState(winId(), state);
+    if (m_panelMode == LetWindowsCover) {
+        KWindowSystem::raiseWindow(winId());
+        KWindowSystem::activateWindow(winId());
+    }
+}
+
+void PanelView::leaveEvent(QEvent *event)
+{
+    if (m_panelMode == AutoHide && !m_editting) {
+        // try not to hide if we have an associated popup or window about
+        bool havePopup = QApplication::activePopupWidget() != 0;
+
+        if (!havePopup) {
+            QWidget *popup = QApplication::activeWindow();
+
+            if (popup) {
+                kDebug() << "got a popup!" << popup
+                         << popup->window() << popup->window()->parentWidget() << popup->parentWidget() << this;
+
+
+                if (popup->window()->parentWidget() == this ||
+                    popup->parentWidget() == this ||
+                    (popup->parentWidget() && popup->parentWidget()->window() == this)) {
+                    havePopup = true;
+                }
+            } /* else {
+                kDebug() << "no popup?!";
+            } */
+        } else {
+            kDebug() << "gota a popup widget";
+        }
+
+        if (!havePopup) {
+            QTimeLine * tl = timeLine();
+            tl->setDirection(QTimeLine::Forward);
+
+            // with composite, we can quite do some nice animations with transparent
+            // backgrounds; without it we can't so we just show/hide
+            if (PlasmaApp::hasComposite()) {
+                if (tl->state() == QTimeLine::NotRunning) {
+                    tl->start();
+                }
+            } else {
+                animateHide(1.0);
+            }
+        }
+    }
+
+    Plasma::View::leaveEvent(event);
+}
+
+void PanelView::drawBackground(QPainter *painter, const QRectF &rect)
+{
+    if (PlasmaApp::hasComposite()) {
+        painter->setCompositionMode(QPainter::CompositionMode_Source);
+        painter->fillRect(rect, Qt::transparent);
+    } else {
+        Plasma::View::drawBackground(painter, rect);
+    }
+}
+
+void PanelView::paintEvent(QPaintEvent *event)
+{
+    Plasma::View::paintEvent(event);
+    if (m_firstPaint) {
+        // set up our auothide system after we paint it visibly to the user
+        if (m_panelMode == AutoHide) {
+            QTimeLine * tl = timeLine();
+            tl->setDirection(QTimeLine::Forward);
+            tl->start();
+        }
+
+        m_firstPaint = false;
+    }
+}
+
+void PanelView::animateHide(qreal progress)
+{
+    int margin = 0;
+    Plasma::Location loc = location();
+
+    if (loc == Plasma::TopEdge || loc == Plasma::BottomEdge) {
+        margin = progress * height();
+    } else {
+        margin = progress * width();
+    }
+
+    int xtrans = 0;
+    int ytrans = 0;
+
+    switch (loc) {
+        case Plasma::TopEdge:
+            ytrans = -margin;
+            break;
+        case Plasma::BottomEdge:
+            ytrans = margin;
+            break;
+        case Plasma::RightEdge:
+            xtrans = margin;
+            break;
+        case Plasma::LeftEdge:
+            xtrans = -margin;
+            break;
+        default:
+            // no hiding unless we're on an edge.
+            return;
+            break;
+    }
+
+    //kDebug() << progress << xtrans << ytrans;
+    if (PlasmaApp::hasComposite()) {
+        viewport()->move(xtrans, ytrans);
+    }
+
+    QTimeLine *tl = timeLine();
+    if (qFuzzyCompare(qreal(1.0), progress) && tl->direction() == QTimeLine::Forward) {
+        //kDebug() << "**************** hide complete" << triggerPoint << triggerWidth << triggerHeight;
+        createUnhideTrigger();
+        hide();
+    }/* else if (qFuzzyCompare(qreal(0.0), progress) && tl->direction() == QTimeLine::Backward) {
+        kDebug() << "show complete";
+    }*/
+}
+
+void PanelView::createUnhideTrigger()
+{
+#ifdef Q_WS_X11
+    if (m_unhideTrigger != None) {
+        return;
+    }
+
+    int triggerWidth = 1;
+    int triggerHeight = 1;
+    QPoint triggerPoint = pos();
+
+    switch (location()) {
+        case Plasma::TopEdge:
+            triggerWidth = width();
+            break;
+        case Plasma::BottomEdge:
+            triggerWidth = width();
+            triggerPoint = geometry().bottomLeft();
+            break;
+        case Plasma::RightEdge:
+            triggerHeight = height();
+            triggerPoint = geometry().topRight();
+            break;
+        case Plasma::LeftEdge:
+            triggerHeight = height();
+            break;
+        default:
+            // no hiding unless we're on an edge.
+            return;
+            break;
+    }
+
+    XSetWindowAttributes attributes;
+    attributes.override_redirect = True;
+    attributes.event_mask = EnterWindowMask;
+    unsigned long valuemask = CWOverrideRedirect | CWEventMask;
+    m_unhideTrigger = XCreateWindow(QX11Info::display(), QX11Info::appRootWindow(),
+                                    triggerPoint.x(), triggerPoint.y(), triggerWidth, triggerHeight,
+                                    0, CopyFromParent, InputOnly, CopyFromParent,
+                                    valuemask, &attributes);
+    XMapWindow(QX11Info::display(), m_unhideTrigger);
+//    KWindowSystem::setState(m_unhideTrigger, NET::StaysOnTop);
+
+#endif
+    //kDebug() << m_unhideTrigger;
+    PlasmaApp::self()->panelHidden(true);
+}
+
+void PanelView::destroyUnhideTrigger()
+{
+#ifdef Q_WS_X11
+    if (m_unhideTrigger == None) {
+        return;
+    }
+
+    XDestroyWindow(QX11Info::display(), m_unhideTrigger);
+    m_unhideTrigger = None;
+#endif
+
+    //kDebug();
+    PlasmaApp::self()->panelHidden(false);
+}
+
+void PanelView::panelDeleted()
+{
+    if (!QApplication::closingDown()) {
+        // the panel was removed at runtime; clean up our configuration object as well
+        KConfigGroup c = config();
+        c.deleteGroup();
+    }
+
+    deleteLater();
+}
+
 #include "panelview.moc"
 


Index: kdebase-workspace.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdebase-workspace/F-9/kdebase-workspace.spec,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- kdebase-workspace.spec	8 Oct 2008 12:18:38 -0000	1.106
+++ kdebase-workspace.spec	9 Oct 2008 17:49:37 -0000	1.107
@@ -4,7 +4,7 @@
 Name: kdebase-workspace
 Version: 4.1.2
 
-Release: 3%{?dist}
+Release: 4%{?dist}
 Source0: ftp://ftp.kde.org/pub/kde/unstable/%{version}/src/kdebase-workspace-%{version}.tar.bz2
 License: GPLv2
 Group: User Interface/Desktops
@@ -21,6 +21,8 @@
 Patch7: kdebase-workspace-4.0.3-timedate-kcm.patch
 # 441062: packagekit tools do not show icons correctly on KDE
 Patch8: kdebase-workspace-4.0.3-krdb.patch
+# originally from plasma-4.0-openSUSE
+Patch9: kdebase-workspace-4.0.98-kickoff-suspend.patch
 Patch10: kdebase-workspace-4.0.72-klipper-url.patch
 # allows to define a default wallpaper via plasmarc:wallpaper
 Patch11: kdebase-workspace-4.0.85-plasma-default-wallpaper.patch
@@ -38,8 +40,25 @@
 Patch102: kdebase-workspace-4.1.0-enable-kwin-taskbarthumbnail.patch
 Patch103: kdebase-workspace-4.1.2-klipper-crash.patch
 
-# plasma-4.0-openSUSE patches:
-Patch204: kdebase-workspace-4.0.98-kickoff-suspend.patch
+# backport of panel autohide from KDE 4.2
+# from plasma-4.1-openSUSE: http://websvn.kde.org/?view=rev&revision=864493
+# Fedora changes:
+# * removed theme changes
+# * removed hunks from plasmacontroller.cpp which rename theme elements
+Patch104: kdebase-workspace-4.1.2-panel-autohide.patch
+# panel autohide bugfixes
+# (use sed -i -e 's!plasma/shells/desktop!plasma/plasma!g' to backport):
+# http://websvn.kde.org/?view=rev&revision=866710
+# http://websvn.kde.org/?view=rev&revision=866715
+Patch105: kdebase-workspace-4.1.2-panel-autohide-fix-flicker.patch
+# http://websvn.kde.org/?view=rev&revision=867559
+Patch106: kdebase-workspace-4.1.2-panel-autohide-867559.patch
+# http://websvn.kde.org/?view=rev&revision=868231
+Patch107: kdebase-workspace-4.1.2-panel-autohide-868231.patch
+# http://websvn.kde.org/?view=rev&revision=869277
+Patch108: kdebase-workspace-4.1.2-panel-autohide-869277.patch
+# end panel autohide bugfixes
+
 # FIXME: "inconsistent naming System Monitor vs KSysGuard" http://bugs.kde.org/162151
 
 Provides: kdebase-kdm = 6:%{version}-%{release}
@@ -164,6 +183,7 @@
 popd
 %patch7 -p0 -b .timedate-kcm
 %patch8 -p0 -b .krdb
+%patch9 -p1 -b .kickoff-suspend
 %patch10 -p1 -b .klipper-url
 %patch11 -p1 -b .plasma-default-wallpaper
 
@@ -171,9 +191,11 @@
 %patch100 -p1 -b .plasma-tooltips
 %patch102 -p0 -b .kwin-taskbarthumbnail
 %patch103 -p0 -b .klipper-crash
-
-# plasma-4.0-openSUSE patches:
-%patch204 -p1 -b .kickoff-suspend
+%patch104 -p0 -b .panel-autohide
+%patch105 -p0 -b .panel-autohide2
+%patch106 -p0 -b .panel-autohide3
+%patch107 -p0 -b .panel-autohide4
+%patch108 -p0 -b .panel-autohide5
 
 
 %build
@@ -311,6 +333,9 @@
 
 
 %changelog
+* Thu Oct 09 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.1.2-4
+- backport panel autohide from 4.2 / plasma-4.1-openSUSE
+
 * Wed Oct  8 2008 Lukáš Tinkl <ltinkl at redhat.com> 4.1.2-3
 - fix crash when invoking a klipper command for a second time
 




More information about the fedora-extras-commits mailing list