gdk/win32/gdkcolor-win32.c gdk/win32/gdkprivate-win32.h Changes to make

2000-07-12  Tor Lillqvist  <tml@iki.fi>

* gdk/win32/gdkcc-win32.c:
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Changes to make compilable, with new
GDK object structure.
This commit is contained in:
Tor Lillqvist
2000-07-11 22:39:34 +00:00
committed by Tor Lillqvist
parent 2823963703
commit 1f581a961e
11 changed files with 223 additions and 105 deletions

View File

@ -25,6 +25,12 @@
* gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth, * gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth,
not the Win32 bitspixel value. not the Win32 bitspixel value.
* gdk/win32/gdkcc-win32.c:
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Changes to make compilable, with new
GDK object structure.
Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org> Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org>
* docs/tutorial/gtk_tut_12.es.sgml (name): * docs/tutorial/gtk_tut_12.es.sgml (name):

View File

@ -25,6 +25,12 @@
* gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth, * gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth,
not the Win32 bitspixel value. not the Win32 bitspixel value.
* gdk/win32/gdkcc-win32.c:
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Changes to make compilable, with new
GDK object structure.
Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org> Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org>
* docs/tutorial/gtk_tut_12.es.sgml (name): * docs/tutorial/gtk_tut_12.es.sgml (name):

View File

@ -25,6 +25,12 @@
* gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth, * gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth,
not the Win32 bitspixel value. not the Win32 bitspixel value.
* gdk/win32/gdkcc-win32.c:
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Changes to make compilable, with new
GDK object structure.
Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org> Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org>
* docs/tutorial/gtk_tut_12.es.sgml (name): * docs/tutorial/gtk_tut_12.es.sgml (name):

View File

@ -25,6 +25,12 @@
* gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth, * gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth,
not the Win32 bitspixel value. not the Win32 bitspixel value.
* gdk/win32/gdkcc-win32.c:
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Changes to make compilable, with new
GDK object structure.
Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org> Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org>
* docs/tutorial/gtk_tut_12.es.sgml (name): * docs/tutorial/gtk_tut_12.es.sgml (name):

View File

@ -25,6 +25,12 @@
* gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth, * gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth,
not the Win32 bitspixel value. not the Win32 bitspixel value.
* gdk/win32/gdkcc-win32.c:
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Changes to make compilable, with new
GDK object structure.
Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org> Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org>
* docs/tutorial/gtk_tut_12.es.sgml (name): * docs/tutorial/gtk_tut_12.es.sgml (name):

View File

@ -25,6 +25,12 @@
* gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth, * gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth,
not the Win32 bitspixel value. not the Win32 bitspixel value.
* gdk/win32/gdkcc-win32.c:
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Changes to make compilable, with new
GDK object structure.
Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org> Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org>
* docs/tutorial/gtk_tut_12.es.sgml (name): * docs/tutorial/gtk_tut_12.es.sgml (name):

View File

@ -25,6 +25,12 @@
* gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth, * gdk/win32/gdkimage-win32.c (gdk_image_new): Use the visual's depth,
not the Win32 bitspixel value. not the Win32 bitspixel value.
* gdk/win32/gdkcc-win32.c:
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Changes to make compilable, with new
GDK object structure.
Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org> Tue Jul 11 20:59:35 2000 Tim Janik <timj@gtk.org>
* docs/tutorial/gtk_tut_12.es.sgml (name): * docs/tutorial/gtk_tut_12.es.sgml (name):

View File

@ -339,7 +339,6 @@ init_true_color (GdkColorContext *cc)
} }
cc->num_colors = (cc->visual->red_mask | cc->visual->green_mask | cc->visual->blue_mask) + 1; cc->num_colors = (cc->visual->red_mask | cc->visual->green_mask | cc->visual->blue_mask) + 1;
cc->white_pixel = 0xffffff; cc->white_pixel = 0xffffff;
cc->black_pixel = 0; cc->black_pixel = 0;
} }
@ -389,7 +388,7 @@ init_palette (GdkColorContext *cc)
free_hash_entry, free_hash_entry,
NULL); NULL);
g_hash_table_destroy (cc->color_hash); g_hash_table_destroy (cc->color_hash);
cc->color_hash = g_hash_table_new (hash_color, compare_colors); cc->color_hash = NULL;
} }
cc->palette = NULL; cc->palette = NULL;

