Deprecate gdk_set/get_use_xshm, make gdk_set_use_xshm a noop. Remove

Fri Sep  7 18:17:47 2001  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdk.h gdk/x11/gdkmain-x11.c: Deprecate gdk_set/get_use_xshm,
	make gdk_set_use_xshm a noop. Remove --no-xshm command line
	option. If we aren't autodetecting properly, we need
	to fix the problem, or at least make it an environment
	variable setting, to avoid problems with propagating
	to embedded children, plugins, etc.

	* gdk/gdkcolor.h: Deprecate gdk_colormap_get_system_size().

	* gdk/gdkpixbuf-render.c gdk/gdkpixbuf.h
	(gdk_pixbuf_render_pixmap_and_mask_for_colormap):
	New function to render a pixmap and mask for a particular colormap.

	* gtk/gtkwindow.c (get_pixmap_and_mask): Change to use
	gdk_pixbuf_render_pixmap_and_mask_for_colormap () instead
	of internal implementation of the same.
This commit is contained in:
Owen Taylor 2001-09-07 22:33:09 +00:00 committed by Owen Taylor
parent e8648181ed
commit a3914aaf10
13 changed files with 206 additions and 62 deletions

View File

@ -1,3 +1,22 @@
Fri Sep 7 18:17:47 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/x11/gdkmain-x11.c: Deprecate gdk_set/get_use_xshm,
make gdk_set_use_xshm a noop. Remove --no-xshm command line
option. If we aren't autodetecting properly, we need
to fix the problem, or at least make it an environment
variable setting, to avoid problems with propagating
to embedded children, plugins, etc.
* gdk/gdkcolor.h: Deprecate gdk_colormap_get_system_size().
* gdk/gdkpixbuf-render.c gdk/gdkpixbuf.h
(gdk_pixbuf_render_pixmap_and_mask_for_colormap):
New function to render a pixmap and mask for a particular colormap.
* gtk/gtkwindow.c (get_pixmap_and_mask): Change to use
gdk_pixbuf_render_pixmap_and_mask_for_colormap () instead
of internal implementation of the same.
2001-09-07 Havoc Pennington <hp@redhat.com> 2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some * gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some

View File

@ -1,3 +1,22 @@
Fri Sep 7 18:17:47 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/x11/gdkmain-x11.c: Deprecate gdk_set/get_use_xshm,
make gdk_set_use_xshm a noop. Remove --no-xshm command line
option. If we aren't autodetecting properly, we need
to fix the problem, or at least make it an environment
variable setting, to avoid problems with propagating
to embedded children, plugins, etc.
* gdk/gdkcolor.h: Deprecate gdk_colormap_get_system_size().
* gdk/gdkpixbuf-render.c gdk/gdkpixbuf.h
(gdk_pixbuf_render_pixmap_and_mask_for_colormap):
New function to render a pixmap and mask for a particular colormap.
* gtk/gtkwindow.c (get_pixmap_and_mask): Change to use
gdk_pixbuf_render_pixmap_and_mask_for_colormap () instead
of internal implementation of the same.
2001-09-07 Havoc Pennington <hp@redhat.com> 2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some * gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some

View File

@ -1,3 +1,22 @@
Fri Sep 7 18:17:47 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/x11/gdkmain-x11.c: Deprecate gdk_set/get_use_xshm,
make gdk_set_use_xshm a noop. Remove --no-xshm command line
option. If we aren't autodetecting properly, we need
to fix the problem, or at least make it an environment
variable setting, to avoid problems with propagating
to embedded children, plugins, etc.
* gdk/gdkcolor.h: Deprecate gdk_colormap_get_system_size().
* gdk/gdkpixbuf-render.c gdk/gdkpixbuf.h
(gdk_pixbuf_render_pixmap_and_mask_for_colormap):
New function to render a pixmap and mask for a particular colormap.
* gtk/gtkwindow.c (get_pixmap_and_mask): Change to use
gdk_pixbuf_render_pixmap_and_mask_for_colormap () instead
of internal implementation of the same.
2001-09-07 Havoc Pennington <hp@redhat.com> 2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some * gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some

View File

@ -1,3 +1,22 @@
Fri Sep 7 18:17:47 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/x11/gdkmain-x11.c: Deprecate gdk_set/get_use_xshm,
make gdk_set_use_xshm a noop. Remove --no-xshm command line
option. If we aren't autodetecting properly, we need
to fix the problem, or at least make it an environment
variable setting, to avoid problems with propagating
to embedded children, plugins, etc.
* gdk/gdkcolor.h: Deprecate gdk_colormap_get_system_size().
* gdk/gdkpixbuf-render.c gdk/gdkpixbuf.h
(gdk_pixbuf_render_pixmap_and_mask_for_colormap):
New function to render a pixmap and mask for a particular colormap.
* gtk/gtkwindow.c (get_pixmap_and_mask): Change to use
gdk_pixbuf_render_pixmap_and_mask_for_colormap () instead
of internal implementation of the same.
2001-09-07 Havoc Pennington <hp@redhat.com> 2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some * gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some

