diff options
author | Owen Taylor <owt1@cornell.edu> | 1998-02-03 20:57:40 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-02-03 20:57:40 +0000 |
commit | 3b0de24a7b2a2786c1c3b8ff3fbda1168e8909df (patch) | |
tree | 8ce17a81bf09eea9e69538eb0544f5f945e45044 /gdk/gdkcolor.c | |
parent | 584231106242a6dd92f7744c0d9f5617574078c0 (diff) | |
download | gdk-pixbuf-3b0de24a7b2a2786c1c3b8ff3fbda1168e8909df.tar.gz |
Only query the colormap for GRAYSCALE and PSEUDOCOLOR visuals, and don't
Tue Feb 3 15:34:27 1998 Owen Taylor <owt1@cornell.edu>
* gdk/gdkcolor.c (gdk_colormap_get_system): Only query
the colormap for GRAYSCALE and PSEUDOCOLOR visuals,
and don't ask for more than 256 colors in any case.
* gdk/gdkwindow.c (gdk_window_internal_destroy): Remove
the input window information when we destroy the window,
not when we are notified of it.
* gdk/gdkinputcommon.h (gdk_input_device_new): Work around
bug in XFree86 3.3.1's handling of Wacom macro buttons.
by assumming no device will report exactly 25 buttons.
* gdk/gdkinputcommon.h (gdk_input_common_other_event): Fill
in string translation for generated key press events,
do sanity checking on received key codes.
* gdk/gdkcc.c (gdk_color_context_new): Allocate enough
room for a GdkColorContextPrivate, not just for a
GdkColorContext.
Diffstat (limited to 'gdk/gdkcolor.c')
-rw-r--r-- | gdk/gdkcolor.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c index 5da61f063..7bc436957 100644 --- a/gdk/gdkcolor.c +++ b/gdk/gdkcolor.c @@ -174,23 +174,27 @@ gdk_colormap_get_system (void) private->next_color = 0; private->ref_count = 1; - for (i = 0; i < 256; i++) + if ((private->visual->type == GDK_VISUAL_GRAYSCALE) || + (private->visual->type == GDK_VISUAL_PSEUDO_COLOR)) { - xpalette[i].pixel = i; - xpalette[i].red = 0; - xpalette[i].green = 0; - xpalette[i].blue = 0; - } - - XQueryColors (gdk_display, private->xcolormap, xpalette, - private->visual->colormap_size); - - for (i = 0; i < 256; i++) - { - colormap->colors[i].pixel = xpalette[i].pixel; - colormap->colors[i].red = xpalette[i].red; - colormap->colors[i].green = xpalette[i].green; - colormap->colors[i].blue = xpalette[i].blue; + for (i = 0; i < 256; i++) + { + xpalette[i].pixel = i; + xpalette[i].red = 0; + xpalette[i].green = 0; + xpalette[i].blue = 0; + } + + XQueryColors (gdk_display, private->xcolormap, xpalette, + MIN (private->visual->colormap_size, 256)); + + for (i = 0; i < 256; i++) + { + colormap->colors[i].pixel = xpalette[i].pixel; + colormap->colors[i].red = xpalette[i].red; + colormap->colors[i].green = xpalette[i].green; + colormap->colors[i].blue = xpalette[i].blue; + } } gdk_colormap_add (colormap); |