Commit 2dd5dd63 authored by Richard Hult's avatar Richard Hult Committed by Richard Hult

Add debugging code to highlight a gdkwindow.

2008-02-16  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkwindow-quartz.c: Add debugging code to highlight a
	gdkwindow.

svn path=/trunk/; revision=19587
parent 45e33fe9
2008-02-16 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkprivate-quartz.h:
* gdk/quartz/gdkwindow-quartz.c: Add debugging code to highlight a
gdkwindow.
2008-02-15 Matthias Clasen <mclasen@redhat.com>
* configure.in: Go back to 2.13.0 as version for now,
......
......@@ -144,6 +144,7 @@ void _gdk_quartz_window_attach_to_parent (GdkWindow *window);
void _gdk_quartz_window_detach_from_parent (GdkWindow *window);
void _gdk_quartz_window_did_become_main (GdkWindow *window);
void _gdk_quartz_window_did_resign_main (GdkWindow *window);
void _gdk_quartz_window_debug_highlight (GdkWindow *window);
/* Events */
void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
......
......@@ -478,6 +478,87 @@ get_default_title (void)
return title;
}
static void
get_ancestor_coordinates_from_child (GdkWindow *child_window,
gint child_x,
gint child_y,
GdkWindow *ancestor_window,
gint *ancestor_x,
gint *ancestor_y)
{
GdkWindowObject *child_private = GDK_WINDOW_OBJECT (child_window);
GdkWindowObject *ancestor_private = GDK_WINDOW_OBJECT (ancestor_window);
while (child_private != ancestor_private)
{
child_x += child_private->x;
child_y += child_private->y;
child_private = child_private->parent;
}
*ancestor_x = child_x;
*ancestor_y = child_y;
}
void
_gdk_quartz_window_debug_highlight (GdkWindow *window)
{
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
gint x, y;
GdkWindow *toplevel;
gint tx, ty;
static NSWindow *debug_window;
static NSRect old_rect;
NSRect rect;
if (window == _gdk_root)
return;
if (window == NULL)
return;
toplevel = gdk_window_get_toplevel (window);
get_ancestor_coordinates_from_child (window, 0, 0, toplevel, &x, &y);
gdk_window_get_origin (toplevel, &tx, &ty);
x += tx;
y += ty;
rect = NSMakeRect (x,
_gdk_quartz_window_get_inverted_screen_y (y + impl->height),
impl->width, impl->height);
if (debug_window &&
rect.origin.x == old_rect.origin.x &&
rect.origin.y == old_rect.origin.y &&
rect.size.width == old_rect.size.width &&
rect.size.height == old_rect.size.height)
{
return;
}
old_rect = rect;
if (debug_window)
[debug_window close];
debug_window = [[NSWindow alloc] initWithContentRect:rect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
[debug_window setBackgroundColor:[NSColor redColor]];
[debug_window setAlphaValue:0.4];
[debug_window setOpaque:NO];
[debug_window setReleasedWhenClosed:YES];
[debug_window setIgnoresMouseEvents:YES];
[debug_window setLevel:NSFloatingWindowLevel];
[debug_window orderFront:nil];
}
gboolean
_gdk_quartz_window_is_ancestor (GdkWindow *ancestor,
GdkWindow *window)
......@@ -2525,6 +2606,7 @@ gdk_window_set_decorations (GdkWindow *window,
new_mask != NSBorderlessWindowMask)
{
rect = [NSWindow frameRectForContentRect:rect styleMask:new_mask];
}
else if (old_mask != NSBorderlessWindowMask &&
new_mask == NSBorderlessWindowMask)
......
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