View File

@ -1,3 +1,22 @@
Fri Sep 7 18:17:47 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/x11/gdkmain-x11.c: Deprecate gdk_set/get_use_xshm,
make gdk_set_use_xshm a noop. Remove --no-xshm command line
option. If we aren't autodetecting properly, we need
to fix the problem, or at least make it an environment
variable setting, to avoid problems with propagating
to embedded children, plugins, etc.
* gdk/gdkcolor.h: Deprecate gdk_colormap_get_system_size().
* gdk/gdkpixbuf-render.c gdk/gdkpixbuf.h
(gdk_pixbuf_render_pixmap_and_mask_for_colormap):
New function to render a pixmap and mask for a particular colormap.
* gtk/gtkwindow.c (get_pixmap_and_mask): Change to use
gdk_pixbuf_render_pixmap_and_mask_for_colormap () instead
of internal implementation of the same.
2001-09-07 Havoc Pennington <hp@redhat.com> 2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some * gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some

View File

@ -1,3 +1,22 @@
Fri Sep 7 18:17:47 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/x11/gdkmain-x11.c: Deprecate gdk_set/get_use_xshm,
make gdk_set_use_xshm a noop. Remove --no-xshm command line
option. If we aren't autodetecting properly, we need
to fix the problem, or at least make it an environment
variable setting, to avoid problems with propagating
to embedded children, plugins, etc.
* gdk/gdkcolor.h: Deprecate gdk_colormap_get_system_size().
* gdk/gdkpixbuf-render.c gdk/gdkpixbuf.h
(gdk_pixbuf_render_pixmap_and_mask_for_colormap):
New function to render a pixmap and mask for a particular colormap.
* gtk/gtkwindow.c (get_pixmap_and_mask): Change to use
gdk_pixbuf_render_pixmap_and_mask_for_colormap () instead
of internal implementation of the same.
2001-09-07 Havoc Pennington <hp@redhat.com> 2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some * gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some

View File

@ -1,3 +1,22 @@
Fri Sep 7 18:17:47 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/x11/gdkmain-x11.c: Deprecate gdk_set/get_use_xshm,
make gdk_set_use_xshm a noop. Remove --no-xshm command line
option. If we aren't autodetecting properly, we need
to fix the problem, or at least make it an environment
variable setting, to avoid problems with propagating
to embedded children, plugins, etc.
* gdk/gdkcolor.h: Deprecate gdk_colormap_get_system_size().
* gdk/gdkpixbuf-render.c gdk/gdkpixbuf.h
(gdk_pixbuf_render_pixmap_and_mask_for_colormap):
New function to render a pixmap and mask for a particular colormap.
* gtk/gtkwindow.c (get_pixmap_and_mask): Change to use
gdk_pixbuf_render_pixmap_and_mask_for_colormap () instead
of internal implementation of the same.
2001-09-07 Havoc Pennington <hp@redhat.com> 2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some * gtk/gtktextlayout.c (gtk_text_layout_get_lines): remove some

View File

@ -75,10 +75,11 @@ void gdk_set_program_class (const char *program_class);
void gdk_error_trap_push (void); void gdk_error_trap_push (void);
gint gdk_error_trap_pop (void); gint gdk_error_trap_pop (void);
#ifndef GDK_DISABLE_DEPRECATED
void gdk_set_use_xshm (gboolean use_xshm); void gdk_set_use_xshm (gboolean use_xshm);
gboolean gdk_get_use_xshm (void); gboolean gdk_get_use_xshm (void);
#endif /* GDK_DISABLE_DEPRECATED */
gchar* gdk_get_display (void); gchar* gdk_get_display (void);
#ifndef GDK_DISABLE_DEPRECATED #ifndef GDK_DISABLE_DEPRECATED

View File

@ -64,7 +64,9 @@ GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
void gdk_colormap_unref (GdkColormap *cmap); void gdk_colormap_unref (GdkColormap *cmap);
GdkColormap* gdk_colormap_get_system (void); GdkColormap* gdk_colormap_get_system (void);
#ifndef GDK_DISABLE_DEPRECATED
gint gdk_colormap_get_system_size (void); gint gdk_colormap_get_system_size (void);
#endif
void gdk_colormap_change (GdkColormap *colormap, void gdk_colormap_change (GdkColormap *colormap,
gint ncolors); gint ncolors);

