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()
This commit is contained in:
Javier Jardón 2010-06-19 21:26:47 +02:00
parent 2a2843c041
commit 4cf4470fcd
13 changed files with 6 additions and 791 deletions

View File

@ -444,10 +444,6 @@ gdk_font_get_type
<TITLE>Drawing Primitives</TITLE> <TITLE>Drawing Primitives</TITLE>
<FILE>drawing</FILE> <FILE>drawing</FILE>
GdkDrawable GdkDrawable
gdk_drawable_ref
gdk_drawable_unref
gdk_drawable_set_data
gdk_drawable_get_data
gdk_drawable_get_display gdk_drawable_get_display
gdk_drawable_get_screen gdk_drawable_get_screen
gdk_drawable_get_visual gdk_drawable_get_visual
@ -477,10 +473,6 @@ gdk_draw_layout_line
gdk_draw_layout_line_with_colors gdk_draw_layout_line_with_colors
gdk_draw_layout gdk_draw_layout
gdk_draw_layout_with_colors gdk_draw_layout_with_colors
<SUBSECTION>
gdk_draw_string
gdk_draw_text
gdk_draw_text_wc
<SUBSECTION> <SUBSECTION>
gdk_draw_pixmap gdk_draw_pixmap

View File

@ -45,44 +45,6 @@ or a #GdkWindow.
</para> </para>
<!-- ##### FUNCTION gdk_drawable_ref ##### -->
<para>
</para>
@drawable:
@Returns:
<!-- ##### FUNCTION gdk_drawable_unref ##### -->
<para>
</para>
@drawable:
<!-- ##### FUNCTION gdk_drawable_set_data ##### -->
<para>
</para>
@drawable:
@key:
@data:
@destroy_func:
<!-- ##### FUNCTION gdk_drawable_get_data ##### -->
<para>
</para>
@drawable:
@key:
@Returns:
<!-- ##### FUNCTION gdk_drawable_get_display ##### --> <!-- ##### FUNCTION gdk_drawable_get_display ##### -->
<para> <para>
@ -395,44 +357,6 @@ bottom edges.
@background: @background:
<!-- ##### FUNCTION gdk_draw_string ##### -->
<para>
</para>
@drawable:
@font:
@gc:
@x:
@y:
@string:
<!-- ##### FUNCTION gdk_draw_text ##### -->
<para>
</para>
@drawable:
@font:
@gc:
@x:
@y:
@text:
@text_length:
<!-- ##### FUNCTION gdk_draw_text_wc ##### -->
<para>
</para>
@drawable:
@font:
@gc:
@x:
@y:
@text:
@text_length:
<!-- ##### MACRO gdk_draw_pixmap ##### --> <!-- ##### MACRO gdk_draw_pixmap ##### -->
<para> <para>
Draws a pixmap, or a part of a pixmap, onto another drawable. Draws a pixmap, or a part of a pixmap, onto another drawable.

View File

