Properly fix task tray background glitches

Ensure session is fully locked before switching to new VT when lock is requested
pull/2/head
Timothy Pearson 12 years ago
parent 667839ee65
commit 3cce16c254

@ -173,6 +173,7 @@ extern bool trinity_desktop_lock_hide_active_windows;
extern bool trinity_desktop_lock_forced; extern bool trinity_desktop_lock_forced;
extern bool argb_visual; extern bool argb_visual;
extern pid_t kdesktop_pid;
extern TQXLibWindowList trinity_desktop_lock_hidden_window_list; extern TQXLibWindowList trinity_desktop_lock_hidden_window_list;
@ -224,6 +225,7 @@ LockProcess::LockProcess()
mHackStartupEnabled(true), mHackStartupEnabled(true),
mOverrideHackStartupEnabled(false), mOverrideHackStartupEnabled(false),
mResizingDesktopLock(false), mResizingDesktopLock(false),
mFullyOnlineSent(false),
m_rootPixmap(NULL), m_rootPixmap(NULL),
mBackingStartupDelayTimer(0), mBackingStartupDelayTimer(0),
m_startupStatusDialog(NULL), m_startupStatusDialog(NULL),
@ -973,6 +975,8 @@ void LockProcess::createSaverWindow()
} }
} }
fullyOnline();
kdDebug(1204) << "Saver window Id: " << winId() << endl; kdDebug(1204) << "Saver window Id: " << winId() << endl;
} }
@ -2739,6 +2743,21 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) {
} }
} }
void LockProcess::fullyOnline() {
if (!mFullyOnlineSent) {
if (kdesktop_pid > 0) {
if (kill(kdesktop_pid, SIGUSR2) < 0) {
// The controlling kdesktop process probably died. Commit suicide...
// Exit uncleanly
exit(1);
}
else {
mFullyOnlineSent = true;
}
}
}
}
//=========================================================================== //===========================================================================
// //
// Control pipe handler // Control pipe handler

@ -155,6 +155,7 @@ private:
void windowAdded( WId window, bool managed ); void windowAdded( WId window, bool managed );
void resume( bool force ); void resume( bool force );
static TQVariant getConf(void *ctx, const char *key, const TQVariant &dflt); static TQVariant getConf(void *ctx, const char *key, const TQVariant &dflt);
void fullyOnline();
bool mLocked; bool mLocked;
int mLockGrace; int mLockGrace;
@ -220,6 +221,7 @@ private:
bool mHackStartupEnabled; bool mHackStartupEnabled;
bool mOverrideHackStartupEnabled; bool mOverrideHackStartupEnabled;
bool mResizingDesktopLock; bool mResizingDesktopLock;
bool mFullyOnlineSent;
TQPixmap backingPixmap; TQPixmap backingPixmap;
KRootPixmap *m_rootPixmap; KRootPixmap *m_rootPixmap;

@ -81,6 +81,7 @@ bool signalled_run;
bool in_internal_mode = FALSE; bool in_internal_mode = FALSE;
bool argb_visual = FALSE; bool argb_visual = FALSE;
pid_t kdesktop_pid = -1;
static void sigusr1_handler(int) static void sigusr1_handler(int)
{ {
@ -490,8 +491,8 @@ int main( int argc, char **argv )
return ret; return ret;
} }
else { else {
pid_t kdesktop_pid = atoi(args->getOption( "internal" )); kdesktop_pid = atoi(args->getOption( "internal" ));
if (kill(kdesktop_pid, SIGUSR2) < 0) { if (kill(kdesktop_pid, 0) < 0) {
// The controlling kdesktop process probably died. Commit suicide... // The controlling kdesktop process probably died. Commit suicide...
return 12; return 12;
} }

@ -1130,10 +1130,8 @@ void SystemTrayApplet::setBackground()
TrayEmbed::TrayEmbed( bool kdeTray, TQWidget* parent ) 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(); hide();
m_scaledWidget = new TQWidget(parent); m_scaledWidget = new TQWidget(parent);
m_scaledWidget->hide(); m_scaledWidget->hide();
@ -1141,7 +1139,7 @@ TrayEmbed::TrayEmbed( bool kdeTray, TQWidget* parent )
TrayEmbed::~TrayEmbed() TrayEmbed::~TrayEmbed()
{ {
delete m_ensureBackgroundSetTimer; //
} }
void TrayEmbed::getIconSize(int defaultIconSize) void TrayEmbed::getIconSize(int defaultIconSize)
@ -1164,20 +1162,19 @@ void TrayEmbed::setBackground()
{ {
const TQPixmap *pbg = parentWidget()->backgroundPixmap(); const TQPixmap *pbg = parentWidget()->backgroundPixmap();
if (pbg) if (pbg) {
{
TQPixmap bg(width(), height()); TQPixmap bg(width(), height());
bg.fill(parentWidget(), pos()); bg.fill(parentWidget(), pos());
setPaletteBackgroundPixmap(bg); setPaletteBackgroundPixmap(bg);
setBackgroundOrigin(WidgetOrigin); setBackgroundOrigin(WidgetOrigin);
} }
else else {
unsetPalette(); unsetPalette();
}
if (!isHidden()) if (!isHidden())
{ {
XClearArea(x11Display(), embeddedWinId(), 0, 0, 0, 0, True); XClearArea(x11Display(), embeddedWinId(), 0, 0, 0, 0, True);
m_ensureBackgroundSetTimerCount = 0;
ensureBackgroundSet(); ensureBackgroundSet();
} }
} }
@ -1211,8 +1208,7 @@ void TrayEmbed::ensureBackgroundSet()
int g = int( tqGreen( l ) ); int g = int( tqGreen( l ) );
int b = int( tqBlue( l ) ); int b = int( tqBlue( l ) );
int a = int( tqAlpha( l ) ); int a = int( tqAlpha( l ) );
ls[x] = tqRgba( r, g, b, a ); XSetForeground(x11Display(), gc, (a << 24) | (r << 16) | (g << 8) | b );
XSetForeground(x11Display(), gc, (r << 16) | (g << 8) | b );
XDrawPoint(x11Display(), argbpixmap, gc, x, y); XDrawPoint(x11Display(), argbpixmap, gc, x, y);
} }
} }
@ -1223,13 +1219,5 @@ void TrayEmbed::ensureBackgroundSet()
// Repaint // Repaint
XClearArea(x11Display(), embeddedWinId(), 0, 0, 0, 0, True); 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);
}
} }
} }

@ -135,8 +135,6 @@ public:
private: private:
bool kde_tray; bool kde_tray;
TQWidget *m_scaledWidget; TQWidget *m_scaledWidget;
TQTimer* m_ensureBackgroundSetTimer;
int m_ensureBackgroundSetTimerCount;
private slots: private slots:
void ensureBackgroundSet(); void ensureBackgroundSet();
}; };

@ -448,9 +448,14 @@ extern int kicker_screen_number;
void PanelKMenu::slotLock() void PanelKMenu::slotLock()
{ {
TQCString appname( "kdesktop" ); TQCString appname( "kdesktop" );
if ( kicker_screen_number ) if ( kicker_screen_number ) {
appname.sprintf("kdesktop-screen-%d", 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() void PanelKMenu::slotLogout()
@ -520,8 +525,9 @@ void PanelKMenu::doNewSession( bool lock )
if (result==KMessageBox::Cancel) if (result==KMessageBox::Cancel)
return; return;
if (lock) if (lock) {
slotLock(); slotLock();
}
DM().startReserve(); DM().startReserve();
} }

Loading…
Cancel
Save