Don't set the PC_EXPLICIT flag for unused palette entries, that might have

2002-02-17  Tor Lillqvist  <tml@iki.fi>

	* gdk/win32/gdkcolor-win32.c (free_colors): Don't set the
	PC_EXPLICIT flag for unused palette entries, that might have
	undesired side effects. Just set them to black. Black is always
	present in a palette, so having superfluous black entries won't
	cause any extra allocations from the system palette either when
	realized.

	* gdk/win32/gdkevents-win32.c
	(gdk_event_translate:WM_QUERYNEWPALETTE): Don't do anything if the
	system visual is static color, i.e. the user has told GDK to use
	just the 16 static colors. In that case no need to redraw
	anything, as the colors are static and by definition always
	correctly mapped in the system palette.
	(WM_PALETTECHANGED): Ditto, no need to call UpdateColors() either.
This commit is contained in:
Tor Lillqvist 2002-02-17 22:03:29 +00:00 committed by Tor Lillqvist
parent 38d639c0e8
commit 28bfe19594
9 changed files with 157 additions and 11 deletions

View File

@ -1,3 +1,22 @@
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkcolor-win32.c (free_colors): Don't set the
PC_EXPLICIT flag for unused palette entries, that might have
undesired side effects. Just set them to black. Black is always
present in a palette, so having superfluous black entries won't
cause any extra allocations from the system palette either when
realized.
* gdk/win32/gdkevents-win32.c
(gdk_event_translate:WM_QUERYNEWPALETTE): Don't do anything if the
system visual is static color, i.e. the user has told GDK to use
just the 16 static colors. In that case no need to redraw
anything, as the colors are static and by definition always
correctly mapped in the system palette.
(WM_PALETTECHANGED): Ditto, no need to call UpdateColors() either.
* gtk/gtk.def: Add new gtkfilesel entry points.
2002-02-17 Matthias Clasen <maclas@gmx.de>
* docs/tutorial/gtk-tut.sgml, examples/paned/paned.c,

View File

@ -1,3 +1,22 @@
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkcolor-win32.c (free_colors): Don't set the
PC_EXPLICIT flag for unused palette entries, that might have
undesired side effects. Just set them to black. Black is always
present in a palette, so having superfluous black entries won't
cause any extra allocations from the system palette either when
realized.
* gdk/win32/gdkevents-win32.c
(gdk_event_translate:WM_QUERYNEWPALETTE): Don't do anything if the
system visual is static color, i.e. the user has told GDK to use
just the 16 static colors. In that case no need to redraw
anything, as the colors are static and by definition always
correctly mapped in the system palette.
(WM_PALETTECHANGED): Ditto, no need to call UpdateColors() either.
* gtk/gtk.def: Add new gtkfilesel entry points.
2002-02-17 Matthias Clasen <maclas@gmx.de>
* docs/tutorial/gtk-tut.sgml, examples/paned/paned.c,

View File

@ -1,3 +1,22 @@
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkcolor-win32.c (free_colors): Don't set the
PC_EXPLICIT flag for unused palette entries, that might have
undesired side effects. Just set them to black. Black is always
present in a palette, so having superfluous black entries won't
cause any extra allocations from the system palette either when
realized.
* gdk/win32/gdkevents-win32.c
(gdk_event_translate:WM_QUERYNEWPALETTE): Don't do anything if the
system visual is static color, i.e. the user has told GDK to use
just the 16 static colors. In that case no need to redraw
anything, as the colors are static and by definition always
correctly mapped in the system palette.
(WM_PALETTECHANGED): Ditto, no need to call UpdateColors() either.
* gtk/gtk.def: Add new gtkfilesel entry points.
2002-02-17 Matthias Clasen <maclas@gmx.de>
* docs/tutorial/gtk-tut.sgml, examples/paned/paned.c,

View File

@ -1,3 +1,22 @@
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkcolor-win32.c (free_colors): Don't set the
PC_EXPLICIT flag for unused palette entries, that might have
undesired side effects. Just set them to black. Black is always
present in a palette, so having superfluous black entries won't
cause any extra allocations from the system palette either when
realized.
* gdk/win32/gdkevents-win32.c
(gdk_event_translate:WM_QUERYNEWPALETTE): Don't do anything if the
system visual is static color, i.e. the user has told GDK to use
just the 16 static colors. In that case no need to redraw
anything, as the colors are static and by definition always
correctly mapped in the system palette.
(WM_PALETTECHANGED): Ditto, no need to call UpdateColors() either.
* gtk/gtk.def: Add new gtkfilesel entry points.
2002-02-17 Matthias Clasen <maclas@gmx.de>
* docs/tutorial/gtk-tut.sgml, examples/paned/paned.c,

View File

@ -1,3 +1,22 @@
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkcolor-win32.c (free_colors): Don't set the
PC_EXPLICIT flag for unused palette entries, that might have
undesired side effects. Just set them to black. Black is always
present in a palette, so having superfluous black entries won't
cause any extra allocations from the system palette either when
realized.
* gdk/win32/gdkevents-win32.c
(gdk_event_translate:WM_QUERYNEWPALETTE): Don't do anything if the
system visual is static color, i.e. the user has told GDK to use
just the 16 static colors. In that case no need to redraw
anything, as the colors are static and by definition always
correctly mapped in the system palette.
(WM_PALETTECHANGED): Ditto, no need to call UpdateColors() either.
* gtk/gtk.def: Add new gtkfilesel entry points.
2002-02-17 Matthias Clasen <maclas@gmx.de>
* docs/tutorial/gtk-tut.sgml, examples/paned/paned.c,

View File

@ -1,3 +1,22 @@
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkcolor-win32.c (free_colors): Don't set the
PC_EXPLICIT flag for unused palette entries, that might have
undesired side effects. Just set them to black. Black is always
present in a palette, so having superfluous black entries won't
cause any extra allocations from the system palette either when
realized.
* gdk/win32/gdkevents-win32.c
(gdk_event_translate:WM_QUERYNEWPALETTE): Don't do anything if the
system visual is static color, i.e. the user has told GDK to use
just the 16 static colors. In that case no need to redraw
anything, as the colors are static and by definition always
correctly mapped in the system palette.
(WM_PALETTECHANGED): Ditto, no need to call UpdateColors() either.
* gtk/gtk.def: Add new gtkfilesel entry points.
2002-02-17 Matthias Clasen <maclas@gmx.de>
* docs/tutorial/gtk-tut.sgml, examples/paned/paned.c,

View File

@ -1,3 +1,22 @@
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkcolor-win32.c (free_colors): Don't set the
PC_EXPLICIT flag for unused palette entries, that might have
undesired side effects. Just set them to black. Black is always
present in a palette, so having superfluous black entries won't
cause any extra allocations from the system palette either when
realized.
* gdk/win32/gdkevents-win32.c
(gdk_event_translate:WM_QUERYNEWPALETTE): Don't do anything if the
system visual is static color, i.e. the user has told GDK to use
just the 16 static colors. In that case no need to redraw
anything, as the colors are static and by definition always
correctly mapped in the system palette.
(WM_PALETTECHANGED): Ditto, no need to call UpdateColors() either.
* gtk/gtk.def: Add new gtkfilesel entry points.
2002-02-17 Matthias Clasen <maclas@gmx.de>
* docs/tutorial/gtk-tut.sgml, examples/paned/paned.c,

View File

@ -454,8 +454,11 @@ free_colors (GdkColormap *cmap,
GdkColormapPrivateWin32 *cmapp = GDK_WIN32_COLORMAP_DATA (cmap);
gint i;
#ifdef G_ENABLE_DEBUG
gint set_explicit = 0;
gint set_black_count = 0;
#endif
gboolean *cleared_entries;
cleared_entries = g_new0 (gboolean, cmap->size);
/* We don't have to do anything for non-palette devices. */
@ -470,7 +473,10 @@ free_colors (GdkColormap *cmap,
else if (cmapp->use[pixels[i]] == GDK_WIN32_PE_STATIC)
; /* Nothing either*/
else
{
cmapp->use[pixels[i]] = GDK_WIN32_PE_AVAILABLE;
cleared_entries[pixels[i]] = TRUE;
}
}
for (i = cmapp->current_size - 1; i >= 0; i--)
if (cmapp->use[i] != GDK_WIN32_PE_AVAILABLE)
@ -484,25 +490,26 @@ free_colors (GdkColormap *cmap,
else
cmapp->current_size = i + 1;
}
pe.peRed = pe.peGreen = pe.peBlue = pe.peFlags = 0;
for (i = 0; i < cmapp->current_size; i++)
{
if (cmapp->use[i] == GDK_WIN32_PE_AVAILABLE)
if (cleared_entries[i])
{
*(WORD*)&pe = i;
pe.peFlags = PC_EXPLICIT;
if (!SetPaletteEntries (cmapp->hpal, i, 1, &pe))
WIN32_GDI_FAILED ("SetPaletteEntries");
GDK_NOTE (COLORMAP, set_explicit++);
GDK_NOTE (COLORMAP, set_black_count++);
}
}
#if 0
GDK_NOTE (COLORMAP, gdk_win32_print_hpalette (cmapp->hpal));
#else
GDK_NOTE (COLORMAP, (set_explicit > 0 ?
g_print ("free_colors: %d (%d) PC_EXPLICIT\n",
set_explicit, cmapp->current_size)
GDK_NOTE (COLORMAP, (set_black_count > 0 ?
g_print ("free_colors: %d (%d) set to black\n",
set_black_count, cmapp->current_size)
: (void) 0));
#endif
g_free (cleared_entries);
break;
default:

View File

@ -2732,8 +2732,11 @@ gdk_event_translate (GdkEvent *event,
case WM_QUERYNEWPALETTE:
GDK_NOTE (EVENTS_OR_COLORMAP, g_print ("WM_QUERYNEWPALETTE: %p\n",
msg->hwnd));
if (gdk_visual_get_system ()->type == GDK_VISUAL_PSEUDO_COLOR)
{
synthesize_expose_events (window);
update_colors_counter = 0;
}
*ret_val_flagp = TRUE;
*ret_valp = FALSE;
break;
@ -2744,6 +2747,9 @@ gdk_event_translate (GdkEvent *event,
*ret_val_flagp = TRUE;
*ret_valp = FALSE;
if (gdk_visual_get_system ()->type != GDK_VISUAL_PSEUDO_COLOR)
break;
if (msg->hwnd == (HWND) msg->wParam)
break;