win32: Make set_keep_above work also for non-mapped windows

This fixes bug #171456
This commit is contained in:
Alexander Larsson 2011-10-26 11:08:33 +02:00
parent ab615105b6
commit 725379192d

View File

@ -895,7 +895,6 @@ show_window_internal (GdkWindow *window,
HWND old_active_window;
gboolean focus_on_map = FALSE;
DWORD exstyle;
HWND top;
if (window->destroyed)
return;
@ -940,17 +939,6 @@ show_window_internal (GdkWindow *window,
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
if (window->state & GDK_WINDOW_STATE_BELOW)
exstyle &= (~WS_EX_TOPMOST);
if (window->state & GDK_WINDOW_STATE_ABOVE)
exstyle |= WS_EX_TOPMOST;
if (exstyle & WS_EX_TOPMOST)
top = HWND_TOPMOST;
else
top = HWND_TOP;
/* Use SetWindowPos to show transparent windows so automatic redraws
* in other windows can be suppressed.
*/
@ -961,7 +949,7 @@ show_window_internal (GdkWindow *window,
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
flags |= SWP_NOACTIVATE;
SetWindowPos (GDK_WINDOW_HWND (window), top, 0, 0, 0, 0, flags);
SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOP, 0, 0, 0, 0, flags);
return;
}
@ -989,6 +977,18 @@ show_window_internal (GdkWindow *window,
{
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
}
/* Sync STATE_ABOVE to TOPMOST */
if (((window->state & GDK_WINDOW_STATE_ABOVE) &&
!(exstyle & WS_EX_TOPMOST)) ||
(!(window->state & GDK_WINDOW_STATE_ABOVE) &&
(exstyle & WS_EX_TOPMOST)))
{
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
(window->state & GDK_WINDOW_STATE_ABOVE)?HWND_TOPMOST:HWND_NOTOPMOST,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE));
}
}
static void
@ -2779,10 +2779,10 @@ gdk_win32_window_set_keep_above (GdkWindow *window,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE));
}
else
gdk_synthesize_window_state (window,
setting ? GDK_WINDOW_STATE_BELOW : GDK_WINDOW_STATE_ABOVE,
setting ? GDK_WINDOW_STATE_ABOVE : 0);
gdk_synthesize_window_state (window,
setting ? GDK_WINDOW_STATE_BELOW : GDK_WINDOW_STATE_ABOVE,
setting ? GDK_WINDOW_STATE_ABOVE : 0);
}
static void
@ -2805,10 +2805,10 @@ gdk_win32_window_set_keep_below (GdkWindow *window,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE));
}
else
gdk_synthesize_window_state (window,
setting ? GDK_WINDOW_STATE_ABOVE : GDK_WINDOW_STATE_BELOW,
setting ? GDK_WINDOW_STATE_BELOW : 0);
gdk_synthesize_window_state (window,
setting ? GDK_WINDOW_STATE_ABOVE : GDK_WINDOW_STATE_BELOW,
setting ? GDK_WINDOW_STATE_BELOW : 0);
}
static void