View File

@ -427,11 +427,16 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
* *
* Creates a pixmap and a mask bitmap which are returned in the @pixmap_return * Creates a pixmap and a mask bitmap which are returned in the @pixmap_return
* and @mask_return arguments, respectively, and renders a pixbuf and its * and @mask_return arguments, respectively, and renders a pixbuf and its
* corresponding tresholded alpha mask to them. This is merely a convenience * corresponding thresholded alpha mask to them. This is merely a convenience
* function; applications that need to render pixbufs with dither offsets or to * function; applications that need to render pixbufs with dither offsets or to
* given drawables should use gdk_pixbuf_render_to_drawable_alpha() or * given drawables should use gdk_pixbuf_render_to_drawable_alpha() or
* gdk_pixbuf_render_to_drawable(), and gdk_pixbuf_render_threshold_alpha(). * gdk_pixbuf_render_to_drawable(), and gdk_pixbuf_render_threshold_alpha().
* *
* The pixmap that is created is created for the colormap returned
* by gdk_rgb_get_colormap(). You normally will want to instead use
* the actual colormap for a widget, and use
* gdk_pixbuf_render_pixmap_and_mask_for_colormap.
*
* If the pixbuf does not have an alpha channel, then *@mask_return will be set * If the pixbuf does not have an alpha channel, then *@mask_return will be set
* to NULL. * to NULL.
**/ **/
@ -440,6 +445,41 @@ gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
GdkPixmap **pixmap_return, GdkPixmap **pixmap_return,
GdkBitmap **mask_return, GdkBitmap **mask_return,
int alpha_threshold) int alpha_threshold)
{
gdk_pixbuf_render_pixmap_and_mask_for_colormap (pixbuf,
gdk_rgb_get_colormap (),
pixmap_return, mask_return,
alpha_threshold);
}
/**
* gdk_pixbuf_render_pixmap_and_mask_for_colormap:
* @pixbuf: A pixbuf.
* @colormap: A #GdkColormap
* @pixmap_return: Return value for the created pixmap.
* @mask_return: Return value for the created mask.
* @alpha_threshold: Threshold value for opacity values.
*
* Creates a pixmap and a mask bitmap which are returned in the @pixmap_return
* and @mask_return arguments, respectively, and renders a pixbuf and its
* corresponding tresholded alpha mask to them. This is merely a convenience
* function; applications that need to render pixbufs with dither offsets or to
* given drawables should use gdk_pixbuf_render_to_drawable_alpha() or
* gdk_pixbuf_render_to_drawable(), and gdk_pixbuf_render_threshold_alpha().
*
* The pixmap that is created uses the #GdkColormap specified by @colormap.
* This colormap must match the colormap of the window where the pixmap
* will eventually be used or an error will result.
*
* If the pixbuf does not have an alpha channel, then *@mask_return will be set
* to NULL.
**/
void
gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
GdkColormap *colormap,
GdkPixmap **pixmap_return,
GdkBitmap **mask_return,
int alpha_threshold)
{ {
g_return_if_fail (pixbuf != NULL); g_return_if_fail (pixbuf != NULL);
@ -447,12 +487,14 @@ gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
{ {
GdkGC *gc; GdkGC *gc;
*pixmap_return = gdk_pixmap_new (NULL, pixbuf->width, pixbuf->height, *pixmap_return = gdk_pixmap_new (NULL, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
gdk_rgb_get_visual ()->depth); gdk_colormap_get_visual (colormap)->depth);
gdk_drawable_set_colormap (GDK_DRAWABLE (*pixmap_return),
colormap);
gc = gdk_gc_new (*pixmap_return); gc = gdk_gc_new (*pixmap_return);
gdk_pixbuf_render_to_drawable (pixbuf, *pixmap_return, gc, gdk_pixbuf_render_to_drawable (pixbuf, *pixmap_return, gc,
0, 0, 0, 0, 0, 0, 0, 0,
pixbuf->width, pixbuf->height, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
GDK_RGB_DITHER_NORMAL, GDK_RGB_DITHER_NORMAL,
0, 0); 0, 0);
gdk_gc_unref (gc); gdk_gc_unref (gc);
@ -460,15 +502,18 @@ gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
if (mask_return) if (mask_return)
{ {
if (pixbuf->has_alpha) if (gdk_pixbuf_get_has_alpha (pixbuf))
{ {
*mask_return = gdk_pixmap_new (NULL, pixbuf->width, pixbuf->height, 1); *mask_return = gdk_pixmap_new (NULL, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), 1);
gdk_pixbuf_render_threshold_alpha (pixbuf, *mask_return, gdk_pixbuf_render_threshold_alpha (pixbuf, *mask_return,
0, 0, 0, 0, 0, 0, 0, 0,
pixbuf->width, pixbuf->height, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
alpha_threshold); alpha_threshold);
} }
else else
*mask_return = NULL; *mask_return = NULL;
} }
} }

View File

@ -45,10 +45,17 @@ void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
GdkRgbDither dither, GdkRgbDither dither,
int x_dither, int x_dither,
int y_dither); int y_dither);
void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
GdkPixmap **pixmap_return, void gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
GdkBitmap **mask_return, GdkColormap *colormap,
int alpha_threshold); GdkPixmap **pixmap_return,
GdkBitmap **mask_return,
int alpha_threshold);
void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
GdkPixmap **pixmap_return,
GdkBitmap **mask_return,
int alpha_threshold);
/* Fetching a region from a drawable */ /* Fetching a region from a drawable */
GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest, GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,

