1999-11-11 22:12:27 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1999-11-11 22:12:27 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1999-11-11 22:12:27 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1999-11-11 22:12:27 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-11-11 22:12:27 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <math.h>
|
1999-11-17 00:45:37 +00:00
|
|
|
#include <glib.h>
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
#include <pango/pangowin32.h>
|
1999-11-11 22:12:27 +00:00
|
|
|
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
#include "gdkinternals.h"
|
|
|
|
#include "gdkprivate-win32.h"
|
1999-11-17 00:45:37 +00:00
|
|
|
|
|
|
|
static void gdk_win32_draw_rectangle (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint filled,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
|
|
|
static void gdk_win32_draw_arc (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint filled,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint angle1,
|
|
|
|
gint angle2);
|
|
|
|
static void gdk_win32_draw_polygon (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint filled,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints);
|
|
|
|
static void gdk_win32_draw_text (GdkDrawable *drawable,
|
|
|
|
GdkFont *font,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
const gchar *text,
|
|
|
|
gint text_length);
|
|
|
|
static void gdk_win32_draw_text_wc (GdkDrawable *drawable,
|
|
|
|
GdkFont *font,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
const GdkWChar *text,
|
|
|
|
gint text_length);
|
|
|
|
static void gdk_win32_draw_drawable (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
GdkPixmap *src,
|
|
|
|
gint xsrc,
|
|
|
|
gint ysrc,
|
|
|
|
gint xdest,
|
|
|
|
gint ydest,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
|
|
|
static void gdk_win32_draw_points (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints);
|
|
|
|
static void gdk_win32_draw_segments (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
GdkSegment *segs,
|
|
|
|
gint nsegs);
|
|
|
|
static void gdk_win32_draw_lines (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints);
|
2000-07-23 21:43:23 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2000-10-25 18:07:12 +00:00
|
|
|
static GdkVisual* gdk_win32_get_visual (GdkDrawable *drawable);
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
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;
|
|
|
|
}
|
1999-11-17 00:45:37 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
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;
|
2000-10-25 18:07:12 +00:00
|
|
|
drawable_class->get_visual = gdk_win32_get_visual;
|
|
|
|
|
|
|
|
drawable_class->get_image = _gdk_win32_get_image;
|
2000-07-23 21:43:23 +00:00
|
|
|
}
|
1999-11-17 00:45:37 +00:00
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* Win32 specific implementations of generic functions *
|
|
|
|
*****************************************************/
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
static GdkColormap*
|
|
|
|
gdk_win32_get_colormap (GdkDrawable *drawable)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
GdkDrawableImplWin32 *impl;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-09-07 19:51:32 +00:00
|
|
|
impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
return impl->colormap;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_set_colormap (GdkDrawable *drawable,
|
|
|
|
GdkColormap *colormap)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
GdkDrawableImplWin32 *impl;
|
|
|
|
|
|
|
|
g_return_if_fail (colormap != NULL);
|
|
|
|
|
|
|
|
impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
|
|
|
|
|
|
|
if (impl->colormap == colormap)
|
|
|
|
return;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (impl->colormap)
|
|
|
|
gdk_colormap_unref (impl->colormap);
|
|
|
|
impl->colormap = colormap;
|
|
|
|
if (impl->colormap)
|
|
|
|
gdk_colormap_ref (impl->colormap);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
/* Drawing
|
|
|
|
*/
|
1999-11-11 22:12:27 +00:00
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_draw_rectangle (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint filled,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
|
|
|
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
1999-11-11 22:12:27 +00:00
|
|
|
HDC hdc;
|
|
|
|
HGDIOBJ oldpen, oldbrush;
|
2000-02-13 23:19:23 +00:00
|
|
|
HBRUSH hbr = NULL;
|
|
|
|
POINT pts[4];
|
|
|
|
gboolean ok = TRUE;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-09-07 19:51:32 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_draw_rectangle: %#x (%p) %s%dx%d@+%d+%d\n",
|
|
|
|
(guint) GDK_DRAWABLE_HANDLE (drawable),
|
1999-11-11 22:12:27 +00:00
|
|
|
gc_private,
|
|
|
|
(filled ? "fill " : ""),
|
|
|
|
width, height, x, y));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = gdk_win32_hdc_get (drawable, gc, mask);
|
2000-02-13 14:52:47 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
#if 0
|
|
|
|
{
|
|
|
|
HBRUSH hbr = GetCurrentObject (hdc, OBJ_BRUSH);
|
|
|
|
HPEN hpen = GetCurrentObject (hdc, OBJ_PEN);
|
|
|
|
LOGBRUSH lbr;
|
|
|
|
LOGPEN lpen;
|
|
|
|
GetObject (hbr, sizeof (lbr), &lbr);
|
|
|
|
GetObject (hpen, sizeof (lpen), &lpen);
|
|
|
|
|
|
|
|
g_print ("current brush: style = %s, color = 0x%.08x\n",
|
|
|
|
(lbr.lbStyle == BS_SOLID ? "SOLID" : "???"),
|
|
|
|
lbr.lbColor);
|
|
|
|
g_print ("current pen: style = %s, width = %d, color = 0x%.08x\n",
|
|
|
|
(lpen.lopnStyle == PS_SOLID ? "SOLID" : "???"),
|
|
|
|
lpen.lopnWidth,
|
|
|
|
lpen.lopnColor);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
|
2000-02-13 14:52:47 +00:00
|
|
|
{
|
|
|
|
if (!BeginPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
|
2000-02-13 23:19:23 +00:00
|
|
|
|
|
|
|
/* Win9x doesn't support Rectangle calls in a path,
|
|
|
|
* thus use Polyline.
|
|
|
|
*/
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
pts[0].x = x;
|
|
|
|
pts[0].y = y;
|
|
|
|
pts[1].x = x + width + 1;
|
|
|
|
pts[1].y = y;
|
|
|
|
pts[2].x = x + width + 1;
|
|
|
|
pts[2].y = y + height + 1;
|
|
|
|
pts[3].x = x;
|
|
|
|
pts[3].y = y + height + 1;
|
|
|
|
|
|
|
|
if (ok)
|
|
|
|
MoveToEx (hdc, x, y, NULL);
|
|
|
|
|
|
|
|
if (ok && !Polyline (hdc, pts, 4))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("Polyline"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !CloseFigure (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("CloseFigure"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !EndPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("EndPath"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !filled)
|
|
|
|
if (!WidenPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("WidenPath"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !FillPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("FillPath"), ok = FALSE;
|
2000-02-13 23:19:23 +00:00
|
|
|
|
|
|
|
if (hbr != NULL)
|
|
|
|
if (!DeleteObject (hbr))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("DeleteObject");
|
2000-02-13 14:52:47 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
2000-02-13 14:52:47 +00:00
|
|
|
{
|
|
|
|
if (filled)
|
|
|
|
oldpen = SelectObject (hdc, GetStockObject (NULL_PEN));
|
|
|
|
else
|
|
|
|
oldbrush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-02-13 14:52:47 +00:00
|
|
|
if (!Rectangle (hdc, x, y, x+width+1, y+height+1))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("Rectangle");
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-02-13 14:52:47 +00:00
|
|
|
if (filled)
|
|
|
|
SelectObject (hdc, oldpen);
|
|
|
|
else
|
|
|
|
SelectObject (hdc, oldbrush);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_draw_arc (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint filled,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint angle1,
|
|
|
|
gint angle2)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
1999-11-11 22:12:27 +00:00
|
|
|
HDC hdc;
|
|
|
|
int nXStartArc, nYStartArc, nXEndArc, nYEndArc;
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_draw_arc: %#x %d,%d,%d,%d %d %d\n",
|
2000-09-07 19:51:32 +00:00
|
|
|
(guint) GDK_DRAWABLE_HANDLE (drawable),
|
1999-11-11 22:12:27 +00:00
|
|
|
x, y, width, height, angle1, angle2));
|
|
|
|
|
2000-05-02 21:36:08 +00:00
|
|
|
/* Seems that drawing arcs with width or height <= 2 fails, at least
|
|
|
|
* with my TNT card.
|
|
|
|
*/
|
2000-07-23 21:43:23 +00:00
|
|
|
if (width <= 2 || height <= 2 || angle2 == 0)
|
|
|
|
return;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = gdk_win32_hdc_get (drawable, gc, mask);
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (angle2 >= 360*64)
|
|
|
|
{
|
|
|
|
nXStartArc = nYStartArc = nXEndArc = nYEndArc = 0;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-23 21:43:23 +00:00
|
|
|
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");
|
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_draw_polygon (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint filled,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
|
|
|
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
1999-11-11 22:12:27 +00:00
|
|
|
HDC hdc;
|
2000-02-13 23:19:23 +00:00
|
|
|
HBRUSH hbr = NULL;
|
1999-11-11 22:12:27 +00:00
|
|
|
POINT *pts;
|
2000-02-13 23:19:23 +00:00
|
|
|
gboolean ok = TRUE;
|
1999-11-11 22:12:27 +00:00
|
|
|
int i;
|
|
|
|
|
2000-09-07 19:51:32 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_draw_polygon: %#x (%p) %d\n",
|
|
|
|
(guint) GDK_DRAWABLE_HANDLE (drawable),
|
|
|
|
gc_private,
|
1999-11-11 22:12:27 +00:00
|
|
|
npoints));
|
|
|
|
|
|
|
|
if (npoints < 2)
|
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = gdk_win32_hdc_get (drawable, gc, mask);
|
2000-02-13 14:52:47 +00:00
|
|
|
pts = g_new (POINT, npoints+1);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
for (i = 0; i < npoints; i++)
|
|
|
|
{
|
|
|
|
pts[i].x = points[i].x;
|
|
|
|
pts[i].y = points[i].y;
|
|
|
|
}
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-02-13 14:52:47 +00:00
|
|
|
if (!BeginPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (ok)
|
|
|
|
MoveToEx (hdc, points[0].x, points[0].y, NULL);
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (pts[0].x == pts[npoints-1].x && pts[0].y == pts[npoints-1].y)
|
|
|
|
npoints--;
|
|
|
|
|
|
|
|
if (ok && !Polyline (hdc, pts, 4))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("Polyline"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !CloseFigure (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("CloseFigure"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !EndPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("EndPath"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !filled)
|
|
|
|
if (!WidenPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("WidenPath"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !FillPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("FillPath"), ok = FALSE;
|
2000-02-13 23:19:23 +00:00
|
|
|
|
|
|
|
if (hbr != NULL)
|
|
|
|
if (!DeleteObject (hbr))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("DeleteObject");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-02-13 14:52:47 +00:00
|
|
|
if (points[0].x != points[npoints-1].x
|
|
|
|
|| points[0].y != points[npoints-1].y)
|
|
|
|
{
|
|
|
|
pts[npoints].x = points[0].x;
|
|
|
|
pts[npoints].y = points[0].y;
|
|
|
|
npoints++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (filled)
|
|
|
|
{
|
|
|
|
if (!Polygon (hdc, pts, npoints))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("Polygon");
|
2000-02-13 14:52:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!Polyline (hdc, pts, npoints))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("Polyline");
|
2000-02-13 14:52:47 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
g_free (pts);
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gint x, y;
|
|
|
|
HDC hdc;
|
|
|
|
} gdk_draw_text_arg;
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
|
|
|
|
const wchar_t *wcstr,
|
|
|
|
int wclen,
|
|
|
|
void *arg)
|
|
|
|
{
|
|
|
|
HGDIOBJ oldfont;
|
|
|
|
SIZE size;
|
|
|
|
gdk_draw_text_arg *argp = (gdk_draw_text_arg *) arg;
|
|
|
|
|
|
|
|
if (!singlefont)
|
|
|
|
return;
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if ((oldfont = SelectObject (argp->hdc, singlefont->hfont)) == NULL)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("SelectObject");
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!TextOutW (argp->hdc, argp->x, argp->y, wcstr, wclen))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("TextOutW");
|
1999-11-11 22:12:27 +00:00
|
|
|
GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size);
|
|
|
|
argp->x += size.cx;
|
|
|
|
|
|
|
|
SelectObject (argp->hdc, oldfont);
|
|
|
|
}
|
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_draw_text (GdkDrawable *drawable,
|
|
|
|
GdkFont *font,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
const gchar *text,
|
|
|
|
gint text_length)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_FONT;
|
|
|
|
wchar_t *wcstr, wc;
|
1999-11-11 22:12:27 +00:00
|
|
|
gint wlen;
|
|
|
|
gdk_draw_text_arg arg;
|
|
|
|
|
|
|
|
if (text_length == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
|
|
|
|
|
|
|
|
arg.x = x;
|
|
|
|
arg.y = y;
|
2000-07-25 17:31:05 +00:00
|
|
|
arg.hdc = gdk_win32_hdc_get (drawable, gc, mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d,%d) \"%.*s\" (len %d)\n",
|
2000-09-07 19:51:32 +00:00
|
|
|
(guint) GDK_DRAWABLE_HANDLE (drawable),
|
1999-11-11 22:12:27 +00:00
|
|
|
x, y,
|
|
|
|
(text_length > 10 ? 10 : text_length),
|
|
|
|
text, text_length));
|
|
|
|
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
if (text_length == 1)
|
|
|
|
{
|
|
|
|
/* For single characters, don't try to interpret as UTF-8. */
|
2000-07-23 21:43:23 +00:00
|
|
|
wc = (guchar) text[0];
|
|
|
|
gdk_wchar_text_handle (font, &wc, 1, gdk_draw_text_handler, &arg);
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
wcstr = g_new (wchar_t, text_length);
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
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);
|
2000-07-23 21:43:23 +00:00
|
|
|
g_free (wcstr);
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_draw_text_wc (GdkDrawable *drawable,
|
|
|
|
GdkFont *font,
|
|
|
|
GdkGC *gc,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
const GdkWChar *text,
|
|
|
|
gint text_length)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_FONT;
|
2000-09-07 19:51:32 +00:00
|
|
|
gint i;
|
1999-11-11 22:12:27 +00:00
|
|
|
wchar_t *wcstr;
|
|
|
|
gdk_draw_text_arg arg;
|
|
|
|
|
|
|
|
if (text_length == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
|
|
|
|
|
|
|
|
arg.x = x;
|
|
|
|
arg.y = y;
|
2000-07-25 17:31:05 +00:00
|
|
|
arg.hdc = gdk_win32_hdc_get (drawable, gc, mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d,%d) len: %d\n",
|
2000-09-07 19:51:32 +00:00
|
|
|
(guint) GDK_DRAWABLE_HANDLE (drawable),
|
1999-11-11 22:12:27 +00:00
|
|
|
x, y, text_length));
|
|
|
|
|
|
|
|
if (sizeof (wchar_t) != sizeof (GdkWChar))
|
|
|
|
{
|
|
|
|
wcstr = g_new (wchar_t, text_length);
|
|
|
|
for (i = 0; i < text_length; i++)
|
|
|
|
wcstr[i] = text[i];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
wcstr = (wchar_t *) text;
|
|
|
|
|
|
|
|
gdk_wchar_text_handle (font, wcstr, text_length,
|
|
|
|
gdk_draw_text_handler, &arg);
|
|
|
|
|
|
|
|
if (sizeof (wchar_t) != sizeof (GdkWChar))
|
|
|
|
g_free (wcstr);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_draw_drawable (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
GdkPixmap *src,
|
|
|
|
gint xsrc,
|
|
|
|
gint ysrc,
|
|
|
|
gint xdest,
|
|
|
|
gint ydest,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
HDC hdc;
|
|
|
|
HDC srcdc;
|
|
|
|
HGDIOBJ hgdiobj;
|
|
|
|
HRGN src_rgn, draw_rgn, outside_rgn;
|
|
|
|
RECT r;
|
2000-07-23 21:43:23 +00:00
|
|
|
gint src_width, src_height;
|
|
|
|
gboolean ok = TRUE;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_draw_pixmap: dest: %#x @+%d+%d"
|
|
|
|
"src: %#x %dx%d@+%d+%d\n",
|
2000-09-07 19:51:32 +00:00
|
|
|
(guint) GDK_DRAWABLE_HANDLE (drawable),
|
|
|
|
xdest, ydest,
|
|
|
|
(guint) GDK_PIXMAP_HBITMAP (src),
|
2000-07-23 21:43:23 +00:00
|
|
|
width, height, xsrc, ysrc));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = gdk_win32_hdc_get (drawable, gc, 0);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
gdk_drawable_get_size (src, &src_width, &src_height);
|
|
|
|
src_rgn = CreateRectRgn (0, 0, src_width + 1, src_height + 1);
|
1999-11-11 22:12:27 +00:00
|
|
|
draw_rgn = CreateRectRgn (xsrc, ysrc, xsrc + width + 1, ysrc + height + 1);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_IS_WINDOW (drawable))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
/* 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
|
|
|
|
*/
|
2000-07-23 21:43:23 +00:00
|
|
|
SetRectEmpty (&r);
|
|
|
|
outside_rgn = CreateRectRgnIndirect (&r);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (CombineRgn (outside_rgn, draw_rgn, src_rgn, RGN_DIFF) != NULLREGION)
|
|
|
|
{
|
|
|
|
OffsetRgn (outside_rgn, xdest, ydest);
|
|
|
|
GDK_NOTE (MISC, (GetRgnBox (outside_rgn, &r),
|
|
|
|
g_print ("...calling InvalidateRgn, "
|
2000-09-07 19:51:32 +00:00
|
|
|
"bbox: %ldx%ld@+%ld+%ld\n",
|
1999-11-11 22:12:27 +00:00
|
|
|
r.right - r.left - 1, r.bottom - r.top - 1,
|
|
|
|
r.left, r.top)));
|
2000-07-23 21:43:23 +00:00
|
|
|
InvalidateRgn (GDK_DRAWABLE_HANDLE (drawable), outside_rgn, TRUE);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-23 21:43:23 +00:00
|
|
|
DeleteObject (outside_rgn);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 1 /* Don't know if this is necessary */
|
|
|
|
if (CombineRgn (draw_rgn, draw_rgn, src_rgn, RGN_AND) == COMPLEXREGION)
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
g_warning ("gdk_win32_draw_drawable: CombineRgn returned a COMPLEXREGION");
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
GetRgnBox (draw_rgn, &r);
|
|
|
|
if (r.left != xsrc
|
|
|
|
|| r.top != ysrc
|
|
|
|
|| r.right != xsrc + width + 1
|
|
|
|
|| r.bottom != ysrc + height + 1)
|
|
|
|
{
|
|
|
|
xdest += r.left - xsrc;
|
|
|
|
xsrc = r.left;
|
|
|
|
ydest += r.top - ysrc;
|
|
|
|
ysrc = r.top;
|
|
|
|
width = r.right - xsrc - 1;
|
|
|
|
height = r.bottom - ysrc - 1;
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("... restricted to src: %dx%d@+%d+%d, "
|
|
|
|
"dest: @+%d+%d\n",
|
|
|
|
width, height, xsrc, ysrc,
|
|
|
|
xdest, ydest));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
DeleteObject (src_rgn);
|
|
|
|
DeleteObject (draw_rgn);
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
/* This function is called also to bitblt from a window.
|
1999-11-11 22:12:27 +00:00
|
|
|
*/
|
2000-07-23 21:43:23 +00:00
|
|
|
if (GDK_IS_PIXMAP (src))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
if ((srcdc = CreateCompatibleDC (hdc)) == NULL)
|
2000-07-23 21:43:23 +00:00
|
|
|
WIN32_GDI_FAILED ("CreateCompatibleDC"), ok = FALSE;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (ok && (hgdiobj = SelectObject (srcdc, GDK_PIXMAP_HBITMAP (src))) == NULL)
|
|
|
|
WIN32_GDI_FAILED ("SelectObject"), ok = FALSE;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (ok && !BitBlt (hdc, xdest, ydest, width, height,
|
|
|
|
srcdc, xsrc, ysrc, SRCCOPY))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("BitBlt");
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (ok && (SelectObject (srcdc, hgdiobj) == NULL))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("SelectObject");
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (srcdc != NULL && !DeleteDC (srcdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("DeleteDC");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-23 21:43:23 +00:00
|
|
|
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);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
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);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, 0);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_draw_points (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
HDC hdc;
|
2000-02-13 14:52:47 +00:00
|
|
|
COLORREF fg;
|
2000-07-23 21:43:23 +00:00
|
|
|
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
|
|
|
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
1999-11-11 22:12:27 +00:00
|
|
|
int i;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = gdk_win32_hdc_get (drawable, gc, 0);
|
2000-03-03 23:21:51 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
fg = gdk_colormap_color (impl->colormap, gc_private->foreground);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-03-03 23:21:51 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_draw_points: %#x %dx%.06x\n",
|
2000-09-07 19:51:32 +00:00
|
|
|
(guint) GDK_DRAWABLE_HANDLE (drawable),
|
|
|
|
npoints, (guint) fg));
|
2000-02-13 14:52:47 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
for (i = 0; i < npoints; i++)
|
2000-03-03 23:21:51 +00:00
|
|
|
SetPixel (hdc, points[i].x, points[i].y, fg);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, 0);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_draw_segments (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
GdkSegment *segs,
|
|
|
|
gint nsegs)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
|
|
|
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
1999-11-11 22:12:27 +00:00
|
|
|
HDC hdc;
|
2000-02-13 23:19:23 +00:00
|
|
|
HBRUSH hbr = NULL;
|
|
|
|
gboolean ok = TRUE;
|
1999-11-11 22:12:27 +00:00
|
|
|
int i;
|
|
|
|
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_draw_segments: %#x nsegs: %d\n",
|
2000-09-07 19:51:32 +00:00
|
|
|
(guint) GDK_DRAWABLE_HANDLE (drawable), nsegs));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = gdk_win32_hdc_get (drawable, gc, mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-02-13 14:52:47 +00:00
|
|
|
if (!BeginPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
|
2000-02-13 23:19:23 +00:00
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
for (i = 0; ok && i < nsegs; i++)
|
2000-02-13 14:52:47 +00:00
|
|
|
{
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE;
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !LineTo (hdc, segs[i].x2, segs[i].y2))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
/* Draw end pixel */
|
2000-07-23 21:43:23 +00:00
|
|
|
if (ok && gc_private->pen_width <= 1)
|
2000-02-13 23:19:23 +00:00
|
|
|
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
|
2000-02-13 23:19:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ok && !EndPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("EndPath"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !WidenPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("WidenPath"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
2000-02-13 23:19:23 +00:00
|
|
|
if (ok && !FillPath (hdc))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("FillPath"), ok = FALSE;
|
2000-02-13 23:19:23 +00:00
|
|
|
|
|
|
|
if (hbr != NULL)
|
|
|
|
if (!DeleteObject (hbr))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("DeleteObject");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-02-13 14:52:47 +00:00
|
|
|
else
|
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
for (i = 0; ok && i < nsegs; i++)
|
2000-02-13 14:52:47 +00:00
|
|
|
{
|
|
|
|
if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL))
|
2000-07-23 21:43:23 +00:00
|
|
|
WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE;
|
|
|
|
if (ok && !LineTo (hdc, segs[i].x2, segs[i].y2))
|
|
|
|
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
|
|
|
|
/* Draw end pixel */
|
2000-07-23 21:43:23 +00:00
|
|
|
if (ok && gc_private->pen_width <= 1)
|
2000-02-13 14:52:47 +00:00
|
|
|
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
|
2000-07-23 21:43:23 +00:00
|
|
|
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
|
2000-02-13 14:52:47 +00:00
|
|
|
}
|
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 00:45:37 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_draw_lines (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
GdkPoint *points,
|
|
|
|
gint npoints)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
|
|
|
|
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
|
1999-11-11 22:12:27 +00:00
|
|
|
HDC hdc;
|
|
|
|
POINT *pts;
|
|
|
|
int i;
|
2000-07-23 21:43:23 +00:00
|
|
|
gboolean ok = TRUE;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (npoints < 2)
|
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = gdk_win32_hdc_get (drawable, gc, mask);
|
2000-07-23 21:43:23 +00:00
|
|
|
|
2000-02-13 14:52:47 +00:00
|
|
|
pts = g_new (POINT, npoints);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
for (i = 0; i < npoints; i++)
|
|
|
|
{
|
|
|
|
pts[i].x = points[i].x;
|
|
|
|
pts[i].y = points[i].y;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Polyline (hdc, pts, npoints))
|
2000-07-23 21:43:23 +00:00
|
|
|
WIN32_GDI_FAILED ("Polyline"), ok = FALSE;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_free (pts);
|
|
|
|
|
|
|
|
/* Draw end pixel */
|
2000-07-23 21:43:23 +00:00
|
|
|
if (ok && gc_private->pen_width <= 1)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
MoveToEx (hdc, points[npoints-1].x, points[npoints-1].y, NULL);
|
|
|
|
if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("LineTo");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, mask);
|
2000-07-23 21:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_draw_glyphs (GdkDrawable *drawable,
|
|
|
|
GdkGC *gc,
|
|
|
|
PangoFont *font,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
PangoGlyphString *glyphs)
|
|
|
|
{
|
|
|
|
const GdkGCValuesMask mask = GDK_GC_FOREGROUND;
|
|
|
|
HDC hdc;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = gdk_win32_hdc_get (drawable, gc, mask);
|
2000-07-23 21:43:23 +00:00
|
|
|
|
2000-10-22 17:16:42 +00:00
|
|
|
/* HB: Maybe there should be a GDK_GC_PANGO flag for hdc_get */
|
|
|
|
/* default write mode is transparent (leave background) */
|
|
|
|
if (SetBkMode (hdc, TRANSPARENT) == 0)
|
|
|
|
WIN32_GDI_FAILED ("SetBkMode");
|
|
|
|
|
|
|
|
if (GDI_ERROR == SetTextAlign (hdc, TA_LEFT|TA_BOTTOM|TA_NOUPDATECP))
|
|
|
|
WIN32_GDI_FAILED ("SetTextAlign");
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
pango_win32_render (hdc, font, glyphs, x, y);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, mask);
|
2000-07-23 21:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
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;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = gdk_win32_hdc_get (drawable, gc, 0);
|
2000-07-23 21:43:23 +00:00
|
|
|
|
|
|
|
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");
|
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_hdc_release (drawable, gc, 0);
|
2000-07-23 21:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-10-25 18:07:12 +00:00
|
|
|
|
|
|
|
static GdkVisual*
|
|
|
|
gdk_win32_get_visual (GdkDrawable *drawable)
|
|
|
|
{
|
|
|
|
return gdk_drawable_get_visual (GDK_DRAWABLE_IMPL_WIN32 (drawable)->wrapper);
|
|
|
|
}
|