Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 364555 | Differences between
and this patch

Collapse All | Expand All

(-)b/plasma/desktop/shell/panelview.h (-6 / +1 lines)
Lines 141-147 public Q_SLOTS: Link Here
141
    /**
141
    /**
142
     * Decides whether give focus to the panel
142
     * Decides whether give focus to the panel
143
     */
143
     */
144
    void statusUpdated(Plasma::ItemStatus newStatus);
144
    void setStatus(Plasma::ItemStatus newStatus);
145
145
146
    /**
146
    /**
147
     * Pinches the min/max sizes of the containment to the current screen resolution
147
     * Pinches the min/max sizes of the containment to the current screen resolution
Lines 240-246 private Q_SLOTS: Link Here
240
    void overlayMoved(PanelAppletOverlay *overlay);
240
    void overlayMoved(PanelAppletOverlay *overlay);
241
    void panelDeleted();
241
    void panelDeleted();
242
    void startAutoHide();
242
    void startAutoHide();
243
    void checkAutounhide();
244
243
245
    /**
244
    /**
246
     * update the appearance of the unhide hinter
245
     * update the appearance of the unhide hinter
Lines 270-276 private: Link Here
270
    GlowBar *m_glowBar;
269
    GlowBar *m_glowBar;
271
    QTimer *m_mousePollTimer;
270
    QTimer *m_mousePollTimer;
272
    QTimer *m_strutsTimer;
271
    QTimer *m_strutsTimer;
273
    QTimer *m_rehideAfterAutounhideTimer;
274
    QTimeLine *m_timeLine;
272
    QTimeLine *m_timeLine;
275
    QGraphicsWidget *m_spacer;
273
    QGraphicsWidget *m_spacer;
276
    int m_spacerIndex;
274
    int m_spacerIndex;
Lines 292-301 private: Link Here
292
290
293
    bool m_editing : 1;
291
    bool m_editing : 1;
294
    bool m_triggerEntered : 1;
292
    bool m_triggerEntered : 1;
295
    bool m_respectStatus : 1;
296
297
    static const int STRUTSTIMERDELAY = 200;
293
    static const int STRUTSTIMERDELAY = 200;
298
    static const int AUTOUNHIDE_CHECK_DELAY = 3000;
299
};
294
};
300
295
301
#endif
296
#endif
(-)a/plasma/desktop/shell/panelview.cpp (-108 / +39 lines)
Lines 20-25 Link Here
20
#include "panelview.h"
20
#include "panelview.h"
21
21
22
#include <QApplication>
22
#include <QApplication>
23
#include <QDesktopWidget>
23
#include <QGraphicsLinearLayout>
24
#include <QGraphicsLinearLayout>
24
#include <QPropertyAnimation>
25
#include <QPropertyAnimation>
25
#include <QTimer>
26
#include <QTimer>
Lines 29-37 Link Here
29
#include <X11/extensions/shape.h>
30
#include <X11/extensions/shape.h>
30
#endif
31
#endif
31
32
32
#include <KDebug>
33
#include <KIdleTime>
34
#include <KWindowSystem>
33
#include <KWindowSystem>
34
#include <KDebug>
35
35
36
#include <Plasma/Containment>
36
#include <Plasma/Containment>
37
#include <Plasma/Corona>
37
#include <Plasma/Corona>
Lines 309-315 PanelView::PanelView(Plasma::Containment Link Here
309
      m_glowBar(0),
309
      m_glowBar(0),
310
      m_mousePollTimer(0),
310
      m_mousePollTimer(0),
311
      m_strutsTimer(new QTimer(this)),
311
      m_strutsTimer(new QTimer(this)),
312
      m_rehideAfterAutounhideTimer(new QTimer(this)),
313
      m_spacer(0),
312
      m_spacer(0),
314
      m_spacerIndex(-1),
313
      m_spacerIndex(-1),
315
      m_shadowWindow(0),
314
      m_shadowWindow(0),
Lines 319-326 PanelView::PanelView(Plasma::Containment Link Here
319
      m_visibilityMode(NormalPanel),
318
      m_visibilityMode(NormalPanel),
320
      m_lastHorizontal(true),
319
      m_lastHorizontal(true),
321
      m_editing(false),
320
      m_editing(false),
322
      m_triggerEntered(false),
321
      m_triggerEntered(false)
323
      m_respectStatus(true)
324
{
322
{
325
    // KWin setup
323
    // KWin setup
326
    KWindowSystem::setOnAllDesktops(winId(), true);
324
    KWindowSystem::setOnAllDesktops(winId(), true);
Lines 330-342 PanelView::PanelView(Plasma::Containment Link Here
330
    m_strutsTimer->setSingleShot(true);
328
    m_strutsTimer->setSingleShot(true);
331
    connect(m_strutsTimer, SIGNAL(timeout()), this, SLOT(updateStruts()));
329
    connect(m_strutsTimer, SIGNAL(timeout()), this, SLOT(updateStruts()));
332
330
333
    // this timer controls checks to re-hide a panel after it's been unhidden
334
    // for the user because, e.g., something is demanding attention
335
    m_rehideAfterAutounhideTimer->setSingleShot(true);
336
    connect(m_rehideAfterAutounhideTimer, SIGNAL(timeout()), this, SLOT(checkAutounhide()));
337
338
    // Graphics view setup
331
    // Graphics view setup
339
    setFrameStyle(QFrame::NoFrame);
332
    setFrameStyle(QFrame::NoFrame);
333
    //setAutoFillBackground(true);
334
    //setDragMode(QGraphicsView::RubberBandDrag);
335
    //setCacheMode(QGraphicsView::CacheBackground);
340
    setInteractive(true);
336
    setInteractive(true);
341
    setAcceptDrops(true);
337
    setAcceptDrops(true);
342
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
338
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Lines 356-375 PanelView::PanelView(Plasma::Containment Link Here
356
352
357
    const bool onScreen = panel->screen() < PlasmaApp::self()->corona()->numScreens();
353
    const bool onScreen = panel->screen() < PlasmaApp::self()->corona()->numScreens();
358
    const QRect screenRect = onScreen ?  PlasmaApp::self()->corona()->screenGeometry(panel->screen()) : QRect();
354
    const QRect screenRect = onScreen ?  PlasmaApp::self()->corona()->screenGeometry(panel->screen()) : QRect();
359
    const int sw = screenRect.width();
355
    if (!onScreen) {
360
    const int sh = screenRect.height();
361
    m_lastSeenSize = sizes.readEntry("lastsize", m_lastHorizontal ? sw : sh);
362
363
    if (onScreen) {
364
        const QString last = m_lastHorizontal ? "Horizontal" + QString::number(sw) :
365
                                                "Vertical" + QString::number(sh);
366
        if (sizes.hasGroup(last)) {
367
            KConfigGroup thisSize(&sizes, last);
368
            resize(thisSize.readEntry("size", m_lastHorizontal ? QSize(sw, 27) : QSize(27, sh)));
369
        }
370
    } else {
371
        resize(panel->size().toSize());
356
        resize(panel->size().toSize());
372
    }
357
    }
358
    m_lastSeenSize = sizes.readEntry("lastsize", m_lastHorizontal ? screenRect.width() : screenRect.height());
373
359
374
    m_alignment = alignmentFilter((Qt::Alignment)viewConfig.readEntry("Alignment", (int)Qt::AlignLeft));
360
    m_alignment = alignmentFilter((Qt::Alignment)viewConfig.readEntry("Alignment", (int)Qt::AlignLeft));
375
    KConfigGroup sizeConfig(&viewConfig, (m_lastHorizontal ? "Horizontal" : "Vertical") +
361
    KConfigGroup sizeConfig(&viewConfig, (m_lastHorizontal ? "Horizontal" : "Vertical") +
Lines 413-419 void PanelView::setContainment(Plasma::C Link Here
413
        disconnect(oldContainment);
399
        disconnect(oldContainment);
414
    }
400
    }
415
401
416
    connect(containment, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(statusUpdated(Plasma::ItemStatus)));
402
    connect(containment, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(setStatus(Plasma::ItemStatus)));
417
    connect(containment, SIGNAL(destroyed(QObject*)), this, SLOT(panelDeleted()));
403
    connect(containment, SIGNAL(destroyed(QObject*)), this, SLOT(panelDeleted()));
418
    connect(containment, SIGNAL(toolBoxToggled()), this, SLOT(togglePanelController()));
404
    connect(containment, SIGNAL(toolBoxToggled()), this, SLOT(togglePanelController()));
419
    connect(containment, SIGNAL(appletAdded(Plasma::Applet *, const QPointF &)), this, SLOT(appletAdded(Plasma::Applet *)));
405
    connect(containment, SIGNAL(appletAdded(Plasma::Applet *, const QPointF &)), this, SLOT(appletAdded(Plasma::Applet *)));
Lines 436-441 void PanelView::setContainment(Plasma::C Link Here
436
422
437
    // ensure we aren't overlapping other panels
423
    // ensure we aren't overlapping other panels
438
    const QRect screenRect = PlasmaApp::self()->corona()->screenGeometry(containment->screen());
424
    const QRect screenRect = PlasmaApp::self()->corona()->screenGeometry(containment->screen());
425
    const QRegion availGeom = PlasmaApp::self()->corona()->availableScreenRegion(containment->screen());
426
    const int w = containment->size().width();
427
    const int h = containment->size().height();
428
    const int length = containment->formFactor() == Plasma::Horizontal ? w : h;
439
429
440
    View::setContainment(containment);
430
    View::setContainment(containment);
441
431
Lines 448-458 void PanelView::setContainment(Plasma::C Link Here
448
438
449
    updateStruts();
439
    updateStruts();
450
    checkShadow();
440
    checkShadow();
451
452
    // if we are an autohiding panel, then see if the status mandates we do something about it
453
    if (m_visibilityMode != NormalPanel && m_visibilityMode != WindowsGoBelow) {
454
        checkUnhide(containment->status());
455
    }
456
}
441
}
457
442
458
void PanelView::themeChanged()
443
void PanelView::themeChanged()
Lines 463-469 void PanelView::themeChanged() Link Here
463
448
464
void PanelView::checkShadow()
449
void PanelView::checkShadow()
465
{
450
{
466
#ifndef Q_WS_WIN
467
    if (KWindowSystem::compositingActive() && containment()->property("shadowPath").isValid()) {
451
    if (KWindowSystem::compositingActive() && containment()->property("shadowPath").isValid()) {
468
        if (!m_shadowWindow) {
452
        if (!m_shadowWindow) {
469
            m_shadowWindow = new ShadowWindow(this);
453
            m_shadowWindow = new ShadowWindow(this);
Lines 478-488 void PanelView::checkShadow() Link Here
478
        if (m_shadowWindow->isValid() && isVisible()) {
462
        if (m_shadowWindow->isValid() && isVisible()) {
479
            m_shadowWindow->show();
463
            m_shadowWindow->show();
480
        }
464
        }
481
    } else if (m_shadowWindow) {
465
    } else {
482
        m_shadowWindow->deleteLater();
466
        if (m_shadowWindow) {
483
        m_shadowWindow = 0;
467
            m_shadowWindow->deleteLater();
468
            m_shadowWindow = 0;
469
        }
484
    }
470
    }
485
#endif
486
}
471
}
487
472
488
void PanelView::setPanelDragPosition(const QPoint &point)
473
void PanelView::setPanelDragPosition(const QPoint &point)
Lines 709-714 void PanelView::updatePanelGeometry() Link Here
709
            geom.moveTopLeft(QPoint(screenGeom.center().x() - geom.width()/2 + 1 - geom.width()%2 + m_offset, screenGeom.top()));
694
            geom.moveTopLeft(QPoint(screenGeom.center().x() - geom.width()/2 + 1 - geom.width()%2 + m_offset, screenGeom.top()));
710
        }
695
        }
711
696
697
        //enable borders if needed
698
        //c->setGeometry(QRect(geom.left(), c->geometry().top(), geom.width(), geom.height()));
712
        break;
699
        break;
713
700
714
    case Plasma::LeftEdge:
701
    case Plasma::LeftEdge:
Lines 720-725 void PanelView::updatePanelGeometry() Link Here
720
            geom.moveTopLeft(QPoint(screenGeom.left(), screenGeom.center().y() - geom.height()/2 + 1 - geom.height()%2 + m_offset));
707
            geom.moveTopLeft(QPoint(screenGeom.left(), screenGeom.center().y() - geom.height()/2 + 1 - geom.height()%2 + m_offset));
721
        }
708
        }
722
709
710
        //enable borders if needed
711
        //c->setGeometry(QRect(c->geometry().left(), geom.top(), geom.width(), geom.height()));
723
        break;
712
        break;
724
713
725
    case Plasma::RightEdge:
714
    case Plasma::RightEdge:
Lines 731-736 void PanelView::updatePanelGeometry() Link Here
731
            geom.moveTopRight(QPoint(screenGeom.right(), screenGeom.center().y() - geom.height()/2 + 1 - geom.height()%2 + m_offset));
720
            geom.moveTopRight(QPoint(screenGeom.right(), screenGeom.center().y() - geom.height()/2 + 1 - geom.height()%2 + m_offset));
732
        }
721
        }
733
722
723
        //enable borders if needed
724
        //c->setGeometry(QRect(c->geometry().left(), geom.top(), geom.width(), geom.height()));
734
        break;
725
        break;
735
726
736
    case Plasma::BottomEdge:
727
    case Plasma::BottomEdge:
Lines 743-748 void PanelView::updatePanelGeometry() Link Here
743
            geom.moveBottomLeft(QPoint(screenGeom.center().x() - geom.width()/2 + 1 - geom.width()%2 + m_offset, screenGeom.bottom()));
734
            geom.moveBottomLeft(QPoint(screenGeom.center().x() - geom.width()/2 + 1 - geom.width()%2 + m_offset, screenGeom.bottom()));
744
        }
735
        }
745
736
737
        //enable borders if needed
738
        //c->setGeometry(QRect(geom.left(), c->geometry().top(), geom.width(), geom.height()));
746
        break;
739
        break;
747
    }
740
    }
748
741
Lines 818-824 void PanelView::pinchContainment(const Q Link Here
818
    KConfigGroup sizes = config();
811
    KConfigGroup sizes = config();
819
    sizes = KConfigGroup(&sizes, "Sizes");
812
    sizes = KConfigGroup(&sizes, "Sizes");
820
813
821
    if (m_lastHorizontal != horizontal || m_lastSeenSize != (horizontal ? sw : sh)) {
814
    if (m_lastHorizontal != horizontal ||
815
        m_lastSeenSize != (horizontal ? sw : sh)) {
822
        // we're adjusting size. store the current size now
816
        // we're adjusting size. store the current size now
823
        KConfigGroup lastSize(&sizes, (m_lastHorizontal ? "Horizontal" : "Vertical") +
817
        KConfigGroup lastSize(&sizes, (m_lastHorizontal ? "Horizontal" : "Vertical") +
824
                                      QString::number(m_lastSeenSize));
818
                                      QString::number(m_lastSeenSize));
Lines 1032-1054 void PanelView::togglePanelController() Link Here
1032
        }
1026
        }
1033
    }
1027
    }
1034
1028
1035
    if (m_panelController->isVisible()) {
1029
    if (!m_panelController->isVisible()) {
1036
        if (m_panelController->showingWidgetExplorer() ||
1037
            m_panelController->showingActivityManager()) {
1038
            m_panelController->switchToController();
1039
            m_panelController->move(m_panelController->positionForPanelGeometry(geometry()));
1040
        } else {
1041
            Plasma::WindowEffects::slideWindow(m_panelController, location());
1042
            m_panelController->close();
1043
            updateStruts();
1044
        }
1045
    } else {
1046
        m_editing = true;
1030
        m_editing = true;
1047
        m_panelController->resize(m_panelController->sizeHint());
1031
        m_panelController->resize(m_panelController->sizeHint());
1048
        m_panelController->move(m_panelController->positionForPanelGeometry(geometry()));
1032
        m_panelController->move(m_panelController->positionForPanelGeometry(geometry()));
1049
        Plasma::WindowEffects::slideWindow(m_panelController, location());
1033
        Plasma::WindowEffects::slideWindow(m_panelController, location());
1050
        kDebug() << "showing panel controller!" << m_panelController->geometry();
1034
        kDebug() << "showing panel controller!" << m_panelController->geometry();
1051
        m_panelController->show();
1035
        m_panelController->show();
1036
    } else {
1037
        Plasma::WindowEffects::slideWindow(m_panelController, location());
1038
        m_panelController->close();
1039
        updateStruts();
1052
    }
1040
    }
1053
}
1041
}
1054
1042
Lines 1438-1444 void PanelView::unhide(bool destroyTrigg Link Here
1438
    }
1426
    }
1439
}
1427
}
1440
1428
1441
void PanelView::statusUpdated(Plasma::ItemStatus newStatus)
1429
void PanelView::setStatus(Plasma::ItemStatus newStatus)
1442
{
1430
{
1443
    if (newStatus == Plasma::AcceptingInputStatus) {
1431
    if (newStatus == Plasma::AcceptingInputStatus) {
1444
        KWindowSystem::forceActiveWindow(winId());
1432
        KWindowSystem::forceActiveWindow(winId());
Lines 1447-1496 void PanelView::statusUpdated(Plasma::It Link Here
1447
1435
1448
void PanelView::checkUnhide(Plasma::ItemStatus newStatus)
1436
void PanelView::checkUnhide(Plasma::ItemStatus newStatus)
1449
{
1437
{
1450
    //kDebug() << "================= got a status: " << newStatus << Plasma::ActiveStatus;
1438
    //kDebug() << "================= got a new status: " << newStatus << Plasma::ActiveStatus;
1451
    m_respectStatus = true;
1452
1453
    if (newStatus > Plasma::ActiveStatus) {
1439
    if (newStatus > Plasma::ActiveStatus) {
1454
        unhide();
1440
        unhide();
1455
        if (newStatus == Plasma::NeedsAttentionStatus) {
1456
            //kDebug() << "starting the timer!";
1457
            // start our rehide timer, so that the panel doesn't stay up and stuck forever and a day
1458
            m_rehideAfterAutounhideTimer->start(AUTOUNHIDE_CHECK_DELAY);
1459
        }
1460
    } else {
1441
    } else {
1461
        //kDebug() << "new status, just autohiding";
1462
        startAutoHide();
1442
        startAutoHide();
1463
    }
1443
    }
1464
}
1444
}
1465
1445
1466
void PanelView::checkAutounhide()
1467
{
1468
    //kDebug() << "***************************" << KIdleTime::instance()->idleTime();
1469
    if (KIdleTime::instance()->idleTime() >= AUTOUNHIDE_CHECK_DELAY) {
1470
        // the user is idle .. let's not hige the panel on them quite yet, but rather given them a
1471
        // chance to see this thing!
1472
        connect(KIdleTime::instance(), SIGNAL(resumingFromIdle()), this, SLOT(checkAutounhide()),
1473
                Qt::UniqueConnection);
1474
        KIdleTime::instance()->catchNextResumeEvent();
1475
        //kDebug() << "exit 1 ***************************";
1476
        return;
1477
    }
1478
1479
    m_respectStatus = false;
1480
    //kDebug() << "in to check ... who's resonsible?" << sender() << KIdleTime::instance();
1481
    if (sender() == KIdleTime::instance()) {
1482
        //kDebug() << "doing a 2s wait";
1483
        QTimer::singleShot(2000, this, SLOT(startAutoHide()));
1484
    } else {
1485
        //kDebug() << "just starting autohide!";
1486
        startAutoHide();
1487
    }
1488
1489
    // this line must come after the check on sender() as it *clears* that value!
1490
    disconnect(KIdleTime::instance(), SIGNAL(resumingFromIdle()), this, SLOT(checkAutounhide()));
1491
    //kDebug() << "exit 0 ***************************";
1492
}
1493
1494
void PanelView::unhide()
1446
void PanelView::unhide()
1495
{
1447
{
1496
    unhide(true);
1448
    unhide(true);
Lines 1503-1533 void PanelView::resetTriggerEnteredSuppr Link Here
1503
1455
1504
void PanelView::startAutoHide()
1456
void PanelView::startAutoHide()
1505
{
1457
{
1506
    /*
1458
    //TODO: is 5s too long? not long enough?
1507
    kDebug() << m_editing << (containment() ? containment()->status() : 0) << Plasma::ActiveStatus
1459
    if (m_editing || (containment() && containment()->status() > Plasma::ActiveStatus) ||
1508
             << geometry().adjusted(-10, -10, 10, 10).contains(QCursor::pos()) << hasPopup();
1460
        geometry().adjusted(-10, -10, 10, 10).contains(QCursor::pos()) ||
1509
    if (containment() && containment()->status() > Plasma::ActiveStatus) {
1461
        hasPopup()) {
1510
        foreach (Plasma::Applet *applet, containment()->applets()) {
1511
            kDebug() << "     " << applet->name() << applet->status();
1512
        }
1513
    }
1514
    */
1515
1516
1517
    if (m_editing || (m_respectStatus && (containment() && containment()->status() > Plasma::ActiveStatus))) {
1518
        if (m_mousePollTimer) {
1519
            m_mousePollTimer->stop();
1520
            disconnect(m_mousePollTimer, SIGNAL(timeout()), this, SLOT(startAutoHide()));
1521
        }
1522
1523
        return;
1524
    }
1525
1526
    // since we've gotten this far, we don't need to worry about rehiding-after-auto-unhide, so just
1527
    // stop the timer
1528
    m_rehideAfterAutounhideTimer->stop();
1529
1530
    if (geometry().adjusted(-10, -10, 10, 10).contains(QCursor::pos()) || hasPopup()) {
1531
        if (!m_mousePollTimer) {
1462
        if (!m_mousePollTimer) {
1532
            leaveEvent(0);
1463
            leaveEvent(0);
1533
        }
1464
        }

Return to bug 364555