- attempt to have windows screen come to forefront sooner

This commit is contained in:
Mark Vejvoda 2012-07-27 19:08:41 +00:00
parent 0e0c43f14a
commit 0309e83791
3 changed files with 24 additions and 7 deletions

View File

@ -104,7 +104,7 @@ void exceptionMessage(const exception &excp);
string getCommandLine();
void init_win32();
void done_win32();
void ontop_win32(int width, int height);
// The following is used for stacking tracing for windows based exceptions
#if !defined(_DEBUG) && !defined(__GNUC__)

View File

@ -401,6 +401,9 @@ void Window::setStyle(WindowStyle windowStyle) {
void Window::create() {
// nothing here
#ifdef WIN32
ontop_win32(this->w,this->h);
#endif
}
void Window::destroy() {

View File

@ -395,8 +395,7 @@ void init_win32() {
SDL_SysWMinfo wminfo;
SDL_VERSION(&wminfo.version)
if (SDL_GetWMInfo(&wminfo) != 1)
{
if (SDL_GetWMInfo(&wminfo) != 1) {
// error: wrong SDL version
}
@ -412,11 +411,26 @@ void init_win32() {
::SetClassLong(hwnd, GCL_HICON, iconPtr);
#endif
SetWindowLong(hwnd, GWL_EXSTYLE, 0);
SetWindowLong(hwnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
//SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, fsWidth, fsHeight, SWP_SHOWWINDOW);
ontop_win32(0, 0);
}
void ontop_win32(int width, int height) {
SDL_SysWMinfo wminfo;
SDL_VERSION(&wminfo.version)
if (SDL_GetWMInfo(&wminfo) != 1) {
// error: wrong SDL version
}
HWND hwnd = wminfo.window;
SetWindowLong(hwnd, GWL_EXSTYLE, 0);
SetWindowLong(hwnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
if(width > 0 && height > 0) {
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, width, height, SWP_SHOWWINDOW);
}
}
void done_win32() {
::DestroyIcon(icon);
}