View File

@ -105,7 +105,6 @@ static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey);
GdkArgDesc _gdk_windowing_args[] = { GdkArgDesc _gdk_windowing_args[] = {
{ "display", GDK_ARG_STRING, &_gdk_display_name, (GdkArgFunc)NULL }, { "display", GDK_ARG_STRING, &_gdk_display_name, (GdkArgFunc)NULL },
{ "sync", GDK_ARG_BOOL, &gdk_synchronize, (GdkArgFunc)NULL }, { "sync", GDK_ARG_BOOL, &gdk_synchronize, (GdkArgFunc)NULL },
{ "no-xshm", GDK_ARG_NOBOOL, &_gdk_use_xshm, (GdkArgFunc)NULL },
{ "gxid-host", GDK_ARG_STRING, &_gdk_input_gxid_host, (GdkArgFunc)NULL }, { "gxid-host", GDK_ARG_STRING, &_gdk_input_gxid_host, (GdkArgFunc)NULL },
{ "gxid-port", GDK_ARG_INT, &_gdk_input_gxid_port, (GdkArgFunc)NULL }, { "gxid-port", GDK_ARG_INT, &_gdk_input_gxid_port, (GdkArgFunc)NULL },
{ NULL } { NULL }
@ -193,7 +192,6 @@ _gdk_windowing_init_check (int argc, char **argv)
void void
gdk_set_use_xshm (gboolean use_xshm) gdk_set_use_xshm (gboolean use_xshm)
{ {
_gdk_use_xshm = use_xshm;
} }
gboolean gboolean

View File

@ -1737,48 +1737,6 @@ gtk_window_get_decorated (GtkWindow *window)
return window->decorated; return window->decorated;
} }
static void
gdk_pixbuf_render_pixmap_and_mask_with_colormap (GdkPixbuf *pixbuf,
GdkPixmap **pixmap_return,
GdkBitmap **mask_return,
int alpha_threshold,
GdkColormap *cmap)
{
g_return_if_fail (pixbuf != NULL);
if (pixmap_return)
{
GdkGC *gc;
*pixmap_return = gdk_pixmap_new (NULL, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
gdk_colormap_get_visual (cmap)->depth);
gdk_drawable_set_colormap (GDK_DRAWABLE (*pixmap_return),
cmap);
gc = gdk_gc_new (*pixmap_return);
gdk_pixbuf_render_to_drawable (pixbuf, *pixmap_return, gc,
0, 0, 0, 0,
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
GDK_RGB_DITHER_NORMAL,
0, 0);
gdk_gc_unref (gc);
}
if (mask_return)
{
if (gdk_pixbuf_get_has_alpha (pixbuf))
{
*mask_return = gdk_pixmap_new (NULL, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), 1);
gdk_pixbuf_render_threshold_alpha (pixbuf, *mask_return,
0, 0, 0, 0,
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
alpha_threshold);
}
else
*mask_return = NULL;
}
}
static GtkWindowIconInfo* static GtkWindowIconInfo*
get_icon_info (GtkWindow *window) get_icon_info (GtkWindow *window)
{ {
@ -1884,11 +1842,11 @@ get_pixmap_and_mask (GtkWindowIconInfo *parent_info,
} }
if (best_icon) if (best_icon)
gdk_pixbuf_render_pixmap_and_mask_with_colormap (best_icon, gdk_pixbuf_render_pixmap_and_mask_for_colormap (best_icon,
pmap_return, gdk_colormap_get_system (),
mask_return, pmap_return,
128, mask_return,
gdk_colormap_get_system ()); 128);
/* Save pmap/mask for others to use if appropriate */ /* Save pmap/mask for others to use if appropriate */
if (parent_info) if (parent_info)