diff options
author | Javier Jardón <jjardon@gnome.org> | 2010-06-19 21:26:47 +0200 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2010-06-19 21:39:22 +0200 |
commit | 4cf4470fcdeb4c277edff0f6c773872540a77204 (patch) | |
tree | 7d65632872e9b0fb3ede5f0363c056062b2f135c /gdk | |
parent | 2a2843c041d8d20da7ddd130812451bc93f83e42 (diff) | |
download | gtk+-4cf4470fcdeb4c277edff0f6c773872540a77204.tar.gz |
Remove deprecated GdkDrawable functions
Remove gdk_drawable_get_data(), gdk_drawable_set_data(),
gdk_drawable_ref(), gdk_drawable_unref(),
gdk_draw_string(), gdk_draw_text(), gdk_draw_text_wc()
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/directfb/gdkdnd-directfb.c | 10 | ||||
-rw-r--r-- | gdk/directfb/gdkdrawable-directfb.c | 30 | ||||
-rw-r--r-- | gdk/gdk.symbols | 9 | ||||
-rw-r--r-- | gdk/gdkdraw.c | 178 | ||||
-rw-r--r-- | gdk/gdkdrawable.h | 56 | ||||
-rw-r--r-- | gdk/gdkoffscreenwindow.c | 52 | ||||
-rw-r--r-- | gdk/gdkpixmap.c | 48 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 52 | ||||
-rw-r--r-- | gdk/quartz/gdkdrawable-quartz.c | 26 | ||||
-rw-r--r-- | gdk/win32/gdkdrawable-win32.c | 139 | ||||
-rw-r--r-- | gdk/x11/gdkdrawable-x11.c | 113 |
11 files changed, 6 insertions, 707 deletions
diff --git a/gdk/directfb/gdkdnd-directfb.c b/gdk/directfb/gdkdnd-directfb.c index 527a817c0d..2c65aab8ee 100644 --- a/gdk/directfb/gdkdnd-directfb.c +++ b/gdk/directfb/gdkdnd-directfb.c @@ -338,7 +338,7 @@ gdk_drag_get_protocol_for_display(GdkDisplay *display, guint32 xid, window = gdk_window_lookup ((GdkNativeWindow) xid); if (window && - GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered"))) + g_object_get_data (G_OBJECT (window), "gdk-dnd-registered") != NULL) { *protocol = GDK_DRAG_PROTO_LOCAL; return xid; @@ -606,11 +606,13 @@ gdk_window_register_dnd (GdkWindow *window) { g_return_if_fail (window != NULL); - if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered"))) + if (g_object_get_data (G_OBJECT (window), "gdk-dnd-registered") != NULL) return; - gdk_drawable_set_data (window, "gdk-dnd-registered", - GINT_TO_POINTER (TRUE), NULL); + g_object_set_data (G_OBJECT (window), + "gdk-dnd-registered", + GINT_TO_POINTER (TRUE)); + } /************************************************************* diff --git a/gdk/directfb/gdkdrawable-directfb.c b/gdk/directfb/gdkdrawable-directfb.c index 3406f08ce1..c142ba596b 100644 --- a/gdk/directfb/gdkdrawable-directfb.c +++ b/gdk/directfb/gdkdrawable-directfb.c @@ -659,30 +659,6 @@ gdk_directfb_draw_polygon (GdkDrawable *drawable, } static void -gdk_directfb_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length) -{ - D_UNIMPLEMENTED(); -} - -static void -gdk_directfb_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length) -{ - D_UNIMPLEMENTED(); -} - -static void gdk_directfb_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, @@ -1522,16 +1498,10 @@ gdk_drawable_impl_directfb_class_init (GdkDrawableImplDirectFBClass *klass) drawable_class->draw_rectangle = gdk_directfb_draw_rectangle; drawable_class->draw_arc = gdk_directfb_draw_arc; drawable_class->draw_polygon = gdk_directfb_draw_polygon; - drawable_class->draw_text = gdk_directfb_draw_text; - drawable_class->draw_text_wc = gdk_directfb_draw_text_wc; drawable_class->draw_drawable = gdk_directfb_draw_drawable; drawable_class->draw_points = gdk_directfb_draw_points; drawable_class->draw_segments = gdk_directfb_draw_segments; drawable_class->draw_lines = gdk_directfb_draw_lines; -#if 0 - drawable_class->draw_glyphs = NULL; - drawable_class->draw_glyphs_transformed = NULL; -#endif drawable_class->draw_image = gdk_directfb_draw_image; drawable_class->ref_cairo_surface = gdk_directfb_ref_cairo_surface; diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index d0f8f72385..e205ab9063 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -601,15 +601,6 @@ gdk_drag_get_protocol gdk_drawable_copy_to_image gdk_drawable_get_clip_region gdk_drawable_get_colormap -#ifndef GDK_DISABLE_DEPRECATED -gdk_drawable_get_data -gdk_drawable_set_data -gdk_drawable_ref -gdk_drawable_unref -gdk_draw_string -gdk_draw_text -gdk_draw_text_wc -#endif gdk_drawable_get_depth gdk_drawable_get_display gdk_drawable_get_image diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index 0e6ccc573e..65412cc0f1 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -95,51 +95,6 @@ gdk_drawable_init (GdkDrawable *drawable) */ /** - * gdk_drawable_set_data: - * @drawable: a #GdkDrawable - * @key: name to store the data under - * @data: arbitrary data - * @destroy_func: (allow-none): function to free @data, or %NULL - * - * This function is equivalent to g_object_set_data(), - * the #GObject variant should be used instead. - * - **/ -void -gdk_drawable_set_data (GdkDrawable *drawable, - const gchar *key, - gpointer data, - GDestroyNotify destroy_func) -{ - g_return_if_fail (GDK_IS_DRAWABLE (drawable)); - - g_object_set_qdata_full (G_OBJECT (drawable), - g_quark_from_string (key), - data, - destroy_func); -} - -/** - * gdk_drawable_get_data: - * @drawable: a #GdkDrawable - * @key: name the data was stored under - * - * Equivalent to g_object_get_data(); the #GObject variant should be - * used instead. - * - * Return value: the data stored at @key - **/ -gpointer -gdk_drawable_get_data (GdkDrawable *drawable, - const gchar *key) -{ - g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL); - - return g_object_get_qdata (G_OBJECT (drawable), - g_quark_try_string (key)); -} - -/** * gdk_drawable_get_size: * @drawable: a #GdkDrawable * @width: (allow-none): (out): location to store drawable's width, or %NULL @@ -276,39 +231,6 @@ gdk_drawable_get_colormap (GdkDrawable *drawable) return GDK_DRAWABLE_GET_CLASS (drawable)->get_colormap (drawable); } -/** - * gdk_drawable_ref: - * @drawable: a #GdkDrawable - * - * Deprecated equivalent of calling g_object_ref() on @drawable. - * (Drawables were not objects in previous versions of GDK.) - * - * Return value: the same @drawable passed in - * - * Deprecated: 2.0: Use g_object_ref() instead. - **/ -GdkDrawable* -gdk_drawable_ref (GdkDrawable *drawable) -{ - return (GdkDrawable *) g_object_ref (drawable); -} - -/** - * gdk_drawable_unref: - * @drawable: a #GdkDrawable - * - * Deprecated equivalent of calling g_object_unref() on @drawable. - * - * Deprecated: 2.0: Use g_object_unref() instead. - **/ -void -gdk_drawable_unref (GdkDrawable *drawable) -{ - g_return_if_fail (GDK_IS_DRAWABLE (drawable)); - - g_object_unref (drawable); -} - /* Drawing */ @@ -498,106 +420,6 @@ gdk_draw_polygon (GdkDrawable *drawable, n_points); } -/* gdk_draw_string - * - * Modified by Li-Da Lho to draw 16 bits and Multibyte strings - * - * Interface changed: add "GdkFont *font" to specify font or fontset explicitely - */ -/** - * gdk_draw_string: - * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap). - * @font: a #GdkFont. - * @gc: a #GdkGC. - * @x: the x coordinate of the left edge of the text. - * @y: the y coordinate of the baseline of the text. - * @string: the string of characters to draw. - * - * Draws a string of characters in the given font or fontset. - * - * Deprecated: 2.4: Use gdk_draw_layout() instead. - **/ -void -gdk_draw_string (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *string) -{ - gdk_draw_text (drawable, font, gc, x, y, string, _gdk_font_strlen (font, string)); -} - -/* gdk_draw_text - * - * Modified by Li-Da Lho to draw 16 bits and Multibyte strings - * - * Interface changed: add "GdkFont *font" to specify font or fontset explicitely - */ -/** - * gdk_draw_text: - * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap). - * @font: a #GdkFont. - * @gc: a #GdkGC. - * @x: the x coordinate of the left edge of the text. - * @y: the y coordinate of the baseline of the text. - * @text: the characters to draw. - * @text_length: the number of characters of @text to draw. - * - * Draws a number of characters in the given font or fontset. - * - * Deprecated: 2.4: Use gdk_draw_layout() instead. - **/ -void -gdk_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length) -{ - g_return_if_fail (GDK_IS_DRAWABLE (drawable)); - g_return_if_fail (font != NULL); - g_return_if_fail (GDK_IS_GC (gc)); - g_return_if_fail (text != NULL); - - GDK_DRAWABLE_GET_CLASS (drawable)->draw_text (drawable, font, gc, x, y, text, text_length); -} - -/** - * gdk_draw_text_wc: - * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap). - * @font: a #GdkFont. - * @gc: a #GdkGC. - * @x: the x coordinate of the left edge of the text. - * @y: the y coordinate of the baseline of the text. - * @text: the wide characters to draw. - * @text_length: the number of characters to draw. - * - * Draws a number of wide characters using the given font of fontset. - * If the font is a 1-byte font, the string is converted into 1-byte - * characters (discarding the high bytes) before output. - * - * Deprecated: 2.4: Use gdk_draw_layout() instead. - **/ -void -gdk_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length) -{ - g_return_if_fail (GDK_IS_DRAWABLE (drawable)); - g_return_if_fail (font != NULL); - g_return_if_fail (GDK_IS_GC (gc)); - g_return_if_fail (text != NULL); - - GDK_DRAWABLE_GET_CLASS (drawable)->draw_text_wc (drawable, font, gc, x, y, text, text_length); -} - /** * gdk_draw_drawable: * @drawable: a #GdkDrawable diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h index b8dabb56f1..0cdad138da 100644 --- a/gdk/gdkdrawable.h +++ b/gdk/gdkdrawable.h @@ -83,20 +83,6 @@ struct _GdkDrawableClass gboolean filled, GdkPoint *points, gint npoints); - void (*draw_text) (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length); - void (*draw_text_wc) (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length); void (*draw_drawable) (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, @@ -240,16 +226,6 @@ GType gdk_drawable_get_type (void) G_GNUC_CONST; /* Manipulation of drawables */ - -#ifndef GDK_DISABLE_DEPRECATED -void gdk_drawable_set_data (GdkDrawable *drawable, - const gchar *key, - gpointer data, - GDestroyNotify destroy_func); -gpointer gdk_drawable_get_data (GdkDrawable *drawable, - const gchar *key); -#endif /* GDK_DISABLE_DEPRECATED */ - void gdk_drawable_get_size (GdkDrawable *drawable, gint *width, gint *height); @@ -261,11 +237,6 @@ gint gdk_drawable_get_depth (GdkDrawable *drawable); GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable); GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable); -#ifndef GDK_DISABLE_DEPRECATED -GdkDrawable* gdk_drawable_ref (GdkDrawable *drawable); -void gdk_drawable_unref (GdkDrawable *drawable); -#endif /* GDK_DISABLE_DEPRECATED */ - /* Drawing */ void gdk_draw_point (GdkDrawable *drawable, @@ -299,33 +270,6 @@ void gdk_draw_polygon (GdkDrawable *drawable, gboolean filled, const GdkPoint *points, gint n_points); -#if !defined (GDK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION) -/* Used by gtk_default_draw_string () */ -void gdk_draw_string (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *string); -#endif /* !GDK_DISABLE_DEPRECATED || GTK_COMPILATION */ -#if !defined (GDK_DISABLE_DEPRECATED) || defined (GDK_COMPILATION) -/* Used by gdk_pixmap_draw_text (), gdk_window_draw_text() */ -void gdk_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length); -/* Used by gdk_pixmap_draw_text_wc (), gdk_window_draw_text_wc () */ -void gdk_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length); -#endif /* !GDK_DISABLE_DEPRECATED || GDK_COMPILATION */ void gdk_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c index 2c4113b0fa..88b33fa59f 100644 --- a/gdk/gdkoffscreenwindow.c +++ b/gdk/gdkoffscreenwindow.c @@ -407,56 +407,6 @@ gdk_offscreen_window_draw_polygon (GdkDrawable *drawable, } static void -gdk_offscreen_window_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length) -{ - GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable); - GdkDrawable *real_drawable = get_real_drawable (offscreen); - GdkWindowObject *private = GDK_WINDOW_OBJECT (offscreen->wrapper); - - gdk_draw_text (real_drawable, - font, - gc, - x, - y, - text, - text_length); - - /* Hard to compute the minimal size, not that often used anyway. */ - add_damage (offscreen, 0, 0, private->width, private->height, FALSE); -} - -static void -gdk_offscreen_window_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length) -{ - GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable); - GdkDrawable *real_drawable = get_real_drawable (offscreen); - GdkWindowObject *private = GDK_WINDOW_OBJECT (offscreen->wrapper); - - gdk_draw_text_wc (real_drawable, - font, - gc, - x, - y, - text, - text_length); - - /* Hard to compute the minimal size, not that often used anyway. */ - add_damage (offscreen, 0, 0, private->width, private->height, FALSE); -} - -static void gdk_offscreen_window_draw_points (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, @@ -1245,8 +1195,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass) drawable_class->draw_rectangle = gdk_offscreen_window_draw_rectangle; drawable_class->draw_arc = gdk_offscreen_window_draw_arc; drawable_class->draw_polygon = gdk_offscreen_window_draw_polygon; - drawable_class->draw_text = gdk_offscreen_window_draw_text; - drawable_class->draw_text_wc = gdk_offscreen_window_draw_text_wc; drawable_class->draw_drawable_with_src = gdk_offscreen_window_draw_drawable; drawable_class->draw_points = gdk_offscreen_window_draw_points; drawable_class->draw_segments = gdk_offscreen_window_draw_segments; diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index 79ebd5c1fa..2adb33f03b 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -55,20 +55,6 @@ static void gdk_pixmap_draw_polygon (GdkDrawable *drawable, gboolean filled, GdkPoint *points, gint npoints); -static void gdk_pixmap_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length); -static void gdk_pixmap_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length); static void gdk_pixmap_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -201,8 +187,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass) drawable_class->draw_rectangle = gdk_pixmap_draw_rectangle; drawable_class->draw_arc = gdk_pixmap_draw_arc; drawable_class->draw_polygon = gdk_pixmap_draw_polygon; - drawable_class->draw_text = gdk_pixmap_draw_text; - drawable_class->draw_text_wc = gdk_pixmap_draw_text_wc; drawable_class->draw_drawable_with_src = gdk_pixmap_draw_drawable; drawable_class->draw_points = gdk_pixmap_draw_points; drawable_class->draw_segments = gdk_pixmap_draw_segments; @@ -340,38 +324,6 @@ gdk_pixmap_draw_polygon (GdkDrawable *drawable, } static void -gdk_pixmap_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length) -{ - GdkPixmapObject *private = (GdkPixmapObject *)drawable; - - _gdk_gc_remove_drawable_clip (gc); - gdk_draw_text (private->impl, font, gc, - x, y, text, text_length); -} - -static void -gdk_pixmap_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length) -{ - GdkPixmapObject *private = (GdkPixmapObject *)drawable; - - _gdk_gc_remove_drawable_clip (gc); - gdk_draw_text_wc (private->impl, font, gc, - x, y, text, text_length); -} - -static void gdk_pixmap_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index a985ef3f2b..9876575bee 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -252,20 +252,6 @@ static void gdk_window_draw_polygon (GdkDrawable *drawable, gboolean filled, GdkPoint *points, gint npoints); -static void gdk_window_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length); -static void gdk_window_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length); static void gdk_window_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -520,8 +506,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass) drawable_class->draw_rectangle = gdk_window_draw_rectangle; drawable_class->draw_arc = gdk_window_draw_arc; drawable_class->draw_polygon = gdk_window_draw_polygon; - drawable_class->draw_text = gdk_window_draw_text; - drawable_class->draw_text_wc = gdk_window_draw_text_wc; drawable_class->draw_drawable_with_src = gdk_window_draw_drawable; drawable_class->draw_points = gdk_window_draw_points; drawable_class->draw_segments = gdk_window_draw_segments; @@ -4038,42 +4022,6 @@ gdk_window_draw_polygon (GdkDrawable *drawable, END_DRAW; } -static void -gdk_window_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length) -{ - if (GDK_WINDOW_DESTROYED (drawable)) - return; - - BEGIN_DRAW; - gdk_draw_text (impl, font, gc, - x - x_offset, y - y_offset, text, text_length); - END_DRAW; -} - -static void -gdk_window_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length) -{ - if (GDK_WINDOW_DESTROYED (drawable)) - return; - - BEGIN_DRAW; - gdk_draw_text_wc (impl, font, gc, - x - x_offset, y - y_offset, text, text_length); - END_DRAW; -} - static GdkDrawable * gdk_window_get_source_drawable (GdkDrawable *drawable) { diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c index 2f03f2eecd..918e4bc50f 100644 --- a/gdk/quartz/gdkdrawable-quartz.c +++ b/gdk/quartz/gdkdrawable-quartz.c @@ -299,30 +299,6 @@ gdk_quartz_draw_polygon (GdkDrawable *drawable, } static void -gdk_quartz_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length) -{ - /* FIXME: Implement */ -} - -static void -gdk_quartz_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length) -{ - /* FIXME: Implement */ -} - -static void gdk_quartz_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -659,8 +635,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass) drawable_class->draw_rectangle = gdk_quartz_draw_rectangle; drawable_class->draw_arc = gdk_quartz_draw_arc; drawable_class->draw_polygon = gdk_quartz_draw_polygon; - drawable_class->draw_text = gdk_quartz_draw_text; - drawable_class->draw_text_wc = gdk_quartz_draw_text_wc; drawable_class->draw_drawable_with_src = gdk_quartz_draw_drawable; drawable_class->draw_points = gdk_quartz_draw_points; drawable_class->draw_segments = gdk_quartz_draw_segments; diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 52ab3fbb81..36bd84a34a 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -70,20 +70,6 @@ static void gdk_win32_draw_polygon (GdkDrawable *drawable, gboolean filled, GdkPoint *points, gint npoints); -static void gdk_win32_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length); -static void gdk_win32_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length); static void gdk_win32_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -160,8 +146,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass) drawable_class->draw_rectangle = gdk_win32_draw_rectangle; drawable_class->draw_arc = gdk_win32_draw_arc; drawable_class->draw_polygon = gdk_win32_draw_polygon; - drawable_class->draw_text = gdk_win32_draw_text; - drawable_class->draw_text_wc = gdk_win32_draw_text_wc; drawable_class->draw_drawable_with_src = gdk_win32_draw_drawable; drawable_class->draw_points = gdk_win32_draw_points; drawable_class->draw_segments = gdk_win32_draw_segments; @@ -1005,129 +989,6 @@ gdk_win32_draw_polygon (GdkDrawable *drawable, g_free (pts); } -typedef struct -{ - gint x, y; - HDC hdc; -} gdk_draw_text_arg; - -static void -gdk_draw_text_handler (GdkWin32SingleFont *singlefont, - const wchar_t *wcstr, - int wclen, - void *arg) -{ - HGDIOBJ oldfont; - SIZE size; - gdk_draw_text_arg *argp = (gdk_draw_text_arg *) arg; - - if (!singlefont) - return; - - if ((oldfont = SelectObject (argp->hdc, singlefont->hfont)) == NULL) - { - WIN32_GDI_FAILED ("SelectObject"); - return; - } - - if (!TextOutW (argp->hdc, argp->x, argp->y, wcstr, wclen)) - WIN32_GDI_FAILED ("TextOutW"); - GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size); - argp->x += size.cx; - - SelectObject (argp->hdc, oldfont); -} - -static void -gdk_win32_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length) -{ - const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_FONT; - wchar_t *wcstr, wc; - glong wlen; - gdk_draw_text_arg arg; - - if (text_length == 0) - return; - - g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET); - - arg.x = x; - arg.y = y; - arg.hdc = gdk_win32_hdc_get (drawable, gc, mask); - - GDK_NOTE (DRAW, g_print ("gdk_win32_draw_text: %s (%d,%d) \"%.*s\" (len %d)\n", - _gdk_win32_drawable_description (drawable), - x, y, - (text_length > 10 ? 10 : text_length), - text, text_length)); - - if (text_length == 1) - { - /* For single characters, don't try to interpret as UTF-8. */ - wc = (guchar) text[0]; - _gdk_wchar_text_handle (font, &wc, 1, gdk_draw_text_handler, &arg); - } - else - { - wcstr = g_utf8_to_utf16 (text, text_length, NULL, &wlen, NULL); - _gdk_wchar_text_handle (font, wcstr, wlen, gdk_draw_text_handler, &arg); - g_free (wcstr); - } - - gdk_win32_hdc_release (drawable, gc, mask); -} - -static void -gdk_win32_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length) -{ - const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_FONT; - gint i; - wchar_t *wcstr; - gdk_draw_text_arg arg; - - if (text_length == 0) - return; - - g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET); - - arg.x = x; - arg.y = y; - arg.hdc = gdk_win32_hdc_get (drawable, gc, mask); - - GDK_NOTE (DRAW, g_print ("gdk_win32_draw_text_wc: %s (%d,%d) len: %d\n", - _gdk_win32_drawable_description (drawable), - x, y, text_length)); - - if (sizeof (wchar_t) != sizeof (GdkWChar)) - { - wcstr = g_new (wchar_t, text_length); - for (i = 0; i < text_length; i++) - wcstr[i] = text[i]; - } - else - wcstr = (wchar_t *) text; - - _gdk_wchar_text_handle (font, wcstr, text_length, - gdk_draw_text_handler, &arg); - - if (sizeof (wchar_t) != sizeof (GdkWChar)) - g_free (wcstr); - - gdk_win32_hdc_release (drawable, gc, mask); -} - static void gdk_win32_draw_drawable (GdkDrawable *drawable, GdkGC *gc, diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c index ab98b7fcd2..42073d38ed 100644 --- a/gdk/x11/gdkdrawable-x11.c +++ b/gdk/x11/gdkdrawable-x11.c @@ -71,20 +71,6 @@ static void gdk_x11_draw_polygon (GdkDrawable *drawable, gboolean filled, GdkPoint *points, gint npoints); -static void gdk_x11_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length); -static void gdk_x11_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length); static void gdk_x11_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -158,8 +144,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass) drawable_class->draw_rectangle = gdk_x11_draw_rectangle; drawable_class->draw_arc = gdk_x11_draw_arc; drawable_class->draw_polygon = gdk_x11_draw_polygon; - drawable_class->draw_text = gdk_x11_draw_text; - drawable_class->draw_text_wc = gdk_x11_draw_text_wc; drawable_class->draw_drawable_with_src = gdk_x11_draw_drawable; drawable_class->draw_points = gdk_x11_draw_points; drawable_class->draw_segments = gdk_x11_draw_segments; @@ -531,103 +515,6 @@ gdk_x11_draw_polygon (GdkDrawable *drawable, g_free (tmp_points); } -/* gdk_x11_draw_text - * - * Modified by Li-Da Lho to draw 16 bits and Multibyte strings - * - * Interface changed: add "GdkFont *font" to specify font or fontset explicitely - */ -static void -gdk_x11_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length) -{ - GdkDrawableImplX11 *impl; - Display *xdisplay; - - impl = GDK_DRAWABLE_IMPL_X11 (drawable); - xdisplay = GDK_SCREEN_XDISPLAY (impl->screen); - - if (font->type == GDK_FONT_FONT) - { - XFontStruct *xfont = (XFontStruct *) GDK_FONT_XFONT (font); - XSetFont(xdisplay, GDK_GC_GET_XGC (gc), xfont->fid); - if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0)) - { - XDrawString (xdisplay, impl->xid, - GDK_GC_GET_XGC (gc), x, y, text, text_length); - } - else - { - XDrawString16 (xdisplay, impl->xid, - GDK_GC_GET_XGC (gc), x, y, (XChar2b *) text, text_length / 2); - } - } - else if (font->type == GDK_FONT_FONTSET) - { - XFontSet fontset = (XFontSet) GDK_FONT_XFONT (font); - XmbDrawString (xdisplay, impl->xid, - fontset, GDK_GC_GET_XGC (gc), x, y, text, text_length); - } - else - g_error("undefined font type\n"); -} - -static void -gdk_x11_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length) -{ - GdkDrawableImplX11 *impl; - Display *xdisplay; - - impl = GDK_DRAWABLE_IMPL_X11 (drawable); - xdisplay = GDK_SCREEN_XDISPLAY (impl->screen); - - if (font->type == GDK_FONT_FONT) - { - XFontStruct *xfont = (XFontStruct *) GDK_FONT_XFONT (font); - gchar *text_8bit; - gint i; - XSetFont(xdisplay, GDK_GC_GET_XGC (gc), xfont->fid); - text_8bit = g_new (gchar, text_length); - for (i=0; i<text_length; i++) text_8bit[i] = text[i]; - XDrawString (xdisplay, impl->xid, - GDK_GC_GET_XGC (gc), x, y, text_8bit, text_length); - g_free (text_8bit); - } - else if (font->type == GDK_FONT_FONTSET) - { - if (sizeof(GdkWChar) == sizeof(wchar_t)) - { - XwcDrawString (xdisplay, impl->xid, - (XFontSet) GDK_FONT_XFONT (font), - GDK_GC_GET_XGC (gc), x, y, (wchar_t *)text, text_length); - } - else - { - wchar_t *text_wchar; - gint i; - text_wchar = g_new (wchar_t, text_length); - for (i=0; i<text_length; i++) text_wchar[i] = text[i]; - XwcDrawString (xdisplay, impl->xid, - (XFontSet) GDK_FONT_XFONT (font), - GDK_GC_GET_XGC (gc), x, y, text_wchar, text_length); - g_free (text_wchar); - } - } - else - g_error("undefined font type\n"); -} - static void gdk_x11_draw_drawable (GdkDrawable *drawable, GdkGC *gc, |