More work on the Win32 backend. More files compile now.

This commit is contained in:
Tor Lillqvist 2000-07-23 21:43:23 +00:00
parent 20b5d8ec2f
commit 4658795817
13 changed files with 1291 additions and 1273 deletions

View File

@ -235,14 +235,14 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
q[-1] |= residue; /* Set left-over bits */ q[-1] |= residue; /* Set left-over bits */
} }
hcursor = CreateCursor (gdk_app_hinstance, x, y, cursor_width, cursor_height, hcursor = CreateCursor (gdk_app_hmodule, x, y, cursor_width, cursor_height,
and_mask, xor_mask); and_mask, xor_mask);
GDK_NOTE (MISC, g_print ("gdk_cursor_new_from_pixmap: " GDK_NOTE (MISC, g_print ("gdk_cursor_new_from_pixmap: "
"%#x (%dx%d) %#x (%dx%d) = %#x (%dx%d)\n", "%#x (%dx%d) %#x (%dx%d) = %#x (%dx%d)\n",
GDK_PIXMAP_HBM (source), GDK_PIXMAP_HBITMAP (source),
source_impl->width, source_impl->height, source_impl->width, source_impl->height,
GDK_PIXMAP_HBM (mask), GDK_PIXMAP_HBITMAP (mask),
mask_impl->width, mask_impl->height, mask_impl->width, mask_impl->height,
hcursor, cursor_width, cursor_height)); hcursor, cursor_width, cursor_height));

View File

