summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorRichard Hult <richard@imendio.com>2006-07-29 11:05:15 +0000
committerRichard Hult <rhult@src.gnome.org>2006-07-29 11:05:15 +0000
commit571c4605032822aafd4bf24924fb9ee12df650db (patch)
tree0020c1ae821a35e8d4788e0cdb245c09f491fb3c /gdk
parent441a86fe554737888d21018466064d6f11361a18 (diff)
downloadgtk+-571c4605032822aafd4bf24924fb9ee12df650db.tar.gz
Always set success to TRUE. (gdk_color_change): Implement.
2006-07-29 Richard Hult <richard@imendio.com> * gdk/quartz/gdkcolor-quartz.c (gdk_colormap_alloc_colors): Always set success to TRUE. (gdk_color_change): Implement. * gdk/quartz/GdkQuartzWindow.c ([GdkQuartzWindow -canBecomeKeyWindow]): Add comment. * gdk/quartz/gdkevents-quartz.c (gdk_screen_get_setting): Make the default font a bit smaller until we have made this get the system setting. * gdk/quartz/gdkwindow-quartz.c (gdk_window_set_type_hint): Enable shadows for the right window types. * gdk/quartz/gdkprivate-quartz.h: * gdk/quartz/gdkgc-quartz.c: * gdk/quartz/gdkdrawable-quartz.c: * gdk/quartz/gdkcolor-quartz.c: Expose the CGContext functions, update callers. * gdk/quartz/gdkmain-quartz.c: (_gdk_windowing_init): No need to get the current process ID, use the right constant instead.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/quartz/GdkQuartzWindow.c8
-rw-r--r--gdk/quartz/gdkcolor-quartz.c13
-rw-r--r--gdk/quartz/gdkdrawable-quartz.c74
-rw-r--r--gdk/quartz/gdkdrawable-quartz.h4
-rw-r--r--gdk/quartz/gdkevents-quartz.c2
-rw-r--r--gdk/quartz/gdkgc-quartz.c2
-rw-r--r--gdk/quartz/gdkmain-quartz.c3
-rw-r--r--gdk/quartz/gdkprivate-quartz.h6
-rw-r--r--gdk/quartz/gdkwindow-quartz.c18
9 files changed, 72 insertions, 58 deletions
diff --git a/gdk/quartz/GdkQuartzWindow.c b/gdk/quartz/GdkQuartzWindow.c
index 6091e7a0b4..e50fddf2fe 100644
--- a/gdk/quartz/GdkQuartzWindow.c
+++ b/gdk/quartz/GdkQuartzWindow.c
@@ -176,6 +176,14 @@
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ /* FIXME: Is this right? If so, the switch shouldn't be needed. Need
+ * this + some tweaking to the event/grab code to get menus
+ * working...
+ */
+ /*if (private->window_type == GDK_WINDOW_TEMP)
+ return NO;
+ */
+
switch (impl->type_hint)
{
case GDK_WINDOW_TYPE_HINT_NORMAL:
diff --git a/gdk/quartz/gdkcolor-quartz.c b/gdk/quartz/gdkcolor-quartz.c
index bc1d200971..07e726c4d0 100644
--- a/gdk/quartz/gdkcolor-quartz.c
+++ b/gdk/quartz/gdkcolor-quartz.c
@@ -140,6 +140,9 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
((colors[i].blue >> 8) & 0xff);
}
+ if (success)
+ *success = TRUE;
+
return ncolors;
}
@@ -167,7 +170,7 @@ gdk_colormap_get_screen (GdkColormap *cmap)
}
void
-_gdk_quartz_set_context_fill_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel)
+gdk_quartz_set_context_fill_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel)
{
float red, green, blue, alpha;
@@ -184,7 +187,7 @@ _gdk_quartz_set_context_fill_color_from_pixel (CGContextRef context, GdkColormap
}
void
-_gdk_quartz_set_context_stroke_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel)
+gdk_quartz_set_context_stroke_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel)
{
float red, green, blue, alpha;
@@ -204,7 +207,9 @@ gboolean
gdk_color_change (GdkColormap *colormap,
GdkColor *color)
{
- /* FIXME: Implement */
- return FALSE;
+ if (color->pixel < 0 || color->pixel >= colormap->size)
+ return FALSE;
+
+ return TRUE;
}
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
index 75c17b6796..11d4973497 100644
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ b/gdk/quartz/gdkdrawable-quartz.c
@@ -37,7 +37,7 @@ surface_info_destroy (void *data)
{
SurfaceInfo *info = data;
- _gdk_quartz_drawable_release_context (info->drawable, info->context);
+ gdk_quartz_drawable_release_context (info->drawable, info->context);
g_free (info);
}
@@ -55,7 +55,7 @@ gdk_quartz_ref_cairo_surface (GdkDrawable *drawable)
GDK_WINDOW_DESTROYED (impl->wrapper))
return NULL;
- context = _gdk_quartz_drawable_get_context (drawable, TRUE);
+ context = gdk_quartz_drawable_get_context (drawable, TRUE);
if (!context)
return NULL;
@@ -123,28 +123,28 @@ gdk_quartz_draw_rectangle (GdkDrawable *drawable,
gint width,
gint height)
{
- CGContextRef context = _gdk_quartz_drawable_get_context (drawable, FALSE);
+ CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
CGRect rect = CGRectMake (x + 0.5, y + 0.5, width, height);
if (!context)
return;
- _gdk_quartz_update_context_from_gc (context, gc);
+ gdk_quartz_update_context_from_gc (context, gc);
if (filled)
{
- _gdk_quartz_set_context_fill_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
+ gdk_quartz_set_context_fill_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
_gdk_gc_get_fg_pixel (gc));
CGContextFillRect (context, rect);
}
else
{
- _gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
+ gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
_gdk_gc_get_fg_pixel (gc));
CGContextStrokeRect (context, rect);
}
- _gdk_quartz_drawable_release_context (drawable, context);
+ gdk_quartz_drawable_release_context (drawable, context);
}
static void
@@ -158,13 +158,13 @@ gdk_quartz_draw_arc (GdkDrawable *drawable,
gint angle1,
gint angle2)
{
- CGContextRef context = _gdk_quartz_drawable_get_context (drawable, FALSE);
+ CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
float start_angle, end_angle;
if (!context)
return;
- _gdk_quartz_update_context_from_gc (context, gc);
+ gdk_quartz_update_context_from_gc (context, gc);
CGContextSaveGState (context);
@@ -177,7 +177,7 @@ gdk_quartz_draw_arc (GdkDrawable *drawable,
if (filled)
{
- _gdk_quartz_set_context_fill_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
+ gdk_quartz_set_context_fill_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
_gdk_gc_get_fg_pixel (gc));
CGContextMoveToPoint (context, 0, 0);
@@ -189,7 +189,7 @@ gdk_quartz_draw_arc (GdkDrawable *drawable,
}
else
{
- _gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
+ gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
_gdk_gc_get_fg_pixel (gc));
CGContextAddArc (context, 0, 0, width / 2,
start_angle, end_angle,
@@ -199,7 +199,7 @@ gdk_quartz_draw_arc (GdkDrawable *drawable,
CGContextRestoreGState (context);
- _gdk_quartz_drawable_release_context (drawable, context);
+ gdk_quartz_drawable_release_context (drawable, context);
}
static void
@@ -209,19 +209,19 @@ gdk_quartz_draw_polygon (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- CGContextRef context = _gdk_quartz_drawable_get_context (drawable, FALSE);
+ CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
int i;
if (!context)
return;
- _gdk_quartz_update_context_from_gc (context, gc);
+ gdk_quartz_update_context_from_gc (context, gc);
if (filled)
- _gdk_quartz_set_context_fill_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
+ gdk_quartz_set_context_fill_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
_gdk_gc_get_fg_pixel (gc));
else
- _gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
+ gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
_gdk_gc_get_fg_pixel (gc));
CGContextMoveToPoint (context, points[0].x + 0.5, points[0].y + 0.5);
@@ -235,7 +235,7 @@ gdk_quartz_draw_polygon (GdkDrawable *drawable,
else
CGContextStrokePath (context);
- _gdk_quartz_drawable_release_context (drawable, context);
+ gdk_quartz_drawable_release_context (drawable, context);
}
static void
@@ -296,12 +296,12 @@ gdk_quartz_draw_drawable (GdkDrawable *drawable,
}
else if (dest_depth != 0 && src_depth == dest_depth)
{
- CGContextRef context = _gdk_quartz_drawable_get_context (drawable, FALSE);
+ CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
if (!context)
return;
- _gdk_quartz_update_context_from_gc (context, gc);
+ gdk_quartz_update_context_from_gc (context, gc);
CGContextSetBlendMode (context, kCGBlendModeNormal);
@@ -312,7 +312,7 @@ gdk_quartz_draw_drawable (GdkDrawable *drawable,
GDK_PIXMAP_IMPL_QUARTZ (src_impl)->height),
GDK_PIXMAP_IMPL_QUARTZ (src_impl)->image);
- _gdk_quartz_drawable_release_context (drawable, context);
+ gdk_quartz_drawable_release_context (drawable, context);
}
else
g_warning ("Attempt to draw a drawable with depth %d to a drawable with depth %d",
@@ -342,14 +342,14 @@ gdk_quartz_draw_segments (GdkDrawable *drawable,
GdkSegment *segs,
gint nsegs)
{
- CGContextRef context = _gdk_quartz_drawable_get_context (drawable, FALSE);
+ CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
int i;
if (!context)
return;
- _gdk_quartz_update_context_from_gc (context, gc);
- _gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
+ gdk_quartz_update_context_from_gc (context, gc);
+ gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
_gdk_gc_get_fg_pixel (gc));
for (i = 0; i < nsegs; i++)
@@ -360,7 +360,7 @@ gdk_quartz_draw_segments (GdkDrawable *drawable,
CGContextStrokePath (context);
- _gdk_quartz_drawable_release_context (drawable, context);
+ gdk_quartz_drawable_release_context (drawable, context);
}
static void
@@ -369,15 +369,15 @@ gdk_quartz_draw_lines (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- CGContextRef context = _gdk_quartz_drawable_get_context (drawable, FALSE);
+ CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
int i;
if (!context)
return;
- _gdk_quartz_update_context_from_gc (context, gc);
- _gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
- _gdk_gc_get_fg_pixel (gc));
+ gdk_quartz_update_context_from_gc (context, gc);
+ gdk_quartz_set_context_stroke_color_from_pixel (context, gdk_drawable_get_colormap (drawable),
+ _gdk_gc_get_fg_pixel (gc));
for (i = 1; i < npoints; i++)
{
@@ -387,7 +387,7 @@ gdk_quartz_draw_lines (GdkDrawable *drawable,
CGContextStrokePath (context);
- _gdk_quartz_drawable_release_context (drawable, context);
+ gdk_quartz_drawable_release_context (drawable, context);
}
static void
@@ -404,7 +404,7 @@ gdk_quartz_draw_pixbuf (GdkDrawable *drawable,
gint x_dither,
gint y_dither)
{
- CGContextRef context = _gdk_quartz_drawable_get_context (drawable, FALSE);
+ CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
CGColorSpaceRef colorspace;
CGDataProviderRef data_provider;
CGImageRef image;
@@ -435,7 +435,7 @@ gdk_quartz_draw_pixbuf (GdkDrawable *drawable,
CGDataProviderRelease (data_provider);
CGColorSpaceRelease (colorspace);
- _gdk_quartz_update_context_from_gc (context, gc);
+ gdk_quartz_update_context_from_gc (context, gc);
CGContextSetBlendMode (context, kCGBlendModeNormal);
@@ -446,7 +446,7 @@ gdk_quartz_draw_pixbuf (GdkDrawable *drawable,
CGContextDrawImage (context, CGRectMake (0, 0, pixbuf_width, pixbuf_height), image);
CGImageRelease (image);
- _gdk_quartz_drawable_release_context (drawable, context);
+ gdk_quartz_drawable_release_context (drawable, context);
}
static void
@@ -460,7 +460,7 @@ gdk_quartz_draw_image (GdkDrawable *drawable,
gint width,
gint height)
{
- CGContextRef context = _gdk_quartz_drawable_get_context (drawable, FALSE);
+ CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
CGColorSpaceRef colorspace;
CGDataProviderRef data_provider;
CGImageRef cgimage;
@@ -482,7 +482,7 @@ gdk_quartz_draw_image (GdkDrawable *drawable,
CGDataProviderRelease (data_provider);
CGColorSpaceRelease (colorspace);
- _gdk_quartz_update_context_from_gc (context, gc);
+ gdk_quartz_update_context_from_gc (context, gc);
CGContextSetBlendMode (context, kCGBlendModeNormal);
@@ -493,7 +493,7 @@ gdk_quartz_draw_image (GdkDrawable *drawable,
CGContextDrawImage (context, CGRectMake (0, 0, image->width, image->height), cgimage);
CGImageRelease (cgimage);
- _gdk_quartz_drawable_release_context (drawable, context);
+ gdk_quartz_drawable_release_context (drawable, context);
}
static void
@@ -571,7 +571,7 @@ gdk_drawable_impl_quartz_get_type (void)
}
CGContextRef
-_gdk_quartz_drawable_get_context (GdkDrawable *drawable, gboolean antialias)
+gdk_quartz_drawable_get_context (GdkDrawable *drawable, gboolean antialias)
{
if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable))
{
@@ -647,7 +647,7 @@ _gdk_quartz_drawable_get_context (GdkDrawable *drawable, gboolean antialias)
}
void
-_gdk_quartz_drawable_release_context (GdkDrawable *drawable, CGContextRef context)
+gdk_quartz_drawable_release_context (GdkDrawable *drawable, CGContextRef context)
{
if (!context)
return;
diff --git a/gdk/quartz/gdkdrawable-quartz.h b/gdk/quartz/gdkdrawable-quartz.h
index 1091b65eb5..2f2f533d1a 100644
--- a/gdk/quartz/gdkdrawable-quartz.h
+++ b/gdk/quartz/gdkdrawable-quartz.h
@@ -54,8 +54,8 @@ struct _GdkDrawableImplQuartzClass
GType gdk_drawable_impl_quartz_get_type (void);
-CGContextRef _gdk_quartz_drawable_get_context (GdkDrawable *drawable, gboolean antialias);
-void _gdk_quartz_drawable_release_context (GdkDrawable *drawable, CGContextRef context);
+CGContextRef gdk_quartz_drawable_get_context (GdkDrawable *drawable, gboolean antialias);
+void gdk_quartz_drawable_release_context (GdkDrawable *drawable, CGContextRef context);
G_END_DECLS
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index ee3f9a6c56..4fad00b932 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -1604,7 +1604,7 @@ gdk_screen_get_setting (GdkScreen *screen,
*/
if (strcmp (name, "gtk-font-name") == 0)
{
- g_value_set_string (value, "Lucida Grande 13");
+ g_value_set_string (value, "Lucida Grande 12");
return TRUE;
}
else if (strcmp (name, "gtk-double-click-time") == 0)
diff --git a/gdk/quartz/gdkgc-quartz.c b/gdk/quartz/gdkgc-quartz.c
index e8fd0ced5e..d18721568b 100644
--- a/gdk/quartz/gdkgc-quartz.c
+++ b/gdk/quartz/gdkgc-quartz.c
@@ -209,7 +209,7 @@ gdk_gc_get_screen (GdkGC *gc)
}
void
-_gdk_quartz_update_context_from_gc (CGContextRef context, GdkGC *gc)
+gdk_quartz_update_context_from_gc (CGContextRef context, GdkGC *gc)
{
GdkGCQuartz *private;
diff --git a/gdk/quartz/gdkmain-quartz.c b/gdk/quartz/gdkmain-quartz.c
index f454d7e147..ff98eaee43 100644
--- a/gdk/quartz/gdkmain-quartz.c
+++ b/gdk/quartz/gdkmain-quartz.c
@@ -30,12 +30,11 @@ const GOptionEntry _gdk_windowing_args[] = {
void
_gdk_windowing_init (void)
{
- ProcessSerialNumber psn;
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
/* Make the current process a foreground application, i.e. an app
* with a user interface, in case we're not running from a .app bundle
*/
- GetCurrentProcess (&psn);
TransformProcessType (&psn, kProcessTransformToForegroundApplication);
}
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index 0116852333..3f8ec8e678 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -98,10 +98,10 @@ void _gdk_events_init (void);
void _gdk_visual_init (void);
void _gdk_input_init (void);
-void _gdk_quartz_set_context_fill_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel);
-void _gdk_quartz_set_context_stroke_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel);
+void gdk_quartz_set_context_fill_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel);
+void gdk_quartz_set_context_stroke_color_from_pixel (CGContextRef context, GdkColormap *colormap, guint32 pixel);
-void _gdk_quartz_update_context_from_gc (CGContextRef context, GdkGC *gc);
+void gdk_quartz_update_context_from_gc (CGContextRef context, GdkGC *gc);
gint _gdk_quartz_get_inverted_screen_y (gint y);
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 7bed32a08b..7fbd0e967c 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -141,7 +141,7 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
GdkRegion *region)
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
- CGContextRef context = _gdk_quartz_drawable_get_context (GDK_DRAWABLE (impl), FALSE);
+ CGContextRef context = gdk_quartz_drawable_get_context (GDK_DRAWABLE (impl), FALSE);
int i, n_rects;
GdkRectangle *rects;
@@ -155,15 +155,15 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
gdk_region_get_rectangles (region, &rects, &n_rects);
for (i = 0; i < n_rects; i++)
{
- _gdk_quartz_set_context_fill_color_from_pixel (context, gdk_drawable_get_colormap (GDK_DRAWABLE_IMPL_QUARTZ (impl)->wrapper),
- GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_QUARTZ (impl)->wrapper)->bg_color.pixel);
+ gdk_quartz_set_context_fill_color_from_pixel (context, gdk_drawable_get_colormap (GDK_DRAWABLE_IMPL_QUARTZ (impl)->wrapper),
+ GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_QUARTZ (impl)->wrapper)->bg_color.pixel);
CGContextFillRect (context, CGRectMake (rects[i].x, rects[i].y, rects[i].width, rects[i].height));
}
g_free (rects);
- _gdk_quartz_drawable_release_context (GDK_DRAWABLE (impl), context);
+ gdk_quartz_drawable_release_context (GDK_DRAWABLE (impl), context);
}
static void
@@ -1366,10 +1366,14 @@ gdk_window_set_type_hint (GdkWindow *window,
{
case GDK_WINDOW_TYPE_HINT_NORMAL: /* Normal toplevel window */
case GDK_WINDOW_TYPE_HINT_DIALOG: /* Dialog window */
+ level = NSNormalWindowLevel;
+ shadow = TRUE;
+ break;
+
case GDK_WINDOW_TYPE_HINT_TOOLBAR: /* Window used to implement toolbars */
case GDK_WINDOW_TYPE_HINT_DESKTOP: /* N/A */
level = NSNormalWindowLevel;
- shadow = TRUE;
+ shadow = FALSE;
break;
case GDK_WINDOW_TYPE_HINT_DOCK:
@@ -1416,9 +1420,7 @@ gdk_window_set_type_hint (GdkWindow *window,
break;
}
- /* Note: The shadow should probably be handled in a theme:
- [impl->toplevel setHasShadow:shadow];
- */
+ [impl->toplevel setHasShadow:shadow];
[impl->toplevel setLevel:level];
}