From 64f6d8cd7f7afe70270994d17449f9e34da13f9b Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 5 Apr 2005 01:46:59 +0000 Subject: [PATCH] Handle 16 colour display mode. For some reason, in this mode 2005-04-05 Tor Lillqvist * 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) --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ ChangeLog.pre-2-8 | 4 ++++ gdk/win32/gdkvisual-win32.c | 14 +++++++++++--- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d518ab0e57..b3b185ac53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-04-05 Tor Lillqvist + * 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) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d518ab0e57..b3b185ac53 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,9 @@ 2005-04-05 Tor Lillqvist + * 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) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d518ab0e57..b3b185ac53 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,9 @@ 2005-04-05 Tor Lillqvist + * 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) diff --git a/gdk/win32/gdkvisual-win32.c b/gdk/win32/gdkvisual-win32.c index 445fd2297d..0007c47d6a 100644 --- a/gdk/win32/gdkvisual-win32.c +++ b/gdk/win32/gdkvisual-win32.c @@ -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;