gtk+ r19683 - in branches/gtk-2-12: . gdk/quartz
- From: rhult svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r19683 - in branches/gtk-2-12: . gdk/quartz
- Date: Sat, 1 Mar 2008 14:21:51 +0000 (GMT)
Author: rhult
Date: Sat Mar 1 14:21:50 2008
New Revision: 19683
URL: http://svn.gnome.org/viewvc/gtk+?rev=19683&view=rev
Log:
2008-03-01 Richard Hult <richard imendio com>
Merged from trunk:
* gdk/quartz/gdkprivate-quartz.h:
* gdk/quartz/gdkwindow-quartz.c: Add debugging code to highlight a
gdkwindow.
Modified:
branches/gtk-2-12/ChangeLog
branches/gtk-2-12/gdk/quartz/gdkprivate-quartz.h
branches/gtk-2-12/gdk/quartz/gdkwindow-quartz.c
Modified: branches/gtk-2-12/gdk/quartz/gdkprivate-quartz.h
==============================================================================
--- branches/gtk-2-12/gdk/quartz/gdkprivate-quartz.h (original)
+++ branches/gtk-2-12/gdk/quartz/gdkprivate-quartz.h Sat Mar 1 14:21:50 2008
@@ -144,6 +144,7 @@
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 */
typedef enum {
Modified: branches/gtk-2-12/gdk/quartz/gdkwindow-quartz.c
==============================================================================
--- branches/gtk-2-12/gdk/quartz/gdkwindow-quartz.c (original)
+++ branches/gtk-2-12/gdk/quartz/gdkwindow-quartz.c Sat Mar 1 14:21:50 2008
@@ -464,6 +464,87 @@
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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]