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 f44c6d66bf
commit ac00340d4c
3 changed files with 24 additions and 44 deletions

View File

@@ -1639,11 +1639,18 @@ doesnt_want_char (gint mask,
void
_gdk_win32_emit_configure_event (GdkWindow *window)
{
GdkWindowImplWin32 *window_impl;
RECT client_rect;
POINT point;
GdkWindowObject *window_object;
HWND hwnd;
window_object = GDK_WINDOW_OBJECT (window);
window_impl = GDK_WINDOW_IMPL_WIN32 (window_object->impl);
if (window_impl->inhibit_configure)
return;
hwnd = GDK_WINDOW_HWND (window);
GetClientRect (hwnd, &client_rect);
@@ -1658,8 +1665,6 @@ _gdk_win32_emit_configure_event (GdkWindow *window)
point.y += _gdk_offset_y;
}
window_object = GDK_WINDOW_OBJECT (window);
window_object->width = client_rect.right - client_rect.left;
window_object->height = client_rect.bottom - client_rect.top;

View File

@@ -1170,10 +1170,7 @@ gdk_win32_window_move (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
{
_gdk_win32_emit_configure_event (window);
return;
}
return;
/* Don't check GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD.
* Foreign windows (another app's windows) might be children of our
@@ -1186,7 +1183,6 @@ gdk_win32_window_move (GdkWindow *window,
else
{
RECT outer_rect;
RECT current_rect;
get_outer_rect (window, private->width, private->height, &outer_rect);
@@ -1200,14 +1196,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);
}
}
@@ -1234,10 +1222,7 @@ gdk_win32_window_resize (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
{
_gdk_win32_emit_configure_event (window);
return;
}
return;
if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
{
@@ -1246,7 +1231,6 @@ gdk_win32_window_resize (GdkWindow *window,
else
{
RECT outer_rect;
RECT current_rect;
get_outer_rect (window, width, height, &outer_rect);
@@ -1262,14 +1246,6 @@ gdk_win32_window_resize (GdkWindow *window,
outer_rect.bottom - outer_rect.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER));
private->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);
}
}
@@ -1297,10 +1273,7 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
if (private->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),
@@ -1313,7 +1286,6 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
else
{
RECT outer_rect;
RECT current_rect;
get_outer_rect (window, width, height, &outer_rect);
@@ -1331,16 +1303,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);
}
}
@@ -1352,10 +1314,16 @@ gdk_win32_window_move_resize (GdkWindow *window,
gint width,
gint height)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplWin32 *window_impl;
window_impl = GDK_WINDOW_IMPL_WIN32 (private->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))
{
@@ -1372,6 +1340,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

@@ -92,6 +92,7 @@ struct _GdkWindowImplWin32
gboolean changing_state;
guint no_bg : 1;
guint inhibit_configure : 1;
};
struct _GdkWindowImplWin32Class