mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 05:31:07 +00:00
More work on the Win32 backend. More files compile now.
This commit is contained in:
parent
20b5d8ec2f
commit
4658795817
@ -235,14 +235,14 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
|
||||
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);
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_cursor_new_from_pixmap: "
|
||||
"%#x (%dx%d) %#x (%dx%d) = %#x (%dx%d)\n",
|
||||
GDK_PIXMAP_HBM (source),
|
||||
GDK_PIXMAP_HBITMAP (source),
|
||||
source_impl->width, source_impl->height,
|
||||
GDK_PIXMAP_HBM (mask),
|
||||
GDK_PIXMAP_HBITMAP (mask),
|
||||
mask_impl->width, mask_impl->height,
|
||||
hcursor, cursor_width, cursor_height));
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkdrawable-win32.h"
|
||||
|
||||
#ifdef OLE2_DND
|
||||
#include <ole2.h>
|
||||
@ -1108,7 +1109,6 @@ gdk_drag_find_window (GdkDragContext *context,
|
||||
GdkDragProtocol *protocol)
|
||||
{
|
||||
GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
|
||||
GdkDrawablePrivate *drag_window_private = (GdkDrawablePrivate*) drag_window;
|
||||
HWND recipient;
|
||||
POINT pt;
|
||||
|
||||
@ -1233,7 +1233,7 @@ gdk_window_register_dnd (GdkWindow *window)
|
||||
* (in gtk, data of type text/uri-list) or not.
|
||||
*/
|
||||
gdk_window_add_filter (window, gdk_dropfiles_filter, NULL);
|
||||
DragAcceptFiles (GDK_DRAWABLE_XID (window), TRUE);
|
||||
DragAcceptFiles (GDK_WINDOW_HWND (window), TRUE);
|
||||
|
||||
#ifdef OLE2_DND
|
||||
/* Register for OLE2 d&d */
|
||||
|
@ -24,19 +24,15 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <glib.h>
|
||||
|
||||
#ifndef G_PI
|
||||
#define G_PI 3.14159265358979323846
|
||||
#endif
|
||||
#include <pango/pangowin32.h>
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
|
||||
static void gdk_win32_drawable_destroy (GdkDrawable *drawable);
|
||||
#include "gdkdrawable-win32.h"
|
||||
#include "gdkpixmap-win32.h"
|
||||
|
||||
static void gdk_win32_draw_rectangle (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
@ -94,86 +90,121 @@ static void gdk_win32_draw_lines (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPoint *points,
|
||||
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 = {
|
||||
gdk_win32_drawable_destroy,
|
||||
_gdk_win32_gc_new,
|
||||
gdk_win32_draw_rectangle,
|
||||
gdk_win32_draw_arc,
|
||||
gdk_win32_draw_polygon,
|
||||
gdk_win32_draw_text,
|
||||
gdk_win32_draw_text_wc,
|
||||
gdk_win32_draw_drawable,
|
||||
gdk_win32_draw_points,
|
||||
gdk_win32_draw_segments,
|
||||
gdk_win32_draw_lines
|
||||
};
|
||||
static void gdk_win32_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap *colormap);
|
||||
|
||||
static GdkColormap* gdk_win32_get_colormap (GdkDrawable *drawable);
|
||||
|
||||
static gint gdk_win32_get_depth (GdkDrawable *drawable);
|
||||
|
||||
static void gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass);
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
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 *
|
||||
*****************************************************/
|
||||
|
||||
GdkColormap*
|
||||
gdk_drawable_get_colormap (GdkDrawable *drawable)
|
||||
static GdkColormap*
|
||||
gdk_win32_get_colormap (GdkDrawable *drawable)
|
||||
{
|
||||
GdkDrawablePrivate *drawable_private;
|
||||
GdkDrawableImplWin32 *impl;
|
||||
|
||||
g_return_val_if_fail (drawable != NULL, NULL);
|
||||
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;
|
||||
return impl->colormap;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drawable_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap *colormap)
|
||||
static void
|
||||
gdk_win32_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap *colormap)
|
||||
{
|
||||
GdkDrawablePrivate *drawable_private;
|
||||
GdkColormapPrivateWin32 *colormap_private;
|
||||
GdkDrawableImplWin32 *impl;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
||||
|
||||
if (impl->colormap == colormap)
|
||||
return;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
drawable_private = (GdkDrawablePrivate *) drawable;
|
||||
colormap_private = (GdkColormapPrivateWin32 *) 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);
|
||||
}
|
||||
if (impl->colormap)
|
||||
gdk_colormap_unref (impl->colormap);
|
||||
impl->colormap = colormap;
|
||||
if (impl->colormap)
|
||||
gdk_colormap_ref (impl->colormap);
|
||||
}
|
||||
|
||||
/* Drawing
|
||||
*/
|
||||
static void
|
||||
gdk_win32_drawable_destroy (GdkDrawable *drawable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_draw_rectangle (GdkDrawable *drawable,
|
||||
@ -184,8 +215,8 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
|
||||
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
|
||||
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
||||
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
||||
HDC hdc;
|
||||
HGDIOBJ oldpen, oldbrush;
|
||||
HBRUSH hbr = NULL;
|
||||
@ -193,13 +224,12 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
|
||||
gboolean ok = TRUE;
|
||||
|
||||
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,
|
||||
(filled ? "fill " : ""),
|
||||
width, height, x, y));
|
||||
|
||||
hdc = gdk_gc_predraw (drawable, gc_private,
|
||||
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
|
||||
hdc = gdk_gc_predraw (drawable, gc_private, mask);
|
||||
|
||||
#if 0
|
||||
{
|
||||
@ -220,7 +250,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED)
|
||||
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
|
||||
{
|
||||
if (!BeginPath (hdc))
|
||||
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
|
||||
@ -277,7 +307,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
|
||||
SelectObject (hdc, oldbrush);
|
||||
}
|
||||
|
||||
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
|
||||
gdk_gc_postdraw (drawable, gc_private, mask);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -291,69 +321,66 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
|
||||
gint angle1,
|
||||
gint angle2)
|
||||
{
|
||||
GdkGCPrivate *gc_private;
|
||||
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
||||
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
||||
HDC hdc;
|
||||
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_DRAWABLE_XID (drawable),
|
||||
GDK_DRAWABLE_HANDLE (drawable),
|
||||
x, y, width, height, angle1, angle2));
|
||||
|
||||
/* Seems that drawing arcs with width or height <= 2 fails, at least
|
||||
* 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,
|
||||
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);
|
||||
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, mask);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -363,8 +390,8 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
|
||||
GdkPoint *points,
|
||||
gint npoints)
|
||||
{
|
||||
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
|
||||
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
|
||||
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
||||
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
||||
HDC hdc;
|
||||
HBRUSH hbr = NULL;
|
||||
POINT *pts;
|
||||
@ -372,14 +399,13 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
|
||||
int i;
|
||||
|
||||
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));
|
||||
|
||||
if (npoints < 2)
|
||||
return;
|
||||
|
||||
hdc = gdk_gc_predraw (drawable, gc_private,
|
||||
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
|
||||
hdc = gdk_gc_predraw (drawable, gc_private, mask);
|
||||
pts = g_new (POINT, npoints+1);
|
||||
|
||||
for (i = 0; i < npoints; i++)
|
||||
@ -388,12 +414,13 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
|
||||
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))
|
||||
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)
|
||||
npoints--;
|
||||
@ -440,7 +467,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
|
||||
}
|
||||
}
|
||||
g_free (pts);
|
||||
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
|
||||
gdk_gc_postdraw (drawable, gc_private, mask);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@ -462,7 +489,7 @@ gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
|
||||
if (!singlefont)
|
||||
return;
|
||||
|
||||
if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL)
|
||||
if ((oldfont = SelectObject (argp->hdc, singlefont->hfont)) == NULL)
|
||||
{
|
||||
WIN32_GDI_FAILED ("SelectObject");
|
||||
return;
|
||||
@ -485,51 +512,45 @@ gdk_win32_draw_text (GdkDrawable *drawable,
|
||||
const gchar *text,
|
||||
gint text_length)
|
||||
{
|
||||
GdkGCPrivate *gc_private;
|
||||
wchar_t *wcstr;
|
||||
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
||||
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_FONT;
|
||||
wchar_t *wcstr, wc;
|
||||
gint wlen;
|
||||
gdk_draw_text_arg arg;
|
||||
|
||||
|
||||
if (GDK_DRAWABLE_DESTROYED (drawable))
|
||||
return;
|
||||
|
||||
if (text_length == 0)
|
||||
return;
|
||||
|
||||
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
|
||||
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
arg.x = x;
|
||||
arg.y = y;
|
||||
arg.hdc = gdk_gc_predraw (drawable, gc_private,
|
||||
GDK_GC_FOREGROUND|GDK_GC_FONT);
|
||||
arg.hdc = gdk_gc_predraw (drawable, gc_private, mask);
|
||||
|
||||
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,
|
||||
(text_length > 10 ? 10 : text_length),
|
||||
text, text_length));
|
||||
|
||||
wcstr = g_new (wchar_t, text_length);
|
||||
if (text_length == 1)
|
||||
{
|
||||
/* For single characters, don't try to interpret as UTF-8. */
|
||||
wcstr[0] = (guchar) text[0];
|
||||
gdk_wchar_text_handle (font, wcstr, 1, gdk_draw_text_handler, &arg);
|
||||
wc = (guchar) text[0];
|
||||
gdk_wchar_text_handle (font, &wc, 1, gdk_draw_text_handler, &arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
wcstr = g_new (wchar_t, text_length);
|
||||
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
|
||||
g_warning ("gdk_win32_draw_text: gdk_nmbstowchar_ts failed");
|
||||
else
|
||||
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
|
||||
@ -541,29 +562,23 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
|
||||
const GdkWChar *text,
|
||||
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;
|
||||
wchar_t *wcstr;
|
||||
gdk_draw_text_arg arg;
|
||||
|
||||
|
||||
if (GDK_DRAWABLE_DESTROYED (drawable))
|
||||
return;
|
||||
|
||||
if (text_length == 0)
|
||||
return;
|
||||
|
||||
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
|
||||
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
arg.x = x;
|
||||
arg.y = y;
|
||||
arg.hdc = gdk_gc_predraw (drawable, gc_private,
|
||||
GDK_GC_FOREGROUND|GDK_GC_FONT);
|
||||
arg.hdc = gdk_gc_predraw (drawable, gc_private, mask);
|
||||
|
||||
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));
|
||||
|
||||
if (sizeof (wchar_t) != sizeof (GdkWChar))
|
||||
@ -581,7 +596,7 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
|
||||
if (sizeof (wchar_t) != sizeof (GdkWChar))
|
||||
g_free (wcstr);
|
||||
|
||||
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_FONT);
|
||||
gdk_gc_postdraw (drawable, gc_private, mask);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -595,38 +610,36 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkDrawablePrivate *src_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
||||
GdkDrawableImplWin32 *src_impl = GDK_DRAWABLE_IMPL_WIN32 (src);
|
||||
HDC hdc;
|
||||
HDC srcdc;
|
||||
HGDIOBJ hgdiobj;
|
||||
HRGN src_rgn, draw_rgn, outside_rgn;
|
||||
RECT r;
|
||||
gint src_width, src_height;
|
||||
gboolean ok = TRUE;
|
||||
|
||||
src_private = (GdkDrawablePrivate*) src;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_draw_pixmap: dest: %#x "
|
||||
"src: %#x %dx%d@+%d+%d"
|
||||
" dest: %#x @+%d+%d\n",
|
||||
GDK_DRAWABLE_XID (drawable),
|
||||
GDK_DRAWABLE_XID (src),
|
||||
width, height, xsrc, ysrc,
|
||||
GDK_DRAWABLE_XID (drawable), xdest, ydest));
|
||||
GDK_NOTE (MISC, g_print ("gdk_draw_pixmap: dest: %#x @+%d+%d"
|
||||
"src: %#x %dx%d@+%d+%d\n",
|
||||
GDK_DRAWABLE_HANDLE (drawable), xdest, ydest,
|
||||
GDK_PIXMAP_HBITMAP (src),
|
||||
width, height, xsrc, ysrc));
|
||||
|
||||
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);
|
||||
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
|
||||
* outside the source pixmap, and invalidate that, causing it to
|
||||
* be cleared. XXX
|
||||
*/
|
||||
SetRectEmpty (&r);
|
||||
outside_rgn = CreateRectRgnIndirect (&r);
|
||||
if (CombineRgn (outside_rgn, draw_rgn, src_rgn, RGN_DIFF) != NULLREGION)
|
||||
{
|
||||
OffsetRgn (outside_rgn, xdest, ydest);
|
||||
@ -635,8 +648,9 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
|
||||
"bbox: %dx%d@+%d+%d\n",
|
||||
r.right - r.left - 1, r.bottom - r.top - 1,
|
||||
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 */
|
||||
@ -665,68 +679,64 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
|
||||
|
||||
DeleteObject (src_rgn);
|
||||
DeleteObject (draw_rgn);
|
||||
DeleteObject (outside_rgn);
|
||||
|
||||
/* Strangely enough, this function is called also to bitblt
|
||||
* from a window.
|
||||
/* This function is called also to bitblt from a window.
|
||||
*/
|
||||
if (src_private->window_type == GDK_DRAWABLE_PIXMAP)
|
||||
if (GDK_IS_PIXMAP (src))
|
||||
{
|
||||
if ((srcdc = CreateCompatibleDC (hdc)) == NULL)
|
||||
WIN32_GDI_FAILED ("CreateCompatibleDC");
|
||||
WIN32_GDI_FAILED ("CreateCompatibleDC"), ok = FALSE;
|
||||
|
||||
if ((hgdiobj = SelectObject (srcdc, GDK_DRAWABLE_XID (src))) == NULL)
|
||||
WIN32_GDI_FAILED ("SelectObject");
|
||||
if (ok && (hgdiobj = SelectObject (srcdc, GDK_PIXMAP_HBITMAP (src))) == NULL)
|
||||
WIN32_GDI_FAILED ("SelectObject"), ok = FALSE;
|
||||
|
||||
if (!BitBlt (hdc, xdest, ydest, width, height,
|
||||
srcdc, xsrc, ysrc, SRCCOPY))
|
||||
if (ok && !BitBlt (hdc, xdest, ydest, width, height,
|
||||
srcdc, xsrc, ysrc, SRCCOPY))
|
||||
WIN32_GDI_FAILED ("BitBlt");
|
||||
|
||||
if ((SelectObject (srcdc, hgdiobj) == NULL))
|
||||
if (ok && (SelectObject (srcdc, hgdiobj) == NULL))
|
||||
WIN32_GDI_FAILED ("SelectObject");
|
||||
|
||||
if (!DeleteDC (srcdc))
|
||||
if (srcdc != NULL && !DeleteDC (srcdc))
|
||||
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
|
||||
{
|
||||
if (GDK_DRAWABLE_XID(drawable) == GDK_DRAWABLE_XID (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");
|
||||
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);
|
||||
}
|
||||
if ((srcdc = GetDC (GDK_WINDOW_HWND (src))) == NULL)
|
||||
WIN32_GDI_FAILED ("GetDC"), ok = FALSE;
|
||||
|
||||
if (ok && !BitBlt (hdc, xdest, ydest, width, height,
|
||||
srcdc, xsrc, ysrc, SRCCOPY))
|
||||
WIN32_GDI_FAILED ("BitBlt");
|
||||
ReleaseDC (GDK_WINDOW_HWND (src), srcdc);
|
||||
}
|
||||
gdk_gc_postdraw (drawable, gc_private, 0);
|
||||
}
|
||||
@ -739,16 +749,15 @@ gdk_win32_draw_points (GdkDrawable *drawable,
|
||||
{
|
||||
HDC hdc;
|
||||
COLORREF fg;
|
||||
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
|
||||
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
|
||||
GdkDrawablePrivate *drawable_private = (GdkDrawablePrivate *) drawable;
|
||||
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
||||
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
||||
GdkColormapPrivateWin32 *colormap_private =
|
||||
(GdkColormapPrivateWin32 *) drawable_private->colormap;
|
||||
(GdkColormapPrivateWin32 *) impl->colormap;
|
||||
int i;
|
||||
|
||||
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_DRAWABLE_XID (drawable), npoints, fg));
|
||||
@ -765,25 +774,24 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
|
||||
GdkSegment *segs,
|
||||
gint nsegs)
|
||||
{
|
||||
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
|
||||
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
|
||||
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
||||
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
||||
HDC hdc;
|
||||
HBRUSH hbr = NULL;
|
||||
gboolean ok = TRUE;
|
||||
int i;
|
||||
|
||||
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,
|
||||
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
|
||||
hdc = gdk_gc_predraw (drawable, gc_private, mask);
|
||||
|
||||
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED)
|
||||
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
|
||||
{
|
||||
if (!BeginPath (hdc))
|
||||
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))
|
||||
WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE;
|
||||
@ -791,7 +799,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
|
||||
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
|
||||
|
||||
/* 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))
|
||||
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
|
||||
}
|
||||
@ -811,20 +819,20 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nsegs; i++)
|
||||
for (i = 0; ok && i < nsegs; i++)
|
||||
{
|
||||
if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
|
||||
WIN32_GDI_FAILED ("MoveToEx");
|
||||
if (!LineTo (hdc, segs[i].x2, segs[i].y2))
|
||||
WIN32_GDI_FAILED ("LineTo");
|
||||
WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE;
|
||||
if (ok && !LineTo (hdc, segs[i].x2, segs[i].y2))
|
||||
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
|
||||
|
||||
/* 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))
|
||||
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
|
||||
@ -833,18 +841,18 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
|
||||
GdkPoint *points,
|
||||
gint npoints)
|
||||
{
|
||||
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
|
||||
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
|
||||
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
||||
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
||||
HDC hdc;
|
||||
POINT *pts;
|
||||
int i;
|
||||
gboolean ok = TRUE;
|
||||
|
||||
if (npoints < 2)
|
||||
return;
|
||||
|
||||
hdc = gdk_gc_predraw (drawable, gc_private,
|
||||
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
|
||||
#if 1
|
||||
hdc = gdk_gc_predraw (drawable, gc_private, mask);
|
||||
|
||||
pts = g_new (POINT, npoints);
|
||||
|
||||
for (i = 0; i < npoints; i++)
|
||||
@ -854,31 +862,129 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
|
||||
}
|
||||
|
||||
if (!Polyline (hdc, pts, npoints))
|
||||
WIN32_GDI_FAILED ("Polyline");
|
||||
WIN32_GDI_FAILED ("Polyline"), ok = FALSE;
|
||||
|
||||
g_free (pts);
|
||||
|
||||
/* 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);
|
||||
if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y))
|
||||
WIN32_GDI_FAILED ("LineTo");
|
||||
}
|
||||
#else
|
||||
MoveToEx (hdc, points[0].x, points[0].y, NULL);
|
||||
for (i = 1; i < npoints; i++)
|
||||
if (!LineTo (hdc, points[i].x, points[i].y))
|
||||
WIN32_GDI_FAILED ("LineTo");
|
||||
|
||||
/* Draw end pixel */
|
||||
/* LineTo doesn't draw the last point, so if we have a pen width of 1,
|
||||
* we draw the end pixel separately... With wider pens we don't care.
|
||||
* //HB: But the NT developers don't read their API documentation ...
|
||||
*/
|
||||
if (gc_data->pen_width <= 1 && windows_version > 0x80000000)
|
||||
if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y))
|
||||
WIN32_GDI_FAILED ("LineTo");
|
||||
#endif
|
||||
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
|
||||
gdk_gc_postdraw (drawable, gc_private, mask);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_draw_glyphs (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
PangoFont *font,
|
||||
gint x,
|
||||
gint y,
|
||||
PangoGlyphString *glyphs)
|
||||
{
|
||||
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
||||
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
||||
const GdkGCValuesMask mask = GDK_GC_FOREGROUND;
|
||||
HDC hdc;
|
||||
|
||||
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
@ -142,7 +142,7 @@ logfont_to_xlfd (const LOGFONT *lfp,
|
||||
|
||||
if (logpixelsy == 0)
|
||||
{
|
||||
logpixelsy = GetDeviceCaps (gdk_DC, LOGPIXELSY);
|
||||
logpixelsy = GetDeviceCaps (gdk_display_hdc, LOGPIXELSY);
|
||||
}
|
||||
|
||||
if (lfp->lfWeight >= FW_HEAVY)
|
||||
@ -281,7 +281,7 @@ gdk_font_full_name_get (GdkFont *font)
|
||||
{
|
||||
singlefont = (GdkWin32SingleFont *) list->data;
|
||||
|
||||
if (GetObject (singlefont->xfont, sizeof (LOGFONT), &logfont) == 0)
|
||||
if (GetObject (singlefont->hfont, sizeof (LOGFONT), &logfont) == 0)
|
||||
{
|
||||
WIN32_GDI_FAILED ("GetObject");
|
||||
return NULL;
|
||||
@ -409,7 +409,7 @@ EnumFontFamExProc (const LOGFONT *lfp,
|
||||
|
||||
lf = *lfp;
|
||||
|
||||
EnumFontFamiliesEx (gdk_DC, &lf, InnerEnumFontFamExProc, lParam, 0);
|
||||
EnumFontFamiliesEx (gdk_display_hdc, &lf, InnerEnumFontFamExProc, lParam, 0);
|
||||
}
|
||||
else
|
||||
InnerEnumFontFamExProc (lfp, metrics, fontType, lParam);
|
||||
@ -429,7 +429,7 @@ gdk_font_list_new (const gchar *font_pattern,
|
||||
xfontnames = g_new (gchar *, font_names_size);
|
||||
memset (&logfont, 0, sizeof (logfont));
|
||||
logfont.lfCharSet = DEFAULT_CHARSET;
|
||||
EnumFontFamiliesEx (gdk_DC, &logfont, EnumFontFamExProc,
|
||||
EnumFontFamiliesEx (gdk_display_hdc, &logfont, EnumFontFamExProc,
|
||||
(LPARAM) font_pattern, 0);
|
||||
|
||||
result = g_new (gchar *, num_fonts + 1);
|
||||
@ -1234,7 +1234,7 @@ gdk_font_load_internal (const gchar *font_name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
logpixelsy = GetDeviceCaps (gdk_DC, LOGPIXELSY);
|
||||
logpixelsy = GetDeviceCaps (gdk_display_hdc, LOGPIXELSY);
|
||||
|
||||
if (strcmp (pixel_size, "*") == 0)
|
||||
if (strcmp (point_size, "*") == 0)
|
||||
@ -1447,13 +1447,13 @@ gdk_font_load_internal (const gchar *font_name)
|
||||
return NULL;
|
||||
|
||||
singlefont = g_new (GdkWin32SingleFont, 1);
|
||||
singlefont->xfont = hfont;
|
||||
GetObject (singlefont->xfont, sizeof (logfont), &logfont);
|
||||
oldfont = SelectObject (gdk_DC, singlefont->xfont);
|
||||
singlefont->hfont = hfont;
|
||||
GetObject (singlefont->hfont, sizeof (logfont), &logfont);
|
||||
oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
|
||||
memset (&singlefont->fs, 0, sizeof (singlefont->fs));
|
||||
singlefont->charset = GetTextCharsetInfo (gdk_DC, &singlefont->fs, 0);
|
||||
GetTextFace (gdk_DC, sizeof (face), face);
|
||||
SelectObject (gdk_DC, oldfont);
|
||||
singlefont->charset = GetTextCharsetInfo (gdk_display_hdc, &singlefont->fs, 0);
|
||||
GetTextFace (gdk_display_hdc, sizeof (face), face);
|
||||
SelectObject (gdk_display_hdc, oldfont);
|
||||
if (TranslateCharsetInfo ((DWORD *) singlefont->charset, &csi,
|
||||
TCI_SRCCHARSET)
|
||||
&& singlefont->charset != MAC_CHARSET)
|
||||
@ -1462,7 +1462,7 @@ gdk_font_load_internal (const gchar *font_name)
|
||||
singlefont->codepage = 0;
|
||||
|
||||
GDK_NOTE (MISC, (g_print ("... = %#x %s cs %s cp%d\n",
|
||||
singlefont->xfont, face,
|
||||
singlefont->hfont, face,
|
||||
charset_name (singlefont->charset),
|
||||
singlefont->codepage),
|
||||
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.)
|
||||
*/
|
||||
font->type = GDK_FONT_FONTSET;
|
||||
oldfont = SelectObject (gdk_DC, singlefont->xfont);
|
||||
GetTextMetrics (gdk_DC, &textmetric);
|
||||
SelectObject (gdk_DC, oldfont);
|
||||
oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
|
||||
GetTextMetrics (gdk_display_hdc, &textmetric);
|
||||
SelectObject (gdk_display_hdc, oldfont);
|
||||
font->ascent = textmetric.tmAscent;
|
||||
font->descent = textmetric.tmDescent;
|
||||
|
||||
@ -1568,9 +1568,9 @@ gdk_fontset_load (const gchar *fontset_name)
|
||||
if (singlefont)
|
||||
{
|
||||
private->fonts = g_slist_append (private->fonts, singlefont);
|
||||
oldfont = SelectObject (gdk_DC, singlefont->xfont);
|
||||
GetTextMetrics (gdk_DC, &textmetric);
|
||||
SelectObject (gdk_DC, oldfont);
|
||||
oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
|
||||
GetTextMetrics (gdk_display_hdc, &textmetric);
|
||||
SelectObject (gdk_display_hdc, oldfont);
|
||||
font->ascent = MAX (font->ascent, textmetric.tmAscent);
|
||||
font->descent = MAX (font->descent, textmetric.tmDescent);
|
||||
}
|
||||
@ -1602,14 +1602,14 @@ _gdk_font_destroy (GdkFont *font)
|
||||
|
||||
singlefont = (GdkWin32SingleFont *) private->fonts->data;
|
||||
GDK_NOTE (MISC, g_print ("_gdk_font_destroy %#x\n",
|
||||
singlefont->xfont));
|
||||
singlefont->hfont));
|
||||
|
||||
gdk_font_hash_remove (font->type, font);
|
||||
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
DeleteObject (singlefont->xfont);
|
||||
DeleteObject (singlefont->hfont);
|
||||
break;
|
||||
|
||||
case GDK_FONT_FONTSET:
|
||||
@ -1617,7 +1617,7 @@ _gdk_font_destroy (GdkFont *font)
|
||||
while (list)
|
||||
{
|
||||
singlefont = (GdkWin32SingleFont *) list->data;
|
||||
DeleteObject (singlefont->xfont);
|
||||
DeleteObject (singlefont->hfont);
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
@ -1647,7 +1647,7 @@ gdk_font_id (const GdkFont *font)
|
||||
private = (const GdkFontPrivateWin32 *) font;
|
||||
|
||||
if (font->type == GDK_FONT_FONT)
|
||||
return (gint) ((GdkWin32SingleFont *) private->fonts->data)->xfont;
|
||||
return (gint) ((GdkWin32SingleFont *) private->fonts->data)->hfont;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@ -1666,8 +1666,8 @@ gdk_font_equal (const GdkFont *fonta,
|
||||
privateb = (const GdkFontPrivateWin32 *) fontb;
|
||||
|
||||
if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT)
|
||||
return (((GdkWin32SingleFont *) privatea->fonts->data)->xfont
|
||||
== ((GdkWin32SingleFont *) privateb->fonts->data)->xfont);
|
||||
return (((GdkWin32SingleFont *) privatea->fonts->data)->hfont
|
||||
== ((GdkWin32SingleFont *) privateb->fonts->data)->hfont);
|
||||
else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET)
|
||||
{
|
||||
GSList *lista = privatea->fonts;
|
||||
@ -1675,8 +1675,8 @@ gdk_font_equal (const GdkFont *fonta,
|
||||
|
||||
while (lista && listb)
|
||||
{
|
||||
if (((GdkWin32SingleFont *) lista->data)->xfont
|
||||
!= ((GdkWin32SingleFont *) listb->data)->xfont)
|
||||
if (((GdkWin32SingleFont *) lista->data)->hfont
|
||||
!= ((GdkWin32SingleFont *) listb->data)->hfont)
|
||||
return 0;
|
||||
lista = lista->next;
|
||||
listb = listb->next;
|
||||
@ -1762,7 +1762,7 @@ gdk_wchar_text_handle (GdkFont *font,
|
||||
|
||||
GDK_NOTE (MISC, g_print ("%d:%d:%d:%#x ",
|
||||
start-wcstr, wcp-wcstr, block,
|
||||
(singlefont ? singlefont->xfont : 0)));
|
||||
(singlefont ? singlefont->hfont : 0)));
|
||||
|
||||
/* Call the callback function */
|
||||
(*handler) (singlefont, start, wcp+1 - start, arg);
|
||||
@ -1789,13 +1789,13 @@ gdk_text_size_handler (GdkWin32SingleFont *singlefont,
|
||||
if (!singlefont)
|
||||
return;
|
||||
|
||||
if ((oldfont = SelectObject (gdk_DC, singlefont->xfont)) == NULL)
|
||||
if ((oldfont = SelectObject (gdk_display_hdc, singlefont->hfont)) == NULL)
|
||||
{
|
||||
WIN32_GDI_FAILED ("SelectObject");
|
||||
return;
|
||||
}
|
||||
GetTextExtentPoint32W (gdk_DC, wcstr, wclen, &this_size);
|
||||
SelectObject (gdk_DC, oldfont);
|
||||
GetTextExtentPoint32W (gdk_display_hdc, wcstr, wclen, &this_size);
|
||||
SelectObject (gdk_display_hdc, oldfont);
|
||||
|
||||
arg->total.cx += this_size.cx;
|
||||
arg->total.cy = MAX (arg->total.cy, this_size.cy);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,9 +29,9 @@
|
||||
|
||||
HWND gdk_root_window = NULL;
|
||||
gint gdk_event_func_from_window_proc = FALSE;
|
||||
HDC gdk_DC;
|
||||
HINSTANCE gdk_DLLInstance;
|
||||
HINSTANCE gdk_ProgInstance;
|
||||
HDC gdk_display_hdc;
|
||||
HINSTANCE gdk_dll_hinstance;
|
||||
HINSTANCE gdk_app_hmodule; /* Works as a HMODULE, too? */
|
||||
UINT gdk_selection_notify_msg;
|
||||
UINT gdk_selection_request_msg;
|
||||
UINT gdk_selection_clear_msg;
|
||||
@ -40,5 +40,4 @@ GdkAtom gdk_win32_dropfiles_atom;
|
||||
GdkAtom gdk_ole2_dnd_atom;
|
||||
ATOM gdk_selection_property;
|
||||
gint gdk_null_window_warnings = TRUE;
|
||||
|
||||
DWORD windows_version = 0;
|
||||
|
@ -107,7 +107,10 @@ gdk_image_exit (void)
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
@ -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].rgbReserved = 0x00;
|
||||
|
||||
private->ximage = CreateDIBSection (gdk_DC, (BITMAPINFO *) &bmi,
|
||||
private->ximage = CreateDIBSection (gdk_display_hdc, (BITMAPINFO *) &bmi,
|
||||
DIB_RGB_COLORS, &bits, NULL, 0);
|
||||
if (bpl != bpl32)
|
||||
{
|
||||
@ -284,7 +287,7 @@ gdk_image_new_with_depth (GdkImageType type,
|
||||
}
|
||||
|
||||
private->ximage =
|
||||
CreateDIBSection (gdk_DC, (BITMAPINFO *) &bmi, iUsage,
|
||||
CreateDIBSection (gdk_display_hdc, (BITMAPINFO *) &bmi, iUsage,
|
||||
&image->mem, NULL, 0);
|
||||
|
||||
if (private->ximage == NULL)
|
||||
@ -587,8 +590,8 @@ gdk_image_get (GdkWindow *window,
|
||||
|
||||
guint32
|
||||
gdk_image_get_pixel (GdkImage *image,
|
||||
gint x,
|
||||
gint y)
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
guint32 pixel;
|
||||
|
||||
@ -629,9 +632,9 @@ gdk_image_get_pixel (GdkImage *image,
|
||||
|
||||
void
|
||||
gdk_image_put_pixel (GdkImage *image,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 pixel)
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 pixel)
|
||||
{
|
||||
g_return_if_fail (image != NULL);
|
||||
|
||||
@ -701,107 +704,3 @@ gdk_win32_image_destroy (GdkImage *image)
|
||||
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);
|
||||
}
|
||||
|
@ -57,10 +57,10 @@ GdkArgDesc _gdk_windowing_args[] = {
|
||||
|
||||
int __stdcall
|
||||
DllMain(HINSTANCE hinstDLL,
|
||||
DWORD dwReason,
|
||||
LPVOID reserved)
|
||||
DWORD dwReason,
|
||||
LPVOID reserved)
|
||||
{
|
||||
gdk_DLLInstance = hinstDLL;
|
||||
gdk_dll_hinstance = hinstDLL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -80,8 +80,8 @@ _gdk_windowing_init_check (int argc,
|
||||
if (gdk_synchronize)
|
||||
GdiSetBatchLimit (1);
|
||||
|
||||
gdk_ProgInstance = GetModuleHandle (NULL);
|
||||
gdk_DC = CreateDC ("DISPLAY", NULL, NULL, NULL);
|
||||
gdk_app_hmodule = GetModuleHandle (NULL);
|
||||
gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
|
||||
gdk_root_window = GetDesktopWindow ();
|
||||
windows_version = GetVersion ();
|
||||
|
||||
@ -205,7 +205,7 @@ gdk_screen_height (void)
|
||||
gint
|
||||
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
|
||||
gdk_screen_height_mm (void)
|
||||
{
|
||||
return GetDeviceCaps (gdk_DC, VERTSIZE);
|
||||
return GetDeviceCaps (gdk_display_hdc, VERTSIZE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -258,8 +258,8 @@ gdk_windowing_exit (void)
|
||||
{
|
||||
gdk_win32_dnd_exit ();
|
||||
CoUninitialize ();
|
||||
DeleteDC (gdk_DC);
|
||||
gdk_DC = NULL;
|
||||
DeleteDC (gdk_display_hdc);
|
||||
gdk_display_hdc = NULL;
|
||||
}
|
||||
|
||||
gchar *
|
||||
|
@ -93,7 +93,7 @@ void gdk_win32_api_failed (const gchar *where,
|
||||
#define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__, __LINE__, api)
|
||||
#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 HWND gdk_root_window;
|
||||
@ -101,7 +101,7 @@ extern gboolean gdk_event_func_from_window_proc;
|
||||
|
||||
extern HDC gdk_display_hdc;
|
||||
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_request_msg;
|
||||
|
@ -39,20 +39,6 @@ static gint available_depths[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
|
||||
gdk_visual_init (void)
|
||||
{
|
||||
@ -71,8 +57,8 @@ gdk_visual_init (void)
|
||||
|
||||
system_visual = g_new (GdkVisualPrivate, 1);
|
||||
|
||||
bitspixel = GetDeviceCaps (gdk_DC, BITSPIXEL);
|
||||
rastercaps = GetDeviceCaps (gdk_DC, RASTERCAPS);
|
||||
bitspixel = GetDeviceCaps (gdk_display_hdc, BITSPIXEL);
|
||||
rastercaps = GetDeviceCaps (gdk_display_hdc, RASTERCAPS);
|
||||
system_visual->xvisual = g_new (Visual, 1);
|
||||
system_visual->xvisual->visualid = 0;
|
||||
system_visual->xvisual->bitspixel = bitspixel;
|
||||
@ -80,8 +66,8 @@ gdk_visual_init (void)
|
||||
if (rastercaps & RC_PALETTE)
|
||||
{
|
||||
system_visual->visual.type = GDK_VISUAL_PSEUDO_COLOR;
|
||||
numcolors = GetDeviceCaps (gdk_DC, NUMCOLORS);
|
||||
sizepalette = GetDeviceCaps (gdk_DC, SIZEPALETTE);
|
||||
numcolors = GetDeviceCaps (gdk_display_hdc, NUMCOLORS);
|
||||
sizepalette = GetDeviceCaps (gdk_display_hdc, SIZEPALETTE);
|
||||
system_visual->xvisual->map_entries = sizepalette;
|
||||
}
|
||||
else if (bitspixel == 1)
|
||||
@ -109,10 +95,10 @@ gdk_visual_init (void)
|
||||
memset (&bmi, 0, sizeof (bmi));
|
||||
bmi.bi.biSize = sizeof (bmi.bi);
|
||||
|
||||
hbm = CreateCompatibleBitmap (gdk_DC, 1, 1);
|
||||
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
|
||||
hbm = CreateCompatibleBitmap (gdk_display_hdc, 1, 1);
|
||||
GetDIBits (gdk_display_hdc, hbm, 0, 1, NULL,
|
||||
(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);
|
||||
DeleteObject (hbm);
|
||||
|
||||
|
@ -235,7 +235,7 @@ struct _GdkColormapPrivateWin32
|
||||
|
||||
struct _GdkImagePrivateWin32
|
||||
{
|
||||
HBITMAP ximage;
|
||||
HBITMAP hbitmap;
|
||||
};
|
||||
|
||||
typedef struct _GdkGCWin32 GdkGCWin32;
|
||||
@ -260,7 +260,7 @@ struct _GdkGCWin32
|
||||
* window or pixmap. We thus keep all the necessary values in the
|
||||
* GdkGCWin32 object.
|
||||
*/
|
||||
HDC xgc;
|
||||
HDC hdc;
|
||||
|
||||
GdkRegion *clip_region;
|
||||
HRGN hcliprgn;
|
||||
@ -295,9 +295,9 @@ GType gdk_gc_win32_get_type (void);
|
||||
#define GDK_ROOT_WINDOW() ((guint32) HWND_DESKTOP)
|
||||
#define GDK_ROOT_PARENT() ((GdkWindow *) gdk_parent_root)
|
||||
#define GDK_DISPLAY() NULL
|
||||
#define GDK_WINDOW_HWND(win) (GDK_DRAWABLE_IMPL_WIN32(((GdkWindowObject *)win)->impl)->handle)
|
||||
#define GDK_PIXMAP_HBM(win) (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_WINDOW_HWND(win) (HWND) (GDK_DRAWABLE_IMPL_WIN32(((GdkWindowObject *)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) ? ((HGDIOBJ) GDK_WINDOW_HWND (win)) : ((HGDIOBJ) GDK_PIXMAP_HBITMAP (win)))
|
||||
#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_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual)
|
||||
@ -310,23 +310,23 @@ GdkPixmap *gdk_pixmap_foreign_new (guint32 anid);
|
||||
GdkWindow *gdk_window_foreign_new (guint32 anid);
|
||||
|
||||
/* 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,
|
||||
* 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
|
||||
* to output text, for instance).
|
||||
*/
|
||||
HDC gdk_win32_hdc_get (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkGCValuesMask usage);
|
||||
HDC gdk_win32_hdc_get (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkGCValuesMask usage);
|
||||
|
||||
/* Each HDC returned from gdk_win32_hdc_get must be released with
|
||||
* this function
|
||||
*/
|
||||
void gdk_win32_hdc_release (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkGCValuesMask usage);
|
||||
void gdk_win32_hdc_release (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkGCValuesMask usage);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -178,24 +178,24 @@ RegisterGdkClass (GdkDrawableType wtype)
|
||||
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
|
||||
* on WM_SIZE and WM_MOVE. Flicker, Performance!
|
||||
*/
|
||||
wcl.lpfnWndProc = gdk_WindowProc;
|
||||
wcl.lpfnWndProc = gdk_window_procedure;
|
||||
wcl.cbClsExtra = 0;
|
||||
wcl.cbWndExtra = 0;
|
||||
wcl.hInstance = gdk_ProgInstance;
|
||||
wcl.hInstance = gdk_app_hmodule;
|
||||
wcl.hIcon = 0;
|
||||
/* initialize once! */
|
||||
if (0 == hAppIcon)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ RegisterGdkClass (GdkDrawableType wtype)
|
||||
#define ONCE_PER_CLASS() \
|
||||
wcl.hIcon = 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);
|
||||
|
||||
switch (wtype)
|
||||
@ -222,7 +222,7 @@ RegisterGdkClass (GdkDrawableType wtype)
|
||||
wcl.lpszClassName = "gdkWindowToplevel";
|
||||
|
||||
ONCE_PER_CLASS();
|
||||
klassTOPLEVEL = RegisterClassEx(&wcl);
|
||||
klassTOPLEVEL = RegisterClassEx (&wcl);
|
||||
}
|
||||
klass = klassTOPLEVEL;
|
||||
break;
|
||||
@ -233,7 +233,7 @@ RegisterGdkClass (GdkDrawableType wtype)
|
||||
|
||||
wcl.style |= CS_PARENTDC; /* MSDN: ... enhances system performance. */
|
||||
ONCE_PER_CLASS();
|
||||
klassCHILD = RegisterClassEx(&wcl);
|
||||
klassCHILD = RegisterClassEx (&wcl);
|
||||
}
|
||||
klass = klassCHILD;
|
||||
break;
|
||||
@ -243,7 +243,7 @@ RegisterGdkClass (GdkDrawableType wtype)
|
||||
wcl.lpszClassName = "gdkWindowDialog";
|
||||
wcl.style |= CS_SAVEBITS;
|
||||
ONCE_PER_CLASS();
|
||||
klassDIALOG = RegisterClassEx(&wcl);
|
||||
klassDIALOG = RegisterClassEx (&wcl);
|
||||
}
|
||||
klass = klassDIALOG;
|
||||
break;
|
||||
@ -253,7 +253,7 @@ RegisterGdkClass (GdkDrawableType wtype)
|
||||
wcl.lpszClassName = "gdkWindowTemp";
|
||||
wcl.style |= CS_SAVEBITS;
|
||||
ONCE_PER_CLASS();
|
||||
klassTEMP = RegisterClassEx(&wcl);
|
||||
klassTEMP = RegisterClassEx (&wcl);
|
||||
}
|
||||
klass = klassTEMP;
|
||||
break;
|
||||
@ -449,7 +449,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
width, height,
|
||||
xparent,
|
||||
NULL,
|
||||
gdk_ProgInstance,
|
||||
gdk_app_hmodule,
|
||||
NULL);
|
||||
|
||||
GDK_NOTE (MISC,
|
||||
|
Loading…
Reference in New Issue
Block a user