win32: More robust way to ensure we get a configure event after move/resize

There were still cases where we didn't get a WINDOWPOSCHANGED after
a SetWindowPos() call, like e.g. with a larger minimum size than
the set size (bug #574935)

So, we revert the previous fix and now just always manually emit
a configure notify after the move_resize call. Also, we inhibit
the WINDOWPOSCHANGED configure event during the move_resize operation
to avoid multiple Configures.
This commit is contained in:
Alexander Larsson
2011-10-27 10:42:07 +02:00
parent 2dbc05f756
commit 2662fe37df
3 changed files with 21 additions and 42 deletions

View File

@ -1478,10 +1478,15 @@ doesnt_want_char (gint mask,
void
_gdk_win32_emit_configure_event (GdkWindow *window)
{
GdkWindowImplWin32 *window_impl;
RECT client_rect;
POINT point;
HWND hwnd;
window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (window_impl->inhibit_configure)
return;
hwnd = GDK_WINDOW_HWND (window);
GetClientRect (hwnd, &client_rect);

View File

@ -1066,10 +1066,7 @@ gdk_win32_window_move (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
{
_gdk_win32_emit_configure_event (window);
return;
}
return;
/* Don't check GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD.
* Foreign windows (another app's windows) might be children of our
@ -1082,7 +1079,6 @@ gdk_win32_window_move (GdkWindow *window,
else
{
RECT outer_rect;
RECT current_rect;
get_outer_rect (window, window->width, window->height, &outer_rect);
@ -1096,14 +1092,6 @@ gdk_win32_window_move (GdkWindow *window,
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
x - _gdk_offset_x, y - _gdk_offset_y, 0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
/* Ensure we always send a configure event, and SetWindowPos doesn't if the window
is maximized, or the position/size doesn't change */
GetWindowRect (GDK_WINDOW_HWND (window), &current_rect);
if (IsZoomed (GDK_WINDOW_HWND (window)) ||
(current_rect.left == x - _gdk_offset_x &&
current_rect.top == y - _gdk_offset_y))
_gdk_win32_emit_configure_event (window);
}
}
@ -1129,10 +1117,7 @@ gdk_win32_window_resize (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
{
_gdk_win32_emit_configure_event (window);
return;
}
return;
if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
{
@ -1141,7 +1126,6 @@ gdk_win32_window_resize (GdkWindow *window,
else
{
RECT outer_rect;
RECT current_rect;
get_outer_rect (window, width, height, &outer_rect);
@ -1157,14 +1141,6 @@ gdk_win32_window_resize (GdkWindow *window,
outer_rect.bottom - outer_rect.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER));
window->resize_count += 1;
/* Ensure we always send a configure event, and SetWindowPos doesn't if the window
is maximized, or the position/size doesn't change */
GetWindowRect (GDK_WINDOW_HWND (window), &current_rect);
if (IsZoomed (GDK_WINDOW_HWND (window)) ||
(current_rect.right - current_rect.left == outer_rect.right - outer_rect.left &&
current_rect.bottom - current_rect.top == outer_rect.bottom - outer_rect.top))
_gdk_win32_emit_configure_event (window);
}
}
@ -1190,10 +1166,7 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
{
_gdk_win32_emit_configure_event (window);
return;
}
return;
GDK_NOTE (MISC, g_print ("gdk_win32_window_move_resize: %p: %dx%d@%+d%+d\n",
GDK_WINDOW_HWND (window),
@ -1206,7 +1179,6 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
else
{
RECT outer_rect;
RECT current_rect;
get_outer_rect (window, width, height, &outer_rect);
@ -1224,16 +1196,6 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
outer_rect.right - outer_rect.left,
outer_rect.bottom - outer_rect.top,
SWP_NOACTIVATE | SWP_NOZORDER));
/* Ensure we always send a configure event, and SetWindowPos doesn't if the window
is maximized, or the position/size doesn't change */
GetWindowRect (GDK_WINDOW_HWND (window), &current_rect);
if (IsZoomed (GDK_WINDOW_HWND (window)) ||
(current_rect.left == x - _gdk_offset_x &&
current_rect.top == y - _gdk_offset_y &&
current_rect.right - current_rect.left == outer_rect.right - outer_rect.left &&
current_rect.bottom - current_rect.top == outer_rect.bottom - outer_rect.top))
_gdk_win32_emit_configure_event (window);
}
}
@ -1245,10 +1207,15 @@ gdk_win32_window_move_resize (GdkWindow *window,
gint width,
gint height)
{
GdkWindowImplWin32 *window_impl;
window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
window_impl->inhibit_configure = TRUE;
/* We ignore changes to the window being moved or resized by the
user, as we don't want to fight the user */
if (GDK_WINDOW_HWND (window) == _modal_move_resize_window)
return;
goto out;
if (with_move && (width < 0 && height < 0))
{
@ -1265,6 +1232,12 @@ gdk_win32_window_move_resize (GdkWindow *window,
gdk_win32_window_resize (window, width, height);
}
}
out:
window_impl->inhibit_configure = FALSE;
if (WINDOW_IS_TOPLEVEL (window))
_gdk_win32_emit_configure_event (window);
}
static gboolean

View File

@ -77,6 +77,7 @@ struct _GdkWindowImplWin32
gboolean changing_state;
guint no_bg : 1;
guint inhibit_configure : 1;
cairo_surface_t *cairo_surface;
HDC hdc;