View File

@ -34,6 +34,10 @@
#include "gdkcolor.h" #include "gdkcolor.h"
#include "gdkprivate-win32.h" #include "gdkprivate-win32.h"
#define GDK_COLORMAP_PRIVATE_DATA(cmap) ((GdkColormapPrivateWin32 *) GDK_COLORMAP (cmap)->windowing_data)
static void free_colormap (Colormap colormap);
static gint gdk_colormap_match_color (GdkColormap *cmap, static gint gdk_colormap_match_color (GdkColormap *cmap,
GdkColor *color, GdkColor *color,
const gchar *available); const gchar *available);
@ -43,8 +47,88 @@ static guint gdk_colormap_hash (Colormap *cmap);
static gint gdk_colormap_cmp (Colormap *a, static gint gdk_colormap_cmp (Colormap *a,
Colormap *b); Colormap *b);
static void gdk_colormap_init (GdkColormap *colormap);
static void gdk_colormap_class_init (GdkColormapClass *klass);
static void gdk_colormap_finalize (GObject *object);
static gpointer parent_class = NULL;
static GHashTable *colormap_hash = NULL; static GHashTable *colormap_hash = NULL;
GType
gdk_colormap_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkColormapClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_colormap_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkColormap),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_colormap_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
"GdkColormap",
&object_info);
}
return object_type;
}
static void
gdk_colormap_init (GdkColormap *colormap)
{
GdkColormapPrivateWin32 *private;
private = g_new (GdkColormapPrivateWin32, 1);
colormap->windowing_data = private;
private->hash = NULL;
private->last_sync_time = 0;
private->info = NULL;
colormap->size = 0;
colormap->colors = NULL;
}
static void
gdk_colormap_class_init (GdkColormapClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_colormap_finalize;
}
static void
gdk_colormap_finalize (GObject *object)
{
GdkColormap *colormap = GDK_COLORMAP (object);
GdkColormapPrivateWin32 *private = GDK_COLORMAP_PRIVATE_DATA (colormap);
gdk_colormap_remove (colormap);
free_colormap (private->xcolormap);
if (private->hash)
g_hash_table_destroy (private->hash);
g_free (private->info);
g_free (colormap->colors);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean static gboolean
alloc_color_cells(Colormap colormap, alloc_color_cells(Colormap colormap,
gboolean contig, gboolean contig,
@ -1326,33 +1410,27 @@ gdk_colormap_new (GdkVisual *visual,
g_return_val_if_fail (visual != NULL, NULL); g_return_val_if_fail (visual != NULL, NULL);
private = g_new (GdkColormapPrivateWin32, 1); colormap = g_object_new (gdk_colormap_get_type (), NULL);
colormap = (GdkColormap*) private; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
private->base.visual = visual; colormap->visual = visual;
private->base.ref_count = 1;
private->hash = NULL;
private->last_sync_time = 0;
private->info = NULL;
xvisual = ((GdkVisualPrivate*) visual)->xvisual; xvisual = ((GdkVisualPrivate*) visual)->xvisual;
colormap->size = visual->colormap_size; colormap->size = visual->colormap_size;
colormap->colors = g_new (GdkColor, colormap->size);
switch (visual->type) switch (visual->type)
{ {
case GDK_VISUAL_GRAYSCALE: case GDK_VISUAL_GRAYSCALE:
case GDK_VISUAL_PSEUDO_COLOR: case GDK_VISUAL_PSEUDO_COLOR:
private->info = g_new0 (GdkColorInfo, colormap->size); private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size);
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash, private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
(GCompareFunc) gdk_color_equal); (GCompareFunc) gdk_color_equal);
private->private_val = private_cmap; private->private_val = private_cmap;
private->xcolormap = create_colormap (gdk_root_window, xvisual, private->xcolormap = create_colormap (gdk_root_window, xvisual, private_cmap);
private_cmap);
if (private_cmap) if (private_cmap)
{ {
@ -1394,25 +1472,6 @@ gdk_colormap_new (GdkVisual *visual,
return colormap; return colormap;
} }
void
_gdk_colormap_real_destroy (GdkColormap *colormap)
{
GdkColormapPrivateWin32 *private = (GdkColormapPrivateWin32 *) colormap;
g_return_if_fail (colormap != NULL);
g_return_if_fail (private->base.ref_count == 0);
gdk_colormap_remove (colormap);
free_colormap (private->xcolormap);
if (private->hash)
g_hash_table_destroy (private->hash);
g_free (private->info);
g_free (colormap->colors);
g_free (colormap);
}
#define MIN_SYNC_TIME 2 #define MIN_SYNC_TIME 2
void void
@ -1420,7 +1479,7 @@ gdk_colormap_sync (GdkColormap *colormap,
gboolean force) gboolean force)
{ {
time_t current_time; time_t current_time;
GdkColormapPrivateWin32 *private = (GdkColormapPrivateWin32 *) colormap; GdkColormapPrivateWin32 *private = GDK_COLORMAP_PRIVATE_DATA (colormap);
XColor *xpalette; XColor *xpalette;
gint nlookup; gint nlookup;
gint i; gint i;
@ -1467,23 +1526,22 @@ gdk_colormap_get_system (void)
if (!colormap) if (!colormap)
{ {
private = g_new (GdkColormapPrivateWin32, 1); colormap = g_object_new (gdk_colormap_get_type (), NULL);
colormap = (GdkColormap*) private; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
private->xcolormap = default_colormap (); private->xcolormap = default_colormap ();
private->base.visual = gdk_visual_get_system (); colormap->visual = gdk_visual_get_system ();
private->private_val = FALSE; private->private_val = FALSE;
private->base.ref_count = 1;
private->hash = NULL; private->hash = NULL;
private->last_sync_time = 0; private->last_sync_time = 0;
private->info = NULL; private->info = NULL;
colormap->colors = NULL; colormap->colors = NULL;
colormap->size = private->base.visual->colormap_size; colormap->size = colormap->visual->colormap_size;
if ((private->base.visual->type == GDK_VISUAL_GRAYSCALE) || if ((colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
(private->base.visual->type == GDK_VISUAL_PSEUDO_COLOR)) (colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
{ {
private->info = g_new0 (GdkColorInfo, colormap->size); private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size); colormap->colors = g_new (GdkColor, colormap->size);
@ -1532,12 +1590,12 @@ gdk_colormap_change (GdkColormap *colormap,
int size; int size;
int i; int i;
g_return_if_fail (colormap != NULL); g_return_if_fail (GDK_IS_COLORMAP (colormap));
palette = g_new (XColor, ncolors); palette = g_new (XColor, ncolors);
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
switch (private->base.visual->type) switch (colormap->visual->type)
{ {
case GDK_VISUAL_GRAYSCALE: case GDK_VISUAL_GRAYSCALE:
case GDK_VISUAL_PSEUDO_COLOR: case GDK_VISUAL_PSEUDO_COLOR:
@ -1574,9 +1632,9 @@ gdk_colors_alloc (GdkColormap *colormap,
gint return_val; gint return_val;
gint i; gint i;
g_return_val_if_fail (colormap != NULL, 0); g_return_val_if_fail (GDK_IS_COLORMAP (colormap), 0);
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
return_val = alloc_color_cells (private->xcolormap, contiguous, return_val = alloc_color_cells (private->xcolormap, contiguous,
planes, nplanes, pixels, npixels); planes, nplanes, pixels, npixels);
@ -1622,13 +1680,13 @@ gdk_colors_free (GdkColormap *colormap,
gint npixels = 0; gint npixels = 0;
gint i; gint i;
g_return_if_fail (colormap != NULL); g_return_if_fail (GDK_IS_COLORMAP (colormap));
g_return_if_fail (in_pixels != NULL); g_return_if_fail (in_pixels != NULL);
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
if ((private->base.visual->type != GDK_VISUAL_PSEUDO_COLOR) && if ((colormap->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
(private->base.visual->type != GDK_VISUAL_GRAYSCALE)) (colormap->visual->type != GDK_VISUAL_GRAYSCALE))
return; return;
pixels = g_new (gulong, in_npixels); pixels = g_new (gulong, in_npixels);
@ -1670,13 +1728,13 @@ gdk_colormap_free_colors (GdkColormap *colormap,
gint npixels = 0; gint npixels = 0;
gint i; gint i;
g_return_if_fail (colormap != NULL); g_return_if_fail (GDK_IS_COLORMAP (colormap));
g_return_if_fail (colors != NULL); g_return_if_fail (colors != NULL);
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
if ((private->base.visual->type != GDK_VISUAL_PSEUDO_COLOR) && if ((colormap->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
(private->base.visual->type != GDK_VISUAL_GRAYSCALE)) (colormap->visual->type != GDK_VISUAL_GRAYSCALE))
return; return;
pixels = g_new (gulong, ncolors); pixels = g_new (gulong, ncolors);
@ -1718,7 +1776,7 @@ gdk_colormap_alloc1 (GdkColormap *colormap,
GdkColormapPrivateWin32 *private; GdkColormapPrivateWin32 *private;
XColor xcolor; XColor xcolor;
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
xcolor.peRed = color->red >> 8; xcolor.peRed = color->red >> 8;
xcolor.peGreen = color->green >> 8; xcolor.peGreen = color->green >> 8;
@ -1767,7 +1825,7 @@ gdk_colormap_alloc_colors_writeable (GdkColormap *colormap,
gboolean status; gboolean status;
gint i, index; gint i, index;
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
if (private->private_val) if (private->private_val)
{ {
@ -1826,7 +1884,7 @@ gdk_colormap_alloc_colors_private (GdkColormap *colormap,
gint nstore = 0; gint nstore = 0;
gint nremaining = 0; gint nremaining = 0;
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
index = -1; index = -1;
/* First, store the colors we have room for */ /* First, store the colors we have room for */
@ -1907,7 +1965,7 @@ gdk_colormap_alloc_colors_shared (GdkColormap *colormap,
gint nremaining = 0; gint nremaining = 0;
gint nfailed = 0; gint nfailed = 0;
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
index = -1; index = -1;
for (i=0; i<ncolors; i++) for (i=0; i<ncolors; i++)
@ -1999,7 +2057,7 @@ gdk_colormap_alloc_colors_pseudocolor (GdkColormap *colormap,
gint i; gint i;
gint nremaining = 0; gint nremaining = 0;
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
/* Check for an exact match among previously allocated colors */ /* Check for an exact match among previously allocated colors */
@ -2047,17 +2105,17 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
gint nremaining = 0; gint nremaining = 0;
XColor xcolor; XColor xcolor;
g_return_val_if_fail (colormap != NULL, FALSE); g_return_val_if_fail (GDK_IS_COLORMAP (colormap), FALSE);
g_return_val_if_fail (colors != NULL, FALSE); g_return_val_if_fail (colors != NULL, FALSE);
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
for (i=0; i<ncolors; i++) for (i=0; i<ncolors; i++)
{ {
success[i] = FALSE; success[i] = FALSE;
} }
switch (private->base.visual->type) switch (colormap->visual->type)
{ {
case GDK_VISUAL_PSEUDO_COLOR: case GDK_VISUAL_PSEUDO_COLOR:
case GDK_VISUAL_GRAYSCALE: case GDK_VISUAL_GRAYSCALE:
@ -2070,7 +2128,7 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
break; break;
case GDK_VISUAL_TRUE_COLOR: case GDK_VISUAL_TRUE_COLOR:
visual = private->base.visual; visual = colormap->visual;
for (i=0; i<ncolors; i++) for (i=0; i<ncolors; i++)
{ {
@ -2105,10 +2163,10 @@ gdk_color_change (GdkColormap *colormap,
GdkColormapPrivateWin32 *private; GdkColormapPrivateWin32 *private;
XColor xcolor; XColor xcolor;
g_return_val_if_fail (colormap != NULL, FALSE); g_return_val_if_fail (GDK_IS_COLORMAP (colormap), FALSE);
g_return_val_if_fail (color != NULL, FALSE); g_return_val_if_fail (color != NULL, FALSE);
private = (GdkColormapPrivateWin32 *) colormap; private = GDK_COLORMAP_PRIVATE_DATA (colormap);
xcolor.peRed = color->red >> 8; xcolor.peRed = color->red >> 8;
xcolor.peGreen = color->green >> 8; xcolor.peGreen = color->green >> 8;
@ -2181,7 +2239,7 @@ gdk_colormap_add (GdkColormap *cmap)
colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash, colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
(GCompareFunc) gdk_colormap_cmp); (GCompareFunc) gdk_colormap_cmp);
private = (GdkColormapPrivateWin32 *) cmap; private = GDK_COLORMAP_PRIVATE_DATA (cmap);
g_hash_table_insert (colormap_hash, &private->xcolormap, cmap); g_hash_table_insert (colormap_hash, &private->xcolormap, cmap);
} }
@ -2195,7 +2253,7 @@ gdk_colormap_remove (GdkColormap *cmap)
colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash, colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
(GCompareFunc) gdk_colormap_cmp); (GCompareFunc) gdk_colormap_cmp);
private = (GdkColormapPrivateWin32 *) cmap; private = GDK_COLORMAP_PRIVATE_DATA (cmap);
g_hash_table_remove (colormap_hash, &private->xcolormap); g_hash_table_remove (colormap_hash, &private->xcolormap);
} }

View File

@ -40,10 +40,10 @@ GdkGC * _gdk_win32_gc_new (GdkDrawable *drawable,
COLORREF gdk_colormap_color (GdkColormapPrivateWin32 *colormap_private, COLORREF gdk_colormap_color (GdkColormapPrivateWin32 *colormap_private,
gulong pixel); gulong pixel);
HDC gdk_gc_predraw (GdkDrawable *drawable, HDC gdk_gc_predraw (GdkDrawable *drawable,
GdkGCPrivate *gc_private, GdkGCWin32 *gcwin32,
GdkGCValuesMask usage); GdkGCValuesMask usage);
void gdk_gc_postdraw (GdkDrawable *drawable, void gdk_gc_postdraw (GdkDrawable *drawable,
GdkGCPrivate *gc_private, GdkGCWin32 *gcwin32,
GdkGCValuesMask usage); GdkGCValuesMask usage);
HRGN BitmapToRegion (HBITMAP hBmp); HRGN BitmapToRegion (HBITMAP hBmp);

View File

@ -182,7 +182,6 @@ typedef struct {
unsigned long base_pixel; unsigned long base_pixel;
} XStandardColormap; } XStandardColormap;
typedef struct _GdkGCWin32Data GdkGCWin32Data;
typedef struct _GdkDrawableWin32Data GdkDrawableWin32Data; typedef struct _GdkDrawableWin32Data GdkDrawableWin32Data;
typedef struct _GdkWindowWin32Data GdkWindowWin32Data; typedef struct _GdkWindowWin32Data GdkWindowWin32Data;
typedef struct _GdkWin32PositionInfo GdkWin32PositionInfo; typedef struct _GdkWin32PositionInfo GdkWin32PositionInfo;
@ -197,39 +196,6 @@ typedef struct _GdkICPrivate GdkICPrivate;
#define GDK_DRAWABLE_WIN32DATA(win) ((GdkDrawableWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data)) #define GDK_DRAWABLE_WIN32DATA(win) ((GdkDrawableWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
#define GDK_WINDOW_WIN32DATA(win) ((GdkWindowWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data)) #define GDK_WINDOW_WIN32DATA(win) ((GdkWindowWin32Data *)(((GdkDrawablePrivate*)(win))->klass_data))
#define GDK_GC_WIN32DATA(gc) ((GdkGCWin32Data *)(((GdkGCPrivate*)(gc))->klass_data))
struct _GdkGCWin32Data
{
GdkRegion *clip_region;
/* A Windows Device Context (DC) is not equivalent to an X11
* GC. We can use a DC only in the window for which it was
* allocated, or (in the case of a memory DC) with the bitmap that
* has been selected into it. Thus, we have to release and
* reallocate a DC each time the GdkGC is used to paint into a new
* window or pixmap. We thus keep all the necessary values in the
* GdkGCWin32Data struct.
*/
HDC xgc;
HRGN hcliprgn;
GdkGCValuesMask values_mask;
gulong foreground; /* Pixel values from GdkColor, */
gulong background; /* not Win32 COLORREFs */
GdkFont *font;
gint rop2;
GdkFill fill_style;
GdkPixmap *tile;
GdkPixmap *stipple;
GdkSubwindowMode subwindow_mode;
gint graphics_exposures;
gint pen_width;
DWORD pen_style;
HANDLE hwnd; /* If a DC is allocated, for which window
* or what bitmap is selected into it
*/
int saved_dc;
};
struct _GdkDrawableWin32Data struct _GdkDrawableWin32Data
{ {
@ -329,6 +295,60 @@ struct _GdkImagePrivateWin32
HBITMAP ximage; HBITMAP ximage;
}; };
typedef struct _GdkGCWin32 GdkGCWin32;
typedef struct _GdkGCWin32Class GdkGCWin32Class;
#define GDK_TYPE_GC_WIN32 (gdk_gc_win32_get_type ())
#define GDK_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_WIN32, GdkGCWin32))
#define GDK_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
#define GDK_IS_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_WIN32))
#define GDK_IS_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_WIN32))
#define GDK_GC_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
struct _GdkGCWin32
{
GdkGC parent_instance;
/* A Windows Device Context (DC) is not equivalent to an X11
* GC. We can use a DC only in the window for which it was
* allocated, or (in the case of a memory DC) with the bitmap that
* has been selected into it. Thus, we have to release and
* reallocate a DC each time the GdkGC is used to paint into a new
* window or pixmap. We thus keep all the necessary values in the
* GdkGCWin32 object.
*/
HDC xgc;
GdkRegion *clip_region;
HRGN hcliprgn;
GdkGCValuesMask values_mask;
gulong foreground; /* Pixel values from GdkColor, */
gulong background; /* not Win32 COLORREFs */
GdkFont *font;
gint rop2;
GdkFill fill_style;
GdkPixmap *tile;
GdkPixmap *stipple;
GdkSubwindowMode subwindow_mode;
gint graphics_exposures;
gint pen_width;
DWORD pen_style;
HANDLE hwnd; /* If a HDC is allocated, for which window,
* or what bitmap is selected into it
*/
int saved_dc;
};
struct _GdkGCWin32Class
{
GdkGCClass parent_class;
};
GType gdk_gc_win32_get_type (void);
#define GDK_ROOT_WINDOW() ((guint32) HWND_DESKTOP) #define GDK_ROOT_WINDOW() ((guint32) HWND_DESKTOP)
#define GDK_ROOT_PARENT() ((GdkWindow *) gdk_parent_root) #define GDK_ROOT_PARENT() ((GdkWindow *) gdk_parent_root)
#define GDK_DISPLAY() NULL #define GDK_DISPLAY() NULL
@ -360,7 +380,6 @@ HDC gdk_win32_hdc_get (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkGCValuesMask usage); GdkGCValuesMask usage);
/* Each HDC returned from gdk_win32_hdc_get must be released with /* Each HDC returned from gdk_win32_hdc_get must be released with
* this function * this function
*/ */