2000-05-01 22:49:16 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
2000-05-01 22:49:16 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
2000-05-01 22:49:16 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2000-05-01 22:49:16 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* gdkgeometry-win32.c: emulation of 32 bit coordinates within the
|
|
|
|
* limits of Win32 GDI. Just a copy of the X11 version, more or less.
|
|
|
|
* Probably totally bogus in functionality. Just a quick hack, to
|
|
|
|
* get the thing to build. Need to write some test code for it.
|
|
|
|
* Well, need to find out what it is supposed to do first ;-)
|
|
|
|
*
|
|
|
|
* The X11 version by Owen Taylor <otaylor@redhat.com>
|
|
|
|
* Copyright Red Hat, Inc. 2000
|
|
|
|
* Win32 hack by Tor Lillqvist <tml@iki.fi>
|
2001-11-18 15:37:13 +00:00
|
|
|
* and Hans Breuer <hans@breuer.org>
|
2000-05-01 22:49:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gdk.h" /* For gdk_rectangle_intersect */
|
|
|
|
#include "gdkregion.h"
|
|
|
|
#include "gdkregion-generic.h"
|
|
|
|
#include "gdkprivate-win32.h"
|
|
|
|
|
2001-09-21 19:58:35 +00:00
|
|
|
#define SIZE_LIMIT 32000
|
|
|
|
|
2000-05-01 22:49:16 +00:00
|
|
|
typedef struct _GdkWindowQueueItem GdkWindowQueueItem;
|
|
|
|
typedef struct _GdkWindowParentPos GdkWindowParentPos;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
GDK_WINDOW_QUEUE_TRANSLATE,
|
|
|
|
GDK_WINDOW_QUEUE_ANTIEXPOSE
|
|
|
|
} GdkWindowQueueType;
|
|
|
|
|
|
|
|
struct _GdkWindowQueueItem
|
|
|
|
{
|
|
|
|
GdkWindow *window;
|
|
|
|
gulong serial;
|
|
|
|
GdkWindowQueueType type;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
gint dx;
|
|
|
|
gint dy;
|
|
|
|
} translate;
|
|
|
|
struct {
|
|
|
|
GdkRegion *area;
|
|
|
|
} antiexpose;
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GdkWindowParentPos
|
|
|
|
{
|
|
|
|
gint x;
|
|
|
|
gint y;
|
|
|
|
gint win32_x;
|
|
|
|
gint win32_y;
|
|
|
|
GdkRectangle clip_rect;
|
|
|
|
};
|
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
static void gdk_window_compute_position (GdkWindowImplWin32 *window,
|
|
|
|
GdkWindowParentPos *parent_pos,
|
|
|
|
GdkWin32PositionInfo *info);
|
|
|
|
static void gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
|
|
|
|
GdkWindowParentPos *parent_pos);
|
2000-05-01 22:49:16 +00:00
|
|
|
static void gdk_window_premove (GdkWindow *window,
|
|
|
|
GdkWindowParentPos *parent_pos);
|
|
|
|
static void gdk_window_postmove (GdkWindow *window,
|
|
|
|
GdkWindowParentPos *parent_pos);
|
|
|
|
static void gdk_window_queue_translation (GdkWindow *window,
|
|
|
|
gint dx,
|
|
|
|
gint dy);
|
|
|
|
static void gdk_window_tmp_unset_bg (GdkWindow *window);
|
|
|
|
static void gdk_window_tmp_reset_bg (GdkWindow *window);
|
|
|
|
static void gdk_window_clip_changed (GdkWindow *window,
|
|
|
|
GdkRectangle *old_clip,
|
|
|
|
GdkRectangle *new_clip);
|
|
|
|
|
|
|
|
static GSList *translate_queue = NULL;
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_windowing_window_get_offsets (GdkWindow *window,
|
|
|
|
gint *x_offset,
|
|
|
|
gint *y_offset)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl =
|
|
|
|
GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
*x_offset = impl->position_info.x_offset;
|
|
|
|
*y_offset = impl->position_info.y_offset;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_window_init_position (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowParentPos parent_pos;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-05-01 22:49:16 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_window_compute_parent_pos (impl, &parent_pos);
|
|
|
|
gdk_window_compute_position (impl, &parent_pos, &impl->position_info);
|
|
|
|
}
|
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
static void
|
|
|
|
gdk_window_copy_area_scroll (GdkWindow *window,
|
|
|
|
GdkRectangle *dest_rect,
|
|
|
|
gint dx,
|
|
|
|
gint dy)
|
|
|
|
{
|
|
|
|
GdkWindowObject *obj = GDK_WINDOW_OBJECT (window);
|
|
|
|
GList *tmp_list;
|
|
|
|
|
|
|
|
if (dest_rect->width > 0 && dest_rect->height > 0)
|
|
|
|
{
|
|
|
|
RECT clipRect;
|
2002-02-10 13:18:51 +00:00
|
|
|
clipRect.left = dest_rect->x;
|
|
|
|
clipRect.top = dest_rect->y;
|
2001-11-18 15:37:13 +00:00
|
|
|
clipRect.right = clipRect.left + dest_rect->width;
|
|
|
|
clipRect.bottom = clipRect.top + dest_rect->height;
|
|
|
|
|
|
|
|
gdk_window_queue_translation (window, dx, dy);
|
|
|
|
|
|
|
|
if (!ScrollWindowEx (GDK_WINDOW_HWND (window),
|
|
|
|
dx, dy, /* in: scroll offsets */
|
|
|
|
NULL, /* in: scroll rect, NULL == entire client area */
|
2002-02-10 13:18:51 +00:00
|
|
|
&clipRect, /* in: restrict to */
|
2001-11-18 15:37:13 +00:00
|
|
|
NULL, /* out: update region */
|
|
|
|
NULL, /* out: update rect */
|
|
|
|
SW_INVALIDATE))
|
|
|
|
WIN32_API_FAILED ("ScrollWindowEx");
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp_list = obj->children;
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
GdkWindow *child = GDK_WINDOW (tmp_list->data);
|
|
|
|
GdkWindowObject *child_obj = GDK_WINDOW_OBJECT (child);
|
|
|
|
|
|
|
|
gdk_window_move (child, child_obj->x + dx, child_obj->y + dy);
|
|
|
|
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
compute_intermediate_position (GdkWin32PositionInfo *position_info,
|
|
|
|
GdkWin32PositionInfo *new_info,
|
|
|
|
gint d_xoffset,
|
|
|
|
gint d_yoffset,
|
|
|
|
GdkRectangle *new_position)
|
|
|
|
{
|
|
|
|
gint new_x0, new_x1, new_y0, new_y1;
|
|
|
|
|
|
|
|
/* Wrap d_xoffset, d_yoffset into [-32768,32767] range. For the
|
|
|
|
* purposes of subwindow movement, it doesn't matter if we are
|
|
|
|
* off by a factor of 65536, and if we don't do this range
|
|
|
|
* reduction, we'll end up with invalid widths.
|
|
|
|
*/
|
|
|
|
d_xoffset = (gint16)d_xoffset;
|
|
|
|
d_yoffset = (gint16)d_yoffset;
|
|
|
|
|
|
|
|
if (d_xoffset < 0)
|
|
|
|
{
|
|
|
|
new_x0 = position_info->x + d_xoffset;
|
|
|
|
new_x1 = position_info->x + position_info->width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_x0 = position_info->x;
|
|
|
|
new_x1 = position_info->x + new_info->width + d_xoffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_position->x = new_x0;
|
|
|
|
new_position->width = new_x1 - new_x0;
|
|
|
|
|
|
|
|
if (d_yoffset < 0)
|
|
|
|
{
|
|
|
|
new_y0 = position_info->y + d_yoffset;
|
|
|
|
new_y1 = position_info->y + position_info->height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_y0 = position_info->y;
|
|
|
|
new_y1 = position_info->y + new_info->height + d_yoffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_position->y = new_y0;
|
|
|
|
new_position->height = new_y1 - new_y0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_guffaw_scroll (GdkWindow *window,
|
|
|
|
gint dx,
|
|
|
|
gint dy)
|
|
|
|
{
|
|
|
|
GdkWindowObject *obj = GDK_WINDOW_OBJECT (window);
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
|
|
|
|
|
|
|
|
gint d_xoffset = -dx;
|
|
|
|
gint d_yoffset = -dy;
|
|
|
|
GdkRectangle new_position;
|
|
|
|
GdkWin32PositionInfo new_info;
|
|
|
|
GdkWindowParentPos parent_pos;
|
|
|
|
GList *tmp_list;
|
|
|
|
|
|
|
|
gdk_window_compute_parent_pos (impl, &parent_pos);
|
|
|
|
gdk_window_compute_position (impl, &parent_pos, &new_info);
|
|
|
|
|
|
|
|
parent_pos.x += obj->x;
|
|
|
|
parent_pos.y += obj->y;
|
|
|
|
parent_pos.win32_x += new_info.x;
|
|
|
|
parent_pos.win32_y += new_info.y;
|
|
|
|
parent_pos.clip_rect = new_info.clip_rect;
|
|
|
|
|
|
|
|
gdk_window_tmp_unset_bg (window);
|
|
|
|
|
|
|
|
if (d_xoffset < 0 || d_yoffset < 0)
|
|
|
|
gdk_window_queue_translation (window, MIN (d_xoffset, 0), MIN (d_yoffset, 0));
|
|
|
|
|
|
|
|
gdk_window_set_static_gravities (window, TRUE);
|
|
|
|
|
|
|
|
compute_intermediate_position (&impl->position_info, &new_info, d_xoffset, d_yoffset,
|
|
|
|
&new_position);
|
|
|
|
|
|
|
|
/* XXX: this is only translating the X11 code. Don't know why the
|
|
|
|
* window movement needs to be done in three steps there, and here ??
|
|
|
|
*/
|
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
|
|
|
new_position.x, new_position.y,
|
|
|
|
new_position.width, new_position.height,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER))
|
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
|
|
|
|
|
|
|
tmp_list = obj->children;
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
GDK_WINDOW_OBJECT(tmp_list->data)->x -= d_xoffset;
|
|
|
|
GDK_WINDOW_OBJECT(tmp_list->data)->y -= d_yoffset;
|
|
|
|
|
|
|
|
gdk_window_premove (tmp_list->data, &parent_pos);
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
|
|
|
new_position.x - d_xoffset, new_position.y - d_yoffset, 1, 1,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE))
|
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
|
|
|
|
|
|
|
if (d_xoffset > 0 || d_yoffset > 0)
|
|
|
|
gdk_window_queue_translation (window, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
|
|
|
|
|
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
|
|
|
impl->position_info.x, impl->position_info.y,
|
|
|
|
impl->position_info.width, impl->position_info.height,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE))
|
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
|
|
|
|
|
|
|
if (impl->position_info.no_bg)
|
|
|
|
gdk_window_tmp_reset_bg (window);
|
|
|
|
|
|
|
|
impl->position_info = new_info;
|
|
|
|
|
|
|
|
tmp_list = obj->children;
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdk_window_postmove (tmp_list->data, &parent_pos);
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
/**
|
|
|
|
* gdk_window_scroll:
|
|
|
|
* @window: a #GdkWindow
|
|
|
|
* @dx: Amount to scroll in the X direction
|
|
|
|
* @dy: Amount to scroll in the Y direction
|
|
|
|
*
|
2001-11-18 15:37:13 +00:00
|
|
|
* Scroll the contents of @window, both pixels and children, by the given
|
|
|
|
* amount. @window itself does not move. Portions of the window that the scroll
|
|
|
|
* operation brings in from offscreen areas are invalidated. The invalidated
|
|
|
|
* region may be bigger than what would strictly be necessary. (For Win32, a
|
|
|
|
* minimum area will be invalidated if the window has no subwindows, or if the
|
|
|
|
* edges of the window's parent do not extend beyond the edges of the window. In
|
|
|
|
* other cases, a multi-step process is used to scroll the window which may
|
|
|
|
* produce temporary visual artifacts and unnecessary invalidations.)
|
2000-07-25 17:31:05 +00:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
gdk_window_scroll (GdkWindow *window,
|
|
|
|
gint dx,
|
|
|
|
gint dy)
|
|
|
|
{
|
|
|
|
gboolean can_guffaw_scroll = FALSE;
|
2001-11-18 15:37:13 +00:00
|
|
|
GdkRegion *invalidate_region;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkWindowObject *obj;
|
2001-11-18 15:37:13 +00:00
|
|
|
GdkRectangle dest_rect;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
2001-11-18 15:37:13 +00:00
|
|
|
|
|
|
|
obj = GDK_WINDOW_OBJECT (window);
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
|
2000-07-25 17:31:05 +00:00
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
if (dx == 0 && dy == 0)
|
|
|
|
return;
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
/* Move the current invalid region */
|
|
|
|
if (obj->update_area)
|
|
|
|
gdk_region_offset (obj->update_area, dx, dy);
|
2001-11-18 15:37:13 +00:00
|
|
|
|
|
|
|
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_invalidate_region (window, invalidate_region, TRUE);
|
|
|
|
gdk_region_destroy (invalidate_region);
|
2001-08-19 18:34:59 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
/* We can guffaw scroll if we are a child window, and the parent
|
2001-11-18 15:37:13 +00:00
|
|
|
* does not extend beyond our edges. Otherwise, we use XCopyArea, then
|
|
|
|
* move any children later
|
2000-07-25 17:31:05 +00:00
|
|
|
*/
|
|
|
|
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *parent_impl = GDK_WINDOW_IMPL_WIN32 (obj->parent->impl);
|
2001-11-18 15:37:13 +00:00
|
|
|
can_guffaw_scroll = ((dx == 0 || (obj->x <= 0 && obj->x + impl->width >= parent_impl->width)) &&
|
|
|
|
(dy == 0 || (obj->y <= 0 && obj->y + impl->height >= parent_impl->height)));
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!obj->children || !can_guffaw_scroll)
|
2001-11-18 15:37:13 +00:00
|
|
|
gdk_window_copy_area_scroll (window, &dest_rect, dx, dy);
|
2000-07-25 17:31:05 +00:00
|
|
|
else
|
2001-11-18 15:37:13 +00:00
|
|
|
gdk_window_guffaw_scroll (window, dx, dy);
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_window_move_resize_child (GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkWindowObject *obj;
|
2000-05-01 22:49:16 +00:00
|
|
|
GdkWin32PositionInfo new_info;
|
|
|
|
GdkWindowParentPos parent_pos;
|
|
|
|
GList *tmp_list;
|
|
|
|
gint d_xoffset, d_yoffset;
|
|
|
|
gint dx, dy;
|
|
|
|
gboolean is_move;
|
|
|
|
gboolean is_resize;
|
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
obj = GDK_WINDOW_OBJECT (window);
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
dx = x - obj->x;
|
|
|
|
dy = y - obj->y;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
is_move = dx != 0 || dy != 0;
|
2000-07-25 17:31:05 +00:00
|
|
|
is_resize = impl->width != width || impl->height != height;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
if (!is_move && !is_resize)
|
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
obj->x = x;
|
|
|
|
obj->y = y;
|
|
|
|
impl->width = width;
|
|
|
|
impl->height = height;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_window_compute_parent_pos (impl, &parent_pos);
|
|
|
|
gdk_window_compute_position (impl, &parent_pos, &new_info);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
parent_pos.x += obj->x;
|
|
|
|
parent_pos.y += obj->y;
|
2000-05-01 22:49:16 +00:00
|
|
|
parent_pos.win32_x += new_info.x;
|
|
|
|
parent_pos.win32_y += new_info.y;
|
|
|
|
parent_pos.clip_rect = new_info.clip_rect;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
d_xoffset = new_info.x_offset - impl->position_info.x_offset;
|
|
|
|
d_yoffset = new_info.y_offset - impl->position_info.y_offset;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
if (d_xoffset != 0 || d_yoffset != 0)
|
|
|
|
{
|
2001-11-18 15:37:13 +00:00
|
|
|
GdkRectangle new_position;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
gdk_window_set_static_gravities (window, TRUE);
|
|
|
|
|
|
|
|
if (d_xoffset < 0 || d_yoffset < 0)
|
|
|
|
gdk_window_queue_translation (window, MIN (d_xoffset, 0), MIN (d_yoffset, 0));
|
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
compute_intermediate_position (&impl->position_info, &new_info, d_xoffset, d_yoffset,
|
|
|
|
&new_position);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
2001-11-18 15:37:13 +00:00
|
|
|
new_position.x, new_position.y,
|
|
|
|
new_position.width, new_position.height,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER))
|
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
tmp_list = obj->children;
|
2000-05-01 22:49:16 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdk_window_premove (tmp_list->data, &parent_pos);
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
2001-11-18 15:37:13 +00:00
|
|
|
new_position.x + dx, new_position.y + dy, 0, 0,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOREDRAW))
|
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
if (d_xoffset > 0 || d_yoffset > 0)
|
|
|
|
gdk_window_queue_translation (window, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
2001-11-18 15:37:13 +00:00
|
|
|
new_info.x, new_info.y,
|
|
|
|
new_info.width, new_info.height,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW))
|
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (impl->position_info.no_bg)
|
2000-05-01 22:49:16 +00:00
|
|
|
gdk_window_tmp_reset_bg (window);
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
|
2000-07-25 17:31:05 +00:00
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->position_info = new_info;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
tmp_list = obj->children;
|
2000-05-01 22:49:16 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdk_window_postmove (tmp_list->data, &parent_pos);
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (is_move && is_resize)
|
|
|
|
gdk_window_set_static_gravities (window, FALSE);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (impl->position_info.mapped && !new_info.mapped)
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
tmp_list = obj->children;
|
2000-05-01 22:49:16 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdk_window_premove (tmp_list->data, &parent_pos);
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
2001-11-18 15:37:13 +00:00
|
|
|
new_info.x, new_info.y,
|
|
|
|
new_info.width, new_info.height,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER |
|
|
|
|
(is_resize ? 0 : SWP_NOSIZE)))
|
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
tmp_list = obj->children;
|
2000-05-01 22:49:16 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdk_window_postmove (tmp_list->data, &parent_pos);
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (impl->position_info.no_bg)
|
2000-05-01 22:49:16 +00:00
|
|
|
gdk_window_tmp_reset_bg (window);
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
|
2000-07-25 17:31:05 +00:00
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->position_info = new_info;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_window_compute_position (GdkWindowImplWin32 *window,
|
2001-11-18 15:37:13 +00:00
|
|
|
GdkWindowParentPos *parent_pos,
|
|
|
|
GdkWin32PositionInfo *info)
|
2000-05-01 22:49:16 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *wrapper;
|
2000-05-01 22:49:16 +00:00
|
|
|
int parent_x_offset;
|
|
|
|
int parent_y_offset;
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (window));
|
|
|
|
|
|
|
|
wrapper = GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_WIN32 (window)->wrapper);
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-05-01 22:49:16 +00:00
|
|
|
info->big = FALSE;
|
|
|
|
|
2001-09-21 19:58:35 +00:00
|
|
|
if (window->width <= SIZE_LIMIT)
|
2000-05-01 22:49:16 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
info->width = window->width;
|
|
|
|
info->x = parent_pos->x + wrapper->x - parent_pos->win32_x;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
info->big = TRUE;
|
2001-09-21 19:58:35 +00:00
|
|
|
info->width = SIZE_LIMIT;
|
|
|
|
if (parent_pos->x + wrapper->x < -(SIZE_LIMIT/2))
|
2000-05-01 22:49:16 +00:00
|
|
|
{
|
2001-09-21 19:58:35 +00:00
|
|
|
if (parent_pos->x + wrapper->x + window->width < (SIZE_LIMIT/2))
|
|
|
|
info->x = parent_pos->x + wrapper->x + window->width - SIZE_LIMIT - parent_pos->win32_x;
|
2000-05-01 22:49:16 +00:00
|
|
|
else
|
2001-09-21 19:58:35 +00:00
|
|
|
info->x = -(SIZE_LIMIT/2) - parent_pos->win32_y;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
else
|
2000-07-25 17:31:05 +00:00
|
|
|
info->x = parent_pos->x + wrapper->x - parent_pos->win32_x;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
|
2001-09-21 19:58:35 +00:00
|
|
|
if (window->height <= SIZE_LIMIT)
|
2000-05-01 22:49:16 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
info->height = window->height;
|
|
|
|
info->y = parent_pos->y + wrapper->y - parent_pos->win32_y;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
info->big = TRUE;
|
2001-09-21 19:58:35 +00:00
|
|
|
info->height = SIZE_LIMIT;
|
|
|
|
if (parent_pos->y + wrapper->y < -(SIZE_LIMIT/2))
|
2000-05-01 22:49:16 +00:00
|
|
|
{
|
2001-09-21 19:58:35 +00:00
|
|
|
if (parent_pos->y + wrapper->y + window->height < (SIZE_LIMIT/2))
|
|
|
|
info->y = parent_pos->y + wrapper->y + window->height - SIZE_LIMIT - parent_pos->win32_y;
|
2000-05-01 22:49:16 +00:00
|
|
|
else
|
2001-09-21 19:58:35 +00:00
|
|
|
info->y = -(SIZE_LIMIT/2) - parent_pos->win32_y;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
else
|
2000-07-25 17:31:05 +00:00
|
|
|
info->y = parent_pos->y + wrapper->y - parent_pos->win32_y;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
parent_x_offset = parent_pos->win32_x - parent_pos->x;
|
|
|
|
parent_y_offset = parent_pos->win32_y - parent_pos->y;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
info->x_offset = parent_x_offset + info->x - wrapper->x;
|
|
|
|
info->y_offset = parent_y_offset + info->y - wrapper->y;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
/* We don't considering the clipping of toplevel windows and their immediate children
|
|
|
|
* by their parents, and simply always map those windows.
|
|
|
|
*/
|
|
|
|
if (parent_pos->clip_rect.width == G_MAXINT)
|
|
|
|
info->mapped = TRUE;
|
|
|
|
/* Check if the window would wrap around into the visible space in either direction */
|
|
|
|
else if (info->x + parent_x_offset < parent_pos->clip_rect.x + parent_pos->clip_rect.width - 65536 ||
|
|
|
|
info->x + info->width + parent_x_offset > parent_pos->clip_rect.x + 65536 ||
|
|
|
|
info->y + parent_y_offset < parent_pos->clip_rect.y + parent_pos->clip_rect.height - 65536 ||
|
2000-07-25 17:31:05 +00:00
|
|
|
info->y + info->height + parent_y_offset > parent_pos->clip_rect.y + 65536)
|
2000-05-01 22:49:16 +00:00
|
|
|
info->mapped = FALSE;
|
|
|
|
else
|
|
|
|
info->mapped = TRUE;
|
|
|
|
|
|
|
|
info->no_bg = FALSE;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_TYPE (wrapper) == GDK_WINDOW_CHILD)
|
2000-05-01 22:49:16 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
info->clip_rect.x = wrapper->x;
|
|
|
|
info->clip_rect.y = wrapper->y;
|
|
|
|
info->clip_rect.width = window->width;
|
|
|
|
info->clip_rect.height = window->height;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
gdk_rectangle_intersect (&info->clip_rect, &parent_pos->clip_rect, &info->clip_rect);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
info->clip_rect.x -= wrapper->x;
|
|
|
|
info->clip_rect.y -= wrapper->y;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
info->clip_rect.x = 0;
|
|
|
|
info->clip_rect.y = 0;
|
|
|
|
info->clip_rect.width = G_MAXINT;
|
|
|
|
info->clip_rect.height = G_MAXINT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-11-18 15:37:13 +00:00
|
|
|
gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
|
2000-05-01 22:49:16 +00:00
|
|
|
GdkWindowParentPos *parent_pos)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *wrapper;
|
|
|
|
GdkWindowObject *parent;
|
2000-05-01 22:49:16 +00:00
|
|
|
GdkRectangle tmp_clip;
|
|
|
|
|
|
|
|
int clip_xoffset = 0;
|
|
|
|
int clip_yoffset = 0;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (window));
|
|
|
|
|
|
|
|
wrapper = GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_WIN32 (window)->wrapper);
|
|
|
|
|
2000-05-01 22:49:16 +00:00
|
|
|
parent_pos->x = 0;
|
|
|
|
parent_pos->y = 0;
|
|
|
|
parent_pos->win32_x = 0;
|
|
|
|
parent_pos->win32_y = 0;
|
|
|
|
|
|
|
|
/* We take a simple approach here and simply consider toplevel
|
|
|
|
* windows not to clip their children on the right/bottom, since the
|
|
|
|
* size of toplevel windows is not directly under our
|
|
|
|
* control. Clipping only really matters when scrolling and
|
|
|
|
* generally we aren't going to be moving the immediate child of a
|
|
|
|
* toplevel beyond the bounds of that toplevel.
|
|
|
|
*
|
|
|
|
* We could go ahead and recompute the clips of toplevel windows and
|
|
|
|
* their descendents when we receive size notification, but it would
|
|
|
|
* probably not be an improvement in most cases.
|
|
|
|
*/
|
|
|
|
parent_pos->clip_rect.x = 0;
|
|
|
|
parent_pos->clip_rect.y = 0;
|
|
|
|
parent_pos->clip_rect.width = G_MAXINT;
|
|
|
|
parent_pos->clip_rect.height = G_MAXINT;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
parent = (GdkWindowObject *)wrapper->parent;
|
|
|
|
while (parent && parent->window_type == GDK_WINDOW_CHILD)
|
2000-05-01 22:49:16 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (parent->impl);
|
|
|
|
|
2000-05-01 22:49:16 +00:00
|
|
|
tmp_clip.x = - clip_xoffset;
|
|
|
|
tmp_clip.y = - clip_yoffset;
|
2000-07-25 17:31:05 +00:00
|
|
|
tmp_clip.width = impl->width;
|
|
|
|
tmp_clip.height = impl->height;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
gdk_rectangle_intersect (&parent_pos->clip_rect, &tmp_clip, &parent_pos->clip_rect);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
parent_pos->x += parent->x;
|
|
|
|
parent_pos->y += parent->y;
|
|
|
|
parent_pos->win32_x += impl->position_info.x;
|
|
|
|
parent_pos->win32_y += impl->position_info.y;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
clip_xoffset += parent->x;
|
|
|
|
clip_yoffset += parent->y;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
parent = (GdkWindowObject *)parent->parent;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_premove (GdkWindow *window,
|
|
|
|
GdkWindowParentPos *parent_pos)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkWindowObject *obj;
|
2000-05-01 22:49:16 +00:00
|
|
|
GdkWin32PositionInfo new_info;
|
|
|
|
GList *tmp_list;
|
|
|
|
gint d_xoffset, d_yoffset;
|
|
|
|
GdkWindowParentPos this_pos;
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
obj = (GdkWindowObject *) window;
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
|
|
|
|
|
|
|
|
gdk_window_compute_position (impl, parent_pos, &new_info);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
this_pos.x = parent_pos->x + obj->x;
|
|
|
|
this_pos.y = parent_pos->y + obj->y;
|
2000-05-01 22:49:16 +00:00
|
|
|
this_pos.win32_x = parent_pos->win32_x + new_info.x;
|
|
|
|
this_pos.win32_y = parent_pos->win32_y + new_info.y;
|
|
|
|
this_pos.clip_rect = new_info.clip_rect;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (impl->position_info.mapped && !new_info.mapped)
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
d_xoffset = new_info.x_offset - impl->position_info.x_offset;
|
|
|
|
d_yoffset = new_info.y_offset - impl->position_info.y_offset;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
if (d_xoffset != 0 || d_yoffset != 0)
|
|
|
|
{
|
2001-11-18 15:37:13 +00:00
|
|
|
GdkRectangle new_position;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
if (d_xoffset < 0 || d_yoffset < 0)
|
|
|
|
gdk_window_queue_translation (window, MIN (d_xoffset, 0), MIN (d_yoffset, 0));
|
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
compute_intermediate_position (&impl->position_info, &new_info, d_xoffset, d_yoffset,
|
|
|
|
&new_position);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
2001-11-18 15:37:13 +00:00
|
|
|
new_position.x, new_position.y,
|
|
|
|
new_position.width, new_position.height,
|
2001-08-19 18:34:59 +00:00
|
|
|
SWP_NOREDRAW | SWP_NOZORDER | SWP_NOACTIVATE))
|
2001-11-18 15:37:13 +00:00
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
tmp_list = obj->children;
|
2000-05-01 22:49:16 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdk_window_premove (tmp_list->data, &this_pos);
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_postmove (GdkWindow *window,
|
|
|
|
GdkWindowParentPos *parent_pos)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkWindowObject *obj;
|
2000-05-01 22:49:16 +00:00
|
|
|
GdkWin32PositionInfo new_info;
|
|
|
|
GList *tmp_list;
|
|
|
|
gint d_xoffset, d_yoffset;
|
|
|
|
GdkWindowParentPos this_pos;
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
obj = (GdkWindowObject *) window;
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
|
|
|
|
|
|
|
|
gdk_window_compute_position (impl, parent_pos, &new_info);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
this_pos.x = parent_pos->x + obj->x;
|
|
|
|
this_pos.y = parent_pos->y + obj->y;
|
2000-05-01 22:49:16 +00:00
|
|
|
this_pos.win32_x = parent_pos->win32_x + new_info.x;
|
|
|
|
this_pos.win32_y = parent_pos->win32_y + new_info.y;
|
|
|
|
this_pos.clip_rect = new_info.clip_rect;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
d_xoffset = new_info.x_offset - impl->position_info.x_offset;
|
|
|
|
d_yoffset = new_info.y_offset - impl->position_info.y_offset;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
if (d_xoffset != 0 || d_yoffset != 0)
|
|
|
|
{
|
|
|
|
if (d_xoffset > 0 || d_yoffset > 0)
|
|
|
|
gdk_window_queue_translation (window, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
2001-11-18 15:37:13 +00:00
|
|
|
new_info.x, new_info.y,
|
|
|
|
new_info.width, new_info.height,
|
|
|
|
SWP_NOREDRAW | SWP_NOZORDER | SWP_NOACTIVATE))
|
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
|
2000-07-25 17:31:05 +00:00
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (impl->position_info.no_bg)
|
2000-05-01 22:49:16 +00:00
|
|
|
gdk_window_tmp_reset_bg (window);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->position_info = new_info;
|
2000-05-01 22:49:16 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
tmp_list = obj->children;
|
2000-05-01 22:49:16 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdk_window_postmove (tmp_list->data, &this_pos);
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_queue_translation (GdkWindow *window,
|
|
|
|
gint dx,
|
|
|
|
gint dy)
|
|
|
|
{
|
|
|
|
GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1);
|
|
|
|
item->window = window;
|
|
|
|
item->serial = GetMessageTime ();
|
|
|
|
item->type = GDK_WINDOW_QUEUE_TRANSLATE;
|
|
|
|
item->u.translate.dx = dx;
|
|
|
|
item->u.translate.dy = dy;
|
|
|
|
|
2000-10-09 19:49:42 +00:00
|
|
|
GDK_NOTE (EVENTS, g_print ("gdk_window_queue_translation %#x %ld %d,%d\n",
|
|
|
|
(guint) GDK_WINDOW_HWND (window),
|
2000-05-01 22:49:16 +00:00
|
|
|
item->serial,
|
|
|
|
dx, dy));
|
|
|
|
|
|
|
|
gdk_drawable_ref (window);
|
|
|
|
translate_queue = g_slist_append (translate_queue, item);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
_gdk_windowing_window_queue_antiexpose (GdkWindow *window,
|
|
|
|
GdkRegion *area)
|
|
|
|
{
|
2001-08-19 18:34:59 +00:00
|
|
|
#if 1
|
2000-05-01 22:49:16 +00:00
|
|
|
GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1);
|
|
|
|
|
|
|
|
item->window = window;
|
|
|
|
item->serial = GetMessageTime ();
|
|
|
|
item->type = GDK_WINDOW_QUEUE_ANTIEXPOSE;
|
|
|
|
item->u.antiexpose.area = area;
|
|
|
|
|
2000-10-09 19:49:42 +00:00
|
|
|
GDK_NOTE (EVENTS, g_print ("_gdk_windowing_window_queue_antiexpose %#x %ld %dx%d@+%d+%d\n",
|
|
|
|
(guint) GDK_WINDOW_HWND (window),
|
2000-05-01 22:49:16 +00:00
|
|
|
item->serial,
|
|
|
|
area->extents.x2 - area->extents.x1,
|
|
|
|
area->extents.y2 - area->extents.y1,
|
|
|
|
area->extents.x1, area->extents.y1));
|
|
|
|
|
|
|
|
gdk_drawable_ref (window);
|
|
|
|
translate_queue = g_slist_append (translate_queue, item);
|
|
|
|
|
|
|
|
return TRUE;
|
2000-10-22 17:16:42 +00:00
|
|
|
#else
|
|
|
|
GdkRectangle r;
|
|
|
|
HRGN hrgn;
|
|
|
|
|
|
|
|
gdk_region_get_clipbox (area, &r);
|
|
|
|
hrgn = CreateRectRgn(r.x, r.y, r.width+1, r.height+1);
|
|
|
|
|
|
|
|
g_return_val_if_fail (area != NULL, FALSE);
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_queue_antiexpose %#x\n",
|
|
|
|
(guint) GDK_WINDOW_HWND (window)));
|
|
|
|
|
|
|
|
/* HB: not quite sure if this is the right thing to do.
|
|
|
|
* (Region not to be proceesed by next WM_PAINT)
|
|
|
|
*/
|
|
|
|
ValidateRgn(GDK_WINDOW_HWND (window), hrgn);
|
|
|
|
DeleteObject(hrgn);
|
|
|
|
return TRUE;
|
|
|
|
#endif
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_window_process_expose (GdkWindow *window,
|
|
|
|
gulong serial,
|
|
|
|
GdkRectangle *area)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2000-05-01 22:49:16 +00:00
|
|
|
GdkRegion *invalidate_region = gdk_region_rectangle (area);
|
|
|
|
GdkRegion *clip_region;
|
|
|
|
GSList *tmp_list = translate_queue;
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
|
|
|
|
2000-10-09 19:49:42 +00:00
|
|
|
GDK_NOTE (EVENTS, g_print ("_gdk_window_process_expose %#x %ld %dx%d@+%d+%d\n",
|
|
|
|
(guint) GDK_WINDOW_HWND (window), serial,
|
2000-05-01 22:49:16 +00:00
|
|
|
area->width, area->height, area->x, area->y));
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-05-01 22:49:16 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
GdkWindowQueueItem *item = tmp_list->data;
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
|
|
|
|
if (serial < item->serial)
|
|
|
|
{
|
|
|
|
if (item->window == window)
|
|
|
|
{
|
|
|
|
if (item->type == GDK_WINDOW_QUEUE_TRANSLATE)
|
|
|
|
gdk_region_offset (invalidate_region, - item->u.translate.dx, - item->u.translate.dy);
|
|
|
|
else /* anti-expose */
|
|
|
|
gdk_region_subtract (invalidate_region, item->u.antiexpose.area);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GSList *tmp_link = translate_queue;
|
|
|
|
|
|
|
|
translate_queue = g_slist_remove_link (translate_queue, translate_queue);
|
|
|
|
gdk_drawable_unref (item->window);
|
|
|
|
|
|
|
|
if (item->type == GDK_WINDOW_QUEUE_ANTIEXPOSE)
|
|
|
|
gdk_region_destroy (item->u.antiexpose.area);
|
|
|
|
|
|
|
|
g_free (item);
|
|
|
|
g_slist_free_1 (tmp_link);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
clip_region = gdk_region_rectangle (&impl->position_info.clip_rect);
|
2000-05-01 22:49:16 +00:00
|
|
|
gdk_region_intersect (invalidate_region, clip_region);
|
|
|
|
|
|
|
|
if (!gdk_region_empty (invalidate_region))
|
|
|
|
gdk_window_invalidate_region (window, invalidate_region, FALSE);
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-05-01 22:49:16 +00:00
|
|
|
gdk_region_destroy (invalidate_region);
|
|
|
|
gdk_region_destroy (clip_region);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_tmp_unset_bg (GdkWindow *window)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkWindowObject *obj;
|
|
|
|
|
|
|
|
obj = (GdkWindowObject *) window;
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
|
|
|
|
|
|
|
|
impl->position_info.no_bg = TRUE;
|
|
|
|
|
2001-03-31 19:33:49 +00:00
|
|
|
/*
|
|
|
|
* The X version sets background = None to avoid updateing for a moment.
|
|
|
|
* Not sure if this could really emulate it.
|
|
|
|
*/
|
2000-07-25 17:31:05 +00:00
|
|
|
if (obj->bg_pixmap != GDK_NO_BG)
|
2001-03-31 19:33:49 +00:00
|
|
|
/* handled in WM_ERASEBKGRND proceesing */;
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_tmp_reset_bg (GdkWindow *window)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkWindowObject *obj;
|
|
|
|
|
|
|
|
obj = (GdkWindowObject *) window;
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
|
|
|
|
|
|
|
|
impl->position_info.no_bg = FALSE;
|
|
|
|
|
|
|
|
if (obj->bg_pixmap == GDK_NO_BG)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (obj->bg_pixmap)
|
|
|
|
{
|
|
|
|
/* ??? */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* ??? */
|
|
|
|
}
|
2000-05-01 22:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-11-18 15:37:13 +00:00
|
|
|
gdk_window_clip_changed (GdkWindow *window, GdkRectangle *old_clip, GdkRectangle *new_clip)
|
2000-05-01 22:49:16 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkWindowObject *obj;
|
2000-05-01 22:49:16 +00:00
|
|
|
GdkRegion *old_clip_region;
|
|
|
|
GdkRegion *new_clip_region;
|
2001-11-18 15:37:13 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (((GdkWindowObject *)window)->input_only)
|
2000-05-01 22:49:16 +00:00
|
|
|
return;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
2000-10-09 19:49:42 +00:00
|
|
|
obj = (GdkWindowObject *) window;
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
|
|
|
|
|
2000-05-01 22:49:16 +00:00
|
|
|
old_clip_region = gdk_region_rectangle (old_clip);
|
|
|
|
new_clip_region = gdk_region_rectangle (new_clip);
|
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
/* We need to update this here because gdk_window_invalidate_region makes
|
|
|
|
* use if it (through gdk_drawable_get_visible_region
|
|
|
|
*/
|
|
|
|
impl->position_info.clip_rect = *new_clip;
|
|
|
|
|
2000-05-01 22:49:16 +00:00
|
|
|
/* Trim invalid region of window to new clip rectangle
|
|
|
|
*/
|
2000-07-25 17:31:05 +00:00
|
|
|
if (obj->update_area)
|
|
|
|
gdk_region_intersect (obj->update_area, new_clip_region);
|
2000-05-01 22:49:16 +00:00
|
|
|
|
|
|
|
/* Invalidate newly exposed portion of window
|
|
|
|
*/
|
|
|
|
gdk_region_subtract (new_clip_region, old_clip_region);
|
|
|
|
if (!gdk_region_empty (new_clip_region))
|
|
|
|
{
|
|
|
|
gdk_window_tmp_unset_bg (window);
|
|
|
|
gdk_window_invalidate_region (window, new_clip_region, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_region_destroy (new_clip_region);
|
|
|
|
gdk_region_destroy (old_clip_region);
|
|
|
|
}
|