From bb0446a014d1481cb4ffff92646e29833a443a4e Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Mon, 9 Dec 2002 01:29:34 +0000 Subject: [PATCH] Fixes for GdkColormapX11 (#100023, Naofumi Yasufuku) Sun Dec 8 20:19:22 2002 Owen Taylor Fixes for GdkColormapX11 (#100023, Naofumi Yasufuku) * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_foreign_new): Fix typo that caused us to always return the system colormap. * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): When allocating a private colormap and copying the system palette to prevent flashing, handle colormap->size greater than system_colormap->size. * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_get_xdisplay): Get rid of the last remains of private->xdisplay in favor of using private->screen. --- ChangeLog | 17 +++++++++++++++++ ChangeLog.pre-2-10 | 17 +++++++++++++++++ ChangeLog.pre-2-2 | 17 +++++++++++++++++ ChangeLog.pre-2-4 | 17 +++++++++++++++++ ChangeLog.pre-2-6 | 17 +++++++++++++++++ ChangeLog.pre-2-8 | 17 +++++++++++++++++ gdk/x11/gdkcolor-x11.c | 19 +++++++++++-------- 7 files changed, 113 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d2e243341..66fa3f7b86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Sun Dec 8 20:19:22 2002 Owen Taylor + + Fixes for GdkColormapX11 (#100023, Naofumi Yasufuku) + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_foreign_new): + Fix typo that caused us to always return the system + colormap. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): When allocating + a private colormap and copying the system palette + to prevent flashing, handle colormap->size greater than + system_colormap->size. + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_get_xdisplay): + Get rid of the last remains of private->xdisplay + in favor of using private->screen. + 2002-12-09 Tor Lillqvist Merge from stable: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6d2e243341..66fa3f7b86 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,20 @@ +Sun Dec 8 20:19:22 2002 Owen Taylor + + Fixes for GdkColormapX11 (#100023, Naofumi Yasufuku) + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_foreign_new): + Fix typo that caused us to always return the system + colormap. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): When allocating + a private colormap and copying the system palette + to prevent flashing, handle colormap->size greater than + system_colormap->size. + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_get_xdisplay): + Get rid of the last remains of private->xdisplay + in favor of using private->screen. + 2002-12-09 Tor Lillqvist Merge from stable: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 6d2e243341..66fa3f7b86 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,20 @@ +Sun Dec 8 20:19:22 2002 Owen Taylor + + Fixes for GdkColormapX11 (#100023, Naofumi Yasufuku) + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_foreign_new): + Fix typo that caused us to always return the system + colormap. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): When allocating + a private colormap and copying the system palette + to prevent flashing, handle colormap->size greater than + system_colormap->size. + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_get_xdisplay): + Get rid of the last remains of private->xdisplay + in favor of using private->screen. + 2002-12-09 Tor Lillqvist Merge from stable: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 6d2e243341..66fa3f7b86 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,20 @@ +Sun Dec 8 20:19:22 2002 Owen Taylor + + Fixes for GdkColormapX11 (#100023, Naofumi Yasufuku) + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_foreign_new): + Fix typo that caused us to always return the system + colormap. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): When allocating + a private colormap and copying the system palette + to prevent flashing, handle colormap->size greater than + system_colormap->size. + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_get_xdisplay): + Get rid of the last remains of private->xdisplay + in favor of using private->screen. + 2002-12-09 Tor Lillqvist Merge from stable: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 6d2e243341..66fa3f7b86 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,20 @@ +Sun Dec 8 20:19:22 2002 Owen Taylor + + Fixes for GdkColormapX11 (#100023, Naofumi Yasufuku) + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_foreign_new): + Fix typo that caused us to always return the system + colormap. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): When allocating + a private colormap and copying the system palette + to prevent flashing, handle colormap->size greater than + system_colormap->size. + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_get_xdisplay): + Get rid of the last remains of private->xdisplay + in favor of using private->screen. + 2002-12-09 Tor Lillqvist Merge from stable: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 6d2e243341..66fa3f7b86 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,20 @@ +Sun Dec 8 20:19:22 2002 Owen Taylor + + Fixes for GdkColormapX11 (#100023, Naofumi Yasufuku) + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_foreign_new): + Fix typo that caused us to always return the system + colormap. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): When allocating + a private colormap and copying the system palette + to prevent flashing, handle colormap->size greater than + system_colormap->size. + + * gdk/x11/gdkcolor-x11.c (gdk_x11_colormap_get_xdisplay): + Get rid of the last remains of private->xdisplay + in favor of using private->screen. + 2002-12-09 Tor Lillqvist Merge from stable: diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c index c4e6a4b0ce..7282d6a329 100644 --- a/gdk/x11/gdkcolor-x11.c +++ b/gdk/x11/gdkcolor-x11.c @@ -38,7 +38,6 @@ struct _GdkColormapPrivateX11 { GdkScreen *screen; Colormap xcolormap; - Display *xdisplay; gint private_val; GHashTable *hash; @@ -205,18 +204,23 @@ gdk_colormap_new (GdkVisual *visual, if (allocate) { + GdkVisual *system_visual; XColor *default_colors; + gint n_default_colors; + + system_visual = gdk_screen_get_system_visual (private->screen); + n_default_colors = MIN (system_visual->colormap_size, colormap->size); default_colors = g_new (XColor, colormap->size); - for (i = 0; i < colormap->size; i++) + for (i = 0; i < n_default_colors; i++) default_colors[i].pixel = i; XQueryColors (xdisplay, DefaultColormapOfScreen (GDK_SCREEN_X11 (private->screen)->xscreen), - default_colors, colormap->size); + default_colors, n_default_colors); - for (i = 0; i < colormap->size; i++) + for (i = 0; i < n_default_colors; i++) { colormap->colors[i].pixel = default_colors[i].pixel; colormap->colors[i].red = default_colors[i].red; @@ -224,7 +228,7 @@ gdk_colormap_new (GdkVisual *visual, colormap->colors[i].blue = default_colors[i].blue; } - gdk_colormap_change (colormap, colormap->size); + gdk_colormap_change (colormap, n_default_colors); g_free (default_colors); } @@ -1282,7 +1286,7 @@ gdk_x11_colormap_foreign_new (GdkVisual *visual, screen = gdk_visual_get_screen (visual); if (xcolormap == DefaultColormap (GDK_SCREEN_XDISPLAY (screen), - GDK_SCREEN_XNUMBER (screen))); + GDK_SCREEN_XNUMBER (screen))) return g_object_ref (gdk_screen_get_system_colormap (screen)); colormap = gdk_colormap_lookup (screen, xcolormap); @@ -1296,7 +1300,6 @@ gdk_x11_colormap_foreign_new (GdkVisual *visual, private->screen = screen; private->xcolormap = xcolormap; - private->xdisplay = GDK_SCREEN_XDISPLAY (screen); private->private_val = FALSE; colormap->size = visual->colormap_size; @@ -1470,7 +1473,7 @@ gdk_x11_colormap_get_xdisplay (GdkColormap *colormap) private = GDK_COLORMAP_PRIVATE_DATA (colormap); - return private->xdisplay; + return GDK_SCREEN_XDISPLAY (private->screen); } /**