@ -37,6 +37,7 @@
#include "gdkproperty.h" #include "gdkproperty.h"
#include "gdkinternals.h" #include "gdkinternals.h"
#include "gdkprivate-win32.h" #include "gdkprivate-win32.h"
#include "gdkdrawable-win32.h"
#ifdef OLE2_DND #ifdef OLE2_DND
#include <ole2.h> #include <ole2.h>
@ -1108,7 +1109,6 @@ gdk_drag_find_window (GdkDragContext *context,
GdkDragProtocol *protocol) GdkDragProtocol *protocol)
{ {
GdkDragContextPrivate *private = (GdkDragContextPrivate *)context; GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
GdkDrawablePrivate *drag_window_private = (GdkDrawablePrivate*) drag_window;
HWND recipient; HWND recipient;
POINT pt; POINT pt;
@ -1233,7 +1233,7 @@ gdk_window_register_dnd (GdkWindow *window)
* (in gtk, data of type text/uri-list) or not. * (in gtk, data of type text/uri-list) or not.
*/ */
gdk_window_add_filter (window, gdk_dropfiles_filter, NULL); gdk_window_add_filter (window, gdk_dropfiles_filter, NULL);
DragAcceptFiles (GDK_DRAWABLE_XID (window), TRUE); DragAcceptFiles (GDK_WINDOW_HWND (window), TRUE);
#ifdef OLE2_DND #ifdef OLE2_DND
/* Register for OLE2 d&d */ /* Register for OLE2 d&d */

View File

@ -24,19 +24,15 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#include "config.h"
#include <math.h> #include <math.h>
#include <glib.h> #include <glib.h>
#ifndef G_PI #include <pango/pangowin32.h>
#define G_PI 3.14159265358979323846
#endif
#include "gdkinternals.h" #include "gdkinternals.h"
#include "gdkprivate-win32.h" #include "gdkprivate-win32.h"
#include "gdkdrawable-win32.h"
static void gdk_win32_drawable_destroy (GdkDrawable *drawable); #include "gdkpixmap-win32.h"
static void gdk_win32_draw_rectangle (GdkDrawable *drawable, static void gdk_win32_draw_rectangle (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
@ -94,86 +90,121 @@ static void gdk_win32_draw_lines (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkPoint *points, GdkPoint *points,
gint npoints); gint npoints);
static void gdk_win32_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
static void gdk_win32_draw_image (GdkDrawable *drawable,
GdkGC *gc,
GdkImage *image,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height);
GdkDrawableClass _gdk_win32_drawable_class = { static void gdk_win32_set_colormap (GdkDrawable *drawable,
gdk_win32_drawable_destroy, GdkColormap *colormap);
_gdk_win32_gc_new,
gdk_win32_draw_rectangle, static GdkColormap* gdk_win32_get_colormap (GdkDrawable *drawable);
gdk_win32_draw_arc,
gdk_win32_draw_polygon, static gint gdk_win32_get_depth (GdkDrawable *drawable);
gdk_win32_draw_text,
gdk_win32_draw_text_wc, static void gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass);
gdk_win32_draw_drawable,
gdk_win32_draw_points, static gpointer parent_class = NULL;
gdk_win32_draw_segments,
gdk_win32_draw_lines GType
}; gdk_drawable_impl_win32_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDrawableImplWin32Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_drawable_impl_win32_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDrawableImplWin32),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
"GdkDrawableImplWin32",
&object_info);
}
return object_type;
}
static void
gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
{
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
drawable_class->create_gc = _gdk_win32_gc_new;
drawable_class->draw_rectangle = gdk_win32_draw_rectangle;
drawable_class->draw_arc = gdk_win32_draw_arc;
drawable_class->draw_polygon = gdk_win32_draw_polygon;
drawable_class->draw_text = gdk_win32_draw_text;
drawable_class->draw_text_wc = gdk_win32_draw_text_wc;
drawable_class->draw_drawable = gdk_win32_draw_drawable;
drawable_class->draw_points = gdk_win32_draw_points;
drawable_class->draw_segments = gdk_win32_draw_segments;
drawable_class->draw_lines = gdk_win32_draw_lines;
drawable_class->draw_glyphs = gdk_win32_draw_glyphs;
drawable_class->draw_image = gdk_win32_draw_image;
drawable_class->set_colormap = gdk_win32_set_colormap;
drawable_class->get_colormap = gdk_win32_get_colormap;
drawable_class->get_depth = gdk_win32_get_depth;
}
/***************************************************** /*****************************************************
* Win32 specific implementations of generic functions * * Win32 specific implementations of generic functions *
*****************************************************/ *****************************************************/
GdkColormap* static GdkColormap*
gdk_drawable_get_colormap (GdkDrawable *drawable) gdk_win32_get_colormap (GdkDrawable *drawable)
{ {
GdkDrawablePrivate *drawable_private; GdkDrawableImplWin32 *impl;
g_return_val_if_fail (drawable != NULL, NULL); return impl->colormap;
drawable_private = (GdkDrawablePrivate*) drawable;
if (!GDK_DRAWABLE_DESTROYED (drawable))
{
if (drawable_private->colormap == NULL)
return gdk_colormap_get_system (); /* XXX ??? */
else
return drawable_private->colormap;
}
return NULL;
} }
void static void
gdk_drawable_set_colormap (GdkDrawable *drawable, gdk_win32_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap) GdkColormap *colormap)
{ {
GdkDrawablePrivate *drawable_private; GdkDrawableImplWin32 *impl;
GdkColormapPrivateWin32 *colormap_private;
g_return_if_fail (colormap != NULL);
impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
if (impl->colormap == colormap)
return;
g_return_if_fail (drawable != NULL); if (impl->colormap)
g_return_if_fail (colormap != NULL); gdk_colormap_unref (impl->colormap);
impl->colormap = colormap;
drawable_private = (GdkDrawablePrivate *) drawable; if (impl->colormap)
colormap_private = (GdkColormapPrivateWin32 *) colormap; gdk_colormap_ref (impl->colormap);
if (!GDK_DRAWABLE_DESTROYED (drawable))
{
if (GDK_IS_WINDOW (drawable))
{
g_return_if_fail (colormap_private->base.visual !=
((GdkColormapPrivate *) (drawable_private->colormap))->visual);
/* XXX ??? */
GDK_NOTE (MISC, g_print ("gdk_drawable_set_colormap: %#x %#x\n",
GDK_DRAWABLE_XID (drawable),
colormap_private->xcolormap));
}
if (drawable_private->colormap)
gdk_colormap_unref (drawable_private->colormap);
drawable_private->colormap = colormap;
gdk_colormap_ref (drawable_private->colormap);
if (GDK_IS_WINDOW (drawable)
&& drawable_private->window_type != GDK_WINDOW_TOPLEVEL)
gdk_window_add_colormap_windows (drawable);
}
} }
/* Drawing /* Drawing
*/ */
static void
gdk_win32_drawable_destroy (GdkDrawable *drawable)
{
}
static void static void
gdk_win32_draw_rectangle (GdkDrawable *drawable, gdk_win32_draw_rectangle (GdkDrawable *drawable,
@ -184,8 +215,8 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
gint width, gint width,
gint height) gint height)
{ {
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc; GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private); const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
HDC hdc; HDC hdc;
HGDIOBJ oldpen, oldbrush; HGDIOBJ oldpen, oldbrush;
HBRUSH hbr = NULL; HBRUSH hbr = NULL;
@ -193,13 +224,12 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
gboolean ok = TRUE; gboolean ok = TRUE;
GDK_NOTE (MISC, g_print ("gdk_win32_draw_rectangle: %#x (%d) %s%dx%d@+%d+%d\n", GDK_NOTE (MISC, g_print ("gdk_win32_draw_rectangle: %#x (%d) %s%dx%d@+%d+%d\n",
GDK_DRAWABLE_XID (drawable), GDK_DRAWABLE_HANDLE (drawable),
gc_private, gc_private,
(filled ? "fill " : ""), (filled ? "fill " : ""),
width, height, x, y)); width, height, x, y));
hdc = gdk_gc_predraw (drawable, gc_private, hdc = gdk_gc_predraw (drawable, gc_private, mask);
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
#if 0 #if 0
{ {
@ -220,7 +250,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
} }
#endif #endif
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED) if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
{ {
if (!BeginPath (hdc)) if (!BeginPath (hdc))
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE; WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
@ -277,7 +307,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
SelectObject (hdc, oldbrush); SelectObject (hdc, oldbrush);
} }
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND); gdk_gc_postdraw (drawable, gc_private, mask);
} }
static void static void
@ -291,69 +321,66 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
gint angle1, gint angle1,
gint angle2) gint angle2)
{ {
GdkGCPrivate *gc_private; GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
HDC hdc; HDC hdc;
int nXStartArc, nYStartArc, nXEndArc, nYEndArc; int nXStartArc, nYStartArc, nXEndArc, nYEndArc;
gc_private = (GdkGCPrivate*) gc;
GDK_NOTE (MISC, g_print ("gdk_draw_arc: %#x %d,%d,%d,%d %d %d\n", GDK_NOTE (MISC, g_print ("gdk_draw_arc: %#x %d,%d,%d,%d %d %d\n",
GDK_DRAWABLE_XID (drawable), GDK_DRAWABLE_HANDLE (drawable),
x, y, width, height, angle1, angle2)); x, y, width, height, angle1, angle2));
/* Seems that drawing arcs with width or height <= 2 fails, at least /* Seems that drawing arcs with width or height <= 2 fails, at least
* with my TNT card. * with my TNT card.
*/ */
if (width > 2 && height > 2 && angle2 != 0) if (width <= 2 || height <= 2 || angle2 == 0)
return;
hdc = gdk_gc_predraw (drawable, gc_private, mask);
if (angle2 >= 360*64)
{ {
hdc = gdk_gc_predraw (drawable, gc_private, nXStartArc = nYStartArc = nXEndArc = nYEndArc = 0;
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
if (angle2 >= 360*64)
{
nXStartArc = nYStartArc = nXEndArc = nYEndArc = 0;
}
else if (angle2 > 0)
{
/* The 100. is just an arbitrary value */
nXStartArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.);
nYStartArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.);
nXEndArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.);
nYEndArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.);
}
else
{
nXEndArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.);
nYEndArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.);
nXStartArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.);
nYStartArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.);
}
/* GDK_OPAQUE_STIPPLED arcs not implemented. */
if (filled)
{
GDK_NOTE (MISC, g_print ("...Pie(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n",
x, y, x+width, y+height,
nXStartArc, nYStartArc,
nXEndArc, nYEndArc));
if (!Pie (hdc, x, y, x+width, y+height,
nXStartArc, nYStartArc, nXEndArc, nYEndArc))
WIN32_GDI_FAILED ("Pie");
}
else
{
GDK_NOTE (MISC, g_print ("...Arc(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n",
x, y, x+width, y+height,
nXStartArc, nYStartArc,
nXEndArc, nYEndArc));
if (!Arc (hdc, x, y, x+width, y+height,
nXStartArc, nYStartArc, nXEndArc, nYEndArc))
WIN32_GDI_FAILED ("Arc");
}
gdk_gc_postdraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
} }
else if (angle2 > 0)
{
/* The 100. is just an arbitrary value */
nXStartArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.);
nYStartArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.);
nXEndArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.);
nYEndArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.);
}
else
{
nXEndArc = x + width/2 + 100. * cos(angle1/64.*2.*G_PI/360.);
nYEndArc = y + height/2 + -100. * sin(angle1/64.*2.*G_PI/360.);
nXStartArc = x + width/2 + 100. * cos((angle1+angle2)/64.*2.*G_PI/360.);
nYStartArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.);
}
/* GDK_OPAQUE_STIPPLED arcs not implemented. */
if (filled)
{
GDK_NOTE (MISC, g_print ("...Pie(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n",
x, y, x+width, y+height,
nXStartArc, nYStartArc,
nXEndArc, nYEndArc));
if (!Pie (hdc, x, y, x+width, y+height,
nXStartArc, nYStartArc, nXEndArc, nYEndArc))
WIN32_GDI_FAILED ("Pie");
}
else
{
GDK_NOTE (MISC, g_print ("...Arc(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n",
x, y, x+width, y+height,
nXStartArc, nYStartArc,
nXEndArc, nYEndArc));
if (!Arc (hdc, x, y, x+width, y+height,
nXStartArc, nYStartArc, nXEndArc, nYEndArc))
WIN32_GDI_FAILED ("Arc");
}
gdk_gc_postdraw (drawable, gc_private, mask);
} }
static void static void
@ -363,8 +390,8 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
GdkPoint *points, GdkPoint *points,
gint npoints) gint npoints)
{ {
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc; GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private); const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
HDC hdc; HDC hdc;
HBRUSH hbr = NULL; HBRUSH hbr = NULL;
POINT *pts; POINT *pts;
@ -372,14 +399,13 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
int i; int i;
GDK_NOTE (MISC, g_print ("gdk_win32_draw_polygon: %#x (%d) %d\n", GDK_NOTE (MISC, g_print ("gdk_win32_draw_polygon: %#x (%d) %d\n",
GDK_DRAWABLE_XID (drawable), gc_private, GDK_DRAWABLE_HANDLE (drawable), gc_private,
npoints)); npoints));
if (npoints < 2) if (npoints < 2)
return; return;
hdc = gdk_gc_predraw (drawable, gc_private, hdc = gdk_gc_predraw (drawable, gc_private, mask);
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
pts = g_new (POINT, npoints+1); pts = g_new (POINT, npoints+1);
for (i = 0; i < npoints; i++) for (i = 0; i < npoints; i++)
@ -388,12 +414,13 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
pts[i].y = points[i].y; pts[i].y = points[i].y;
} }
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED) if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
{ {
if (!BeginPath (hdc)) if (!BeginPath (hdc))
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE; WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
MoveToEx (hdc, points[0].x, points[0].y, NULL); if (ok)
MoveToEx (hdc, points[0].x, points[0].y, NULL);
if (pts[0].x == pts[npoints-1].x && pts[0].y == pts[npoints-1].y) if (pts[0].x == pts[npoints-1].x && pts[0].y == pts[npoints-1].y)
npoints--; npoints--;
@ -440,7 +467,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
} }
} }
g_free (pts); g_free (pts);
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND); gdk_gc_postdraw (drawable, gc_private, mask);
} }
typedef struct typedef struct
@ -462,7 +489,7 @@ gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
if (!singlefont) if (!singlefont)
return; return;
if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL) if ((oldfont = SelectObject (argp->hdc, singlefont->hfont)) == NULL)
{ {
WIN32_GDI_FAILED ("SelectObject"); WIN32_GDI_FAILED ("SelectObject");
return; return;
@ -485,51 +512,45 @@ gdk_win32_draw_text (GdkDrawable *drawable,
const gchar *text, const gchar *text,
gint text_length) gint text_length)
{ {
GdkGCPrivate *gc_private; GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
wchar_t *wcstr; const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_FONT;
wchar_t *wcstr, wc;
gint wlen; gint wlen;
gdk_draw_text_arg arg; gdk_draw_text_arg arg;
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
if (text_length == 0) if (text_length == 0)
return; return;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET); g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
gc_private = (GdkGCPrivate*) gc;
arg.x = x; arg.x = x;
arg.y = y; arg.y = y;
arg.hdc = gdk_gc_predraw (drawable, gc_private, arg.hdc = gdk_gc_predraw (drawable, gc_private, mask);
GDK_GC_FOREGROUND|GDK_GC_FONT);
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d,%d) \"%.*s\" (len %d)\n", GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d,%d) \"%.*s\" (len %d)\n",
GDK_DRAWABLE_XID (drawable), GDK_DRAWABLE_HANDLE (drawable),
x, y, x, y,
(text_length > 10 ? 10 : text_length), (text_length > 10 ? 10 : text_length),
text, text_length)); text, text_length));
wcstr = g_new (wchar_t, text_length);
if (text_length == 1) if (text_length == 1)
{ {
/* For single characters, don't try to interpret as UTF-8. */ /* For single characters, don't try to interpret as UTF-8. */
wcstr[0] = (guchar) text[0]; wc = (guchar) text[0];
gdk_wchar_text_handle (font, wcstr, 1, gdk_draw_text_handler, &arg); gdk_wchar_text_handle (font, &wc, 1, gdk_draw_text_handler, &arg);
} }
else else
{ {
wcstr = g_new (wchar_t, text_length);
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1) if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
g_warning ("gdk_win32_draw_text: gdk_nmbstowchar_ts failed"); g_warning ("gdk_win32_draw_text: gdk_nmbstowchar_ts failed");
else else
gdk_wchar_text_handle (font, wcstr, wlen, gdk_draw_text_handler, &arg); gdk_wchar_text_handle (font, wcstr, wlen, gdk_draw_text_handler, &arg);
g_free (wcstr);
} }
g_free (wcstr);
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_FONT); gdk_gc_postdraw (drawable, gc_private, mask);
} }
static void static void
@ -541,29 +562,23 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text, const GdkWChar *text,
gint text_length) gint text_length)
{ {
GdkGCPrivate *gc_private; GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_FONT;
gint i, wlen; gint i, wlen;
wchar_t *wcstr; wchar_t *wcstr;
gdk_draw_text_arg arg; gdk_draw_text_arg arg;
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
if (text_length == 0) if (text_length == 0)
return; return;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET); g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
gc_private = (GdkGCPrivate*) gc;
arg.x = x; arg.x = x;
arg.y = y; arg.y = y;
arg.hdc = gdk_gc_predraw (drawable, gc_private, arg.hdc = gdk_gc_predraw (drawable, gc_private, mask);
GDK_GC_FOREGROUND|GDK_GC_FONT);
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d,%d) len: %d\n", GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d,%d) len: %d\n",
GDK_DRAWABLE_XID (drawable), GDK_DRAWABLE_HANDLE (drawable),
x, y, text_length)); x, y, text_length));
if (sizeof (wchar_t) != sizeof (GdkWChar)) if (sizeof (wchar_t) != sizeof (GdkWChar))
@ -581,7 +596,7 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
if (sizeof (wchar_t) != sizeof (GdkWChar)) if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr); g_free (wcstr);
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_FONT); gdk_gc_postdraw (drawable, gc_private, mask);
} }
static void static void
@ -595,38 +610,36 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
gint width, gint width,
gint height) gint height)
{ {
GdkDrawablePrivate *src_private; GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCPrivate *gc_private; GdkDrawableImplWin32 *src_impl = GDK_DRAWABLE_IMPL_WIN32 (src);
HDC hdc; HDC hdc;
HDC srcdc; HDC srcdc;
HGDIOBJ hgdiobj; HGDIOBJ hgdiobj;
HRGN src_rgn, draw_rgn, outside_rgn; HRGN src_rgn, draw_rgn, outside_rgn;
RECT r; RECT r;
gint src_width, src_height;
gboolean ok = TRUE;
src_private = (GdkDrawablePrivate*) src; GDK_NOTE (MISC, g_print ("gdk_draw_pixmap: dest: %#x @+%d+%d"
gc_private = (GdkGCPrivate*) gc; "src: %#x %dx%d@+%d+%d\n",
GDK_DRAWABLE_HANDLE (drawable), xdest, ydest,
GDK_NOTE (MISC, g_print ("gdk_draw_pixmap: dest: %#x " GDK_PIXMAP_HBITMAP (src),
"src: %#x %dx%d@+%d+%d" width, height, xsrc, ysrc));
" dest: %#x @+%d+%d\n",
GDK_DRAWABLE_XID (drawable),
GDK_DRAWABLE_XID (src),
width, height, xsrc, ysrc,
GDK_DRAWABLE_XID (drawable), xdest, ydest));
hdc = gdk_gc_predraw (drawable, gc_private, 0); hdc = gdk_gc_predraw (drawable, gc_private, 0);
src_rgn = CreateRectRgn (0, 0, src_private->width + 1, src_private->height + 1); gdk_drawable_get_size (src, &src_width, &src_height);
src_rgn = CreateRectRgn (0, 0, src_width + 1, src_height + 1);
draw_rgn = CreateRectRgn (xsrc, ysrc, xsrc + width + 1, ysrc + height + 1); draw_rgn = CreateRectRgn (xsrc, ysrc, xsrc + width + 1, ysrc + height + 1);
SetRectEmpty (&r);
outside_rgn = CreateRectRgnIndirect (&r);
if (GDK_DRAWABLE_TYPE (drawable) != GDK_DRAWABLE_PIXMAP) if (!GDK_IS_PIXMAP (drawable))
{ {
/* If we are drawing on a window, calculate the region that is /* If we are drawing on a window, calculate the region that is
* outside the source pixmap, and invalidate that, causing it to * outside the source pixmap, and invalidate that, causing it to
* be cleared. XXX * be cleared. XXX
*/ */
SetRectEmpty (&r);
outside_rgn = CreateRectRgnIndirect (&r);
if (CombineRgn (outside_rgn, draw_rgn, src_rgn, RGN_DIFF) != NULLREGION) if (CombineRgn (outside_rgn, draw_rgn, src_rgn, RGN_DIFF) != NULLREGION)
{ {
OffsetRgn (outside_rgn, xdest, ydest); OffsetRgn (outside_rgn, xdest, ydest);
@ -635,8 +648,9 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
"bbox: %dx%d@+%d+%d\n", "bbox: %dx%d@+%d+%d\n",
r.right - r.left - 1, r.bottom - r.top - 1, r.right - r.left - 1, r.bottom - r.top - 1,
r.left, r.top))); r.left, r.top)));
InvalidateRgn (GDK_DRAWABLE_XID (drawable), outside_rgn, TRUE); InvalidateRgn (GDK_DRAWABLE_HANDLE (drawable), outside_rgn, TRUE);
} }
DeleteObject (outside_rgn);
} }
#if 1 /* Don't know if this is necessary */ #if 1 /* Don't know if this is necessary */
@ -665,68 +679,64 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
DeleteObject (src_rgn); DeleteObject (src_rgn);
DeleteObject (draw_rgn); DeleteObject (draw_rgn);
DeleteObject (outside_rgn);
/* Strangely enough, this function is called also to bitblt /* This function is called also to bitblt from a window.
* from a window.
*/ */
if (src_private->window_type == GDK_DRAWABLE_PIXMAP) if (GDK_IS_PIXMAP (src))
{ {
if ((srcdc = CreateCompatibleDC (hdc)) == NULL) if ((srcdc = CreateCompatibleDC (hdc)) == NULL)
WIN32_GDI_FAILED ("CreateCompatibleDC"); WIN32_GDI_FAILED ("CreateCompatibleDC"), ok = FALSE;
if ((hgdiobj = SelectObject (srcdc, GDK_DRAWABLE_XID (src))) == NULL) if (ok && (hgdiobj = SelectObject (srcdc, GDK_PIXMAP_HBITMAP (src))) == NULL)
WIN32_GDI_FAILED ("SelectObject"); WIN32_GDI_FAILED ("SelectObject"), ok = FALSE;
if (!BitBlt (hdc, xdest, ydest, width, height, if (ok && !BitBlt (hdc, xdest, ydest, width, height,
srcdc, xsrc, ysrc, SRCCOPY)) srcdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt"); WIN32_GDI_FAILED ("BitBlt");
if ((SelectObject (srcdc, hgdiobj) == NULL)) if (ok && (SelectObject (srcdc, hgdiobj) == NULL))
WIN32_GDI_FAILED ("SelectObject"); WIN32_GDI_FAILED ("SelectObject");
if (!DeleteDC (srcdc)) if (srcdc != NULL && !DeleteDC (srcdc))
WIN32_GDI_FAILED ("DeleteDC"); WIN32_GDI_FAILED ("DeleteDC");
} }
else if (GDK_DRAWABLE_HANDLE (drawable) == GDK_DRAWABLE_HANDLE (src))
{
/* Blitting inside a window, use ScrollDC */
RECT scrollRect, clipRect, emptyRect;
HRGN updateRgn;
scrollRect.left = MIN (xsrc, xdest);
scrollRect.top = MIN (ysrc, ydest);
scrollRect.right = MAX (xsrc + width + 1, xdest + width + 1);
scrollRect.bottom = MAX (ysrc + height + 1, ydest + height + 1);
clipRect.left = xdest;
clipRect.top = ydest;
clipRect.right = xdest + width + 1;
clipRect.bottom = ydest + height + 1;
SetRectEmpty (&emptyRect);
updateRgn = CreateRectRgnIndirect (&emptyRect);
if (!ScrollDC (hdc, xdest - xsrc, ydest - ysrc,
&scrollRect, &clipRect,
updateRgn, NULL))
WIN32_GDI_FAILED ("ScrollDC"), ok = FALSE;
if (ok && !InvalidateRgn (GDK_WINDOW_HWND (drawable), updateRgn, FALSE))
WIN32_GDI_FAILED ("InvalidateRgn"), ok = FALSE;
if (ok && !UpdateWindow (GDK_WINDOW_HWND (drawable)))
WIN32_GDI_FAILED ("UpdateWindow");
DeleteObject (updateRgn);
}
else else
{ {
if (GDK_DRAWABLE_XID(drawable) == GDK_DRAWABLE_XID (src)) if ((srcdc = GetDC (GDK_WINDOW_HWND (src))) == NULL)
{ WIN32_GDI_FAILED ("GetDC"), ok = FALSE;
/* Blitting inside a window, use ScrollDC */
RECT scrollRect, clipRect, emptyRect; if (ok && !BitBlt (hdc, xdest, ydest, width, height,
HRGN updateRgn; srcdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt");
scrollRect.left = MIN (xsrc, xdest); ReleaseDC (GDK_WINDOW_HWND (src), srcdc);
scrollRect.top = MIN (ysrc, ydest);
scrollRect.right = MAX (xsrc + width + 1, xdest + width + 1);
scrollRect.bottom = MAX (ysrc + height + 1, ydest + height + 1);
clipRect.left = xdest;
clipRect.top = ydest;
clipRect.right = xdest + width + 1;
clipRect.bottom = ydest + height + 1;
SetRectEmpty (&emptyRect);
updateRgn = CreateRectRgnIndirect (&emptyRect);
if (!ScrollDC (hdc, xdest - xsrc, ydest - ysrc,
&scrollRect, &clipRect,
updateRgn, NULL))
WIN32_GDI_FAILED ("ScrollDC");
if (!InvalidateRgn (GDK_DRAWABLE_XID (drawable), updateRgn, FALSE))
WIN32_GDI_FAILED ("InvalidateRgn");
if (!UpdateWindow (GDK_DRAWABLE_XID (drawable)))
WIN32_GDI_FAILED ("UpdateWindow");
}
else
{
if ((srcdc = GetDC (GDK_DRAWABLE_XID (src))) == NULL)
WIN32_GDI_FAILED ("GetDC");
if (!BitBlt (hdc, xdest, ydest, width, height,
srcdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt");
ReleaseDC (GDK_DRAWABLE_XID (src), srcdc);
}
} }
gdk_gc_postdraw (drawable, gc_private, 0); gdk_gc_postdraw (drawable, gc_private, 0);
} }
@ -739,16 +749,15 @@ gdk_win32_draw_points (GdkDrawable *drawable,
{ {
HDC hdc; HDC hdc;
COLORREF fg; COLORREF fg;
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc; GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private); GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
GdkDrawablePrivate *drawable_private = (GdkDrawablePrivate *) drawable;
GdkColormapPrivateWin32 *colormap_private = GdkColormapPrivateWin32 *colormap_private =
(GdkColormapPrivateWin32 *) drawable_private->colormap; (GdkColormapPrivateWin32 *) impl->colormap;
int i; int i;
hdc = gdk_gc_predraw (drawable, gc_private, 0); hdc = gdk_gc_predraw (drawable, gc_private, 0);
fg = gdk_colormap_color (colormap_private, gc_data->foreground); fg = gdk_colormap_color (colormap_private, gc_private->foreground);
GDK_NOTE (MISC, g_print ("gdk_draw_points: %#x %dx%.06x\n", GDK_NOTE (MISC, g_print ("gdk_draw_points: %#x %dx%.06x\n",
GDK_DRAWABLE_XID (drawable), npoints, fg)); GDK_DRAWABLE_XID (drawable), npoints, fg));
@ -765,25 +774,24 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
GdkSegment *segs, GdkSegment *segs,
gint nsegs) gint nsegs)
{ {
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc; GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private); const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
HDC hdc; HDC hdc;
HBRUSH hbr = NULL; HBRUSH hbr = NULL;
gboolean ok = TRUE; gboolean ok = TRUE;
int i; int i;
GDK_NOTE (MISC, g_print ("gdk_win32_draw_segments: %#x nsegs: %d\n", GDK_NOTE (MISC, g_print ("gdk_win32_draw_segments: %#x nsegs: %d\n",
GDK_DRAWABLE_XID (drawable), nsegs)); GDK_DRAWABLE_HANDLE (drawable), nsegs));
hdc = gdk_gc_predraw (drawable, gc_private, hdc = gdk_gc_predraw (drawable, gc_private, mask);
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED) if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
{ {
if (!BeginPath (hdc)) if (!BeginPath (hdc))
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE; WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
for (i = 0; i < nsegs; i++) for (i = 0; ok && i < nsegs; i++)
{ {
if (ok && !MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL)) if (ok && !MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE; WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE;
@ -791,7 +799,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
WIN32_GDI_FAILED ("LineTo"), ok = FALSE; WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
/* Draw end pixel */ /* Draw end pixel */
if (ok && gc_data->pen_width <= 1) if (ok && gc_private->pen_width <= 1)
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2)) if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
WIN32_GDI_FAILED ("LineTo"), ok = FALSE; WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
} }
@ -811,20 +819,20 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
} }
else else
{ {
for (i = 0; i < nsegs; i++) for (i = 0; ok && i < nsegs; i++)
{ {
if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL)) if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
WIN32_GDI_FAILED ("MoveToEx"); WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE;
if (!LineTo (hdc, segs[i].x2, segs[i].y2)) if (ok && !LineTo (hdc, segs[i].x2, segs[i].y2))
WIN32_GDI_FAILED ("LineTo"); WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
/* Draw end pixel */ /* Draw end pixel */
if (gc_data->pen_width <= 1) if (ok && gc_private->pen_width <= 1)
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2)) if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
WIN32_GDI_FAILED ("LineTo"); WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
} }
} }
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND); gdk_gc_postdraw (drawable, gc_private, mask);
} }
static void static void
@ -833,18 +841,18 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
GdkPoint *points, GdkPoint *points,
gint npoints) gint npoints)
{ {
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc; GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private); const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
HDC hdc; HDC hdc;
POINT *pts; POINT *pts;
int i; int i;
gboolean ok = TRUE;
if (npoints < 2) if (npoints < 2)
return; return;
hdc = gdk_gc_predraw (drawable, gc_private, hdc = gdk_gc_predraw (drawable, gc_private, mask);
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
#if 1
pts = g_new (POINT, npoints); pts = g_new (POINT, npoints);
for (i = 0; i < npoints; i++) for (i = 0; i < npoints; i++)
@ -854,31 +862,129 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
} }
if (!Polyline (hdc, pts, npoints)) if (!Polyline (hdc, pts, npoints))
WIN32_GDI_FAILED ("Polyline"); WIN32_GDI_FAILED ("Polyline"), ok = FALSE;
g_free (pts); g_free (pts);
/* Draw end pixel */ /* Draw end pixel */
if (gc_data->pen_width <= 1) if (ok && gc_private->pen_width <= 1)
{ {
MoveToEx (hdc, points[npoints-1].x, points[npoints-1].y, NULL); MoveToEx (hdc, points[npoints-1].x, points[npoints-1].y, NULL);
if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y)) if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y))
WIN32_GDI_FAILED ("LineTo"); WIN32_GDI_FAILED ("LineTo");
} }
#else gdk_gc_postdraw (drawable, gc_private, mask);
MoveToEx (hdc, points[0].x, points[0].y, NULL); }
for (i = 1; i < npoints; i++)
if (!LineTo (hdc, points[i].x, points[i].y)) static void
WIN32_GDI_FAILED ("LineTo"); gdk_win32_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
/* Draw end pixel */ PangoFont *font,
/* LineTo doesn't draw the last point, so if we have a pen width of 1, gint x,
* we draw the end pixel separately... With wider pens we don't care. gint y,
* //HB: But the NT developers don't read their API documentation ... PangoGlyphString *glyphs)
*/ {
if (gc_data->pen_width <= 1 && windows_version > 0x80000000) GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y)) GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
WIN32_GDI_FAILED ("LineTo"); const GdkGCValuesMask mask = GDK_GC_FOREGROUND;
#endif HDC hdc;
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
hdc = gdk_gc_predraw (drawable, gc_private, mask);
pango_win32_render (hdc, font, glyphs, x, y);
gdk_gc_postdraw (drawable, gc_private, mask);
}
static void
gdk_win32_draw_image (GdkDrawable *drawable,
GdkGC *gc,
GdkImage *image,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height)
{
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkImagePrivateWin32 *image_private = (GdkImagePrivateWin32 *) image;
GdkColormapPrivateWin32 *colormap_private = (GdkColormapPrivateWin32 *) impl->colormap;
HDC hdc, memdc;
HGDIOBJ oldbitmap;
DIBSECTION ds;
static struct {
BITMAPINFOHEADER bmiHeader;
WORD bmiIndices[256];
} bmi;
static gboolean bmi_inited = FALSE;
gboolean ok = TRUE;
int i;
hdc = gdk_gc_predraw (drawable, gc_private, 0);
if (colormap_private && colormap_private->xcolormap->rc_palette)
{
if (!bmi_inited)
{
for (i = 0; i < 256; i++)
bmi.bmiIndices[i] = i;
bmi_inited = TRUE;
}
if (GetObject (image_private->hbitmap, sizeof (DIBSECTION),
&ds) != sizeof (DIBSECTION))
WIN32_GDI_FAILED ("GetObject"), ok = FALSE;
#if 0
g_print("xdest = %d, ydest = %d, xsrc = %d, ysrc = %d, width = %d, height = %d\n",
xdest, ydest, xsrc, ysrc, width, height);
g_print("bmWidth = %d, bmHeight = %d, bmBitsPixel = %d, bmBits = %p\n",
ds.dsBm.bmWidth, ds.dsBm.bmHeight, ds.dsBm.bmBitsPixel, ds.dsBm.bmBits);
g_print("biWidth = %d, biHeight = %d, biBitCount = %d, biClrUsed = %d\n",
ds.dsBmih.biWidth, ds.dsBmih.biHeight, ds.dsBmih.biBitCount, ds.dsBmih.biClrUsed);
#endif
bmi.bmiHeader = ds.dsBmih;
/* I have spent hours on getting the parameters to
* SetDIBitsToDevice right. I wonder what drugs the guys in
* Redmond were on when they designed this API.
*/
if (ok && SetDIBitsToDevice (hdc,
xdest, ydest,
width, height,
xsrc, (-ds.dsBmih.biHeight)-height-ysrc,
0, -ds.dsBmih.biHeight,
ds.dsBm.bmBits,
(CONST BITMAPINFO *) &bmi,
DIB_PAL_COLORS) == 0)
WIN32_GDI_FAILED ("SetDIBitsToDevice");
}
else
{
if ((memdc = CreateCompatibleDC (hdc)) == NULL)
WIN32_GDI_FAILED ("CreateCompatibleDC"), ok = FALSE;
if (ok && (oldbitmap = SelectObject (memdc, image_private->hbitmap)) == NULL)
WIN32_GDI_FAILED ("SelectObject"), ok = FALSE;
if (ok && !BitBlt (hdc, xdest, ydest, width, height,
memdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt");
if (oldbitmap != NULL && SelectObject (memdc, oldbitmap) == NULL)
WIN32_GDI_FAILED ("SelectObject");
if (memdc != NULL && !DeleteDC (memdc))
WIN32_GDI_FAILED ("DeleteDC");
}
gdk_gc_postdraw (drawable, gc_private, 0);
}
static gint
gdk_win32_get_depth (GdkDrawable *drawable)
{
/* This is a bit bogus but I'm not sure the other way is better */
return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_WIN32 (drawable)->wrapper);
} }

