summaryrefslogtreecommitdiff
path: root/gdk/linux-fb
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2001-06-14 18:10:01 +0000
committerAlexander Larsson <alexl@src.gnome.org>2001-06-14 18:10:01 +0000
commit7d1a049bc39000840d2989f38e0ac444958d8740 (patch)
treef2c0576862678435fd9347d0f4a1e75136e71213 /gdk/linux-fb
parent685144826761ae80bd0a8241199f20cd6664d785 (diff)
downloadgdk-pixbuf-7d1a049bc39000840d2989f38e0ac444958d8740.tar.gz
Add some example config files that can be used with the URW fonts.
2001-06-14 Alexander Larsson <alexl@redhat.com> * docs/README.linux-fb: Add some example config files that can be used with the URW fonts. * gdk/linux-fb/gdkvisual-fb.c (gdk_visual_init): Set up the color ramps for DirectColor mode.
Diffstat (limited to 'gdk/linux-fb')
-rw-r--r--gdk/linux-fb/gdkvisual-fb.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/gdk/linux-fb/gdkvisual-fb.c b/gdk/linux-fb/gdkvisual-fb.c
index 4ac5d3c82..d593d21f5 100644
--- a/gdk/linux-fb/gdkvisual-fb.c
+++ b/gdk/linux-fb/gdkvisual-fb.c
@@ -27,6 +27,7 @@
#include "gdkvisual.h"
#include "gdkprivate-fb.h"
#include "gdkinternals.h"
+#include <sys/ioctl.h>
static GdkVisual *system_visual = NULL;
@@ -46,10 +47,6 @@ gdk_visual_init (void)
system_visual->type = GDK_VISUAL_PSEUDO_COLOR;
break;
case FB_VISUAL_DIRECTCOLOR:
- /* TODO: Should load the colormap to ramps here, as they might be initialized to
- some other garbage */
-
- /* Fall through */
case FB_VISUAL_TRUECOLOR:
system_visual->type = GDK_VISUAL_TRUE_COLOR;
@@ -64,6 +61,35 @@ gdk_visual_init (void)
system_visual->blue_prec = gdk_display->modeinfo.blue.length;
system_visual->blue_shift = gdk_display->modeinfo.blue.offset;
system_visual->blue_mask = ((1 << (system_visual->blue_prec)) - 1) << system_visual->blue_shift;
+
+ if (gdk_display->sinfo.visual == FB_VISUAL_DIRECTCOLOR)
+ {
+ guint16 red[256], green[256], blue[256];
+ struct fb_cmap fbc = {0,0};
+ int size, i;
+ /* Load the colormap to ramps here, as they might be initialized to
+ some other garbage */
+
+ g_warning ("Directcolor visual, not very well tested\n");
+ fbc.red = red;
+ fbc.green = green;
+ fbc.blue = blue;
+
+ size = 1 << system_visual->red_prec;
+ for (i = 0; i < size; i++)
+ red[i] = i * 65535 / (size - 1);
+
+ size = 1 << system_visual->green_prec;
+ fbc.len = size;
+ for (i = 0; i < size; i++)
+ green[i] = i * 65535 / (size - 1);
+
+ size = 1 << system_visual->blue_prec;
+ for (i = 0; i < size; i++)
+ blue[i] = i * 65535 / (size - 1);
+
+ ioctl (gdk_display->fb_fd, FBIOPUTCMAP, &fbc);
+ }
break;
case FB_VISUAL_STATIC_PSEUDOCOLOR:
system_visual->type = GDK_VISUAL_STATIC_COLOR;