Implement, fixes bug #405868. Based on patch from metz81@web.de.

2007-07-31  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkwindow-quartz.c: (gdk_window_get_geometry):
	Implement, fixes bug #405868. Based on patch from metz81@web.de.

svn path=/trunk/; revision=18560
This commit is contained in:
Richard Hult 2007-07-31 19:25:28 +00:00 committed by Richard Hult
parent f581dcca39
commit b0b47c9b49
2 changed files with 76 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2007-07-31 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkwindow-quartz.c: (gdk_window_get_geometry):
Implement, fixes bug #405868. Based on patch from metz81@web.de.
2007-07-31 Xan Lopez <xan@gnome.org>
* gtk/gtkentry.c (gtk_entry_completion_key_press): reset the

View File

@ -1310,9 +1310,78 @@ gdk_window_get_geometry (GdkWindow *window,
gint *height,
gint *depth)
{
g_return_if_fail (GDK_IS_WINDOW (window));
GdkWindowImplQuartz *impl;
NSRect ns_rect;
/* FIXME: Implement */
g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
if (!window)
window = _gdk_root;
if (GDK_WINDOW_DESTROYED (window))
return;
impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
if (window == _gdk_root)
{
if (x)
*x = 0;
if (y)
*y = 0;
if (width)
*width = impl->width;
if (height)
*height = impl->height;
}
else if (WINDOW_IS_TOPLEVEL (window))
{
ns_rect = [impl->toplevel contentRectForFrameRect:[impl->toplevel frame]];
/* This doesn't work exactly as in X. There doesn't seem to be a
* way to get the coords relative to the parent window (usually
* the window frame), but that seems useless except for
* borderless windows where it's relative to the root window. So
* we return (0, 0) (should be something like (0, 22)) for
* windows with borders and the root relative coordinates
* otherwise.
*/
if ([impl->toplevel styleMask] == NSBorderlessWindowMask)
{
if (x)
*x = ns_rect.origin.x;
if (y)
*y = _gdk_quartz_window_get_inverted_screen_y (ns_rect.origin.y + ns_rect.size.height);
}
else
{
if (x)
*x = 0;
if (y)
*y = 0;
}
if (width)
*width = ns_rect.size.width;
if (height)
*height = ns_rect.size.height;
}
else
{
ns_rect = [impl->view frame];
if (x)
*x = ns_rect.origin.x;
if (y)
*y = ns_rect.origin.y;
if (width)
*width = ns_rect.size.width;
if (height)
*height = ns_rect.size.height;
}
if (depth)
*depth = gdk_drawable_get_depth (window);
}
gboolean