@ -338,7 +338,7 @@ gdk_drag_get_protocol_for_display(GdkDisplay *display, guint32 xid,
window = gdk_window_lookup ((GdkNativeWindow) xid); window = gdk_window_lookup ((GdkNativeWindow) xid);
if (window && 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; *protocol = GDK_DRAG_PROTO_LOCAL;
return xid; return xid;
@ -606,11 +606,13 @@ gdk_window_register_dnd (GdkWindow *window)
{ {
g_return_if_fail (window != NULL); 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; return;
gdk_drawable_set_data (window, "gdk-dnd-registered", g_object_set_data (G_OBJECT (window),
GINT_TO_POINTER (TRUE), NULL); "gdk-dnd-registered",
GINT_TO_POINTER (TRUE));
} }
/************************************************************* /*************************************************************

View File

@ -658,30 +658,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 static void
gdk_directfb_draw_drawable (GdkDrawable *drawable, gdk_directfb_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
@ -1522,16 +1498,10 @@ gdk_drawable_impl_directfb_class_init (GdkDrawableImplDirectFBClass *klass)
drawable_class->draw_rectangle = gdk_directfb_draw_rectangle; drawable_class->draw_rectangle = gdk_directfb_draw_rectangle;
drawable_class->draw_arc = gdk_directfb_draw_arc; drawable_class->draw_arc = gdk_directfb_draw_arc;
drawable_class->draw_polygon = gdk_directfb_draw_polygon; 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_drawable = gdk_directfb_draw_drawable;
drawable_class->draw_points = gdk_directfb_draw_points; drawable_class->draw_points = gdk_directfb_draw_points;
drawable_class->draw_segments = gdk_directfb_draw_segments; drawable_class->draw_segments = gdk_directfb_draw_segments;
drawable_class->draw_lines = gdk_directfb_draw_lines; 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->draw_image = gdk_directfb_draw_image;
drawable_class->ref_cairo_surface = gdk_directfb_ref_cairo_surface; drawable_class->ref_cairo_surface = gdk_directfb_ref_cairo_surface;

View File

@ -601,15 +601,6 @@ gdk_drag_get_protocol
gdk_drawable_copy_to_image gdk_drawable_copy_to_image
gdk_drawable_get_clip_region gdk_drawable_get_clip_region
gdk_drawable_get_colormap 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_depth
gdk_drawable_get_display gdk_drawable_get_display
gdk_drawable_get_image gdk_drawable_get_image

View File

@ -94,51 +94,6 @@ gdk_drawable_init (GdkDrawable *drawable)
/* Manipulation of drawables /* Manipulation of drawables
*/ */
/**
* 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: * gdk_drawable_get_size:
* @drawable: a #GdkDrawable * @drawable: a #GdkDrawable
@ -276,39 +231,6 @@ gdk_drawable_get_colormap (GdkDrawable *drawable)
return GDK_DRAWABLE_GET_CLASS (drawable)->get_colormap (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 /* Drawing
*/ */
@ -498,106 +420,6 @@ gdk_draw_polygon (GdkDrawable *drawable,
n_points); 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: * gdk_draw_drawable:
* @drawable: a #GdkDrawable * @drawable: a #GdkDrawable

View File

@ -83,20 +83,6 @@ struct _GdkDrawableClass
gboolean filled, gboolean filled,
GdkPoint *points, GdkPoint *points,
gint npoints); 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, void (*draw_drawable) (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkDrawable *src, GdkDrawable *src,
@ -240,16 +226,6 @@ GType gdk_drawable_get_type (void) G_GNUC_CONST;
/* Manipulation of drawables /* 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, void gdk_drawable_get_size (GdkDrawable *drawable,
gint *width, gint *width,
gint *height); gint *height);
@ -261,11 +237,6 @@ gint gdk_drawable_get_depth (GdkDrawable *drawable);
GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable); GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable);
GdkDisplay* gdk_drawable_get_display (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 /* Drawing
*/ */
void gdk_draw_point (GdkDrawable *drawable, void gdk_draw_point (GdkDrawable *drawable,
@ -299,33 +270,6 @@ void gdk_draw_polygon (GdkDrawable *drawable,
gboolean filled, gboolean filled,
const GdkPoint *points, const GdkPoint *points,
gint n_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, void gdk_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkDrawable *src, GdkDrawable *src,

View File

@ -406,56 +406,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 static void
gdk_offscreen_window_draw_points (GdkDrawable *drawable, gdk_offscreen_window_draw_points (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
@ -1245,8 +1195,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
drawable_class->draw_rectangle = gdk_offscreen_window_draw_rectangle; drawable_class->draw_rectangle = gdk_offscreen_window_draw_rectangle;
drawable_class->draw_arc = gdk_offscreen_window_draw_arc; drawable_class->draw_arc = gdk_offscreen_window_draw_arc;
drawable_class->draw_polygon = gdk_offscreen_window_draw_polygon; 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_drawable_with_src = gdk_offscreen_window_draw_drawable;
drawable_class->draw_points = gdk_offscreen_window_draw_points; drawable_class->draw_points = gdk_offscreen_window_draw_points;
drawable_class->draw_segments = gdk_offscreen_window_draw_segments; drawable_class->draw_segments = gdk_offscreen_window_draw_segments;

View File

@ -55,20 +55,6 @@ static void gdk_pixmap_draw_polygon (GdkDrawable *drawable,
gboolean filled, gboolean filled,
GdkPoint *points, GdkPoint *points,
gint npoints); 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, static void gdk_pixmap_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkPixmap *src, GdkPixmap *src,
@ -201,8 +187,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
drawable_class->draw_rectangle = gdk_pixmap_draw_rectangle; drawable_class->draw_rectangle = gdk_pixmap_draw_rectangle;
drawable_class->draw_arc = gdk_pixmap_draw_arc; drawable_class->draw_arc = gdk_pixmap_draw_arc;
drawable_class->draw_polygon = gdk_pixmap_draw_polygon; 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_drawable_with_src = gdk_pixmap_draw_drawable;
drawable_class->draw_points = gdk_pixmap_draw_points; drawable_class->draw_points = gdk_pixmap_draw_points;
drawable_class->draw_segments = gdk_pixmap_draw_segments; drawable_class->draw_segments = gdk_pixmap_draw_segments;
@ -339,38 +323,6 @@ gdk_pixmap_draw_polygon (GdkDrawable *drawable,
gdk_draw_polygon (private->impl, gc, filled, points, npoints); gdk_draw_polygon (private->impl, gc, filled, points, npoints);
} }
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 static void
gdk_pixmap_draw_drawable (GdkDrawable *drawable, gdk_pixmap_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,

View File

@ -252,20 +252,6 @@ static void gdk_window_draw_polygon (GdkDrawable *drawable,
gboolean filled, gboolean filled,
GdkPoint *points, GdkPoint *points,
gint npoints); 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, static void gdk_window_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkPixmap *src, GdkPixmap *src,
@ -520,8 +506,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
drawable_class->draw_rectangle = gdk_window_draw_rectangle; drawable_class->draw_rectangle = gdk_window_draw_rectangle;
drawable_class->draw_arc = gdk_window_draw_arc; drawable_class->draw_arc = gdk_window_draw_arc;
drawable_class->draw_polygon = gdk_window_draw_polygon; 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_drawable_with_src = gdk_window_draw_drawable;
drawable_class->draw_points = gdk_window_draw_points; drawable_class->draw_points = gdk_window_draw_points;
drawable_class->draw_segments = gdk_window_draw_segments; drawable_class->draw_segments = gdk_window_draw_segments;
@ -4038,42 +4022,6 @@ gdk_window_draw_polygon (GdkDrawable *drawable,
END_DRAW; 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 * static GdkDrawable *
gdk_window_get_source_drawable (GdkDrawable *drawable) gdk_window_get_source_drawable (GdkDrawable *drawable)
{ {

View File

@ -298,30 +298,6 @@ gdk_quartz_draw_polygon (GdkDrawable *drawable,
gdk_quartz_drawable_release_context (drawable, context); gdk_quartz_drawable_release_context (drawable, context);
} }
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 static void
gdk_quartz_draw_drawable (GdkDrawable *drawable, gdk_quartz_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
@ -659,8 +635,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
drawable_class->draw_rectangle = gdk_quartz_draw_rectangle; drawable_class->draw_rectangle = gdk_quartz_draw_rectangle;
drawable_class->draw_arc = gdk_quartz_draw_arc; drawable_class->draw_arc = gdk_quartz_draw_arc;
drawable_class->draw_polygon = gdk_quartz_draw_polygon; 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_drawable_with_src = gdk_quartz_draw_drawable;
drawable_class->draw_points = gdk_quartz_draw_points; drawable_class->draw_points = gdk_quartz_draw_points;
drawable_class->draw_segments = gdk_quartz_draw_segments; drawable_class->draw_segments = gdk_quartz_draw_segments;

View File

@ -70,20 +70,6 @@ static void gdk_win32_draw_polygon (GdkDrawable *drawable,
gboolean filled, gboolean filled,
GdkPoint *points, GdkPoint *points,
gint npoints); 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, static void gdk_win32_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkPixmap *src, 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_rectangle = gdk_win32_draw_rectangle;
drawable_class->draw_arc = gdk_win32_draw_arc; drawable_class->draw_arc = gdk_win32_draw_arc;
drawable_class->draw_polygon = gdk_win32_draw_polygon; 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_drawable_with_src = gdk_win32_draw_drawable;
drawable_class->draw_points = gdk_win32_draw_points; drawable_class->draw_points = gdk_win32_draw_points;
drawable_class->draw_segments = gdk_win32_draw_segments; drawable_class->draw_segments = gdk_win32_draw_segments;
@ -1005,129 +989,6 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
g_free (pts); 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 static void
gdk_win32_draw_drawable (GdkDrawable *drawable, gdk_win32_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,

View File

@ -71,20 +71,6 @@ static void gdk_x11_draw_polygon (GdkDrawable *drawable,
gboolean filled, gboolean filled,
GdkPoint *points, GdkPoint *points,
gint npoints); 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, static void gdk_x11_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkPixmap *src, 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_rectangle = gdk_x11_draw_rectangle;
drawable_class->draw_arc = gdk_x11_draw_arc; drawable_class->draw_arc = gdk_x11_draw_arc;
drawable_class->draw_polygon = gdk_x11_draw_polygon; 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_drawable_with_src = gdk_x11_draw_drawable;
drawable_class->draw_points = gdk_x11_draw_points; drawable_class->draw_points = gdk_x11_draw_points;
drawable_class->draw_segments = gdk_x11_draw_segments; drawable_class->draw_segments = gdk_x11_draw_segments;
@ -531,103 +515,6 @@ gdk_x11_draw_polygon (GdkDrawable *drawable,
g_free (tmp_points); 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 static void
gdk_x11_draw_drawable (GdkDrawable *drawable, gdk_x11_draw_drawable (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,