Add check for source being a window.

2006-04-16  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkdrawable-quartz.c: (gdk_quartz_draw_drawable): Add check
	for source being a window.

	* gdk/quartz/gdkwindow-quartz.c: (_gdk_windowing_window_get_pointer):
	Don't assert on window not being the root window.
This commit is contained in:
Richard Hult 2006-04-16 20:13:13 +00:00 committed by Richard Hult
parent 5dc0919ed6
commit 7deea61cbf
4 changed files with 46 additions and 30 deletions

View File

@ -1,3 +1,11 @@
2006-04-16 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkdrawable-quartz.c: (gdk_quartz_draw_drawable): Add check
for source being a window.
* gdk/quartz/gdkwindow-quartz.c: (_gdk_windowing_window_get_pointer):
Don't assert on window not being the root window.
2006-04-16 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkdrawable-quartz.c: Remove leading cairo/ in include.

View File

@ -1,3 +1,11 @@
2006-04-16 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkdrawable-quartz.c: (gdk_quartz_draw_drawable): Add check
for source being a window.
* gdk/quartz/gdkwindow-quartz.c: (_gdk_windowing_window_get_pointer):
Don't assert on window not being the root window.
2006-04-16 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkdrawable-quartz.c: Remove leading cairo/ in include.

View File

@ -275,15 +275,20 @@ gdk_quartz_draw_drawable (GdkDrawable *drawable,
{
int src_depth = gdk_drawable_get_depth (src);
int dest_depth = gdk_drawable_get_depth (drawable);
GdkDrawableImplQuartz *impl;
GdkDrawableImplQuartz *src_impl;
impl = GDK_DRAWABLE_IMPL_QUARTZ (drawable);
if (GDK_IS_DRAWABLE_IMPL_QUARTZ (src))
src_impl = GDK_DRAWABLE_IMPL_QUARTZ (src);
else
else if (GDK_IS_PIXMAP (src))
src_impl = GDK_DRAWABLE_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (src)->impl);
else if (GDK_IS_WINDOW (src))
{
src_impl = GDK_DRAWABLE_IMPL_QUARTZ (GDK_WINDOW_OBJECT (src)->impl);
/* FIXME: Implement drawing a window. */
return;
}
else
g_assert_not_reached ();
if (src_depth == 1)
{

View File

@ -952,35 +952,30 @@ _gdk_windowing_window_get_pointer (GdkDisplay *display,
gint *y,
GdkModifierType *mask)
{
if (window == _gdk_root)
{
g_error ("FIXME: support get_pointer with root window");
}
else
{
GdkWindow *toplevel = gdk_window_get_toplevel (window);
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (toplevel)->impl);
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
NSWindow *nswindow = impl->toplevel;
NSPoint point = [nswindow mouseLocationOutsideOfEventStream];
int x_tmp, y_tmp;
GdkWindow *toplevel = gdk_window_get_toplevel (window);
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (toplevel)->impl);
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
NSWindow *nswindow = impl->toplevel;
NSPoint point = [nswindow mouseLocationOutsideOfEventStream];
int x_tmp, y_tmp;
/* First flip the y coordinate */
x_tmp = point.x;
y_tmp = impl->height - point.y;
/* FIXME: Might need to special-case window being the root window. */
/* First flip the y coordinate */
x_tmp = point.x;
y_tmp = impl->height - point.y;
while (private != GDK_WINDOW_OBJECT (toplevel)) {
x_tmp -= private->x;
y_tmp -= private->y;
while (private != GDK_WINDOW_OBJECT (toplevel)) {
x_tmp -= private->x;
y_tmp -= private->y;
private = private->parent;
}
private = private->parent;
}
if (x)
*x = x_tmp;
if (y)
*y = y_tmp;
}
if (x)
*x = x_tmp;
if (y)
*y = y_tmp;
/* FIXME: Implement return value */
return NULL;