Commit eb555979 authored by Ignacio Casal Quinteiro's avatar Ignacio Casal Quinteiro
Browse files

win32: properly handle show and focus

The first time a window is shown we should always call SW_SHOWNORMAL.
Understand whether to call SW_SHOW or SW_SHOWNORMAL and the specific
ones for the temporary windows depending on IsWindowVisible.
This also fixes the problem when calling gtk_window_present and
the window is snapped to the left or right of the screen.

This patch is based on the patches provided by Yevgen Muntyan
and Aleksander Morgado.

https://bugzilla.gnome.org/show_bug.cgi?id=698652
parent 07a994c8
......@@ -1132,12 +1132,19 @@ show_window_internal (GdkWindow *window,
}
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
{
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNOACTIVATE);
if (!IsWindowVisible (GDK_WINDOW_HWND (window)))
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNOACTIVATE);
else
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
}
else
else if (!IsWindowVisible (GDK_WINDOW_HWND (window)))
{
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
}
else
{
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOW);
}
/* Sync STATE_ABOVE to TOPMOST */
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_TEMP &&
......@@ -2996,8 +3003,10 @@ gdk_win32_window_focus (GdkWindow *window,
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMAXIMIZED);
else if (window->state & GDK_WINDOW_STATE_ICONIFIED)
ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
else
else if (!IsWindowVisible (GDK_WINDOW_HWND (window)))
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
else
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOW);
SetFocus (GDK_WINDOW_HWND (window));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment