Handle 16 colour display mode. For some reason, in this mode

2005-04-05  Tor Lillqvist  <tml@novell.com>

	* gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Handle 16 colour
	display mode. For some reason, in this mode GetDeviceCaps(BITSPIXEL)
	returns 1 (but GetDeviceCaps(NUMCOLORS)	does return 16). (#143415)
This commit is contained in:
Tor Lillqvist 2005-04-05 01:46:59 +00:00 committed by Tor Lillqvist
parent 8b388cd365
commit 64f6d8cd7f
4 changed files with 23 additions and 3 deletions

View File

@ -1,5 +1,9 @@
2005-04-05 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Handle 16 colour
display mode. For some reason, in this mode GetDeviceCaps(BITSPIXEL)
returns 1 (but GetDeviceCaps(NUMCOLORS) does return 16). (#143415)
* gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Don't force
24bpp GdkVisual on 32bpp displays. (#140706)

View File

@ -1,5 +1,9 @@
2005-04-05 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Handle 16 colour
display mode. For some reason, in this mode GetDeviceCaps(BITSPIXEL)
returns 1 (but GetDeviceCaps(NUMCOLORS) does return 16). (#143415)
* gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Don't force
24bpp GdkVisual on 32bpp displays. (#140706)

View File

@ -1,5 +1,9 @@
2005-04-05 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Handle 16 colour
display mode. For some reason, in this mode GetDeviceCaps(BITSPIXEL)
returns 1 (but GetDeviceCaps(NUMCOLORS) does return 16). (#143415)
* gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Don't force
24bpp GdkVisual on 32bpp displays. (#140706)

View File

@ -97,20 +97,22 @@ _gdk_visual_init (void)
HBITMAP hbm;
const gint rastercaps = GetDeviceCaps (_gdk_display_hdc, RASTERCAPS);
const int numcolors = GetDeviceCaps (_gdk_display_hdc, NUMCOLORS);
gint bitspixel = GetDeviceCaps (_gdk_display_hdc, BITSPIXEL);
gint map_entries = 0;
system_visual = g_object_new (GDK_TYPE_VISUAL, NULL);
GDK_NOTE (COLORMAP, g_print ("BITSPIXEL=%d NUMCOLORS=%d\n",
bitspixel, numcolors));
if (rastercaps & RC_PALETTE)
{
const int sizepalette = GetDeviceCaps (_gdk_display_hdc, SIZEPALETTE);
const int numcolors = GetDeviceCaps (_gdk_display_hdc, NUMCOLORS);
gchar *max_colors = getenv ("GDK_WIN32_MAX_COLORS");
system_visual->type = GDK_VISUAL_PSEUDO_COLOR;
GDK_NOTE (COLORMAP, g_print ("BITSPIXEL=%d NUMCOLORS=%d SIZEPALETTE=%d\n",
bitspixel, numcolors, sizepalette));
GDK_NOTE (COLORMAP, g_print ("SIZEPALETTE=%d\n", sizepalette));
g_assert (sizepalette == 256);
if (max_colors != NULL)
@ -155,6 +157,12 @@ _gdk_visual_init (void)
else
map_entries = sizepalette;
}
else if (bitspixel == 1 && numcolors == 16)
{
bitspixel = 4;
system_visual->type = GDK_VISUAL_STATIC_COLOR;
map_entries = 16;
}
else if (bitspixel == 1)
{
system_visual->type = GDK_VISUAL_STATIC_GRAY;