forked from AuroraMiddleware/gtk
Clean up namespaces to make the code more maintainable.
2007-04-06 Richard Hult <richard@imendio.com> * gdk/quartz/: Clean up namespaces to make the code more maintainable. * gdk/quartz/gdkdrawable-quartz.c: * gdk/quartz/gdkgc-quartz.c: Fix bug #418384, alignment of tiled images, by setting the pattern phase for the CG pattern. svn path=/trunk/; revision=17584
This commit is contained in:
parent
e397ed56cc
commit
9e2114e629
@ -1,3 +1,12 @@
|
||||
2007-04-06 Richard Hult <richard@imendio.com>
|
||||
|
||||
* gdk/quartz/: Clean up namespaces to make the code more
|
||||
maintainable.
|
||||
|
||||
* gdk/quartz/gdkdrawable-quartz.c:
|
||||
* gdk/quartz/gdkgc-quartz.c: Fix bug #418384, alignment of tiled
|
||||
images, by setting the pattern phase for the CG pattern.
|
||||
|
||||
2007-04-04 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtktooltip.c (tooltip_browse_mode_expired),
|
||||
|
@ -59,14 +59,14 @@
|
||||
{
|
||||
GdkWindow *window = [[self contentView] gdkWindow];
|
||||
|
||||
_gdk_quartz_update_focus_window (window, TRUE);
|
||||
_gdk_quartz_events_update_focus_window (window, TRUE);
|
||||
}
|
||||
|
||||
-(void)windowDidResignKey:(NSNotification *)aNotification
|
||||
{
|
||||
GdkWindow *window = [[self contentView] gdkWindow];
|
||||
|
||||
_gdk_quartz_update_focus_window (window, FALSE);
|
||||
_gdk_quartz_events_update_focus_window (window, FALSE);
|
||||
}
|
||||
|
||||
-(void)windowDidMove:(NSNotification *)aNotification
|
||||
@ -78,7 +78,7 @@
|
||||
GdkEvent *event;
|
||||
|
||||
private->x = content_rect.origin.x;
|
||||
private->y = _gdk_quartz_get_inverted_screen_y (content_rect.origin.y) - impl->height;
|
||||
private->y = _gdk_quartz_window_get_inverted_screen_y (content_rect.origin.y) - impl->height;
|
||||
|
||||
/* Synthesize a configure event */
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
@ -298,7 +298,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
|
||||
event.dnd.context = current_context;
|
||||
event.dnd.time = GDK_CURRENT_TIME;
|
||||
event.dnd.x_root = screen_point.x;
|
||||
event.dnd.y_root = _gdk_quartz_get_inverted_screen_y (screen_point.y);
|
||||
event.dnd.y_root = _gdk_quartz_window_get_inverted_screen_y (screen_point.y);
|
||||
|
||||
(*_gdk_event_func) (&event, _gdk_event_data);
|
||||
|
||||
@ -321,7 +321,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
|
||||
event.dnd.context = current_context;
|
||||
event.dnd.time = GDK_CURRENT_TIME;
|
||||
event.dnd.x_root = screen_point.x;
|
||||
event.dnd.y_root = _gdk_quartz_get_inverted_screen_y (screen_point.y);
|
||||
event.dnd.y_root = _gdk_quartz_window_get_inverted_screen_y (screen_point.y);
|
||||
|
||||
(*_gdk_event_func) (&event, _gdk_event_data);
|
||||
|
||||
|
@ -170,12 +170,12 @@ gdk_colormap_get_screen (GdkColormap *cmap)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_quartz_get_rgba_from_pixel (GdkColormap *colormap,
|
||||
guint32 pixel,
|
||||
float *red,
|
||||
float *green,
|
||||
float *blue,
|
||||
float *alpha)
|
||||
_gdk_quartz_colormap_get_rgba_from_pixel (GdkColormap *colormap,
|
||||
guint32 pixel,
|
||||
float *red,
|
||||
float *green,
|
||||
float *blue,
|
||||
float *alpha)
|
||||
{
|
||||
*red = (pixel >> 16 & 0xff) / 255.0;
|
||||
*green = (pixel >> 8 & 0xff) / 255.0;
|
||||
|
@ -184,7 +184,7 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
|
||||
return cursor;
|
||||
}
|
||||
|
||||
NSImage *
|
||||
static NSImage *
|
||||
_gdk_quartz_pixbuf_to_ns_image (GdkPixbuf *pixbuf)
|
||||
{
|
||||
NSBitmapImageRep *bitmap_rep;
|
||||
|
@ -137,10 +137,12 @@ gdk_quartz_draw_rectangle (GdkDrawable *drawable,
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
gdk_quartz_update_context_from_gc (context, gc,
|
||||
filled ?
|
||||
GDK_QUARTZ_CONTEXT_FILL :
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
_gdk_quartz_gc_update_cg_context (gc,
|
||||
drawable,
|
||||
context,
|
||||
filled ?
|
||||
GDK_QUARTZ_CONTEXT_FILL :
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
|
||||
if (filled)
|
||||
{
|
||||
@ -175,10 +177,10 @@ gdk_quartz_draw_arc (GdkDrawable *drawable,
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
gdk_quartz_update_context_from_gc (context, gc,
|
||||
filled ?
|
||||
GDK_QUARTZ_CONTEXT_FILL :
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||
filled ?
|
||||
GDK_QUARTZ_CONTEXT_FILL :
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
|
||||
CGContextSaveGState (context);
|
||||
|
||||
@ -230,10 +232,10 @@ gdk_quartz_draw_polygon (GdkDrawable *drawable,
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
gdk_quartz_update_context_from_gc (context, gc,
|
||||
filled ?
|
||||
GDK_QUARTZ_CONTEXT_FILL :
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||
filled ?
|
||||
GDK_QUARTZ_CONTEXT_FILL :
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
|
||||
if (filled)
|
||||
{
|
||||
@ -320,8 +322,8 @@ gdk_quartz_draw_drawable (GdkDrawable *drawable,
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
gdk_quartz_update_context_from_gc (context, gc,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
|
||||
CGContextClipToRect (context, CGRectMake (xdest, ydest, width, height));
|
||||
CGContextTranslateCTM (context, xdest - xsrc, ydest - ysrc);
|
||||
@ -350,9 +352,9 @@ gdk_quartz_draw_points (GdkDrawable *drawable,
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
gdk_quartz_update_context_from_gc (context, gc,
|
||||
GDK_QUARTZ_CONTEXT_STROKE |
|
||||
GDK_QUARTZ_CONTEXT_FILL);
|
||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||
GDK_QUARTZ_CONTEXT_STROKE |
|
||||
GDK_QUARTZ_CONTEXT_FILL);
|
||||
|
||||
/* Just draw 1x1 rectangles */
|
||||
for (i = 0; i < npoints; i++)
|
||||
@ -376,8 +378,8 @@ gdk_quartz_draw_segments (GdkDrawable *drawable,
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
gdk_quartz_update_context_from_gc (context, gc,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
|
||||
for (i = 0; i < nsegs; i++)
|
||||
{
|
||||
@ -402,7 +404,7 @@ gdk_quartz_draw_lines (GdkDrawable *drawable,
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
gdk_quartz_update_context_from_gc (context, gc,
|
||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
|
||||
CGContextMoveToPoint (context, points[0].x + 0.5, points[0].y + 0.5);
|
||||
@ -460,8 +462,8 @@ gdk_quartz_draw_pixbuf (GdkDrawable *drawable,
|
||||
CGDataProviderRelease (data_provider);
|
||||
CGColorSpaceRelease (colorspace);
|
||||
|
||||
gdk_quartz_update_context_from_gc (context, gc,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
|
||||
CGContextClipToRect (context, CGRectMake (dest_x, dest_y, width, height));
|
||||
CGContextTranslateCTM (context, dest_x - src_x, dest_y - src_y + pixbuf_height);
|
||||
@ -506,8 +508,8 @@ gdk_quartz_draw_image (GdkDrawable *drawable,
|
||||
CGDataProviderRelease (data_provider);
|
||||
CGColorSpaceRelease (colorspace);
|
||||
|
||||
gdk_quartz_update_context_from_gc (context, gc,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
|
||||
CGContextClipToRect (context, CGRectMake (xdest, ydest, width, height));
|
||||
CGContextTranslateCTM (context, xdest - xsrc, ydest - ysrc + image->height);
|
||||
@ -562,7 +564,7 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
|
||||
drawable_class->get_screen = gdk_quartz_get_screen;
|
||||
drawable_class->get_visual = gdk_quartz_get_visual;
|
||||
|
||||
drawable_class->_copy_to_image = _gdk_quartz_copy_to_image;
|
||||
drawable_class->_copy_to_image = _gdk_quartz_image_copy_to_image;
|
||||
}
|
||||
|
||||
GType
|
||||
|
@ -397,7 +397,7 @@ get_event_mask_from_ns_event (NSEvent *nsevent)
|
||||
case NSKeyUp:
|
||||
case NSFlagsChanged:
|
||||
{
|
||||
switch (_gdk_quartz_key_event_type (nsevent))
|
||||
switch (_gdk_quartz_keys_event_type (nsevent))
|
||||
{
|
||||
case GDK_KEY_PRESS:
|
||||
return GDK_KEY_PRESS_MASK;
|
||||
@ -431,8 +431,8 @@ create_focus_event (GdkWindow *window,
|
||||
|
||||
/* Note: Used to both set a new focus window and to unset the old one. */
|
||||
void
|
||||
_gdk_quartz_update_focus_window (GdkWindow *window,
|
||||
gboolean got_focus)
|
||||
_gdk_quartz_events_update_focus_window (GdkWindow *window,
|
||||
gboolean got_focus)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
@ -704,11 +704,11 @@ synthesize_crossing_events (GdkWindow *window,
|
||||
synthesize_enter_event (window, nsevent, mode, GDK_NOTIFY_UNKNOWN);
|
||||
}
|
||||
|
||||
_gdk_quartz_update_mouse_window (window);
|
||||
_gdk_quartz_events_update_mouse_window (window);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_quartz_send_map_events (GdkWindow *window)
|
||||
_gdk_quartz_events_send_map_events (GdkWindow *window)
|
||||
{
|
||||
GList *list;
|
||||
GdkWindow *interested_window;
|
||||
@ -726,12 +726,12 @@ _gdk_quartz_send_map_events (GdkWindow *window)
|
||||
}
|
||||
|
||||
for (list = private->children; list != NULL; list = list->next)
|
||||
_gdk_quartz_send_map_events ((GdkWindow *)list->data);
|
||||
_gdk_quartz_events_send_map_events ((GdkWindow *)list->data);
|
||||
}
|
||||
|
||||
/* Get current mouse window */
|
||||
GdkWindow *
|
||||
_gdk_quartz_get_mouse_window (void)
|
||||
_gdk_quartz_events_get_mouse_window (void)
|
||||
{
|
||||
if (_gdk_quartz_pointer_grab_window && !pointer_grab_owner_events)
|
||||
return _gdk_quartz_pointer_grab_window;
|
||||
@ -741,7 +741,7 @@ _gdk_quartz_get_mouse_window (void)
|
||||
|
||||
/* Update mouse window */
|
||||
void
|
||||
_gdk_quartz_update_mouse_window (GdkWindow *window)
|
||||
_gdk_quartz_events_update_mouse_window (GdkWindow *window)
|
||||
{
|
||||
if (window)
|
||||
g_object_ref (window);
|
||||
@ -753,7 +753,7 @@ _gdk_quartz_update_mouse_window (GdkWindow *window)
|
||||
|
||||
/* Update current cursor */
|
||||
void
|
||||
_gdk_quartz_update_cursor (GdkWindow *window)
|
||||
_gdk_quartz_events_update_cursor (GdkWindow *window)
|
||||
{
|
||||
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
|
||||
NSCursor *nscursor = nil;
|
||||
@ -801,7 +801,7 @@ find_window_for_event (NSEvent *nsevent, gint *x, gint *y)
|
||||
NSPoint point = [nsevent locationInWindow];
|
||||
GdkWindow *mouse_window;
|
||||
|
||||
mouse_window = _gdk_quartz_find_child_window_by_point (toplevel, point.x, point.y, x, y);
|
||||
mouse_window = _gdk_quartz_window_find_child_by_point (toplevel, point.x, point.y, x, y);
|
||||
|
||||
if (!mouse_window)
|
||||
mouse_window = _gdk_root;
|
||||
@ -817,7 +817,7 @@ find_window_for_event (NSEvent *nsevent, gint *x, gint *y)
|
||||
{
|
||||
synthesize_crossing_events (mouse_window, GDK_CROSSING_NORMAL, nsevent, *x, *y);
|
||||
|
||||
_gdk_quartz_update_cursor (mouse_window);
|
||||
_gdk_quartz_events_update_cursor (mouse_window);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -882,7 +882,7 @@ find_window_for_event (NSEvent *nsevent, gint *x, gint *y)
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_window = _gdk_quartz_find_child_window_by_point (toplevel, point.x, point.y, x, y);
|
||||
mouse_window = _gdk_quartz_window_find_child_by_point (toplevel, point.x, point.y, x, y);
|
||||
}
|
||||
|
||||
event_mask = get_event_mask_from_ns_event (nsevent);
|
||||
@ -901,7 +901,7 @@ find_window_for_event (NSEvent *nsevent, gint *x, gint *y)
|
||||
point = [nsevent locationInWindow];
|
||||
toplevel = [(GdkQuartzView *)[nswindow contentView] gdkWindow];
|
||||
|
||||
mouse_window = _gdk_quartz_find_child_window_by_point (toplevel, point.x, point.y, x, y);
|
||||
mouse_window = _gdk_quartz_window_find_child_by_point (toplevel, point.x, point.y, x, y);
|
||||
|
||||
synthesize_crossing_events (mouse_window, GDK_CROSSING_NORMAL, nsevent, *x, *y);
|
||||
}
|
||||
@ -1067,7 +1067,7 @@ create_key_event (GdkWindow *window, NSEvent *nsevent, GdkEventType type)
|
||||
&event->key.keyval,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
event->key.is_modifier = _gdk_quartz_key_is_modifier (event->key.hardware_keycode);
|
||||
event->key.is_modifier = _gdk_quartz_keys_is_modifier (event->key.hardware_keycode);
|
||||
|
||||
event->key.string = NULL;
|
||||
|
||||
@ -1117,7 +1117,8 @@ create_key_event (GdkWindow *window, NSEvent *nsevent, GdkEventType type)
|
||||
}
|
||||
|
||||
static GdkEventMask current_mask = 0;
|
||||
GdkEventMask _gdk_quartz_get_current_event_mask (void)
|
||||
GdkEventMask
|
||||
_gdk_quartz_events_get_current_event_mask (void)
|
||||
{
|
||||
return current_mask;
|
||||
}
|
||||
@ -1284,7 +1285,7 @@ gdk_event_translate (NSEvent *nsevent)
|
||||
{
|
||||
GdkEventType type;
|
||||
|
||||
type = _gdk_quartz_key_event_type (nsevent);
|
||||
type = _gdk_quartz_keys_event_type (nsevent);
|
||||
if (type == GDK_NOTHING)
|
||||
return FALSE;
|
||||
|
||||
|
@ -268,14 +268,24 @@ static void
|
||||
gdk_quartz_draw_tiled_pattern (void *info,
|
||||
CGContextRef context)
|
||||
{
|
||||
GdkGC *gc = GDK_GC (info);
|
||||
CGImageRef pattern_image;
|
||||
GdkGC *gc = GDK_GC (info);
|
||||
GdkGCQuartz *private = GDK_GC_QUARTZ (gc);
|
||||
CGImageRef pattern_image;
|
||||
size_t width, height;
|
||||
|
||||
pattern_image = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_tile (gc))->impl)->image;
|
||||
|
||||
CGContextDrawImage (context, CGRectMake (0, 0,
|
||||
CGImageGetWidth (pattern_image),
|
||||
CGImageGetHeight (pattern_image)),
|
||||
width = CGImageGetWidth (pattern_image);
|
||||
height = CGImageGetHeight (pattern_image);
|
||||
|
||||
if (private->is_window)
|
||||
{
|
||||
CGContextTranslateCTM (context, 0, height);
|
||||
CGContextScaleCTM (context, 1.0, -1.0);
|
||||
}
|
||||
|
||||
CGContextDrawImage (context,
|
||||
CGRectMake (0, 0, width, height),
|
||||
pattern_image);
|
||||
}
|
||||
|
||||
@ -294,8 +304,9 @@ gdk_quartz_draw_stippled_pattern (void *info,
|
||||
CGImageGetHeight (pattern_image));
|
||||
|
||||
CGContextClipToMask (context, rect, pattern_image);
|
||||
gdk_quartz_get_rgba_from_pixel (gc->colormap, _gdk_gc_get_fg_pixel (gc),
|
||||
&r, &g, &b, &a);
|
||||
_gdk_quartz_colormap_get_rgba_from_pixel (gc->colormap,
|
||||
_gdk_gc_get_fg_pixel (gc),
|
||||
&r, &g, &b, &a);
|
||||
CGContextSetRGBFillColor (context, r, g, b, a);
|
||||
CGContextFillRect (context, rect);
|
||||
}
|
||||
@ -314,22 +325,25 @@ gdk_quartz_draw_opaque_stippled_pattern (void *info,
|
||||
CGImageGetWidth (pattern_image),
|
||||
CGImageGetHeight (pattern_image));
|
||||
|
||||
gdk_quartz_get_rgba_from_pixel (gc->colormap, _gdk_gc_get_bg_pixel (gc),
|
||||
&r, &g, &b, &a);
|
||||
_gdk_quartz_colormap_get_rgba_from_pixel (gc->colormap,
|
||||
_gdk_gc_get_bg_pixel (gc),
|
||||
&r, &g, &b, &a);
|
||||
CGContextSetRGBFillColor (context, r, g, b, a);
|
||||
CGContextFillRect (context, rect);
|
||||
|
||||
CGContextClipToMask (context, rect, pattern_image);
|
||||
gdk_quartz_get_rgba_from_pixel (gc->colormap, _gdk_gc_get_fg_pixel (gc),
|
||||
&r, &g, &b, &a);
|
||||
_gdk_quartz_colormap_get_rgba_from_pixel (gc->colormap,
|
||||
_gdk_gc_get_fg_pixel (gc),
|
||||
&r, &g, &b, &a);
|
||||
CGContextSetRGBFillColor (context, r, g, b, a);
|
||||
CGContextFillRect (context, rect);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_quartz_update_context_from_gc (CGContextRef context,
|
||||
GdkGC *gc,
|
||||
GdkQuartzContextValuesMask mask)
|
||||
_gdk_quartz_gc_update_cg_context (GdkGC *gc,
|
||||
GdkDrawable *drawable,
|
||||
CGContextRef context,
|
||||
GdkQuartzContextValuesMask mask)
|
||||
{
|
||||
GdkGCQuartz *private;
|
||||
guint32 fg_pixel;
|
||||
@ -435,8 +449,9 @@ gdk_quartz_update_context_from_gc (CGContextRef context,
|
||||
CGLineJoin line_join = kCGLineJoinMiter;
|
||||
gfloat r, g, b, a;
|
||||
|
||||
gdk_quartz_get_rgba_from_pixel (gc->colormap, fg_pixel,
|
||||
&r, &g, &b, &a);
|
||||
_gdk_quartz_colormap_get_rgba_from_pixel (gc->colormap,
|
||||
fg_pixel,
|
||||
&r, &g, &b, &a);
|
||||
CGContextSetRGBStrokeColor (context, r, g, b, a);
|
||||
|
||||
CGContextSetLineWidth (context, MAX (G_MINFLOAT, private->line_width));
|
||||
@ -500,8 +515,9 @@ gdk_quartz_update_context_from_gc (CGContextRef context,
|
||||
|
||||
if (fill == GDK_SOLID)
|
||||
{
|
||||
gdk_quartz_get_rgba_from_pixel (gc->colormap, fg_pixel,
|
||||
&r, &g, &b, &a);
|
||||
_gdk_quartz_colormap_get_rgba_from_pixel (gc->colormap,
|
||||
fg_pixel,
|
||||
&r, &g, &b, &a);
|
||||
CGContextSetRGBFillColor (context, r, g, b, a);
|
||||
}
|
||||
else
|
||||
@ -512,6 +528,7 @@ gdk_quartz_update_context_from_gc (CGContextRef context,
|
||||
gfloat width, height;
|
||||
gboolean is_colored = FALSE;
|
||||
CGPatternCallbacks callbacks = { 0, NULL, NULL };
|
||||
CGPoint phase;
|
||||
|
||||
switch (fill)
|
||||
{
|
||||
@ -537,6 +554,9 @@ gdk_quartz_update_context_from_gc (CGContextRef context,
|
||||
width = CGImageGetWidth (pattern_image);
|
||||
height = CGImageGetHeight (pattern_image);
|
||||
|
||||
phase = CGPointApplyAffineTransform (CGPointMake (gc->ts_x_origin, gc->ts_y_origin), CGContextGetCTM (context));
|
||||
CGContextSetPatternPhase (context, CGSizeMake (phase.x, phase.y));
|
||||
|
||||
private->ts_pattern = CGPatternCreate (private,
|
||||
CGRectMake (0, 0, width, height),
|
||||
CGAffineTransformIdentity,
|
||||
@ -554,17 +574,22 @@ gdk_quartz_update_context_from_gc (CGContextRef context,
|
||||
CGColorSpaceRelease (baseSpace);
|
||||
|
||||
if (fill == GDK_STIPPLED)
|
||||
gdk_quartz_get_rgba_from_pixel (gc->colormap, fg_pixel,
|
||||
&colors[0], &colors[1],
|
||||
&colors[2], &colors[3]);
|
||||
|
||||
_gdk_quartz_colormap_get_rgba_from_pixel (gc->colormap, fg_pixel,
|
||||
&colors[0], &colors[1],
|
||||
&colors[2], &colors[3]);
|
||||
|
||||
CGContextSetFillPattern (context, private->ts_pattern,
|
||||
(fill == GDK_STIPPLED) ? colors : &alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mask & GDK_QUARTZ_CONTEXT_TEXT)
|
||||
{
|
||||
/* FIXME: implement text */
|
||||
}
|
||||
|
||||
if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable))
|
||||
private->is_window = TRUE;
|
||||
else
|
||||
private->is_window = FALSE;
|
||||
}
|
||||
|
@ -27,14 +27,14 @@
|
||||
static GObjectClass *parent_class;
|
||||
|
||||
GdkImage *
|
||||
_gdk_quartz_copy_to_image (GdkDrawable *drawable,
|
||||
GdkImage *image,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint dest_x,
|
||||
gint dest_y,
|
||||
gint width,
|
||||
gint height)
|
||||
_gdk_quartz_image_copy_to_image (GdkDrawable *drawable,
|
||||
GdkImage *image,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint dest_x,
|
||||
gint dest_y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
/* FIXME: Implement */
|
||||
return NULL;
|
||||
|
@ -591,7 +591,7 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
* GDK_KEY_PRESS, GDK_KEY_RELEASE, GDK_NOTHING (should be ignored)
|
||||
*/
|
||||
GdkEventType
|
||||
_gdk_quartz_key_event_type (NSEvent *event)
|
||||
_gdk_quartz_keys_event_type (NSEvent *event)
|
||||
{
|
||||
unsigned short keycode;
|
||||
unsigned int flags;
|
||||
@ -631,7 +631,7 @@ _gdk_quartz_key_event_type (NSEvent *event)
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_quartz_key_is_modifier (guint keycode)
|
||||
_gdk_quartz_keys_is_modifier (guint keycode)
|
||||
{
|
||||
gint i;
|
||||
|
||||
|
@ -71,6 +71,8 @@ struct _GdkGCQuartz
|
||||
gfloat dash_phase;
|
||||
|
||||
CGPatternRef ts_pattern;
|
||||
|
||||
guint is_window : 1;
|
||||
};
|
||||
|
||||
struct _GdkGCQuartzClass
|
||||
@ -100,74 +102,76 @@ extern GdkWindow *_gdk_root;
|
||||
|
||||
extern GdkDragContext *_gdk_quartz_drag_source_context;
|
||||
|
||||
GType _gdk_gc_quartz_get_type (void);
|
||||
|
||||
GdkGC *_gdk_quartz_gc_new (GdkDrawable *drawable,
|
||||
GdkGCValues *values,
|
||||
GdkGCValuesMask values_mask);
|
||||
|
||||
/* Initialization */
|
||||
void _gdk_windowing_window_init (void);
|
||||
void _gdk_events_init (void);
|
||||
void _gdk_visual_init (void);
|
||||
void _gdk_input_init (void);
|
||||
void _gdk_windowing_window_init (void);
|
||||
void _gdk_events_init (void);
|
||||
void _gdk_visual_init (void);
|
||||
void _gdk_input_init (void);
|
||||
void _gdk_quartz_event_loop_init (void);
|
||||
|
||||
/* GC */
|
||||
typedef enum {
|
||||
GDK_QUARTZ_CONTEXT_STROKE = 1 << 0,
|
||||
GDK_QUARTZ_CONTEXT_FILL = 1 << 1,
|
||||
GDK_QUARTZ_CONTEXT_TEXT = 1 << 2
|
||||
} GdkQuartzContextValuesMask;
|
||||
|
||||
void gdk_quartz_get_rgba_from_pixel (GdkColormap *colormap,
|
||||
guint32 pixel,
|
||||
gfloat *red,
|
||||
gfloat *green,
|
||||
gfloat *blue,
|
||||
gfloat *alpha);
|
||||
GType _gdk_gc_quartz_get_type (void);
|
||||
GdkGC *_gdk_quartz_gc_new (GdkDrawable *drawable,
|
||||
GdkGCValues *values,
|
||||
GdkGCValuesMask values_mask);
|
||||
void _gdk_quartz_gc_update_cg_context (GdkGC *gc,
|
||||
GdkDrawable *drawable,
|
||||
CGContextRef context,
|
||||
GdkQuartzContextValuesMask mask);
|
||||
|
||||
void gdk_quartz_update_context_from_gc (CGContextRef context,
|
||||
GdkGC *gc,
|
||||
GdkQuartzContextValuesMask mask);
|
||||
/* Colormap */
|
||||
void _gdk_quartz_colormap_get_rgba_from_pixel (GdkColormap *colormap,
|
||||
guint32 pixel,
|
||||
gfloat *red,
|
||||
gfloat *green,
|
||||
gfloat *blue,
|
||||
gfloat *alpha);
|
||||
|
||||
gint _gdk_quartz_get_inverted_screen_y (gint y);
|
||||
/* Window */
|
||||
GdkWindow *_gdk_quartz_window_find_child_by_point (GdkWindow *toplevel,
|
||||
gint x,
|
||||
gint y,
|
||||
gint *x_ret,
|
||||
gint *y_ret);
|
||||
gint _gdk_quartz_window_get_inverted_screen_y (gint y);
|
||||
|
||||
GdkWindow * _gdk_quartz_find_child_window_by_point (GdkWindow *toplevel,
|
||||
int x,
|
||||
int y,
|
||||
int *x_ret,
|
||||
int *y_ret);
|
||||
|
||||
void _gdk_quartz_update_focus_window (GdkWindow *new_window,
|
||||
gboolean got_focus);
|
||||
GdkWindow *_gdk_quartz_get_mouse_window (void);
|
||||
void _gdk_quartz_update_mouse_window (GdkWindow *window);
|
||||
void _gdk_quartz_update_cursor (GdkWindow *window);
|
||||
|
||||
GdkImage *_gdk_quartz_copy_to_image (GdkDrawable *drawable,
|
||||
GdkImage *image,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint dest_x,
|
||||
gint dest_y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void _gdk_quartz_send_map_events (GdkWindow *window);
|
||||
|
||||
GdkEventType _gdk_quartz_key_event_type (NSEvent *event);
|
||||
gboolean _gdk_quartz_key_is_modifier (guint keycode);
|
||||
|
||||
GdkEventMask _gdk_quartz_get_current_event_mask (void);
|
||||
/* Events */
|
||||
void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
|
||||
gboolean got_focus);
|
||||
GdkWindow * _gdk_quartz_events_get_mouse_window (void);
|
||||
void _gdk_quartz_events_update_mouse_window (GdkWindow *window);
|
||||
void _gdk_quartz_events_update_cursor (GdkWindow *window);
|
||||
void _gdk_quartz_events_send_map_events (GdkWindow *window);
|
||||
GdkEventMask _gdk_quartz_events_get_current_event_mask (void);
|
||||
|
||||
extern GdkWindow *_gdk_quartz_keyboard_grab_window;
|
||||
extern GdkWindow *_gdk_quartz_pointer_grab_window;
|
||||
|
||||
NSImage *_gdk_quartz_pixbuf_to_ns_image (GdkPixbuf *pixbuf);
|
||||
/* Event loop */
|
||||
NSEvent * _gdk_quartz_event_loop_get_current (void);
|
||||
void _gdk_quartz_event_loop_release_current (void);
|
||||
|
||||
void _gdk_quartz_event_loop_init (void);
|
||||
NSEvent *_gdk_quartz_event_loop_get_current (void);
|
||||
void _gdk_quartz_event_loop_release_current (void);
|
||||
/* FIXME: image */
|
||||
GdkImage *_gdk_quartz_image_copy_to_image (GdkDrawable *drawable,
|
||||
GdkImage *image,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint dest_x,
|
||||
gint dest_y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void _gdk_quartz_drawable_finish (GdkDrawable *drawable);
|
||||
/* Keys */
|
||||
GdkEventType _gdk_quartz_keys_event_type (NSEvent *event);
|
||||
gboolean _gdk_quartz_keys_is_modifier (guint keycode);
|
||||
|
||||
/* Drawable */
|
||||
void _gdk_quartz_drawable_finish (GdkDrawable *drawable);
|
||||
|
||||
#endif /* __GDK_PRIVATE_QUARTZ_H__ */
|
||||
|
@ -173,7 +173,7 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
|
||||
gint i;
|
||||
|
||||
cg_context = gdk_quartz_drawable_get_context (GDK_DRAWABLE (impl), FALSE);
|
||||
gdk_quartz_get_rgba_from_pixel (gdk_drawable_get_colormap (drawable_impl->wrapper),
|
||||
_gdk_quartz_colormap_get_rgba_from_pixel (gdk_drawable_get_colormap (drawable_impl->wrapper),
|
||||
GDK_WINDOW_OBJECT (drawable_impl->wrapper)->bg_color.pixel,
|
||||
&r, &g, &b, &a);
|
||||
|
||||
@ -424,8 +424,9 @@ get_default_title (void)
|
||||
return title;
|
||||
}
|
||||
|
||||
/* FIXME: Should probably be in screen instead. */
|
||||
gint
|
||||
_gdk_quartz_get_inverted_screen_y (gint y)
|
||||
_gdk_quartz_window_get_inverted_screen_y (gint y)
|
||||
{
|
||||
NSRect rect = [[NSScreen mainScreen] frame];
|
||||
|
||||
@ -434,12 +435,12 @@ _gdk_quartz_get_inverted_screen_y (gint y)
|
||||
|
||||
static GdkWindow *
|
||||
find_child_window_by_point_helper (GdkWindow *window,
|
||||
int x,
|
||||
int y,
|
||||
int x_offset,
|
||||
int y_offset,
|
||||
int *x_ret,
|
||||
int *y_ret)
|
||||
gint x,
|
||||
gint y,
|
||||
gint x_offset,
|
||||
gint y_offset,
|
||||
gint *x_ret,
|
||||
gint *y_ret)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
@ -479,11 +480,11 @@ find_child_window_by_point_helper (GdkWindow *window,
|
||||
* flipped.
|
||||
*/
|
||||
GdkWindow *
|
||||
_gdk_quartz_find_child_window_by_point (GdkWindow *toplevel,
|
||||
int x,
|
||||
int y,
|
||||
int *x_ret,
|
||||
int *y_ret)
|
||||
_gdk_quartz_window_find_child_by_point (GdkWindow *toplevel,
|
||||
gint x,
|
||||
gint y,
|
||||
gint *x_ret,
|
||||
gint *y_ret)
|
||||
{
|
||||
GdkWindowObject *private = (GdkWindowObject *)toplevel;
|
||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
|
||||
@ -632,9 +633,10 @@ gdk_window_new (GdkWindow *parent,
|
||||
case GDK_WINDOW_DIALOG:
|
||||
case GDK_WINDOW_TEMP:
|
||||
{
|
||||
NSRect content_rect = NSMakeRect (private->x,
|
||||
_gdk_quartz_get_inverted_screen_y (private->y) - impl->height,
|
||||
impl->width, impl->height);
|
||||
NSRect content_rect =
|
||||
NSMakeRect (private->x,
|
||||
_gdk_quartz_window_get_inverted_screen_y (private->y) - impl->height,
|
||||
impl->width, impl->height);
|
||||
const char *title;
|
||||
int style_mask;
|
||||
|
||||
@ -732,10 +734,8 @@ _gdk_windowing_window_destroy (GdkWindow *window,
|
||||
{
|
||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
|
||||
|
||||
if (window == _gdk_quartz_get_mouse_window ())
|
||||
{
|
||||
_gdk_quartz_update_mouse_window (_gdk_root);
|
||||
}
|
||||
if (window == _gdk_quartz_events_get_mouse_window ())
|
||||
_gdk_quartz_events_update_mouse_window (_gdk_root);
|
||||
|
||||
GDK_QUARTZ_ALLOC_POOL;
|
||||
|
||||
@ -797,7 +797,7 @@ show_window_internal (GdkWindow *window,
|
||||
}
|
||||
|
||||
if (all_parents_shown (private->parent))
|
||||
_gdk_quartz_send_map_events (window);
|
||||
_gdk_quartz_events_send_map_events (window);
|
||||
|
||||
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_WITHDRAWN, 0);
|
||||
|
||||
@ -899,9 +899,10 @@ move_resize_window_internal (GdkWindow *window,
|
||||
|
||||
if (impl->toplevel)
|
||||
{
|
||||
NSRect content_rect = NSMakeRect (private->x,
|
||||
_gdk_quartz_get_inverted_screen_y (private->y) ,
|
||||
impl->width, impl->height);
|
||||
NSRect content_rect =
|
||||
NSMakeRect (private->x,
|
||||
_gdk_quartz_window_get_inverted_screen_y (private->y) ,
|
||||
impl->width, impl->height);
|
||||
NSRect frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
|
||||
|
||||
frame_rect.origin.y -= frame_rect.size.height;
|
||||
@ -1099,7 +1100,7 @@ gdk_window_set_cursor (GdkWindow *window,
|
||||
|
||||
impl->nscursor = nscursor;
|
||||
|
||||
_gdk_quartz_update_cursor (_gdk_quartz_get_mouse_window ());
|
||||
_gdk_quartz_events_update_cursor (_gdk_quartz_events_get_mouse_window ());
|
||||
}
|
||||
|
||||
void
|
||||
@ -1146,7 +1147,7 @@ gdk_window_get_origin (GdkWindow *window,
|
||||
content_rect = [impl->toplevel contentRectForFrameRect:[impl->toplevel frame]];
|
||||
|
||||
tmp_x = content_rect.origin.x;
|
||||
tmp_y = _gdk_quartz_get_inverted_screen_y (content_rect.origin.y + content_rect.size.height);
|
||||
tmp_y = _gdk_quartz_window_get_inverted_screen_y (content_rect.origin.y + content_rect.size.height);
|
||||
|
||||
while (private != GDK_WINDOW_OBJECT (toplevel))
|
||||
{
|
||||
@ -1238,15 +1239,15 @@ _gdk_windowing_window_get_pointer (GdkDisplay *display,
|
||||
if (window == _gdk_root)
|
||||
{
|
||||
point = [NSEvent mouseLocation];
|
||||
y_tmp = _gdk_quartz_get_inverted_screen_y (point.y);
|
||||
*mask = _gdk_quartz_get_current_event_mask ();
|
||||
y_tmp = _gdk_quartz_window_get_inverted_screen_y (point.y);
|
||||
*mask = _gdk_quartz_events_get_current_event_mask ();
|
||||
}
|
||||
else
|
||||
{
|
||||
NSWindow *nswindow = impl->toplevel;
|
||||
point = [nswindow mouseLocationOutsideOfEventStream];
|
||||
y_tmp = impl->height - point.y;
|
||||
*mask = _gdk_quartz_get_current_event_mask ();
|
||||
*mask = _gdk_quartz_events_get_current_event_mask ();
|
||||
}
|
||||
x_tmp = point.x;
|
||||
|
||||
@ -1261,7 +1262,7 @@ _gdk_windowing_window_get_pointer (GdkDisplay *display,
|
||||
*x = x_tmp;
|
||||
*y = y_tmp;
|
||||
|
||||
return _gdk_quartz_find_child_window_by_point (window,
|
||||
return _gdk_quartz_window_find_child_by_point (window,
|
||||
point.x, point.y,
|
||||
&x_tmp, &y_tmp);
|
||||
}
|
||||
@ -1747,7 +1748,7 @@ gdk_window_get_frame_extents (GdkWindow *window,
|
||||
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->y = _gdk_quartz_window_get_inverted_screen_y (ns_rect.origin.y + ns_rect.size.height);
|
||||
rect->width = ns_rect.size.width;
|
||||
rect->height = ns_rect.size.height;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user