Commit 09f777e5 authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at

2003-07-29  Tor Lillqvist  <tml@iki.fi>

	Fix for #108007, #112402, #117042: There was confusion in
	gdk/win32 at various places whether a window position refers to
	the decoration position or the client area position. Also whether
	window size includes decorations or not.

	The correct interpretation apparently is that in GDK (like in
	X11), a top-level window position means the decoration's position,
	but size means the window's inner size (client area size). In the
	Win32 API, the window size usually includes the decorations,
	though.

	* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
	#ifdef G_ENABLE_DEBUG.
	(handle_configure_event): New function, generates GDK_CONFIGURE
	events from WM_SIZE and WM_MOVE messages. Even if no event is
	generated because of the event mask, still set the private
	position and size fields. Calculate position and size correctly.
	(gdk_event_translate): Call handle_configure_event().

	* gdk/win32/gdkgeometry-win32.c: Cosmetics.

	* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
	macros. Cosmetic debugging output changes.
	(SafeAdjustWindowRectEx): Remove. If an application wants to
	locate a window outside of the screen, it's not GDK's business to
	prevent it. And anyway, with multiple monitors, negative
	coordinates are perfectly normal.
	(gdk_window_new): Adjust the window size for decorations after
	_gdk_window_init_position() has done its job. (But the big window
	code currently is presumably broken on Win32 anyway.)
	(gdk_window_move): The position passed in is supposed to be that
	of the window border, so don't need to adjust for decorations.
	(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
parent 05ce8747
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
Tue Jul 29 13:55:44 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (gtk_toolbar_set_style,
......
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
Tue Jul 29 13:55:44 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (gtk_toolbar_set_style,
......
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
Tue Jul 29 13:55:44 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (gtk_toolbar_set_style,
......
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
Tue Jul 29 13:55:44 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (gtk_toolbar_set_style,
......
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
Tue Jul 29 13:55:44 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (gtk_toolbar_set_style,
......
......@@ -979,6 +979,25 @@ print_event (GdkEvent *event)
g_print ("\n");
}
static char *
decode_key_lparam (LPARAM lParam)
{
static char buf[100];
char *p = buf;
if (HIWORD (lParam) & KF_UP)
p += g_sprintf (p, "KF_UP ");
if (HIWORD (lParam) & KF_REPEAT)
p += g_sprintf (p, "KF_REPEAT ");
if (HIWORD (lParam) & KF_ALTDOWN)
p += g_sprintf (p, "KF_ALTDOWN ");
if (HIWORD (lParam) & KF_EXTENDED)
p += g_sprintf (p, "KF_EXTENDED ");
p += g_sprintf (p, "sc:%d rep:%d", LOBYTE (HIWORD (lParam)), LOWORD (lParam));
return buf;
}
#endif
static void
......@@ -1552,23 +1571,53 @@ doesnt_want_scroll (gint mask,
#endif
}
static char *
decode_key_lparam (LPARAM lParam)
static void
handle_configure_event (MSG *msg,
GdkWindow *window)
{
static char buf[100];
char *p = buf;
RECT client_rect, outer_rect;
POINT point;
LONG style, exstyle;
if (HIWORD (lParam) & KF_UP)
p += g_sprintf (p, "KF_UP ");
if (HIWORD (lParam) & KF_REPEAT)
p += g_sprintf (p, "KF_REPEAT ");
if (HIWORD (lParam) & KF_ALTDOWN)
p += g_sprintf (p, "KF_ALTDOWN ");
if (HIWORD (lParam) & KF_EXTENDED)
p += g_sprintf (p, "KF_EXTENDED ");
p += g_sprintf (p, "sc:%d rep:%d", LOBYTE (HIWORD (lParam)), LOWORD (lParam));
GetClientRect (msg->hwnd, &client_rect);
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->width = client_rect.right - client_rect.left;
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->height = client_rect.bottom - client_rect.top;
point.x = client_rect.left;
point.y = client_rect.top;
ClientToScreen (msg->hwnd, &point);
outer_rect.left = point.x;
outer_rect.top = point.y;
point.x = client_rect.right;
point.y = client_rect.bottom;
ClientToScreen (msg->hwnd, &point);
outer_rect.right = point.x;
outer_rect.bottom = point.y;
style = GetWindowLong (msg->hwnd, GWL_STYLE);
exstyle = GetWindowLong (msg->hwnd, GWL_EXSTYLE);
API_CALL (AdjustWindowRectEx, (&outer_rect, style,
FALSE, exstyle));
((GdkWindowObject *) window)->x = outer_rect.left;
((GdkWindowObject *) window)->y = outer_rect.top;
if (((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK)
{
GdkEvent *event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = window;
return buf;
event->configure.width = client_rect.right - client_rect.left;
event->configure.height = client_rect.bottom - client_rect.top;
event->configure.x = outer_rect.left;
event->configure.y = outer_rect.top;
append_event (gdk_drawable_get_display (window), event);
}
}
static void
......@@ -1777,7 +1826,6 @@ gdk_event_translate (GdkDisplay *display,
DWORD pidThis;
PAINTSTRUCT paintstruct;
HDC hdc;
RECT rect;
POINT pt;
MINMAXINFO *mmi;
HWND hwnd;
......@@ -2752,26 +2800,9 @@ gdk_event_translate (GdkDisplay *display,
GdkWindowState withdrawn_bit =
IsWindowVisible (msg->hwnd) ? GDK_WINDOW_STATE_WITHDRAWN : 0;
if ((((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK) &&
!GDK_WINDOW_DESTROYED (window))
{
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = window;
pt.x = 0;
pt.y = 0;
ClientToScreen (msg->hwnd, &pt);
event->configure.x = pt.x;
event->configure.y = pt.y;
event->configure.width = LOWORD (msg->lParam);
event->configure.height = HIWORD (msg->lParam);
append_event (display, event);
}
((GdkWindowObject *) window)->x = event->configure.x;
((GdkWindowObject *) window)->y = event->configure.y;
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->width = event->configure.width;
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->height = event->configure.height;
if (!GDK_WINDOW_DESTROYED (window))
handle_configure_event (msg, window);
if (msg->wParam == SIZE_RESTORED)
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
......@@ -2835,29 +2866,13 @@ gdk_event_translate (GdkDisplay *display,
msg->hwnd,
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
if (!(((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK))
break;
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
!IsIconic (msg->hwnd) &&
IsWindowVisible (msg->hwnd))
{
if (!GDK_WINDOW_DESTROYED (window))
{
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = window;
event->configure.x = GET_X_LPARAM (msg->lParam);
event->configure.y = GET_Y_LPARAM (msg->lParam);
GetClientRect (msg->hwnd, &rect);
event->configure.width = rect.right;
event->configure.height = rect.bottom;
handle_configure_event (msg, window);
append_event (display, event);
}
((GdkWindowObject *) window)->x = event->configure.x;
((GdkWindowObject *) window)->y = event->configure.y;
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->width = event->configure.width;
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->height = event->configure.height;
return_val = TRUE;
}
break;
......
......@@ -193,9 +193,9 @@ gdk_window_copy_area_scroll (GdkWindow *window,
static void
compute_intermediate_position (GdkWin32PositionInfo *position_info,
GdkWin32PositionInfo *new_info,
gint d_xoffset,
gint d_yoffset,
GdkRectangle *new_position)
gint d_xoffset,
gint d_yoffset,
GdkRectangle *new_position)
{
gint new_x0, new_x1, new_y0, new_y1;
......@@ -578,8 +578,8 @@ _gdk_window_move_resize_child (GdkWindow *window,
static void
gdk_window_compute_position (GdkWindowImplWin32 *window,
GdkWindowParentPos *parent_pos,
GdkWin32PositionInfo *info)
GdkWindowParentPos *parent_pos,
GdkWin32PositionInfo *info)
{
GdkWindowObject *wrapper;
int parent_x_offset;
......@@ -675,7 +675,7 @@ gdk_window_compute_position (GdkWindowImplWin32 *window,
}
static void
gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
GdkWindowParentPos *parent_pos)
{
GdkWindowObject *wrapper;
......@@ -923,8 +923,8 @@ _gdk_windowing_window_queue_antiexpose (GdkWindow *window,
}
void
_gdk_window_process_expose (GdkWindow *window,
GdkRegion *invalidate_region)
_gdk_window_process_expose (GdkWindow *window,
GdkRegion *invalidate_region)
{
GdkWindowImplWin32 *impl;
GdkRegion *clip_region;
......
This diff is collapsed.
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