Make sure splash screen gets focus. Also better key press/release handling in working banner.

This commit is contained in:
LoRd_MuldeR 2013-11-30 13:10:34 +01:00
parent 72f2ef3617
commit 4635d9bf76
5 changed files with 33 additions and 6 deletions

View File

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 9
#define VER_LAMEXP_BUILD 1490
#define VER_LAMEXP_BUILD 1495
#define VER_LAMEXP_CONFG 1348
///////////////////////////////////////////////////////////////////////////////

View File

@ -126,7 +126,7 @@ void SplashScreen::showSplash(QThread *thread)
//Wait for window to show
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
splashScreen->repaint();
splashScreen->repaint(); lamexp_bring_to_front(splashScreen);
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
//Connect thread signals
@ -181,6 +181,7 @@ void SplashScreen::updateHandler(void)
else
{
setWindowOpacity(1.0);
lamexp_bring_to_front(this);
m_timer->stop();
m_status = STATUS_WAIT;
}
@ -209,6 +210,7 @@ void SplashScreen::threadComplete(void)
{
m_timer->start(FADE_DELAY);
}
lamexp_bring_to_front(this);
}
////////////////////////////////////////////////////////////

View File

@ -236,12 +236,12 @@ void WorkingBanner::keyPressEvent(QKeyEvent *event)
QTimer::singleShot(0, parent(), SLOT(showMinimized()));
}
event->ignore();
QDialog::keyPressEvent(event);
}
void WorkingBanner::keyReleaseEvent(QKeyEvent *event)
{
event->ignore();
QDialog::keyReleaseEvent(event);
}
void WorkingBanner::closeEvent(QCloseEvent *event)

View File

@ -149,6 +149,7 @@ const QStringList &lamexp_arguments(void);
QStringList lamexp_available_codepages(bool noAliases = true);
bool lamexp_beep(int beepType);
void lamexp_blink_window(QWidget *poWindow, unsigned int count = 10, unsigned int delay = 150);
bool lamexp_block_window_move(void *message);
bool lamexp_bring_process_to_front(const unsigned long pid);
bool lamexp_bring_to_front(const QWidget *win);
bool lamexp_broadcast(int eventType, bool onlyToVisible);

View File

@ -1495,6 +1495,26 @@ int lamexp_system_message(const wchar_t *text, int beepType)
return MessageBoxW(NULL, text, L"LameXP", flags);
}
/*
* Block window "move" message
*/
bool lamexp_block_window_move(void *message)
{
if(message)
{
MSG *msg = reinterpret_cast<MSG*>(message);
if((msg->message == WM_SYSCOMMAND) && (msg->wParam == SC_MOVE))
{
return true;
}
if((msg->message == WM_NCLBUTTONDOWN) && (msg->wParam == HTCAPTION))
{
return true;
}
}
return false;
}
/*
* Suspend calling thread for N milliseconds
*/
@ -1745,9 +1765,13 @@ bool lamexp_bring_to_front(const QWidget *window)
if(window)
{
ret = (SetForegroundWindow(window->winId()) == TRUE);
for(int i = 0; (i < 5) && (!ret); i++)
{
ret = (SetForegroundWindow(window->winId()) != FALSE);
SwitchToThisWindow(window->winId(), TRUE);
}
LockSetForegroundWindow(LSFW_LOCK);
}
return ret;
}