From 3cce16c2543ebd7441477b466b35c89333eef28c Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 3 May 2013 15:55:11 -0500 Subject: Properly fix task tray background glitches Ensure session is fully locked before switching to new VT when lock is requested --- kicker/applets/systemtray/systemtrayapplet.cpp | 24 ++++++------------------ kicker/applets/systemtray/systemtrayapplet.h | 2 -- kicker/kicker/ui/k_mnu.cpp | 12 +++++++++--- 3 files changed, 15 insertions(+), 23 deletions(-) (limited to 'kicker') diff --git a/kicker/applets/systemtray/systemtrayapplet.cpp b/kicker/applets/systemtray/systemtrayapplet.cpp index 542ac42d0..b91dafd27 100644 --- a/kicker/applets/systemtray/systemtrayapplet.cpp +++ b/kicker/applets/systemtray/systemtrayapplet.cpp @@ -1130,10 +1130,8 @@ void SystemTrayApplet::setBackground() TrayEmbed::TrayEmbed( bool kdeTray, TQWidget* parent ) - : QXEmbed( parent ), kde_tray( kdeTray ), m_ensureBackgroundSetTimerCount(0) + : QXEmbed( parent ), kde_tray( kdeTray ) { - m_ensureBackgroundSetTimer = new TQTimer(); - connect(m_ensureBackgroundSetTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(ensureBackgroundSet())); hide(); m_scaledWidget = new TQWidget(parent); m_scaledWidget->hide(); @@ -1141,7 +1139,7 @@ TrayEmbed::TrayEmbed( bool kdeTray, TQWidget* parent ) TrayEmbed::~TrayEmbed() { - delete m_ensureBackgroundSetTimer; + // } void TrayEmbed::getIconSize(int defaultIconSize) @@ -1164,20 +1162,19 @@ void TrayEmbed::setBackground() { const TQPixmap *pbg = parentWidget()->backgroundPixmap(); - if (pbg) - { + if (pbg) { TQPixmap bg(width(), height()); bg.fill(parentWidget(), pos()); setPaletteBackgroundPixmap(bg); setBackgroundOrigin(WidgetOrigin); } - else + else { unsetPalette(); + } if (!isHidden()) { XClearArea(x11Display(), embeddedWinId(), 0, 0, 0, 0, True); - m_ensureBackgroundSetTimerCount = 0; ensureBackgroundSet(); } } @@ -1211,8 +1208,7 @@ void TrayEmbed::ensureBackgroundSet() int g = int( tqGreen( l ) ); int b = int( tqBlue( l ) ); int a = int( tqAlpha( l ) ); - ls[x] = tqRgba( r, g, b, a ); - XSetForeground(x11Display(), gc, (r << 16) | (g << 8) | b ); + XSetForeground(x11Display(), gc, (a << 24) | (r << 16) | (g << 8) | b ); XDrawPoint(x11Display(), argbpixmap, gc, x, y); } } @@ -1223,13 +1219,5 @@ void TrayEmbed::ensureBackgroundSet() // Repaint XClearArea(x11Display(), embeddedWinId(), 0, 0, 0, 0, True); - - // HACK - // Clear background artifacts in first available timeslot after initial icon display - if (m_ensureBackgroundSetTimerCount < 1) { - m_ensureBackgroundSetTimerCount++; - m_ensureBackgroundSetTimer->stop(); - m_ensureBackgroundSetTimer->start(0, TRUE); - } } } diff --git a/kicker/applets/systemtray/systemtrayapplet.h b/kicker/applets/systemtray/systemtrayapplet.h index 06b42c23d..250480b65 100644 --- a/kicker/applets/systemtray/systemtrayapplet.h +++ b/kicker/applets/systemtray/systemtrayapplet.h @@ -135,8 +135,6 @@ public: private: bool kde_tray; TQWidget *m_scaledWidget; - TQTimer* m_ensureBackgroundSetTimer; - int m_ensureBackgroundSetTimerCount; private slots: void ensureBackgroundSet(); }; diff --git a/kicker/kicker/ui/k_mnu.cpp b/kicker/kicker/ui/k_mnu.cpp index 8ab0d3a0f..e7a7a0fb0 100644 --- a/kicker/kicker/ui/k_mnu.cpp +++ b/kicker/kicker/ui/k_mnu.cpp @@ -448,9 +448,14 @@ extern int kicker_screen_number; void PanelKMenu::slotLock() { TQCString appname( "kdesktop" ); - if ( kicker_screen_number ) + if ( kicker_screen_number ) { appname.sprintf("kdesktop-screen-%d", kicker_screen_number); - kapp->dcopClient()->send(appname, "KScreensaverIface", "lock()", TQString("")); + } + TQCString replyType; + TQByteArray replyData; + // Block here until lock is complete + // If this is not done the desktop of the locked session will be shown after VT switch until the lock fully engages! + kapp->dcopClient()->call(appname, "KScreensaverIface", "lock()", TQCString(""), replyType, replyData); } void PanelKMenu::slotLogout() @@ -520,8 +525,9 @@ void PanelKMenu::doNewSession( bool lock ) if (result==KMessageBox::Cancel) return; - if (lock) + if (lock) { slotLock(); + } DM().startReserve(); } -- cgit v1.2.1