Fix comment. (gdk_window_set_title): Surround by release pool macros.

2006-07-17  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkwindow-quartz.c:
	(_gdk_windowing_window_destroy_foreign): Fix comment.
	(gdk_window_set_title): Surround by release pool macros.
	(gdk_window_get_type_hint): Fix return value.
	(gdk_window_get_frame_extents): Implement.
	(gdk_window_iconify): Use the release pool macros.
	(gdk_window_deiconify): Likewise.
	(_gdk_windowing_get_pointer): Implement.
	(gdk_window_get_deskrelative_origin, gdk_window_get_root_origin):
	Implement.

	* gdk/quartz/gdkevents-quartz.c (create_crossing_event)
	(create_scroll_event, convert_window_coordinates_to_root):
	Set coordinates and root coordinates for crossing and scroll
	events.

	* gdk/quartz/gdkcursor-quartz.c (gdk_cursor_new_for_display):
	Map some more cursors.
This commit is contained in:
Richard Hult 2006-07-17 08:07:55 +00:00 committed by Richard Hult
parent 5175386051
commit 2d41ff51f5
5 changed files with 162 additions and 29 deletions

View File

@ -1,3 +1,24 @@
2006-07-17 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkwindow-quartz.c:
(_gdk_windowing_window_destroy_foreign): Fix comment.
(gdk_window_set_title): Surround by release pool macros.
(gdk_window_get_type_hint): Fix return value.
(gdk_window_get_frame_extents): Implement.
(gdk_window_iconify): Use the release pool macros.
(gdk_window_deiconify): Likewise.
(_gdk_windowing_get_pointer): Implement.
(gdk_window_get_deskrelative_origin, gdk_window_get_root_origin):
Implement.
* gdk/quartz/gdkevents-quartz.c (create_crossing_event)
(create_scroll_event, convert_window_coordinates_to_root):
Set coordinates and root coordinates for crossing and scroll
events.
* gdk/quartz/gdkcursor-quartz.c (gdk_cursor_new_for_display):
Map some more cursors.
2006-07-17 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkwindow.c (gdk_window_get_pointer): Add some more

View File

@ -1,3 +1,24 @@
2006-07-17 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkwindow-quartz.c:
(_gdk_windowing_window_destroy_foreign): Fix comment.
(gdk_window_set_title): Surround by release pool macros.
(gdk_window_get_type_hint): Fix return value.
(gdk_window_get_frame_extents): Implement.
(gdk_window_iconify): Use the release pool macros.
(gdk_window_deiconify): Likewise.
(_gdk_windowing_get_pointer): Implement.
(gdk_window_get_deskrelative_origin, gdk_window_get_root_origin):
Implement.
* gdk/quartz/gdkevents-quartz.c (create_crossing_event)
(create_scroll_event, convert_window_coordinates_to_root):
Set coordinates and root coordinates for crossing and scroll
events.
* gdk/quartz/gdkcursor-quartz.c (gdk_cursor_new_for_display):
Map some more cursors.
2006-07-17 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkwindow.c (gdk_window_get_pointer): Add some more

View File