File diff suppressed because it is too large Load Diff

View File

@ -142,7 +142,7 @@ logfont_to_xlfd (const LOGFONT *lfp,
if (logpixelsy == 0) if (logpixelsy == 0)
{ {
logpixelsy = GetDeviceCaps (gdk_DC, LOGPIXELSY); logpixelsy = GetDeviceCaps (gdk_display_hdc, LOGPIXELSY);
} }
if (lfp->lfWeight >= FW_HEAVY) if (lfp->lfWeight >= FW_HEAVY)
@ -281,7 +281,7 @@ gdk_font_full_name_get (GdkFont *font)
{ {
singlefont = (GdkWin32SingleFont *) list->data; singlefont = (GdkWin32SingleFont *) list->data;
if (GetObject (singlefont->xfont, sizeof (LOGFONT), &logfont) == 0) if (GetObject (singlefont->hfont, sizeof (LOGFONT), &logfont) == 0)
{ {
WIN32_GDI_FAILED ("GetObject"); WIN32_GDI_FAILED ("GetObject");
return NULL; return NULL;
@ -409,7 +409,7 @@ EnumFontFamExProc (const LOGFONT *lfp,
lf = *lfp; lf = *lfp;
EnumFontFamiliesEx (gdk_DC, &lf, InnerEnumFontFamExProc, lParam, 0); EnumFontFamiliesEx (gdk_display_hdc, &lf, InnerEnumFontFamExProc, lParam, 0);
} }
else else
InnerEnumFontFamExProc (lfp, metrics, fontType, lParam); InnerEnumFontFamExProc (lfp, metrics, fontType, lParam);
@ -429,7 +429,7 @@ gdk_font_list_new (const gchar *font_pattern,
xfontnames = g_new (gchar *, font_names_size); xfontnames = g_new (gchar *, font_names_size);
memset (&logfont, 0, sizeof (logfont)); memset (&logfont, 0, sizeof (logfont));
logfont.lfCharSet = DEFAULT_CHARSET; logfont.lfCharSet = DEFAULT_CHARSET;
EnumFontFamiliesEx (gdk_DC, &logfont, EnumFontFamExProc, EnumFontFamiliesEx (gdk_display_hdc, &logfont, EnumFontFamExProc,
(LPARAM) font_pattern, 0); (LPARAM) font_pattern, 0);
result = g_new (gchar *, num_fonts + 1); result = g_new (gchar *, num_fonts + 1);
@ -1234,7 +1234,7 @@ gdk_font_load_internal (const gchar *font_name)
return NULL; return NULL;
} }
logpixelsy = GetDeviceCaps (gdk_DC, LOGPIXELSY); logpixelsy = GetDeviceCaps (gdk_display_hdc, LOGPIXELSY);
if (strcmp (pixel_size, "*") == 0) if (strcmp (pixel_size, "*") == 0)
if (strcmp (point_size, "*") == 0) if (strcmp (point_size, "*") == 0)
@ -1447,13 +1447,13 @@ gdk_font_load_internal (const gchar *font_name)
return NULL; return NULL;
singlefont = g_new (GdkWin32SingleFont, 1); singlefont = g_new (GdkWin32SingleFont, 1);
singlefont->xfont = hfont; singlefont->hfont = hfont;
GetObject (singlefont->xfont, sizeof (logfont), &logfont); GetObject (singlefont->hfont, sizeof (logfont), &logfont);
oldfont = SelectObject (gdk_DC, singlefont->xfont); oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
memset (&singlefont->fs, 0, sizeof (singlefont->fs)); memset (&singlefont->fs, 0, sizeof (singlefont->fs));
singlefont->charset = GetTextCharsetInfo (gdk_DC, &singlefont->fs, 0); singlefont->charset = GetTextCharsetInfo (gdk_display_hdc, &singlefont->fs, 0);
GetTextFace (gdk_DC, sizeof (face), face); GetTextFace (gdk_display_hdc, sizeof (face), face);
SelectObject (gdk_DC, oldfont); SelectObject (gdk_display_hdc, oldfont);
if (TranslateCharsetInfo ((DWORD *) singlefont->charset, &csi, if (TranslateCharsetInfo ((DWORD *) singlefont->charset, &csi,
TCI_SRCCHARSET) TCI_SRCCHARSET)
&& singlefont->charset != MAC_CHARSET) && singlefont->charset != MAC_CHARSET)
@ -1462,7 +1462,7 @@ gdk_font_load_internal (const gchar *font_name)
singlefont->codepage = 0; singlefont->codepage = 0;
GDK_NOTE (MISC, (g_print ("... = %#x %s cs %s cp%d\n", GDK_NOTE (MISC, (g_print ("... = %#x %s cs %s cp%d\n",
singlefont->xfont, face, singlefont->hfont, face,
charset_name (singlefont->charset), charset_name (singlefont->charset),
singlefont->codepage), singlefont->codepage),
g_print ("... Unicode subranges:"), g_print ("... Unicode subranges:"),
@ -1504,9 +1504,9 @@ gdk_font_load (const gchar *font_name)
* chars to work. (Yes, even Latin-1, as we use Unicode internally.) * chars to work. (Yes, even Latin-1, as we use Unicode internally.)
*/ */
font->type = GDK_FONT_FONTSET; font->type = GDK_FONT_FONTSET;
oldfont = SelectObject (gdk_DC, singlefont->xfont); oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
GetTextMetrics (gdk_DC, &textmetric); GetTextMetrics (gdk_display_hdc, &textmetric);
SelectObject (gdk_DC, oldfont); SelectObject (gdk_display_hdc, oldfont);
font->ascent = textmetric.tmAscent; font->ascent = textmetric.tmAscent;
font->descent = textmetric.tmDescent; font->descent = textmetric.tmDescent;
@ -1568,9 +1568,9 @@ gdk_fontset_load (const gchar *fontset_name)
if (singlefont) if (singlefont)
{ {
private->fonts = g_slist_append (private->fonts, singlefont); private->fonts = g_slist_append (private->fonts, singlefont);
oldfont = SelectObject (gdk_DC, singlefont->xfont); oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
GetTextMetrics (gdk_DC, &textmetric); GetTextMetrics (gdk_display_hdc, &textmetric);
SelectObject (gdk_DC, oldfont); SelectObject (gdk_display_hdc, oldfont);
font->ascent = MAX (font->ascent, textmetric.tmAscent); font->ascent = MAX (font->ascent, textmetric.tmAscent);
font->descent = MAX (font->descent, textmetric.tmDescent); font->descent = MAX (font->descent, textmetric.tmDescent);
} }
@ -1602,14 +1602,14 @@ _gdk_font_destroy (GdkFont *font)
singlefont = (GdkWin32SingleFont *) private->fonts->data; singlefont = (GdkWin32SingleFont *) private->fonts->data;
GDK_NOTE (MISC, g_print ("_gdk_font_destroy %#x\n", GDK_NOTE (MISC, g_print ("_gdk_font_destroy %#x\n",
singlefont->xfont)); singlefont->hfont));
gdk_font_hash_remove (font->type, font); gdk_font_hash_remove (font->type, font);
switch (font->type) switch (font->type)
{ {
case GDK_FONT_FONT: case GDK_FONT_FONT:
DeleteObject (singlefont->xfont); DeleteObject (singlefont->hfont);
break; break;
case GDK_FONT_FONTSET: case GDK_FONT_FONTSET:
@ -1617,7 +1617,7 @@ _gdk_font_destroy (GdkFont *font)
while (list) while (list)
{ {
singlefont = (GdkWin32SingleFont *) list->data; singlefont = (GdkWin32SingleFont *) list->data;
DeleteObject (singlefont->xfont); DeleteObject (singlefont->hfont);
list = list->next; list = list->next;
} }
@ -1647,7 +1647,7 @@ gdk_font_id (const GdkFont *font)
private = (const GdkFontPrivateWin32 *) font; private = (const GdkFontPrivateWin32 *) font;
if (font->type == GDK_FONT_FONT) if (font->type == GDK_FONT_FONT)
return (gint) ((GdkWin32SingleFont *) private->fonts->data)->xfont; return (gint) ((GdkWin32SingleFont *) private->fonts->data)->hfont;
else else
return 0; return 0;
} }
@ -1666,8 +1666,8 @@ gdk_font_equal (const GdkFont *fonta,
privateb = (const GdkFontPrivateWin32 *) fontb; privateb = (const GdkFontPrivateWin32 *) fontb;
if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT) if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT)
return (((GdkWin32SingleFont *) privatea->fonts->data)->xfont return (((GdkWin32SingleFont *) privatea->fonts->data)->hfont
== ((GdkWin32SingleFont *) privateb->fonts->data)->xfont); == ((GdkWin32SingleFont *) privateb->fonts->data)->hfont);
else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET) else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET)
{ {
GSList *lista = privatea->fonts; GSList *lista = privatea->fonts;
@ -1675,8 +1675,8 @@ gdk_font_equal (const GdkFont *fonta,
while (lista && listb) while (lista && listb)
{ {
if (((GdkWin32SingleFont *) lista->data)->xfont if (((GdkWin32SingleFont *) lista->data)->hfont
!= ((GdkWin32SingleFont *) listb->data)->xfont) != ((GdkWin32SingleFont *) listb->data)->hfont)
return 0; return 0;
lista = lista->next; lista = lista->next;
listb = listb->next; listb = listb->next;
@ -1762,7 +1762,7 @@ gdk_wchar_text_handle (GdkFont *font,
GDK_NOTE (MISC, g_print ("%d:%d:%d:%#x ", GDK_NOTE (MISC, g_print ("%d:%d:%d:%#x ",
start-wcstr, wcp-wcstr, block, start-wcstr, wcp-wcstr, block,
(singlefont ? singlefont->xfont : 0))); (singlefont ? singlefont->hfont : 0)));
/* Call the callback function */ /* Call the callback function */
(*handler) (singlefont, start, wcp+1 - start, arg); (*handler) (singlefont, start, wcp+1 - start, arg);
@ -1789,13 +1789,13 @@ gdk_text_size_handler (GdkWin32SingleFont *singlefont,
if (!singlefont) if (!singlefont)
return; return;
if ((oldfont = SelectObject (gdk_DC, singlefont->xfont)) == NULL) if ((oldfont = SelectObject (gdk_display_hdc, singlefont->hfont)) == NULL)
{ {
WIN32_GDI_FAILED ("SelectObject"); WIN32_GDI_FAILED ("SelectObject");
return; return;
} }
GetTextExtentPoint32W (gdk_DC, wcstr, wclen, &this_size); GetTextExtentPoint32W (gdk_display_hdc, wcstr, wclen, &this_size);
SelectObject (gdk_DC, oldfont); SelectObject (gdk_display_hdc, oldfont);
arg->total.cx += this_size.cx; arg->total.cx += this_size.cx;
arg->total.cy = MAX (arg->total.cy, this_size.cy); arg->total.cy = MAX (arg->total.cy, this_size.cy);

File diff suppressed because it is too large Load Diff

View File

@ -29,9 +29,9 @@
HWND gdk_root_window = NULL; HWND gdk_root_window = NULL;
gint gdk_event_func_from_window_proc = FALSE; gint gdk_event_func_from_window_proc = FALSE;
HDC gdk_DC; HDC gdk_display_hdc;
HINSTANCE gdk_DLLInstance; HINSTANCE gdk_dll_hinstance;
HINSTANCE gdk_ProgInstance; HINSTANCE gdk_app_hmodule; /* Works as a HMODULE, too? */
UINT gdk_selection_notify_msg; UINT gdk_selection_notify_msg;
UINT gdk_selection_request_msg; UINT gdk_selection_request_msg;
UINT gdk_selection_clear_msg; UINT gdk_selection_clear_msg;
@ -40,5 +40,4 @@ GdkAtom gdk_win32_dropfiles_atom;
GdkAtom gdk_ole2_dnd_atom; GdkAtom gdk_ole2_dnd_atom;
ATOM gdk_selection_property; ATOM gdk_selection_property;
gint gdk_null_window_warnings = TRUE; gint gdk_null_window_warnings = TRUE;
DWORD windows_version = 0; DWORD windows_version = 0;

View File

@ -107,7 +107,10 @@ gdk_image_exit (void)
} }
GdkImage * GdkImage *
gdk_image_new_bitmap (GdkVisual *visual, gpointer data, gint w, gint h) gdk_image_new_bitmap (GdkVisual *visual,
gpointer data,
gint w,
gint h)
/* /*
* Desc: create a new bitmap image * Desc: create a new bitmap image
*/ */
@ -162,7 +165,7 @@ gdk_image_new_bitmap (GdkVisual *visual, gpointer data, gint w, gint h)
bmi.u.bmiColors[1].rgbRed = 0xFF; bmi.u.bmiColors[1].rgbRed = 0xFF;
bmi.u.bmiColors[1].rgbReserved = 0x00; bmi.u.bmiColors[1].rgbReserved = 0x00;
private->ximage = CreateDIBSection (gdk_DC, (BITMAPINFO *) &bmi, private->ximage = CreateDIBSection (gdk_display_hdc, (BITMAPINFO *) &bmi,
DIB_RGB_COLORS, &bits, NULL, 0); DIB_RGB_COLORS, &bits, NULL, 0);
if (bpl != bpl32) if (bpl != bpl32)
{ {
@ -284,7 +287,7 @@ gdk_image_new_with_depth (GdkImageType type,
} }
private->ximage = private->ximage =
CreateDIBSection (gdk_DC, (BITMAPINFO *) &bmi, iUsage, CreateDIBSection (gdk_display_hdc, (BITMAPINFO *) &bmi, iUsage,
&image->mem, NULL, 0); &image->mem, NULL, 0);
if (private->ximage == NULL) if (private->ximage == NULL)
@ -587,8 +590,8 @@ gdk_image_get (GdkWindow *window,
guint32 guint32
gdk_image_get_pixel (GdkImage *image, gdk_image_get_pixel (GdkImage *image,
gint x, gint x,
gint y) gint y)
{ {
guint32 pixel; guint32 pixel;
@ -629,9 +632,9 @@ gdk_image_get_pixel (GdkImage *image,
void void
gdk_image_put_pixel (GdkImage *image, gdk_image_put_pixel (GdkImage *image,
gint x, gint x,
gint y, gint y,
guint32 pixel) guint32 pixel)
{ {
g_return_if_fail (image != NULL); g_return_if_fail (image != NULL);
@ -701,107 +704,3 @@ gdk_win32_image_destroy (GdkImage *image)
g_free (private); g_free (private);
} }
static void
gdk_image_put (GdkImage *image,
GdkDrawable *drawable,
GdkGC *gc,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height)
{
GdkDrawablePrivate *drawable_private;
GdkImagePrivateWin32 *image_private;
GdkGCPrivate *gc_private;
HDC hdc;
GdkColormapPrivateWin32 *colormap_private;
g_return_if_fail (drawable != NULL);
g_return_if_fail (image != NULL);
g_return_if_fail (gc != NULL);
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
image_private = (GdkImagePrivateWin32 *) image;
drawable_private = (GdkDrawablePrivate *) drawable;
gc_private = (GdkGCPrivate *) gc;
hdc = gdk_gc_predraw (drawable, gc_private, 0);
colormap_private = (GdkColormapPrivateWin32 *) drawable_private->colormap;
if (colormap_private && colormap_private->xcolormap->rc_palette)
{
DIBSECTION ds;
static struct {
BITMAPINFOHEADER bmiHeader;
WORD bmiIndices[256];
} bmi;
static gboolean bmi_inited = FALSE;
int i;
if (!bmi_inited)
{
for (i = 0; i < 256; i++)
bmi.bmiIndices[i] = i;
bmi_inited = TRUE;
}
if (GetObject (image_private->ximage, sizeof (DIBSECTION),
&ds) != sizeof (DIBSECTION))
{
WIN32_GDI_FAILED ("GetObject");
}
#if 0
g_print("xdest = %d, ydest = %d, xsrc = %d, ysrc = %d, width = %d, height = %d\n",
xdest, ydest, xsrc, ysrc, width, height);
g_print("bmWidth = %d, bmHeight = %d, bmBitsPixel = %d, bmBits = %p\n",
ds.dsBm.bmWidth, ds.dsBm.bmHeight, ds.dsBm.bmBitsPixel, ds.dsBm.bmBits);
g_print("biWidth = %d, biHeight = %d, biBitCount = %d, biClrUsed = %d\n",
ds.dsBmih.biWidth, ds.dsBmih.biHeight, ds.dsBmih.biBitCount, ds.dsBmih.biClrUsed);
#endif
bmi.bmiHeader = ds.dsBmih;
/* I have spent hours on getting the parameters to
* SetDIBitsToDevice right. I wonder what drugs the guys in
* Redmond were on when they designed this API.
*/
if (SetDIBitsToDevice (hdc,
xdest, ydest,
width, height,
xsrc, (-ds.dsBmih.biHeight)-height-ysrc,
0, -ds.dsBmih.biHeight,
ds.dsBm.bmBits,
(CONST BITMAPINFO *) &bmi,
DIB_PAL_COLORS) == 0)
WIN32_GDI_FAILED ("SetDIBitsToDevice");
}
else
{
HDC memdc;
HGDIOBJ oldbitmap;
if ((memdc = CreateCompatibleDC (hdc)) == NULL)
{
WIN32_GDI_FAILED ("CreateCompatibleDC");
gdk_gc_postdraw (drawable, gc_private, 0);
return;
}
if ((oldbitmap = SelectObject (memdc, image_private->ximage)) == NULL)
{
WIN32_GDI_FAILED ("SelectObject");
gdk_gc_postdraw (drawable, gc_private, 0);
return;
}
if (!BitBlt (hdc, xdest, ydest, width, height,
memdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt");
if (SelectObject (memdc, oldbitmap) == NULL)
WIN32_GDI_FAILED ("SelectObject");
if (!DeleteDC (memdc))
WIN32_GDI_FAILED ("DeleteDC");
}
gdk_gc_postdraw (drawable, gc_private, 0);
}

View File

@ -57,10 +57,10 @@ GdkArgDesc _gdk_windowing_args[] = {
int __stdcall int __stdcall
DllMain(HINSTANCE hinstDLL, DllMain(HINSTANCE hinstDLL,
DWORD dwReason, DWORD dwReason,
LPVOID reserved) LPVOID reserved)
{ {
gdk_DLLInstance = hinstDLL; gdk_dll_hinstance = hinstDLL;
return TRUE; return TRUE;
} }
@ -80,8 +80,8 @@ _gdk_windowing_init_check (int argc,
if (gdk_synchronize) if (gdk_synchronize)
GdiSetBatchLimit (1); GdiSetBatchLimit (1);
gdk_ProgInstance = GetModuleHandle (NULL); gdk_app_hmodule = GetModuleHandle (NULL);
gdk_DC = CreateDC ("DISPLAY", NULL, NULL, NULL); gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
gdk_root_window = GetDesktopWindow (); gdk_root_window = GetDesktopWindow ();
windows_version = GetVersion (); windows_version = GetVersion ();
@ -205,7 +205,7 @@ gdk_screen_height (void)
gint gint
gdk_screen_width_mm (void) gdk_screen_width_mm (void)
{ {
return GetDeviceCaps (gdk_DC, HORZSIZE); return GetDeviceCaps (gdk_display_hdc, HORZSIZE);
} }
/* /*
@ -226,7 +226,7 @@ gdk_screen_width_mm (void)
gint gint
gdk_screen_height_mm (void) gdk_screen_height_mm (void)
{ {
return GetDeviceCaps (gdk_DC, VERTSIZE); return GetDeviceCaps (gdk_display_hdc, VERTSIZE);
} }
void void
@ -258,8 +258,8 @@ gdk_windowing_exit (void)
{ {
gdk_win32_dnd_exit (); gdk_win32_dnd_exit ();
CoUninitialize (); CoUninitialize ();
DeleteDC (gdk_DC); DeleteDC (gdk_display_hdc);
gdk_DC = NULL; gdk_display_hdc = NULL;
} }
gchar * gchar *

View File

@ -93,7 +93,7 @@ void gdk_win32_api_failed (const gchar *where,
#define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__, __LINE__, api) #define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__, __LINE__, api)
#endif #endif
extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM); extern LRESULT CALLBACK gdk_window_procedure (HWND, UINT, WPARAM, LPARAM);
extern GdkDrawableClass _gdk_win32_drawable_class; extern GdkDrawableClass _gdk_win32_drawable_class;
extern HWND gdk_root_window; extern HWND gdk_root_window;
@ -101,7 +101,7 @@ extern gboolean gdk_event_func_from_window_proc;
extern HDC gdk_display_hdc; extern HDC gdk_display_hdc;
extern HINSTANCE gdk_dll_hinstance; extern HINSTANCE gdk_dll_hinstance;
extern HINSTANCE gdk_app_hinstance; extern HINSTANCE gdk_app_hmodule;
extern UINT gdk_selection_notify_msg; extern UINT gdk_selection_notify_msg;
extern UINT gdk_selection_request_msg; extern UINT gdk_selection_request_msg;

View File

@ -39,20 +39,6 @@ static gint available_depths[1];
static GdkVisualType available_types[1]; static GdkVisualType available_types[1];
#ifdef G_ENABLE_DEBUG
static const gchar* visual_names[] =
{
"static gray",
"grayscale",
"static color",
"pseudo color",
"true color",
"direct color",
};
#endif /* G_ENABLE_DEBUG */
void void
gdk_visual_init (void) gdk_visual_init (void)
{ {
@ -71,8 +57,8 @@ gdk_visual_init (void)
system_visual = g_new (GdkVisualPrivate, 1); system_visual = g_new (GdkVisualPrivate, 1);
bitspixel = GetDeviceCaps (gdk_DC, BITSPIXEL); bitspixel = GetDeviceCaps (gdk_display_hdc, BITSPIXEL);
rastercaps = GetDeviceCaps (gdk_DC, RASTERCAPS); rastercaps = GetDeviceCaps (gdk_display_hdc, RASTERCAPS);
system_visual->xvisual = g_new (Visual, 1); system_visual->xvisual = g_new (Visual, 1);
system_visual->xvisual->visualid = 0; system_visual->xvisual->visualid = 0;
system_visual->xvisual->bitspixel = bitspixel; system_visual->xvisual->bitspixel = bitspixel;
@ -80,8 +66,8 @@ gdk_visual_init (void)
if (rastercaps & RC_PALETTE) if (rastercaps & RC_PALETTE)
{ {
system_visual->visual.type = GDK_VISUAL_PSEUDO_COLOR; system_visual->visual.type = GDK_VISUAL_PSEUDO_COLOR;
numcolors = GetDeviceCaps (gdk_DC, NUMCOLORS); numcolors = GetDeviceCaps (gdk_display_hdc, NUMCOLORS);
sizepalette = GetDeviceCaps (gdk_DC, SIZEPALETTE); sizepalette = GetDeviceCaps (gdk_display_hdc, SIZEPALETTE);
system_visual->xvisual->map_entries = sizepalette; system_visual->xvisual->map_entries = sizepalette;
} }
else if (bitspixel == 1) else if (bitspixel == 1)
@ -109,10 +95,10 @@ gdk_visual_init (void)
memset (&bmi, 0, sizeof (bmi)); memset (&bmi, 0, sizeof (bmi));
bmi.bi.biSize = sizeof (bmi.bi); bmi.bi.biSize = sizeof (bmi.bi);
hbm = CreateCompatibleBitmap (gdk_DC, 1, 1); hbm = CreateCompatibleBitmap (gdk_display_hdc, 1, 1);
GetDIBits (gdk_DC, hbm, 0, 1, NULL, GetDIBits (gdk_display_hdc, hbm, 0, 1, NULL,
(BITMAPINFO *) &bmi, DIB_RGB_COLORS); (BITMAPINFO *) &bmi, DIB_RGB_COLORS);
GetDIBits (gdk_DC, hbm, 0, 1, NULL, GetDIBits (gdk_display_hdc, hbm, 0, 1, NULL,
(BITMAPINFO *) &bmi, DIB_RGB_COLORS); (BITMAPINFO *) &bmi, DIB_RGB_COLORS);
DeleteObject (hbm); DeleteObject (hbm);

View File

@ -235,7 +235,7 @@ struct _GdkColormapPrivateWin32
struct _GdkImagePrivateWin32 struct _GdkImagePrivateWin32
{ {
HBITMAP ximage; HBITMAP hbitmap;
}; };
typedef struct _GdkGCWin32 GdkGCWin32; typedef struct _GdkGCWin32 GdkGCWin32;
@ -260,7 +260,7 @@ struct _GdkGCWin32
* window or pixmap. We thus keep all the necessary values in the * window or pixmap. We thus keep all the necessary values in the
* GdkGCWin32 object. * GdkGCWin32 object.
*/ */
HDC xgc; HDC hdc;
GdkRegion *clip_region; GdkRegion *clip_region;
HRGN hcliprgn; HRGN hcliprgn;
@ -295,9 +295,9 @@ 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
#define GDK_WINDOW_HWND(win) (GDK_DRAWABLE_IMPL_WIN32(((GdkWindowObject *)win)->impl)->handle) #define GDK_WINDOW_HWND(win) (HWND) (GDK_DRAWABLE_IMPL_WIN32(((GdkWindowObject *)win)->impl)->handle)
#define GDK_PIXMAP_HBM(win) (GDK_DRAWABLE_IMPL_WIN32(((GdkPixmapObject *)win)->impl)->handle) #define GDK_PIXMAP_HBITMAP(win) (HBITMAP) (GDK_DRAWABLE_IMPL_WIN32(((GdkPixmapObject *)win)->impl)->handle)
#define GDK_DRAWABLE_HANDLE(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_HWND (win) : GDK_PIXMAP_HBM (win)) #define GDK_DRAWABLE_HANDLE(win) (GDK_IS_WINDOW (win) ? ((HGDIOBJ) GDK_WINDOW_HWND (win)) : ((HGDIOBJ) GDK_PIXMAP_HBITMAP (win)))
#define GDK_IMAGE_HBM(image) (((GdkImagePrivateWin32 *) GDK_IMAGE (image)->windowing_data)->hbm) #define GDK_IMAGE_HBM(image) (((GdkImagePrivateWin32 *) GDK_IMAGE (image)->windowing_data)->hbm)
#define GDK_COLORMAP_WIN32COLORMAP(cmap) (((GdkColormapPrivateWin32 *)GDK_COLORMAP (cmap)->windowing_data)->xcolormap) #define GDK_COLORMAP_WIN32COLORMAP(cmap) (((GdkColormapPrivateWin32 *)GDK_COLORMAP (cmap)->windowing_data)->xcolormap)
#define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual) #define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual)
@ -310,23 +310,23 @@ GdkPixmap *gdk_pixmap_foreign_new (guint32 anid);
GdkWindow *gdk_window_foreign_new (guint32 anid); GdkWindow *gdk_window_foreign_new (guint32 anid);
/* Return the Gdk* for a particular HANDLE */ /* Return the Gdk* for a particular HANDLE */
gpointer gdk_xid_table_lookup (HANDLE handle); gpointer gdk_xid_table_lookup (HANDLE handle);
/* Return a device context to draw in a drawable, given a GDK GC, /* Return a device context to draw in a drawable, given a GDK GC,
* and a mask indicating which GC values might be used (for efficiency, * and a mask indicating which GC values might be used (for efficiency,
* no need to muck around with text-related stuff if we aren't going * no need to muck around with text-related stuff if we aren't going
* to output text, for instance). * to output text, for instance).
*/ */
HDC gdk_win32_hdc_get (GdkDrawable *drawable, 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
*/ */
void gdk_win32_hdc_release (GdkDrawable *drawable, void gdk_win32_hdc_release (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkGCValuesMask usage); GdkGCValuesMask usage);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -178,24 +178,24 @@ RegisterGdkClass (GdkDrawableType wtype)
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
* on WM_SIZE and WM_MOVE. Flicker, Performance! * on WM_SIZE and WM_MOVE. Flicker, Performance!
*/ */
wcl.lpfnWndProc = gdk_WindowProc; wcl.lpfnWndProc = gdk_window_procedure;
wcl.cbClsExtra = 0; wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0; wcl.cbWndExtra = 0;
wcl.hInstance = gdk_ProgInstance; wcl.hInstance = gdk_app_hmodule;
wcl.hIcon = 0; wcl.hIcon = 0;
/* initialize once! */ /* initialize once! */
if (0 == hAppIcon) if (0 == hAppIcon)
{ {
gchar sLoc [_MAX_PATH+1]; gchar sLoc [_MAX_PATH+1];
if (0 != GetModuleFileName(gdk_ProgInstance, sLoc, _MAX_PATH)) if (0 != GetModuleFileName (gdk_app_hmodule, sLoc, _MAX_PATH))
{ {
hAppIcon = ExtractIcon(gdk_ProgInstance, sLoc, 0); hAppIcon = ExtractIcon (gdk_app_hmodule, sLoc, 0);
if (0 == hAppIcon) if (0 == hAppIcon)
{ {
char *gdklibname = g_strdup_printf ("gdk-%s.dll", GDK_VERSION); char *gdklibname = g_strdup_printf ("gdk-%s.dll", GDK_VERSION);
hAppIcon = ExtractIcon(gdk_ProgInstance, gdklibname, 0); hAppIcon = ExtractIcon (gdk_app_hmodule, gdklibname, 0);
g_free (gdklibname); g_free (gdklibname);
} }
@ -211,7 +211,7 @@ RegisterGdkClass (GdkDrawableType wtype)
#define ONCE_PER_CLASS() \ #define ONCE_PER_CLASS() \
wcl.hIcon = CopyIcon (hAppIcon); \ wcl.hIcon = CopyIcon (hAppIcon); \
wcl.hIconSm = CopyIcon (hAppIcon); \ wcl.hIconSm = CopyIcon (hAppIcon); \
wcl.hbrBackground = CreateSolidBrush( RGB(0,0,0)); \ wcl.hbrBackground = CreateSolidBrush (RGB (0,0,0)); \
wcl.hCursor = LoadCursor (NULL, IDC_ARROW); wcl.hCursor = LoadCursor (NULL, IDC_ARROW);
switch (wtype) switch (wtype)
@ -222,7 +222,7 @@ RegisterGdkClass (GdkDrawableType wtype)
wcl.lpszClassName = "gdkWindowToplevel"; wcl.lpszClassName = "gdkWindowToplevel";
ONCE_PER_CLASS(); ONCE_PER_CLASS();
klassTOPLEVEL = RegisterClassEx(&wcl); klassTOPLEVEL = RegisterClassEx (&wcl);
} }
klass = klassTOPLEVEL; klass = klassTOPLEVEL;
break; break;
@ -233,7 +233,7 @@ RegisterGdkClass (GdkDrawableType wtype)
wcl.style |= CS_PARENTDC; /* MSDN: ... enhances system performance. */ wcl.style |= CS_PARENTDC; /* MSDN: ... enhances system performance. */
ONCE_PER_CLASS(); ONCE_PER_CLASS();
klassCHILD = RegisterClassEx(&wcl); klassCHILD = RegisterClassEx (&wcl);
} }
klass = klassCHILD; klass = klassCHILD;
break; break;
@ -243,7 +243,7 @@ RegisterGdkClass (GdkDrawableType wtype)
wcl.lpszClassName = "gdkWindowDialog"; wcl.lpszClassName = "gdkWindowDialog";
wcl.style |= CS_SAVEBITS; wcl.style |= CS_SAVEBITS;
ONCE_PER_CLASS(); ONCE_PER_CLASS();
klassDIALOG = RegisterClassEx(&wcl); klassDIALOG = RegisterClassEx (&wcl);
} }
klass = klassDIALOG; klass = klassDIALOG;
break; break;
@ -253,7 +253,7 @@ RegisterGdkClass (GdkDrawableType wtype)
wcl.lpszClassName = "gdkWindowTemp"; wcl.lpszClassName = "gdkWindowTemp";
wcl.style |= CS_SAVEBITS; wcl.style |= CS_SAVEBITS;
ONCE_PER_CLASS(); ONCE_PER_CLASS();
klassTEMP = RegisterClassEx(&wcl); klassTEMP = RegisterClassEx (&wcl);
} }
klass = klassTEMP; klass = klassTEMP;
break; break;
@ -449,7 +449,7 @@ gdk_window_new (GdkWindow *parent,
width, height, width, height,
xparent, xparent,
NULL, NULL,
gdk_ProgInstance, gdk_app_hmodule,
NULL); NULL);
GDK_NOTE (MISC, GDK_NOTE (MISC,