Get the invalidated region from ScrollWindowEx() instead of an incorrect

2006-01-02  Tor Lillqvist  <tml@novell.com>

	* gdk/win32/gdkgeometry-win32.c (gdk_window_scroll): Get the
	invalidated region from ScrollWindowEx() instead of an incorrect
	attempt to calculate it ourselves. Fix by John Ehresman. (#323666)

	* gdkevents-win32.c: Make _gdk_win32_hrgn_to_region() non-static.

	* gdkprivate-win32.h: Declare it.
This commit is contained in:
Tor Lillqvist 2006-01-02 00:45:39 +00:00 committed by Tor Lillqvist
parent 36a2bde0d1
commit 53e2c08380
5 changed files with 81 additions and 24 deletions

View File

@ -1,3 +1,13 @@
2006-01-02 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkgeometry-win32.c (gdk_window_scroll): Get the
invalidated region from ScrollWindowEx() instead of an incorrect
attempt to calculate it ourselves. Fix by John Ehresman. (#323666)
* gdkevents-win32.c: Make _gdk_win32_hrgn_to_region() non-static.
* gdkprivate-win32.h: Declare it.
2005-12-31 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkaction.c:

View File

@ -1,3 +1,13 @@
2006-01-02 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkgeometry-win32.c (gdk_window_scroll): Get the
invalidated region from ScrollWindowEx() instead of an incorrect
attempt to calculate it ourselves. Fix by John Ehresman. (#323666)
* gdkevents-win32.c: Make _gdk_win32_hrgn_to_region() non-static.
* gdkprivate-win32.h: Declare it.
2005-12-31 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkaction.c:

View File

@ -1973,7 +1973,7 @@ erase_background (GdkWindow *window,
}
}
static GdkRegion *
GdkRegion *
_gdk_win32_hrgn_to_region (HRGN hrgn)
{
RGNDATA *rgndata;
@ -3069,6 +3069,43 @@ gdk_event_translate (MSG *msg,
KillTimer (NULL, resize_timer);
break;
#ifdef G_ENABLE_DEBUG
case WM_NCCALCSIZE:
if (msg->wParam)
{
NCCALCSIZE_PARAMS *nccsp = (NCCALCSIZE_PARAMS *) msg->lParam;
GDK_NOTE (EVENTS, g_print (" TRUE %s %s %s %s",
_gdk_win32_rect_to_string (&nccsp->rgrc[0]),
_gdk_win32_rect_to_string (&nccsp->rgrc[1]),
_gdk_win32_rect_to_string (&nccsp->rgrc[2]),
_gdk_win32_windowpos_to_string (nccsp->lppos)));
}
else
GDK_NOTE (EVENTS, g_print (" FALSE %s",
_gdk_win32_rect_to_string ((RECT *) msg->lParam)));
return_val = TRUE;
GDK_NOTE (EVENTS, g_print (" DefWindowProc"));
*ret_valp = DefWindowProc (msg->hwnd, msg->message, msg->wParam, msg->lParam);
if (msg->wParam)
{
NCCALCSIZE_PARAMS *nccsp = (NCCALCSIZE_PARAMS *) msg->lParam;
GDK_NOTE (EVENTS,
(g_print ("%s%s%s%s%s%s%s",
(*ret_valp & WVR_ALIGNTOP) ? "ALIGNTOP " : "",
(*ret_valp & WVR_ALIGNLEFT) ? "ALIGNLEFT " : "",
(*ret_valp & WVR_ALIGNBOTTOM) ? "ALIGNBOTTOM " : "",
(*ret_valp & WVR_ALIGNRIGHT) ? "ALIGNRIGHT " : "",
(*ret_valp & WVR_HREDRAW) ? "HREDRAW " : "",
(*ret_valp & WVR_VREDRAW) ? "VREDRAW " : "",
(*ret_valp & WVR_VALIDRECTS) ? "VALIDRECTS " : ""),
((*ret_valp & WVR_VALIDRECTS) ?
g_print (" %s %s",
_gdk_win32_rect_to_string (&nccsp->rgrc[1]),
_gdk_win32_rect_to_string (&nccsp->rgrc[2])) : 0)));
}
break;
#endif
case WM_WINDOWPOSCHANGED :
/* Once we've entered the moving or sizing modal loop, we won't
* return to the main loop until we're done sizing or moving.
@ -3283,7 +3320,9 @@ gdk_event_translate (MSG *msg,
rect.right = impl->hints.min_width;
rect.bottom = impl->hints.min_height;
GDK_NOTE (EVENTS, g_print (" (have MIN_SIZE: %dx%d)", impl->hints.min_width, impl->hints.min_height));
_gdk_win32_adjust_client_rect (window, &rect);
GDK_NOTE (EVENTS, g_print (" (after AdjustWindowRectEx: %dx%d)", rect.right - rect.left, rect.bottom - rect.top));
mmi->ptMinTrackSize.x = rect.right - rect.left;
mmi->ptMinTrackSize.y = rect.bottom - rect.top;
@ -3297,7 +3336,9 @@ gdk_event_translate (MSG *msg,
rect.right = impl->hints.max_width;
rect.bottom = impl->hints.max_height;
GDK_NOTE (EVENTS, g_print (" (have MAX_SIZE: %dx%d)", impl->hints.max_width, impl->hints.max_height));
_gdk_win32_adjust_client_rect (window, &rect);
GDK_NOTE (EVENTS, g_print (" (after AdjustWindowRectEx: %dx%d)", rect.right - rect.left, rect.bottom - rect.top));
/* at least on win9x we have the 16 bit trouble */
maxw = rect.right - rect.left;

View File

@ -108,9 +108,9 @@ gdk_window_scroll (GdkWindow *window,
GdkRegion *invalidate_region;
GdkWindowImplWin32 *impl;
GdkWindowObject *obj;
GdkRectangle dest_rect;
GList *tmp_list;
GdkWindowParentPos parent_pos;
HRGN native_invalidate_region;
g_return_if_fail (GDK_IS_WINDOW (window));
@ -130,22 +130,6 @@ gdk_window_scroll (GdkWindow *window,
if (obj->update_area)
gdk_region_offset (obj->update_area, dx, dy);
invalidate_region = gdk_region_rectangle (&impl->position_info.clip_rect);
dest_rect = impl->position_info.clip_rect;
dest_rect.x += dx;
dest_rect.y += dy;
gdk_rectangle_intersect (&dest_rect, &impl->position_info.clip_rect, &dest_rect);
if (dest_rect.width > 0 && dest_rect.height > 0)
{
GdkRegion *tmp_region;
tmp_region = gdk_region_rectangle (&dest_rect);
gdk_region_subtract (invalidate_region, tmp_region);
gdk_region_destroy (tmp_region);
}
gdk_window_compute_parent_pos (impl, &parent_pos);
parent_pos.x += obj->x;
@ -156,10 +140,13 @@ gdk_window_scroll (GdkWindow *window,
gdk_window_tmp_unset_bg (window);
if (!ScrollWindowEx (GDK_WINDOW_HWND (window),
dx, dy, NULL, NULL,
NULL, NULL, SW_SCROLLCHILDREN))
WIN32_API_FAILED ("ScrollWindowEx");
native_invalidate_region = CreateRectRgn (0, 0, 0, 0);
if (native_invalidate_region == NULL)
WIN32_API_FAILED ("CreateRectRgn");
API_CALL (ScrollWindowEx, (GDK_WINDOW_HWND (window),
dx, dy, NULL, NULL,
native_invalidate_region, NULL, SW_SCROLLCHILDREN));
if (impl->position_info.no_bg)
gdk_window_tmp_reset_bg (window);
@ -173,8 +160,15 @@ gdk_window_scroll (GdkWindow *window,
tmp_list = tmp_list->next;
}
gdk_window_invalidate_region (window, invalidate_region, TRUE);
gdk_region_destroy (invalidate_region);
if (native_invalidate_region != NULL)
{
invalidate_region = _gdk_win32_hrgn_to_region (native_invalidate_region);
gdk_region_offset (invalidate_region, impl->position_info.x_offset,
impl->position_info.y_offset);
gdk_window_invalidate_region (window, invalidate_region, TRUE);
gdk_region_destroy (invalidate_region);
GDI_CALL (DeleteObject, (native_invalidate_region));
}
}
void

View File

@ -353,6 +353,8 @@ HRGN _gdk_win32_gdkregion_to_hrgn (GdkRegion *region,
gint x_origin,
gint y_origin);
GdkRegion *_gdk_win32_hrgn_to_region (HRGN hrgn);
void _gdk_win32_adjust_client_rect (GdkWindow *window,
RECT *RECT);