@ -58,6 +58,37 @@ gdk_cursor_new_for_display (GdkDisplay *display,
case GDK_SB_V_DOUBLE_ARROW:
nscursor = [NSCursor resizeUpDownCursor];
break;
case GDK_SB_UP_ARROW:
case GDK_BASED_ARROW_UP:
case GDK_BOTTOM_TEE:
case GDK_TOP_SIDE:
nscursor = [NSCursor resizeUpCursor];
break;
case GDK_SB_DOWN_ARROW:
case GDK_BASED_ARROW_DOWN:
case GDK_TOP_TEE:
case GDK_BOTTOM_SIDE:
nscursor = [NSCursor resizeDownCursor];
break;
case GDK_SB_LEFT_ARROW:
case GDK_RIGHT_TEE:
case GDK_LEFT_SIDE:
nscursor = [NSCursor resizeLeftCursor];
break;
case GDK_SB_RIGHT_ARROW:
case GDK_LEFT_TEE:
case GDK_RIGHT_SIDE:
nscursor = [NSCursor resizeRightCursor];
break;
case GDK_TCROSS:
case GDK_CROSS:
case GDK_CROSSHAIR:
case GDK_DIAMOND_CROSS:
nscursor = [NSCursor crosshairCursor];
case GDK_HAND1:
case GDK_HAND2:
nscursor = [NSCursor pointingHandCursor];
break;
default:
g_warning ("Unsupported cursor type %d, using default", cursor_type);
nscursor = [NSCursor arrowCursor];

View File

@ -802,9 +802,16 @@ static void
convert_window_coordinates_to_root (GdkWindow *window, gdouble x, gdouble y,
gdouble *x_root, gdouble *y_root)
{
/* FIXME: Implement */
*x_root = 0;
*y_root = 0;
gint ox, oy;
*x_root = x;
*y_root = y;
if (gdk_window_get_origin (window, &ox, &oy))
{
*x_root += ox;
*y_root += oy;
}
}
static GdkEvent *
@ -815,13 +822,21 @@ create_crossing_event (GdkWindow *window,
GdkNotifyType detail)
{
GdkEvent *event;
NSPoint point;
event = gdk_event_new (event_type);
event->crossing.window = window;
event->crossing.subwindow = NULL; /* FIXME */
event->crossing.time = get_event_time (nsevent);
/* FIXME: x, y, x_root, y_root */
point = [nsevent locationInWindow];
event->crossing.x = point.x;
event->crossing.y = point.y;
convert_window_coordinates_to_root (window, event->crossing.x, event->crossing.y,
&event->crossing.x_root,
&event->crossing.y_root);
event->crossing.mode = mode;
event->crossing.detail = detail;
/* FIXME: focus */
@ -1300,16 +1315,23 @@ static GdkEvent *
create_scroll_event (GdkWindow *window, NSEvent *nsevent, GdkScrollDirection direction)
{
GdkEvent *event;
NSPoint point;
event = gdk_event_new (GDK_SCROLL);
event->scroll.window = window;
event->scroll.time = get_event_time (nsevent);
/* FIXME event->x, event->y */
point = [nsevent locationInWindow];
event->scroll.x = point.x;
event->scroll.y = point.y;
convert_window_coordinates_to_root (window, event->scroll.x, event->scroll.y,
&event->scroll.x_root,
&event->scroll.y_root);
/* FIXME event->state; */
/* FIXME event->is_hint; */
event->scroll.direction = direction;
event->scroll.device = _gdk_display->core_pointer;
/* FIXME: event->x_root, event->y_root */
return event;
}

View File

@ -539,7 +539,7 @@ _gdk_windowing_window_destroy (GdkWindow *window,
void
_gdk_windowing_window_destroy_foreign (GdkWindow *window)
{
/* FIXME: Implement */
/* Foreign windows aren't supported in OSX. */
}
static gboolean
@ -660,13 +660,8 @@ move_resize_window_internal (GdkWindow *window,
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl;
GDK_QUARTZ_ALLOC_POOL;
if (GDK_WINDOW_DESTROYED (window))
{
GDK_QUARTZ_RELEASE_POOL;
return;
}
return;
impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
@ -682,6 +677,8 @@ move_resize_window_internal (GdkWindow *window,
if (height != -1)
impl->height = height;
GDK_QUARTZ_ALLOC_POOL;
if (impl->toplevel)
{
NSRect content_rect = NSMakeRect (private->x,
@ -699,7 +696,7 @@ move_resize_window_internal (GdkWindow *window,
{
[impl->view setFrame:NSMakeRect (private->x, private->y,
impl->width, impl->height)];
/* FIXME: Maybe we should use setNeedsDisplayInRect instead */
[impl->view setNeedsDisplay:YES];
}
@ -930,8 +927,7 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
{
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
/* FIXME: Implement */
return FALSE;
return gdk_window_get_origin (window, x, y);
}
void
@ -939,9 +935,20 @@ gdk_window_get_root_origin (GdkWindow *window,
gint *x,
gint *y)
{
GdkRectangle rect;
g_return_if_fail (GDK_IS_WINDOW (window));
/* FIXME: Implement */
rect.x = 0;
rect.y = 0;
gdk_window_get_frame_extents (window, &rect);
if (x)
*x = rect.x;
if (y)
*y = rect.y;
}
void
@ -951,6 +958,10 @@ _gdk_windowing_get_pointer (GdkDisplay *display,
gint *y,
GdkModifierType *mask)
{
g_return_if_fail (display == _gdk_display);
*screen = _gdk_screen;
_gdk_windowing_window_get_pointer (_gdk_display, _gdk_root, x, y, mask);
}
GdkWindow *
@ -1061,7 +1072,9 @@ gdk_window_set_title (GdkWindow *window,
if (impl->toplevel)
{
GDK_QUARTZ_ALLOC_POOL;
[impl->toplevel setTitle:[NSString stringWithUTF8String:title]];
GDK_QUARTZ_RELEASE_POOL;
}
}
@ -1230,6 +1243,7 @@ GdkWindowTypeHint
gdk_window_get_type_hint (GdkWindow *window)
{
/* FIXME: Implement */
return GDK_WINDOW_TYPE_HINT_NORMAL;
}
void
@ -1295,7 +1309,33 @@ void
gdk_window_get_frame_extents (GdkWindow *window,
GdkRectangle *rect)
{
/* FIXME: Implement */
GdkWindowObject *private;
GdkWindow *toplevel;
GdkWindowImplQuartz *impl;
NSRect ns_rect;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (rect != NULL);
private = GDK_WINDOW_OBJECT (window);
rect->x = 0;
rect->y = 0;
rect->width = 1;
rect->height = 1;
if (GDK_WINDOW_DESTROYED (window))
return;
toplevel = gdk_window_get_toplevel (window);
impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (toplevel)->impl);
ns_rect = [impl->toplevel frame];
rect->x = ns_rect.origin.x;
rect->y = _gdk_quartz_get_inverted_screen_y (ns_rect.origin.y + ns_rect.size.height);
rect->width = ns_rect.size.width;
rect->height = ns_rect.size.height;
}
void
@ -1308,8 +1348,8 @@ gdk_window_set_decorations (GdkWindow *window,
}
gboolean
gdk_window_get_decorations(GdkWindow *window,
GdkWMDecoration *decorations)
gdk_window_get_decorations (GdkWindow *window,
GdkWMDecoration *decorations)
{
/* FIXME: Implement */
return FALSE;
@ -1371,27 +1411,25 @@ void
gdk_window_iconify (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
NSAutoreleasePool *pool;
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
if (!impl->toplevel)
return;
pool = [[NSAutoreleasePool alloc] init];
GDK_QUARTZ_ALLOC_POOL;
[impl->toplevel miniaturize:nil];
[pool release];
GDK_QUARTZ_RELEASE_POOL;
}
void
gdk_window_deiconify (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
NSAutoreleasePool *pool;
g_return_if_fail (GDK_IS_WINDOW (window));
@ -1402,9 +1440,9 @@ gdk_window_deiconify (GdkWindow *window)
if (!impl->toplevel)
return;
pool = [[NSAutoreleasePool alloc] init];
GDK_QUARTZ_ALLOC_POOL;
[impl->toplevel deminiaturize:nil];
[pool release];
GDK_QUARTZ_RELEASE_POOL;
}
void