Commit 51046a9f authored by Tor Lillqvist's avatar Tor Lillqvist

README.win32 Add HAVE_WINTAB. Undefine it if bulding without the Wintab

	* README.win32
	* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
 	the Wintab SDK.

	* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
 	OK, but getting closer. Guard against bogus tilt data from Wacom
 	ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
 	enable easier building without Wintab.

	* gdk/win32/gdkinput.h
	* gdk/win32/gdkevents.c
	* gdk/win32/gdkwindow.c: Minor changes related related to above.

	* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
 	code. As we have just one visual on Win32, no sense to have it in a
 	table, and no need for the hash table.
parent b0a2c890
1999-07-21 Tor Lillqvist <tml@iki.fi>
1999-07-25 Tor Lillqvist <tml@iki.fi>
* README.win32
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
the Wintab SDK.
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
OK, but getting closer. Guard against bogus tilt data from Wacom
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
enable easier building without Wintab.
* gdk/win32/gdkinput.h
* gdk/win32/gdkevents.c
* gdk/win32/gdkwindow.c: Minor changes related related to above.
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
code. As we have just one visual on Win32, no sense to have it in a
table, and no need for the hash table.
1999-07-21 Tor Lillqvist <tml@iki.fi>
* README.win32: Update gcc build instructions. Mention gettext is
GPL.
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
supported cursor size with GetSystemMetrics.
* gdk/win32/gdkfont.c
* gtk/gtkfontsel.c: Guard against some font weight and charset
symbols being undefined (in mingw32 headers).
......
1999-07-21 Tor Lillqvist <tml@iki.fi>
1999-07-25 Tor Lillqvist <tml@iki.fi>
* README.win32
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
the Wintab SDK.
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
OK, but getting closer. Guard against bogus tilt data from Wacom
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
enable easier building without Wintab.
* gdk/win32/gdkinput.h
* gdk/win32/gdkevents.c
* gdk/win32/gdkwindow.c: Minor changes related related to above.
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
code. As we have just one visual on Win32, no sense to have it in a
table, and no need for the hash table.
1999-07-21 Tor Lillqvist <tml@iki.fi>
* README.win32: Update gcc build instructions. Mention gettext is
GPL.
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
supported cursor size with GetSystemMetrics.
* gdk/win32/gdkfont.c
* gtk/gtkfontsel.c: Guard against some font weight and charset
symbols being undefined (in mingw32 headers).
......
1999-07-21 Tor Lillqvist <tml@iki.fi>
1999-07-25 Tor Lillqvist <tml@iki.fi>
* README.win32
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
the Wintab SDK.
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
OK, but getting closer. Guard against bogus tilt data from Wacom
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
enable easier building without Wintab.
* gdk/win32/gdkinput.h
* gdk/win32/gdkevents.c
* gdk/win32/gdkwindow.c: Minor changes related related to above.
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
code. As we have just one visual on Win32, no sense to have it in a
table, and no need for the hash table.
1999-07-21 Tor Lillqvist <tml@iki.fi>
* README.win32: Update gcc build instructions. Mention gettext is
GPL.
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
supported cursor size with GetSystemMetrics.
* gdk/win32/gdkfont.c
* gtk/gtkfontsel.c: Guard against some font weight and charset
symbols being undefined (in mingw32 headers).
......
1999-07-21 Tor Lillqvist <tml@iki.fi>
1999-07-25 Tor Lillqvist <tml@iki.fi>
* README.win32
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
the Wintab SDK.
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
OK, but getting closer. Guard against bogus tilt data from Wacom
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
enable easier building without Wintab.
* gdk/win32/gdkinput.h
* gdk/win32/gdkevents.c
* gdk/win32/gdkwindow.c: Minor changes related related to above.
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
code. As we have just one visual on Win32, no sense to have it in a
table, and no need for the hash table.
1999-07-21 Tor Lillqvist <tml@iki.fi>
* README.win32: Update gcc build instructions. Mention gettext is
GPL.
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
supported cursor size with GetSystemMetrics.
* gdk/win32/gdkfont.c
* gtk/gtkfontsel.c: Guard against some font weight and charset
symbols being undefined (in mingw32 headers).
......
1999-07-21 Tor Lillqvist <tml@iki.fi>
1999-07-25 Tor Lillqvist <tml@iki.fi>
* README.win32
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
the Wintab SDK.
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
OK, but getting closer. Guard against bogus tilt data from Wacom
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
enable easier building without Wintab.
* gdk/win32/gdkinput.h
* gdk/win32/gdkevents.c
* gdk/win32/gdkwindow.c: Minor changes related related to above.
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
code. As we have just one visual on Win32, no sense to have it in a
table, and no need for the hash table.
1999-07-21 Tor Lillqvist <tml@iki.fi>
* README.win32: Update gcc build instructions. Mention gettext is
GPL.
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
supported cursor size with GetSystemMetrics.
* gdk/win32/gdkfont.c
* gtk/gtkfontsel.c: Guard against some font weight and charset
symbols being undefined (in mingw32 headers).
......
1999-07-21 Tor Lillqvist <tml@iki.fi>
1999-07-25 Tor Lillqvist <tml@iki.fi>
* README.win32
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
the Wintab SDK.
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
OK, but getting closer. Guard against bogus tilt data from Wacom
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
enable easier building without Wintab.
* gdk/win32/gdkinput.h
* gdk/win32/gdkevents.c
* gdk/win32/gdkwindow.c: Minor changes related related to above.
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
code. As we have just one visual on Win32, no sense to have it in a
table, and no need for the hash table.
1999-07-21 Tor Lillqvist <tml@iki.fi>
* README.win32: Update gcc build instructions. Mention gettext is
GPL.
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
supported cursor size with GetSystemMetrics.
* gdk/win32/gdkfont.c
* gtk/gtkfontsel.c: Guard against some font weight and charset
symbols being undefined (in mingw32 headers).
......
1999-07-21 Tor Lillqvist <tml@iki.fi>
1999-07-25 Tor Lillqvist <tml@iki.fi>
* README.win32
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
the Wintab SDK.
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
OK, but getting closer. Guard against bogus tilt data from Wacom
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
enable easier building without Wintab.
* gdk/win32/gdkinput.h
* gdk/win32/gdkevents.c
* gdk/win32/gdkwindow.c: Minor changes related related to above.
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
code. As we have just one visual on Win32, no sense to have it in a
table, and no need for the hash table.
1999-07-21 Tor Lillqvist <tml@iki.fi>
* README.win32: Update gcc build instructions. Mention gettext is
GPL.
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
supported cursor size with GetSystemMetrics.
* gdk/win32/gdkfont.c
* gtk/gtkfontsel.c: Guard against some font weight and charset
symbols being undefined (in mingw32 headers).
......
......@@ -14,7 +14,8 @@ See the README.win32 file in the GLib distribution for instructions
how to build with gcc.
The tablet support uses the Wintab API. The Wintab development kit can
be downloaded from http://www.pointing.com.
be downloaded from http://www.pointing.com. If you don't care for
that, undefine HAVE_WINTAB in config.h.win32 before building.
GTk+ wants to be built with the GNU gettext library for
internationalisation (i18n). Get the version ported to Win32 (not a
......
......@@ -182,3 +182,6 @@
/* define if compiled symbols have a leading underscore */
/* #undef WITH_SYMBOL_UNDERSCORE */
/* Define if you have the Wintab programmer's kit */
#define HAVE_WINTAB 1
......@@ -28,9 +28,13 @@
#include "config.h"
#include <stdio.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#include "gdkx.h"
#ifdef HAVE_WINTAB
#include <wintab.h>
#endif
#include "gdkinput.h"
#define PING() printf("%s: %d\n",__FILE__,__LINE__),fflush(stdout)
......@@ -2782,6 +2786,7 @@ gdk_event_translate (GdkEvent *event,
return_val = window_private && !window_private->destroyed;
break;
#ifdef HAVE_WINTAB
/* Handle WINTAB events here, as we know that gdkinput.c will
* use the fixed WT_DEFBASE as lcMsgBase, and we thus can use the
* constants as case labels.
......@@ -2801,9 +2806,11 @@ gdk_event_translate (GdkEvent *event,
g_print ("WT_PROXIMITY: %#x %d %d\n",
xevent->wParam,
LOWORD (xevent->lParam), HIWORD (xevent->lParam)));
/* Fall through */
wintab:
return_val = gdk_input_vtable.other_event(event, xevent);
break;
#endif
}
bypass_switch:
......
......@@ -28,9 +28,13 @@
#include "config.h"
#include <stdio.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#include "gdkx.h"
#ifdef HAVE_WINTAB
#include <wintab.h>
#endif
#include "gdkinput.h"
#define PING() printf("%s: %d\n",__FILE__,__LINE__),fflush(stdout)
......@@ -2782,6 +2786,7 @@ gdk_event_translate (GdkEvent *event,
return_val = window_private && !window_private->destroyed;
break;
#ifdef HAVE_WINTAB
/* Handle WINTAB events here, as we know that gdkinput.c will
* use the fixed WT_DEFBASE as lcMsgBase, and we thus can use the
* constants as case labels.
......@@ -2801,9 +2806,11 @@ gdk_event_translate (GdkEvent *event,
g_print ("WT_PROXIMITY: %#x %d %d\n",
xevent->wParam,
LOWORD (xevent->lParam), HIWORD (xevent->lParam)));
/* Fall through */
wintab:
return_val = gdk_input_vtable.other_event(event, xevent);
break;
#endif
}
bypass_switch:
......
This diff is collapsed.
This diff is collapsed.
......@@ -27,11 +27,6 @@
#ifndef __GDK_INPUT_H__
#define __GDK_INPUT_H__
#include <wintab.h>
#define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION)
#define PACKETMODE (PK_BUTTONS)
#include <pktdef.h>
typedef struct _GdkAxisInfo GdkAxisInfo;
typedef struct _GdkInputVTable GdkInputVTable;
typedef struct _GdkDevicePrivate GdkDevicePrivate;
......@@ -89,40 +84,6 @@ struct _GdkAxisInfo
gint min_value, max_value;
};
#define GDK_INPUT_NUM_EVENTC 6
struct _GdkDevicePrivate {
GdkDeviceInfo info;
/* information about the axes */
GdkAxisInfo *axes;
/* reverse lookup on axis use type */
gint axis_for_use[GDK_AXIS_LAST];
/* true if we need to select a different set of events, but
* can't because this is the core pointer
*/
gint needs_update;
/* State of buttons */
gint button_state;
gint *last_axis_data;
gint last_buttons;
/* WINTAB stuff: */
HCTX hctx;
/* Cursor number */
UINT cursor;
/* The cursor's CSR_PKTDATA */
WTPKT pktdata;
/* CSR_NPBTNMARKS */
UINT npbtnmarks[2];
/* Azimuth and altitude axis */
AXIS orientation_axes[2];
};
struct _GdkInputWindow
{
/* gdk window */
......
......@@ -29,24 +29,15 @@
#include <gdk/gdk.h>
#include "gdkx.h"
static void gdk_visual_add (GdkVisual *visual);
static void gdk_visual_decompose_mask (gulong mask,
gint *shift,
gint *prec);
static guint gdk_visual_hash (Visual *key);
static gint gdk_visual_compare (Visual *a,
Visual *b);
static GdkVisualPrivate *system_visual;
static GdkVisualPrivate *visuals;
static gint nvisuals;
static gint available_depths[7];
static gint navailable_depths;
static gint available_depths[1];
static GdkVisualType available_types[6];
static gint navailable_types;
static GdkVisualType available_types[1];
#ifdef G_ENABLE_DEBUG
......@@ -62,8 +53,6 @@ static const gchar* visual_names[] =
#endif /* G_ENABLE_DEBUG */
static GHashTable *visual_hash = NULL;
void
gdk_visual_init (void)
{
......@@ -94,242 +83,156 @@ gdk_visual_init (void)
int rastercaps, numcolors, sizepalette, colorres, bitspixel;
Visual *default_xvisual;
GdkVisualPrivate temp_visual;
int nxvisuals;
int i, j;
nxvisuals = 1;
visuals = g_new (GdkVisualPrivate, nxvisuals);
system_visual = g_new (GdkVisualPrivate, 1);
bitspixel = GetDeviceCaps (gdk_DC, BITSPIXEL);
rastercaps = GetDeviceCaps (gdk_DC, RASTERCAPS);
default_xvisual = g_new (Visual, 1);
system_visual->xvisual = default_xvisual;
system_visual->xvisual->visualid = 0;
system_visual->xvisual->bitspixel = bitspixel;
nvisuals = 0;
for (i = 0; i < nxvisuals; i++)
if (rastercaps & RC_PALETTE)
{
system_visual->visual.type = GDK_VISUAL_PSEUDO_COLOR;
numcolors = GetDeviceCaps (gdk_DC, NUMCOLORS);
sizepalette = GetDeviceCaps (gdk_DC, SIZEPALETTE);
colorres = GetDeviceCaps (gdk_DC, COLORRES);
system_visual->xvisual->map_entries = sizepalette;
}
else if (bitspixel == 1)
{
system_visual->visual.type = GDK_VISUAL_STATIC_GRAY;
system_visual->xvisual->map_entries = 2;
}
else if (bitspixel == 4)
{
system_visual->visual.type = GDK_VISUAL_STATIC_COLOR;
system_visual->xvisual->map_entries = 16;
}
else if (bitspixel == 8)
{
system_visual->visual.type = GDK_VISUAL_STATIC_COLOR;
system_visual->xvisual->map_entries = 256;
}
else if (bitspixel == 16)
{
if (1)
system_visual->visual.type = GDK_VISUAL_TRUE_COLOR;
#if 1
/* This code by Mike Enright,
* see http://www.users.cts.com/sd/m/menright/display.html
*/
memset (&bmi, 0, sizeof (bmi));
bmi.bi.biSize = sizeof (bmi.bi);
hbm = CreateCompatibleBitmap (gdk_DC, 1, 1);
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
DeleteObject (hbm);
if (bmi.bi.biCompression != BI_BITFIELDS)
{
bitspixel = GetDeviceCaps (gdk_DC, BITSPIXEL);
rastercaps = GetDeviceCaps (gdk_DC, RASTERCAPS);
default_xvisual = g_new (Visual, 1);
visuals[nvisuals].xvisual = default_xvisual;
visuals[nvisuals].xvisual->visualid = nvisuals;
visuals[nvisuals].xvisual->bitspixel = bitspixel;
if (rastercaps & RC_PALETTE)
/* Either BI_RGB or BI_RLE_something
* .... or perhaps (!!) something else.
* Theoretically biCompression might be
* mmioFourCC('c','v','i','d') but I doubt it.
*/
if (bmi.bi.biCompression == BI_RGB)
{
visuals[nvisuals].visual.type = GDK_VISUAL_PSEUDO_COLOR;
numcolors = GetDeviceCaps (gdk_DC, NUMCOLORS);
sizepalette = GetDeviceCaps (gdk_DC, SIZEPALETTE);
colorres = GetDeviceCaps (gdk_DC, COLORRES);
visuals[nvisuals].xvisual->map_entries = sizepalette;
/* It's 555 */
bitspixel = 15;
system_visual->visual.red_mask = 0x00007C00;
system_visual->visual.green_mask = 0x000003E0;
system_visual->visual.blue_mask = 0x0000001F;
}
else if (bitspixel == 1)
{
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_GRAY;
visuals[nvisuals].xvisual->map_entries = 2;
}
else if (bitspixel == 4)
else
{
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_COLOR;
visuals[nvisuals].xvisual->map_entries = 16;
g_assert_not_reached ();
}
else if (bitspixel == 8)
}
else
{
DWORD allmasks =
bmi.u.fields[0] | bmi.u.fields[1] | bmi.u.fields[2];
int k = 0;
while (allmasks)
{
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_COLOR;
visuals[nvisuals].xvisual->map_entries = 256;
if (allmasks&1)
k++;
allmasks/=2;
}
else if (bitspixel == 16)
{
visuals[nvisuals].visual.type = GDK_VISUAL_TRUE_COLOR;
#if 1
/* This code by Mike Enright,
* see http://www.users.cts.com/sd/m/menright/display.html
*/
memset (&bmi, 0, sizeof (bmi));
bmi.bi.biSize = sizeof (bmi.bi);
hbm = CreateCompatibleBitmap (gdk_DC, 1, 1);
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
DeleteObject (hbm);
if (bmi.bi.biCompression != BI_BITFIELDS)
{
/* Either BI_RGB or BI_RLE_something
* .... or perhaps (!!) something else.
* Theoretically biCompression might be
* mmioFourCC('c','v','i','d') but I doubt it.
*/
if (bmi.bi.biCompression == BI_RGB)
{
/* It's 555 */
bitspixel = 15;
visuals[nvisuals].visual.red_mask = 0x00007C00;
visuals[nvisuals].visual.green_mask = 0x000003E0;
visuals[nvisuals].visual.blue_mask = 0x0000001F;
}
else
{
g_assert_not_reached ();
}
}
else
{
DWORD allmasks =
bmi.u.fields[0] | bmi.u.fields[1] | bmi.u.fields[2];
int k = 0;
while (allmasks)
{
if (allmasks&1)
k++;
allmasks/=2;
}
bitspixel = k;
visuals[nvisuals].visual.red_mask = bmi.u.fields[0];
visuals[nvisuals].visual.green_mask = bmi.u.fields[1];
visuals[nvisuals].visual.blue_mask = bmi.u.fields[2];
}
bitspixel = k;
system_visual->visual.red_mask = bmi.u.fields[0];
system_visual->visual.green_mask = bmi.u.fields[1];
system_visual->visual.blue_mask = bmi.u.fields[2];
}
#else
/* Old, incorrect (but still working) code. */
/* Old, incorrect (but still working) code. */
#if 0
visuals[nvisuals].visual.red_mask = 0x0000F800;
visuals[nvisuals].visual.green_mask = 0x000007E0;
visuals[nvisuals].visual.blue_mask = 0x0000001F;
system_visual->visual.red_mask = 0x0000F800;
system_visual->visual.green_mask = 0x000007E0;
system_visual->visual.blue_mask = 0x0000001F;
#else
visuals[nvisuals].visual.red_mask = 0x00007C00;
visuals[nvisuals].visual.green_mask = 0x000003E0;
visuals[nvisuals].visual.blue_mask = 0x0000001F;
system_visual->visual.red_mask = 0x00007C00;
system_visual->visual.green_mask = 0x000003E0;
system_visual->visual.blue_mask = 0x0000001F;
#endif
#endif
}
else if (bitspixel == 24 || bitspixel == 32)
{
visuals[nvisuals].visual.type = GDK_VISUAL_TRUE_COLOR;
visuals[nvisuals].visual.red_mask = 0x00FF0000;
visuals[nvisuals].visual.green_mask = 0x0000FF00;
visuals[nvisuals].visual.blue_mask = 0x000000FF;
}
else
g_error ("gdk_visual_init: unsupported BITSPIXEL: %d\n", bitspixel);
visuals[nvisuals].visual.depth = bitspixel;
visuals[nvisuals].visual.byte_order = GDK_LSB_FIRST;
visuals[nvisuals].visual.bits_per_rgb = 42; /* Not used? */
if ((visuals[nvisuals].visual.type == GDK_VISUAL_TRUE_COLOR) ||
(visuals[nvisuals].visual.type == GDK_VISUAL_DIRECT_COLOR))
{
gdk_visual_decompose_mask (visuals[nvisuals].visual.red_mask,
&visuals[nvisuals].visual.red_shift,
&visuals[nvisuals].visual.red_prec);
gdk_visual_decompose_mask (visuals[nvisuals].visual.green_mask,
&visuals[nvisuals].visual.green_shift,
&visuals[nvisuals].visual.green_prec);
gdk_visual_decompose_mask (visuals[nvisuals].visual.blue_mask,
&visuals[nvisuals].visual.blue_shift,
&visuals[nvisuals].visual.blue_prec);
visuals[nvisuals].xvisual->map_entries =
1 << (MAX (visuals[nvisuals].visual.red_prec,
MAX (visuals[nvisuals].visual.green_prec,
visuals[nvisuals].visual.blue_prec)));
}
else
{
visuals[nvisuals].visual.red_mask = 0;
visuals[nvisuals].visual.red_shift = 0;
visuals[nvisuals].visual.red_prec = 0;
visuals[nvisuals].visual.green_mask = 0;
visuals[nvisuals].visual.green_shift = 0;
visuals[nvisuals].visual.green_prec = 0;
visuals[nvisuals].visual.blue_mask = 0;
visuals[nvisuals].visual.blue_shift = 0;
visuals[nvisuals].visual.blue_prec = 0;
}
visuals[nvisuals].visual.colormap_size = visuals[nvisuals].xvisual->map_entries;
nvisuals += 1;
}
}
for (i = 0; i < nvisuals; i++)
else if (bitspixel == 24 || bitspixel == 32)
{
for (j = i+1; j < nvisuals; j++)
{
if (visuals[j].visual.depth >= visuals[i].visual.depth)
{
if ((visuals[j].visual.depth == 8) && (visuals[i].visual.depth == 8))
{
if (visuals[j].visual.type == GDK_VISUAL_PSEUDO_COLOR)
{
temp_visual = visuals[j];
visuals[j] = visuals[i];
visuals[i] = temp_visual;
}
else if ((visuals[i].visual.type != GDK_VISUAL_PSEUDO_COLOR) &&
visuals[j].visual.type > visuals[i].visual.type)
{
temp_visual = visuals[j];
visuals[j] = visuals[i];
visuals[i] = temp_visual;
}
}
else if ((visuals[j].visual.depth > visuals[i].visual.depth) ||
((visuals[j].visual.depth == visuals[i].visual.depth) &&
(visuals[j].visual.type > visuals[i].visual.type)))
{
temp_visual = visuals[j];
visuals[j] = visuals[i];
visuals[i] = temp_visual;
}
}
}
system_visual->visual.type = GDK_VISUAL_TRUE_COLOR;
system_visual->visual.red_mask = 0x00FF0000;
system_visual->visual.green_mask = 0x0000FF00;
system_visual->visual.blue_mask = 0x000000FF;
}
else
g_error ("gdk_visual_init: unsupported BITSPIXEL: %d\n", bitspixel);
for (i = 0; i < nvisuals; i++)
if (default_xvisual->visualid == visuals[i].xvisual->visualid)
{
system_visual = &visuals[i];
break;
}
system_visual->visual.depth = bitspixel;
system_visual->visual.byte_order = GDK_LSB_FIRST;
system_visual->visual.bits_per_rgb = 42; /* Not used? */
navailable_depths = 0;
for (i = 0; i < npossible_depths; i++)
if ((system_visual->visual.type == GDK_VISUAL_TRUE_COLOR) ||
(system_visual->visual.type == GDK_VISUAL_DIRECT_COLOR))
{
for (j = 0; j < nvisuals; j++)
{
if (visuals[j].visual.depth == possible_depths[i])
{
available_depths[navailable_depths++] = visuals[j].visual.depth;
break;
}
}
gdk_visual_decompose_mask (system_visual->visual.red_mask,
&system_visual->visual.red_shift,
&system_visual->visual.red_prec);
gdk_visual_decompose_mask (system_visual->visual.green_mask,
&system_visual->visual.green_shift,
&system_visual->visual.green_prec);
gdk_visual_decompose_mask (system_visual->visual.blue_mask,
&system_visual->visual.blue_shift,
&system_visual->visual.blue_prec);
system_visual->xvisual->map_entries =
1 << (MAX (system_visual->visual.red_prec,
MAX (system_visual->visual.green_prec,
system_visual->visual.blue_prec)));
}
else
{
system_visual->visual.red_mask = 0;
system_visual->visual.red_shift = 0;
system_visual->visual.red_prec = 0;