Commit 43696e84 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Convert GdkVisual to a GObject.

2001-06-29  Alex Larsson  <alexl@redhat.com>

	* gdk/gdkvisual.h:
	* gdk/gdkcolor.c:
	* gdk/x11/gdkx.h:
	* gdk/x11/gdkvisual-x11.c:
	Convert GdkVisual to a GObject.

	* gdk/gdkinput.h:
	* gdk/gdkevents.c:
	* gdk/x11/gdkinputprivate.h:
	* gdk/x11/gdkinput-gxi.c:
	* gdk/x11/gdkinput-none.c:
	* gdk/x11/gdkinput-x11.c:
	* gdk/x11/gdkinput-xfree.c:
	* gdk/x11/gdkinput.c:
	Convert GdkDevice to a GObject.
parent ee5ff7dd
2001-06-29 Alex Larsson <alexl@redhat.com>
* gdk/gdkvisual.h:
* gdk/gdkcolor.c:
* gdk/x11/gdkx.h:
* gdk/x11/gdkvisual-x11.c:
Convert GdkVisual to a GObject.
* gdk/gdkinput.h:
* gdk/gdkevents.c:
* gdk/x11/gdkinputprivate.h:
* gdk/x11/gdkinput-gxi.c:
* gdk/x11/gdkinput-none.c:
* gdk/x11/gdkinput-x11.c:
* gdk/x11/gdkinput-xfree.c:
* gdk/x11/gdkinput.c:
Convert GdkDevice to a GObject.
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
......
2001-06-29 Alex Larsson <alexl@redhat.com>
* gdk/gdkvisual.h:
* gdk/gdkcolor.c:
* gdk/x11/gdkx.h:
* gdk/x11/gdkvisual-x11.c:
Convert GdkVisual to a GObject.
* gdk/gdkinput.h:
* gdk/gdkevents.c:
* gdk/x11/gdkinputprivate.h:
* gdk/x11/gdkinput-gxi.c:
* gdk/x11/gdkinput-none.c:
* gdk/x11/gdkinput-x11.c:
* gdk/x11/gdkinput-xfree.c:
* gdk/x11/gdkinput.c:
Convert GdkDevice to a GObject.
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
......
2001-06-29 Alex Larsson <alexl@redhat.com>
* gdk/gdkvisual.h:
* gdk/gdkcolor.c:
* gdk/x11/gdkx.h:
* gdk/x11/gdkvisual-x11.c:
Convert GdkVisual to a GObject.
* gdk/gdkinput.h:
* gdk/gdkevents.c:
* gdk/x11/gdkinputprivate.h:
* gdk/x11/gdkinput-gxi.c:
* gdk/x11/gdkinput-none.c:
* gdk/x11/gdkinput-x11.c:
* gdk/x11/gdkinput-xfree.c:
* gdk/x11/gdkinput.c:
Convert GdkDevice to a GObject.
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
......
2001-06-29 Alex Larsson <alexl@redhat.com>
* gdk/gdkvisual.h:
* gdk/gdkcolor.c:
* gdk/x11/gdkx.h:
* gdk/x11/gdkvisual-x11.c:
Convert GdkVisual to a GObject.
* gdk/gdkinput.h:
* gdk/gdkevents.c:
* gdk/x11/gdkinputprivate.h:
* gdk/x11/gdkinput-gxi.c:
* gdk/x11/gdkinput-none.c:
* gdk/x11/gdkinput-x11.c:
* gdk/x11/gdkinput-xfree.c:
* gdk/x11/gdkinput.c:
Convert GdkDevice to a GObject.
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
......
2001-06-29 Alex Larsson <alexl@redhat.com>
* gdk/gdkvisual.h:
* gdk/gdkcolor.c:
* gdk/x11/gdkx.h:
* gdk/x11/gdkvisual-x11.c:
Convert GdkVisual to a GObject.
* gdk/gdkinput.h:
* gdk/gdkevents.c:
* gdk/x11/gdkinputprivate.h:
* gdk/x11/gdkinput-gxi.c:
* gdk/x11/gdkinput-none.c:
* gdk/x11/gdkinput-x11.c:
* gdk/x11/gdkinput-xfree.c:
* gdk/x11/gdkinput.c:
Convert GdkDevice to a GObject.
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
......
2001-06-29 Alex Larsson <alexl@redhat.com>
* gdk/gdkvisual.h:
* gdk/gdkcolor.c:
* gdk/x11/gdkx.h:
* gdk/x11/gdkvisual-x11.c:
Convert GdkVisual to a GObject.
* gdk/gdkinput.h:
* gdk/gdkevents.c:
* gdk/x11/gdkinputprivate.h:
* gdk/x11/gdkinput-gxi.c:
* gdk/x11/gdkinput-none.c:
* gdk/x11/gdkinput-x11.c:
* gdk/x11/gdkinput-xfree.c:
* gdk/x11/gdkinput.c:
Convert GdkDevice to a GObject.
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
......
2001-06-29 Alex Larsson <alexl@redhat.com>
* gdk/gdkvisual.h:
* gdk/gdkcolor.c:
* gdk/x11/gdkx.h:
* gdk/x11/gdkvisual-x11.c:
Convert GdkVisual to a GObject.
* gdk/gdkinput.h:
* gdk/gdkevents.c:
* gdk/x11/gdkinputprivate.h:
* gdk/x11/gdkinput-gxi.c:
* gdk/x11/gdkinput-none.c:
* gdk/x11/gdkinput-x11.c:
* gdk/x11/gdkinput-xfree.c:
* gdk/x11/gdkinput.c:
Convert GdkDevice to a GObject.
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
......
......@@ -230,21 +230,3 @@ gdk_color_get_type (void)
FALSE);
return our_type;
}
/* We define this here to avoid having to create a new .C file just for this
* function. The rest of GdkVisual is platform-specific
*/
GType
gdk_visual_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static ("GdkVisual",
NULL,
(GBoxedCopyFunc)gdk_visual_ref,
(GBoxedFreeFunc)gdk_visual_unref,
TRUE);
return our_type;
}
......@@ -1016,32 +1016,3 @@ gdk_event_get_type (void)
FALSE);
return our_type;
}
/* These functions are defined here to avoid a new C file, as GdkDevice is
* platform specific. (similar to how gdk_visual_get_type() is in gdkcolor.c)
*/
GdkDevice *
gdk_device_ref (GdkDevice *device)
{
return device;
}
void
gdk_device_unref (GdkDevice *device)
{
return;
}
GType
gdk_device_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static ("GdkDevice",
NULL,
(GBoxedCopyFunc)gdk_device_ref,
(GBoxedFreeFunc)gdk_device_unref,
TRUE);
return our_type;
}
......@@ -7,11 +7,17 @@
extern "C" {
#endif /* __cplusplus */
#define GDK_TYPE_DEVICE (gdk_device_get_type ())
#define GDK_TYPE_DEVICE (gdk_device_get_type ())
#define GDK_DEVICE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DEVICE, GdkDevice))
#define GDK_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DEVICE, GdkDeviceClass))
#define GDK_IS_DEVICE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DEVICE))
#define GDK_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DEVICE))
#define GDK_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DEVICE, GdkDeviceClass))
typedef struct _GdkDeviceKey GdkDeviceKey;
typedef struct _GdkDeviceAxis GdkDeviceAxis;
typedef struct _GdkDevice GdkDevice;
typedef struct _GdkDeviceClass GdkDeviceClass;
typedef struct _GdkTimeCoord GdkTimeCoord;
typedef enum
......@@ -63,6 +69,7 @@ struct _GdkDeviceAxis
struct _GdkDevice
{
GObject parent_instance;
/* All fields are read-only */
gchar *name;
......@@ -89,11 +96,6 @@ struct _GdkTimeCoord
};
GType gdk_device_get_type (void);
/* these two are no ops provided for the boxed type code */
/* XXXX do they need to be exposed as public APIs at all? */
GdkDevice *gdk_device_ref (GdkDevice *device);
void gdk_device_unref (GdkDevice *device);
/* Returns a list of GdkDevice * */
GList * gdk_devices_list (void);
......
......@@ -7,7 +7,14 @@
extern "C" {
#endif /* __cplusplus */
#define GDK_TYPE_VISUAL gdk_visual_get_type ()
#define GDK_TYPE_VISUAL (gdk_visual_get_type ())
#define GDK_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_VISUAL, GdkVisual))
#define GDK_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_VISUAL, GdkVisualClass))
#define GDK_IS_VISUAL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_VISUAL))
#define GDK_IS_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_VISUAL))
#define GDK_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_VISUAL, GdkVisualClass))
typedef struct _GdkVisualClass GdkVisualClass;
/* Types of visuals.
* StaticGray:
......@@ -41,6 +48,8 @@ typedef enum
*/
struct _GdkVisual
{
GObject parent_instance;
GdkVisualType type;
gint depth;
GdkByteOrder byte_order;
......@@ -71,9 +80,10 @@ GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
GdkVisual* gdk_visual_get_best_with_both (gint depth,
GdkVisualType visual_type);
/* Actually, these are no-ops... */
GdkVisual* gdk_visual_ref (GdkVisual *visual);
void gdk_visual_unref (GdkVisual *visual);
#ifndef GTK_DISABLE_DEPRECATED
#define gdk_visual_ref(v) g_object_ref(v)
#define gdk_visual_unref(v) g_object_unref(v)
#endif
void gdk_query_depths (gint **depths,
gint *count);
......
......@@ -53,6 +53,7 @@ gdk_input_init(void)
{
GList *tmp_list;
_gdk_init_input_core ();
gdk_input_ignore_core = FALSE;
gdk_input_core_pointer = NULL;
......
......@@ -29,6 +29,7 @@
void
gdk_input_init (void)
{
_gdk_init_input_core ();
gdk_input_devices = g_list_append (NULL, gdk_core_pointer);
gdk_input_ignore_core = FALSE;
......
......@@ -96,7 +96,7 @@ gdk_input_device_new (XDeviceInfo *device, gint include_core)
XAnyClassPtr class;
gint i,j;
gdkdev = g_new(GdkDevicePrivate,1);
gdkdev = g_object_new (GDK_TYPE_DEVICE_PRIVATE, 1);
gdkdev->deviceid = device->id;
if (device->name[0])
......@@ -245,7 +245,7 @@ gdk_input_device_new (XDeviceInfo *device, gint include_core)
g_free (gdkdev->info.keys);
if (gdkdev->info.axes)
g_free (gdkdev->info.axes);
g_free (gdkdev);
g_object_unref (gdkdev);
return NULL;
}
......
......@@ -33,6 +33,7 @@ static void gdk_input_check_proximity (void);
void
gdk_input_init(void)
{
_gdk_init_input_core ();
gdk_input_ignore_core = FALSE;
gdk_input_common_init(FALSE);
}
......
......@@ -39,21 +39,7 @@ static GdkDeviceAxis gdk_input_core_axes[] = {
{ GDK_AXIS_Y, 0, 0 }
};
static const GdkDevice gdk_input_core_info =
{
"Core Pointer",
GDK_SOURCE_MOUSE,
GDK_MODE_SCREEN,
TRUE,
2,
gdk_input_core_axes,
0,
NULL
};
GdkDevice *gdk_core_pointer = (GdkDevice *)&gdk_input_core_info;
GdkDevice *gdk_core_pointer = NULL;
/* Global variables */
......@@ -65,6 +51,61 @@ gint gdk_input_ignore_core;
GList *gdk_input_devices;
GList *gdk_input_windows;
void
_gdk_init_input_core (void)
{
gdk_core_pointer = g_object_new (GDK_TYPE_DEVICE, NULL);
gdk_core_pointer->name = "Core Pointer";
gdk_core_pointer->source = GDK_SOURCE_MOUSE;
gdk_core_pointer->mode = GDK_MODE_SCREEN;
gdk_core_pointer->has_cursor = TRUE;
gdk_core_pointer->num_axes = 2;
gdk_core_pointer->axes = gdk_input_core_axes;
gdk_core_pointer->num_keys = 0;
gdk_core_pointer->keys = NULL;
}
static void
gdk_device_finalize (GObject *object)
{
g_error ("A GdkDevice object was finalized. This should not happen");
}
static void
gdk_device_class_init (GObjectClass *class)
{
class->finalize = gdk_device_finalize;
}
GType
gdk_device_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDeviceClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_device_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDevicePrivate),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
"GdkDevice",
&object_info, 0);
}
return object_type;
}
GList *
gdk_devices_list (void)
{
......
......@@ -38,6 +38,7 @@
#include <X11/extensions/XInput.h>
#endif
typedef struct _GdkAxisInfo GdkAxisInfo;
typedef struct _GdkDevicePrivate GdkDevicePrivate;
typedef struct _GdkInputWindow GdkInputWindow;
......@@ -94,6 +95,11 @@ struct _GdkDevicePrivate
#endif /* !XINPUT_NONE */
};
struct _GdkDeviceClass
{
GObjectClass parent_class;
};
struct _GdkInputWindow
{
/* gdk window */
......@@ -114,6 +120,8 @@ struct _GdkInputWindow
gint grabbed;
};
/* Global data */
#define GDK_IS_CORE(d) (((GdkDevice *)(d)) == gdk_core_pointer)
......@@ -132,6 +140,7 @@ GdkInputWindow *gdk_input_window_find (GdkWindow *window);
void gdk_input_window_destroy (GdkWindow *window);
GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
gint n_events);
void _gdk_init_input_core (void);
/* The following functions are provided by each implementation
* (xfree, gxi, and none)
......
......@@ -41,7 +41,7 @@ static gboolean gdk_visual_equal (Visual *a,
static GdkVisualPrivate *system_visual;
static GdkVisualPrivate *visuals;
static GdkVisualPrivate **visuals;
static gint nvisuals;
static gint available_depths[7];
......@@ -66,6 +66,48 @@ static const gchar* visual_names[] =
static GHashTable *visual_hash = NULL;
static void
gdk_visual_finalize (GObject *object)
{
g_error ("A GdkVisual object was finalized. This should not happen");
}
static void
gdk_visual_class_init (GObjectClass *class)
{
class->finalize = gdk_visual_finalize;
}
GType
gdk_visual_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkVisualClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_visual_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkVisualPrivate),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
"GdkVisual",
&object_info, 0);
}
return object_type;
}
void
gdk_visual_init (void)
{
......@@ -85,14 +127,17 @@ gdk_visual_init (void)
XVisualInfo *visual_list;
XVisualInfo visual_template;
GdkVisualPrivate temp_visual;
GdkVisualPrivate *temp_visual;
Visual *default_xvisual;
int nxvisuals;
int i, j;
visual_template.screen = gdk_screen;
visual_list = XGetVisualInfo (gdk_display, VisualScreenMask, &visual_template, &nxvisuals);
visuals = g_new (GdkVisualPrivate, nxvisuals);
visuals = g_new (GdkVisualPrivate *, nxvisuals);
for (i = 0; i < nxvisuals; i++)
visuals[i] = g_object_new (GDK_TYPE_VISUAL, NULL);
default_xvisual = DefaultVisual (gdk_display, gdk_screen);
......@@ -108,64 +153,64 @@ gdk_visual_init (void)
#endif /* __cplusplus */
{
case StaticGray:
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_GRAY;
visuals[nvisuals]->visual.type = GDK_VISUAL_STATIC_GRAY;
break;
case GrayScale:
visuals[nvisuals].visual.type = GDK_VISUAL_GRAYSCALE;
visuals[nvisuals]->visual.type = GDK_VISUAL_GRAYSCALE;
break;
case StaticColor:
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_COLOR;
visuals[nvisuals]->visual.type = GDK_VISUAL_STATIC_COLOR;
break;
case PseudoColor:
visuals[nvisuals].visual.type = GDK_VISUAL_PSEUDO_COLOR;
visuals[nvisuals]->visual.type = GDK_VISUAL_PSEUDO_COLOR;
break;
case TrueColor:
visuals[nvisuals].visual.type = GDK_VISUAL_TRUE_COLOR;
visuals[nvisuals]->visual.type = GDK_VISUAL_TRUE_COLOR;
break;
case DirectColor:
visuals[nvisuals].visual.type = GDK_VISUAL_DIRECT_COLOR;
visuals[nvisuals]->visual.type = GDK_VISUAL_DIRECT_COLOR;
break;
}
visuals[nvisuals].visual.depth = visual_list[i].depth;
visuals[nvisuals].visual.byte_order =
visuals[nvisuals]->visual.depth = visual_list[i].depth;
visuals[nvisuals]->visual.byte_order =
(ImageByteOrder(gdk_display) == LSBFirst) ?
GDK_LSB_FIRST : GDK_MSB_FIRST;
visuals[nvisuals].visual.red_mask = visual_list[i].red_mask;
visuals[nvisuals].visual.green_mask = visual_list[i].green_mask;
visuals[nvisuals].visual.blue_mask = visual_list[i].blue_mask;
visuals[nvisuals].visual.colormap_size = visual_list[i].colormap_size;
visuals[nvisuals].visual.bits_per_rgb = visual_list[i].bits_per_rgb;
visuals[nvisuals].xvisual = visual_list[i].visual;
if ((visuals[nvisuals].visual.type == GDK_VISUAL_TRUE_COLOR) ||
(visuals[nvisuals].visual.type == GDK_VISUAL_DIRECT_COLOR))
visuals[nvisuals]->visual.red_mask = visual_list[i].red_mask;
visuals[nvisuals]->visual.green_mask = visual_list[i].green_mask;
visuals[nvisuals]->visual.blue_mask = visual_list[i].blue_mask;
visuals[nvisuals]->visual.colormap_size = visual_list[i].colormap_size;
visuals[nvisuals]->visual.bits_per_rgb = visual_list[i].bits_per_rgb;
visuals[nvisuals]->xvisual = visual_list[i].visual;
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.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.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);
gdk_visual_decompose_mask (visuals[nvisuals]->visual.blue_mask,
&visuals[nvisuals]->visual.blue_shift,
&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.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.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.blue_mask = 0;
visuals[nvisuals]->visual.blue_shift = 0;
visuals[nvisuals]->visual.blue_prec = 0;
}
nvisuals += 1;
......@@ -179,27 +224,27 @@ gdk_visual_init (void)
{
for (j = i+1; j < nvisuals; j++)
{
if (visuals[j].visual.depth >= visuals[i].visual.depth)
if (visuals[j]->visual.depth >= visuals[i]->visual.depth)
{
if ((visuals[j].visual.depth == 8) && (visuals[i].visual.depth == 8))
if ((visuals[j]->visual.depth == 8) && (visuals[i]->visual.depth == 8))
{
if (visuals[j].visual.type == GDK_VISUAL_PSEUDO_COLOR)
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)
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)))
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];
......@@ -210,9 +255,9 @@ gdk_visual_init (void)
}
for (i = 0; i < nvisuals; i++)
if (default_xvisual->visualid == visuals[i].xvisual->visualid)
if (default_xvisual->visualid == visuals[i]->xvisual->visualid)
{
system_visual = &visuals[i];
system_visual = visuals[i];
break;
}
......@@ -220,8 +265,8 @@ gdk_visual_init (void)
if (gdk_debug_flags & GDK_DEBUG_MISC)
for (i = 0; i < nvisuals; i++)
g_message ("visual: %s: %d",
visual_names[visuals[i].visual.type],
visuals[i].visual.depth);
visual_names[visuals[i]->visual.type],
visuals[i]->visual.depth);
#endif /* G_ENABLE_DEBUG */
navailable_depths = 0;
......@@ -229,9 +274,9 @@ gdk_visual_init (void)
{
for (j = 0; j < nvisuals; j++)
{
if (visuals[j].visual.depth == possible_depths[i])
if (visuals[j]->visual.depth == possible_depths[i])
{
available_depths[navailable_depths++] = visuals[j].visual.depth;
available_depths[navailable_depths++] = visuals[j]->visual.depth;
break;
}
}
......@@ -245,33 +290,21 @@ gdk_visual_init (void)
{
for (j = 0; j < nvisuals; j++)
{
if (visuals[j].visual.type == possible_types[i])
if (visuals[j]->visual.type == possible_types[i])
{
available_types[navailable_types++] = visuals[j].visual.type;
available_types[navailable_types++] = visuals[j]->visual.type;
break;
}
}
}
for (i = 0; i < nvisuals; i++)
gdk_visual_add ((GdkVisual*) &visuals[i]);
gdk_visual_add ((GdkVisual*) visuals[i]);
if (npossible_types == 0)
g_error ("unable to find a usable visual type");
}
GdkVisual*
gdk_visual_ref (GdkVisual *visual)
{
return visual;
}
void
gdk_visual_unref (GdkVisual *visual)
{
return;
}
gint
gdk_visual_get_best_depth (void)
{
......@@ -293,7 +326,7 @@ gdk_visual_get_system (void)
GdkVisual*
gdk_visual_get_best (void)
{
return ((GdkVisual*) &(visuals[0]));
return ((GdkVisual*) visuals[0]);
}