New file, hand-written wrapper for the Wintab library.

2001-10-29  Tor Lillqvist  <tml@iki.fi>

	* gdk/win32/libwntab32x.la: New file, hand-written wrapper for the
	Wintab library.

	* gdk/win32/gdkwin32.h
	* gdk/win32/gdkprivate-win32.h: Reorganise to match corresponding
	X11 headers better, and to enable gdkwin32.h to be installed and
	included from applications, but not the *-win32.h headers.

	* gdk/win32/*.c: Corresponding small changes, simplifications of
	#includes.

	* gdk/win32/gdkregion-win32.c: Remove.

	* gdk/win32/gdkevents-win32.c (print_event): Add GDK_SETTING.

	* gdk/win32/gdkfont-win32.c
	* gdk/win32/gdkgeometry-win32.c: Remove unused variables.

	* gdk/win32/gdkproperty-win32.c (gdk_atom_intern): Don't insert
	GDK_NONE values into hash table.

	Changes for autoconfiscated build on Win32, and addition of Win32
	backend to the related files:

	* gdk/win32/Makefile.am: Actually enable building the win32
	objects here, not just list all files in EXTRA_DIST. Link in the
	compiled resource file from rc/gdk-win32res.lo. If HAVE_WINTAB,
	copy the Wintab library into the .libs directory.

	* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Don't assume the
	name of the GDK DLL when fetching the icon. Use the HMODULE saved
	in gdk_dll_hinstance by DllMain.

	* gdk/win32/rc/Makefile.am: Build gdk-win32res.lo using the
	build/win32/lt-compile-resource script.

	* gdk/win32/rc/gdk.rc.in
	* gtk/gtk-win32.rc.in: Use the DLL name that libtool would use.
This commit is contained in:
Tor Lillqvist 2001-10-29 06:50:55 +00:00 committed by Tor Lillqvist
parent 47dc8d4dac
commit a53f14a6e3
24 changed files with 376 additions and 708 deletions

View File

@ -1,8 +1,39 @@
## Process this file with automake to produce Makefile.in
libgdkincludedir = $(includedir)/gtk-2.0/gdk
INCLUDES = @STRIP_BEGIN@ \
-DG_LOG_DOMAIN=\"Gdk\" \
-DINSIDE_GDK_WIN32 \
-I$(top_srcdir) \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
@GTK_DEBUG_FLAGS@ \
@GDK_DEP_CFLAGS@ \
@GDK_WIN32_EXTRA_CFLAGS@\
-DGDK_COMPILATION \
@STRIP_END@
LDADDS = @STRIP_BEGIN@ \
@GDK_DEP_LIBS@ \
@STRIP_END@
if HAVE_WINTAB
noinst_DATA = .libs/libwntab32x.a
.libs/libwntab32x.a: @WINTAB_LIB@
cp $< $@
endif
noinst_LTLIBRARIES = libgdk-win32.la
SUBDIRS=rc
EXTRA_DIST = \
makefile.mingw \
makefile.msc \
makefile.msc
libgdk_win32_la_SOURCES = \
bdfcursor.c \
xcursors.h \
gdkcolor-win32.c \
@ -27,7 +58,6 @@ EXTRA_DIST = \
gdkpixmap-win32.h \
gdkprivate-win32.h \
gdkproperty-win32.c \
gdkregion-win32.c \
gdkselection-win32.c \
gdkvisual-win32.c \
gdkwin32.h \
@ -35,3 +65,8 @@ EXTRA_DIST = \
gdkwindow-win32.c \
gdkwindow-win32.h \
surrogate-dimm.h
libgdkinclude_HEADERS = \
gdkwin32.h
libgdk_win32_la_LIBADD = rc/gdk-win32res.lo

View File

@ -24,14 +24,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "gdkcolor.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
static void free_colormap (Colormap colormap);

View File

@ -17,12 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "gdkwin32.h"
#include "gdkcursor.h"
#include "gdkinternals.h"
#include "gdkpixmap-win32.h"
#include "gdkprivate-win32.h"
#include "xcursors.h"

View File

@ -25,8 +25,6 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <string.h>
/* #define OLE2_DND */

View File

@ -29,7 +29,6 @@
#include <pango/pangowin32.h>
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
static void gdk_win32_draw_rectangle (GdkDrawable *drawable,

View File

@ -28,6 +28,7 @@
#define __GDK_DRAWABLE_WIN32_H__
#include <gdk/gdkdrawable.h>
#include <gdk/win32/gdkwin32.h>
#ifdef __cplusplus
extern "C" {

View File

@ -25,8 +25,6 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
/* Cannot use TrackMouseEvent, as the stupid WM_MOUSELEAVE message
* doesn't tell us where the mouse has gone. Thus we cannot use it to
* generate a correct GdkNotifyType. Pity, as using TrackMouseEvent
@ -41,7 +39,10 @@
#include <stdio.h>
#include "gdk.h"
#include "gdkprivate-win32.h"
#include "gdkinput-win32.h"
#include "gdkkeysyms.h"
#include <objbase.h>
#include <imm.h>
@ -52,13 +53,6 @@
#include "surrogate-dimm.h"
#endif
#include "gdk.h"
#include "gdkinternals.h"
#include "gdkinput-win32.h"
#include "gdkkeysyms.h"
#define PING() printf("%s: %d\n",__FILE__,__LINE__),fflush(stdout)
typedef struct _GdkIOClosure GdkIOClosure;
typedef struct _GdkEventPrivate GdkEventPrivate;
@ -1065,6 +1059,7 @@ print_event (GdkEvent *event)
CASE (GDK_NO_EXPOSE);
CASE (GDK_SCROLL);
CASE (GDK_WINDOW_STATE);
CASE (GDK_SETTING);
#undef CASE
}
g_print ("%#lx ", (gulong) GDK_WINDOW_HWND (event->any.window));

View File

@ -31,7 +31,6 @@
#include <pango/pangowin32.h>
#include "gdkfont.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
static GHashTable *font_name_hash = NULL;
@ -1520,7 +1519,6 @@ gdk_font_load (const gchar *font_name)
GdkFontPrivateWin32 *private;
GdkWin32SingleFont *singlefont;
HGDIOBJ oldfont;
HANDLE *f;
TEXTMETRIC textmetric;
g_return_val_if_fail (font_name != NULL, NULL);

View File

@ -24,15 +24,12 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <string.h>
#include "gdkgc.h"
#include "gdkfont.h"
#include "gdkpixmap.h"
#include "gdkregion-generic.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
static void gdk_win32_gc_get_values (GdkGC *gc,

View File

@ -31,10 +31,7 @@
#include "gdk.h" /* For gdk_rectangle_intersect */
#include "gdkregion.h"
#include "gdkregion-generic.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
#include "gdkdrawable-win32.h"
#include "gdkwindow-win32.h"
#define SIZE_LIMIT 32000
@ -271,7 +268,6 @@ _gdk_window_move_resize_child (GdkWindow *window,
GdkWindowObject *obj;
GdkWin32PositionInfo new_info;
GdkWindowParentPos parent_pos;
RECT rect;
GList *tmp_list;
gint d_xoffset, d_yoffset;
gint dx, dy;

View File

@ -31,13 +31,13 @@ HWND gdk_root_window = NULL;
gint gdk_event_func_from_window_proc = FALSE;
HDC gdk_display_hdc;
HINSTANCE gdk_dll_hinstance;
HINSTANCE gdk_app_hmodule; /* Works as a HMODULE, too? */
HINSTANCE gdk_app_hmodule;
UINT gdk_selection_notify_msg;
UINT gdk_selection_request_msg;
UINT gdk_selection_clear_msg;
GdkAtom gdk_clipboard_atom;
GdkAtom gdk_win32_dropfiles_atom;
GdkAtom gdk_ole2_dnd_atom;
GdkAtom _gdk_selection_property;
GdkAtom _gdk_selection_property;
DWORD windows_version = 0;
gint gdk_input_ignore_wintab = FALSE;

View File

@ -24,15 +24,9 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gdkimage.h"
#include "gdkpixmap.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
#include "gdkdrawable-win32.h"
#include "gdkwindow-win32.h"
#include "gdkpixmap-win32.h"
static GList *image_list = NULL;
static gpointer parent_class = NULL;

View File

@ -25,14 +25,11 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "gdkpixmap.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
static void gdk_pixmap_impl_win32_get_size (GdkDrawable *drawable,

View File

@ -28,7 +28,303 @@
#define __GDK_PRIVATE_WIN32_H__
#include <gdk/gdkprivate.h>
#include "gdkwin32.h"
#include <gdk/win32/gdkwindow-win32.h>
#include <gdk/win32/gdkpixmap-win32.h>
#include "gdkinternals.h"
#include <config.h>
/* Make up for some minor w32api header lossage */
/* PS_JOIN_MASK is missing */
#ifndef PS_JOIN_MASK
#define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
#endif
/* CLR_INVALID is missing */
#ifndef CLR_INVALID
#define CLR_INVALID CLR_NONE
#endif
/* Some charsets are missing from MSVC 5 headers */
#ifndef JOHAB_CHARSET
#define JOHAB_CHARSET 130
#endif
#ifndef VIETNAMESE_CHARSET
#define VIETNAMESE_CHARSET 163
#endif
#ifndef FS_VIETNAMESE
#define FS_VIETNAMESE 0x100
#endif
/* Some virtual keycodes are missing */
#ifndef VM_OEM_PLUS
#define VK_OEM_PLUS 0xBB
#endif
#ifndef VK_OEM_COMMA
#define VK_OEM_COMMA 0xBC
#endif
#ifndef VK_OEM_MINUS
#define VK_OEM_MINUS 0xBD
#endif
#ifndef VK_OEM_PERIOD
#define VK_OEM_PERIOD 0xBE
#endif
#ifndef VK_OEM_1
#define VK_OEM_1 0xBA
#endif
#ifndef VK_OEM_2
#define VK_OEM_2 0xBF
#endif
#ifndef VK_OEM_3
#define VK_OEM_3 0xC0
#endif
#ifndef VK_OEM_4
#define VK_OEM_4 0xDB
#endif
#ifndef VK_OEM_5
#define VK_OEM_5 0xDC
#endif
#ifndef VK_OEM_6
#define VK_OEM_6 0xDD
#endif
#ifndef VK_OEM_7
#define VK_OEM_7 0xDE
#endif
#ifndef VK_OEM_8
#define VK_OEM_8 0xDF
#endif
/* Missing messages */
#ifndef WM_SYNCPAINT
#define WM_SYNCPAINT 0x88
#endif
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0X20A
#endif
#ifndef WM_GETOBJECT
#define WM_GETOBJECT 0x3D
#endif
#ifndef WM_NCXBUTTONDOWN
#define WM_NCXBUTTONDOWN 0xAB
#endif
#ifndef WM_NCXBUTTONUP
#define WM_NCXBUTTONUP 0xAC
#endif
#ifndef WM_NCXBUTTONDBLCLK
#define WM_NCXBUTTONDBLCLK 0xAD
#endif
#ifndef WM_MENURBUTTONUP
#define WM_MENURBUTTONUP 0x122
#endif
#ifndef WM_MENUDRAG
#define WM_MENUDRAG 0x123
#endif
#ifndef WM_MENUGETOBJECT
#define WM_MENUGETOBJECT 0x124
#endif
#ifndef WM_UNINITMENUPOPUP
#define WM_UNINITMENUPOPUP 0x125
#endif
#ifndef WM_MENUCOMMAND
#define WM_MENUCOMMAND 0x126
#endif
#ifndef WM_CHANGEUISTATE
#define WM_CHANGEUISTATE 0x127
#endif
#ifndef WM_UPDATEUISTATE
#define WM_UPDATEUISTATE 0x128
#endif
#ifndef WM_QUERYUISTATE
#define WM_QUERYUISTATE 0x129
#endif
#ifndef WM_XBUTTONDOWN
#define WM_XBUTTONDOWN 0x20B
#endif
#ifndef WM_XBUTTONUP
#define WM_XBUTTONUP 0x20C
#endif
#ifndef WM_XBUTTONDBLCLK
#define WM_XBUTTONDBLCLK 0x20D
#endif
#ifndef WM_IME_REQUEST
#define WM_IME_REQUEST 0x288
#endif
#ifndef WM_MOUSEHOVER
#define WM_MOUSEHOVER 0x2A1
#endif
#ifndef WM_MOUSELEAVE
#define WM_MOUSELEAVE 0x2A3
#endif
#ifndef WM_NCMOUSEHOVER
#define WM_NCMOUSEHOVER 0x2A0
#endif
#ifndef WM_NCMOUSELEAVE
#define WM_NCMOUSELEAVE 0x2A2
#endif
#ifndef WM_APPCOMMAND
#define WM_APPCOMMAND 0x319
#endif
#ifndef WM_HANDHELDFIRST
#define WM_HANDHELDFIRST 0x358
#endif
#ifndef WM_HANDHELDLAST
#define WM_HANDHELDLAST 0x35F
#endif
#ifndef WM_AFXFIRST
#define WM_AFXFIRST 0x360
#endif
#ifndef WM_AFXLAST
#define WM_AFXLAST 0x37F
#endif
#ifndef CopyCursor
#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
#endif
/* Define corresponding Windows types for some X11 types, just for laziness. */
typedef PALETTEENTRY XColor;
/* Some structs are somewhat useful to emulate internally. */
typedef struct {
HPALETTE palette; /* Palette handle used when drawing. */
guint size; /* Number of entries in the palette. */
gboolean stale; /* 1 if palette needs to be realized,
* otherwise 0. */
gboolean *in_use;
gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
gulong sizepalette; /* SIZEPALETTE if rc_palette */
} ColormapStruct, *Colormap;
typedef struct {
gint map_entries;
guint visualid;
guint bitspixel;
} Visual;
typedef struct {
Colormap colormap;
unsigned long red_max;
unsigned long red_mult;
unsigned long green_max;
unsigned long green_mult;
unsigned long blue_max;
unsigned long blue_mult;
unsigned long base_pixel;
} XStandardColormap;
#define GDK_TYPE_GC_WIN32 (_gdk_gc_win32_get_type ())
#define GDK_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_WIN32, GdkGCWin32))
#define GDK_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
#define GDK_IS_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_WIN32))
#define GDK_IS_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_WIN32))
#define GDK_GC_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
typedef struct _GdkImagePrivateWin32 GdkImagePrivateWin32;
typedef struct _GdkVisualPrivate GdkVisualPrivate;
typedef struct _GdkGCWin32 GdkGCWin32;
typedef struct _GdkGCWin32Class GdkGCWin32Class;
struct _GdkCursorPrivate
{
GdkCursor cursor;
HCURSOR hcursor;
};
struct _GdkWin32SingleFont
{
HFONT hfont;
UINT charset;
UINT codepage;
FONTSIGNATURE fs;
};
struct _GdkFontPrivateWin32
{
GdkFontPrivate base;
GSList *fonts; /* List of GdkWin32SingleFonts */
GSList *names;
};
struct _GdkVisualClass
{
GObjectClass parent_class;
};
struct _GdkVisualPrivate
{
GdkVisual visual;
Visual *xvisual;
};
struct _GdkColormapPrivateWin32
{
Colormap xcolormap;
gint private_val;
GHashTable *hash;
GdkColorInfo *info;
DWORD last_sync_time;
};
struct _GdkImagePrivateWin32
{
HBITMAP hbitmap;
};
struct _GdkGCWin32
{
GdkGC parent_instance;
/* A Windows Device Context (DC) is not equivalent to an X11
* GC. We can use a DC only in the window for which it was
* allocated, or (in the case of a memory DC) with the bitmap that
* has been selected into it. Thus, we have to release and
* reallocate a DC each time the GdkGC is used to paint into a new
* window or pixmap. We thus keep all the necessary values in the
* GdkGCWin32 object.
*/
HDC hdc;
GdkRegion *clip_region;
HRGN hcliprgn;
GdkGCValuesMask values_mask;
gulong foreground; /* Pixel values from GdkColor, */
gulong background; /* not Win32 COLORREFs */
GdkFont *font;
gint rop2;
GdkFill fill_style;
GdkPixmap *tile;
GdkPixmap *stipple;
GdkSubwindowMode subwindow_mode;
gint graphics_exposures;
gint pen_width;
DWORD pen_style;
HANDLE hwnd; /* If a HDC is allocated, for which window,
* or what bitmap is selected into it
*/
int saved_dc;
};
struct _GdkGCWin32Class
{
GdkGCClass parent_class;
};
GType _gdk_gc_win32_get_type (void);
/* Routines from gdkgeometry-win32.c */
void
@ -106,6 +402,10 @@ gchar *gdk_win32_function_to_string (GdkFunction function);
gchar *gdk_win32_join_style_to_string (GdkJoinStyle join_style);
gchar *gdk_win32_line_style_to_string (GdkLineStyle line_style);
gchar *gdk_win32_message_name (UINT msg);
#define PING() printf(G_STRLOC),fflush(stdout)
#else
#define PING()
#endif
gchar *gdk_win32_last_error_string (void);
@ -150,7 +450,7 @@ extern DWORD windows_version;
extern gint gdk_input_ignore_wintab;
extern GdkAtom _gdk_selection_property;
extern GdkAtom _gdk_selection_property;
#define IMAGE_PRIVATE_DATA(image) ((GdkImagePrivateWin32 *) GDK_IMAGE (image)->windowing_data)

View File

@ -24,16 +24,11 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <string.h>
#include "gdkproperty.h"
#include "gdkselection.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
#include "gdkdrawable-win32.h"
#include "gdkwindow-win32.h"
GdkAtom
gdk_atom_intern (const gchar *atom_name,
@ -78,11 +73,12 @@ gdk_atom_intern (const gchar *atom_name,
win32_atom = 0;
else
win32_atom = GlobalAddAtom (atom_name);
retval = GUINT_TO_POINTER (win32_atom);
retval = GUINT_TO_POINTER ((guint) win32_atom);
}
g_hash_table_insert (atom_hash,
g_strdup (atom_name),
retval);
if (retval != GDK_NONE)
g_hash_table_insert (atom_hash,
g_strdup (atom_name),
retval);
}
return retval;
@ -109,7 +105,7 @@ gdk_atom_name (GdkAtom atom)
win32_atom = GPOINTER_TO_UINT (atom);
if (win32_atom < 0xC000)
return g_strdup_printf ("#%x", atom);
return g_strdup_printf ("#%p", atom);
else if (GlobalGetAtomName (win32_atom, name, sizeof (name)) == 0)
return NULL;
return g_strdup (name);

View File

@ -1,328 +0,0 @@
#error this file should not be used, I think
/* 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
* modify it under the terms of the GNU Lesser General Public
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* 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 "config.h"
#include "gdk.h"
#include "gdkprivate-win32.h"
GdkRegion*
gdk_region_new (void)
{
GdkRegionPrivate *private;
GdkRegion *region;
HRGN xregion;
RECT emptyRect;
/* Create an empty region */
SetRectEmpty (&emptyRect);
xregion = CreateRectRgnIndirect (&emptyRect);
private = g_new (GdkRegionPrivate, 1);
private->xregion = xregion;
region = (GdkRegion*) private;
region->user_data = NULL;
return region;
}
void
gdk_region_destroy (GdkRegion *region)
{
GdkRegionPrivate *private;
g_return_if_fail (region != NULL);
private = (GdkRegionPrivate *) region;
DeleteObject (private->xregion);
g_free (private);
}
gboolean
gdk_region_empty (GdkRegion *region)
{
GdkRegionPrivate *private;
RECT rect;
g_return_val_if_fail (region != NULL, 0);
private = (GdkRegionPrivate *) region;
return (GetRgnBox (private->xregion, &rect) == NULLREGION);
}
gboolean
gdk_region_equal (GdkRegion *region1,
GdkRegion *region2)
{
GdkRegionPrivate *private1;
GdkRegionPrivate *private2;
g_return_val_if_fail (region1 != NULL, 0);
g_return_val_if_fail (region2 != NULL, 0);
private1 = (GdkRegionPrivate *) region1;
private2 = (GdkRegionPrivate *) region2;
return EqualRgn (private1->xregion, private2->xregion);
}
void
gdk_region_get_clipbox(GdkRegion *region,
GdkRectangle *rectangle)
{
GdkRegionPrivate *rp;
RECT r;
g_return_if_fail(region != NULL);
g_return_if_fail(rectangle != NULL);
rp = (GdkRegionPrivate *)region;
GetRgnBox (rp->xregion, &r);
rectangle->x = r.left;
rectangle->y = r.top;
rectangle->width = r.right - r.left;
rectangle->height = r.bottom - r.top;
}
gboolean
gdk_region_point_in (GdkRegion *region,
gint x,
gint y)
{
GdkRegionPrivate *private;
g_return_val_if_fail (region != NULL, 0);
private = (GdkRegionPrivate *) region;
return PtInRegion (private->xregion, x, y);
}
GdkOverlapType
gdk_region_rect_in (GdkRegion *region,
GdkRectangle *rect)
{
GdkRegionPrivate *private;
RECT r;
int res;
g_return_val_if_fail (region != NULL, 0);
private = (GdkRegionPrivate *) region;
r.left = rect->x;
r.top = rect->y;
r.right = rect->x + rect->width;
r.bottom = rect->y + rect->height;
if (RectInRegion (private->xregion, &r))
return GDK_OVERLAP_RECTANGLE_PART;
return GDK_OVERLAP_RECTANGLE_OUT; /*what else ? */
}
GdkRegion *
gdk_region_polygon (GdkPoint *points,
gint npoints,
GdkFillRule fill_rule)
{
GdkRegionPrivate *private;
GdkRegion *region;
HRGN xregion;
POINT *pts;
gint xfill_rule = ALTERNATE;
gint i;
g_return_val_if_fail (points != NULL, NULL);
g_return_val_if_fail (npoints != 0, NULL); /* maybe we should check for at least three points */
switch (fill_rule)
{
case GDK_EVEN_ODD_RULE:
xfill_rule = ALTERNATE;
break;
case GDK_WINDING_RULE:
xfill_rule = WINDING;
break;
}
pts = g_malloc (npoints * sizeof (*pts));
for (i = 0; i < npoints; i++)
{
pts[i].x = points[i].x;
pts[i].y = points[i].y;
}
xregion = CreatePolygonRgn (pts, npoints, xfill_rule);
g_free (pts);
private = g_new (GdkRegionPrivate, 1);
private->xregion = xregion;
region = (GdkRegion *) private;
region->user_data = NULL;
return region;
}
void
gdk_region_offset (GdkRegion *region,
gint dx,
gint dy)
{
GdkRegionPrivate *private;
g_return_if_fail (region != NULL);
private = (GdkRegionPrivate *) region;
OffsetRgn (private->xregion, dx, dy);
}
void
gdk_region_shrink (GdkRegion *region,
gint dx,
gint dy)
{
GdkRegionPrivate *private;
HRGN shrunken_bbox;
RECT r;
g_return_if_fail (region != NULL);
private = (GdkRegionPrivate *) region;
if (dx > 0 || dy > 0)
{
/* We want to shrink it in one or both dimensions.
* Is it correct just to intersect it with a smaller bounding box?
* XXX
*/
GetRgnBox (private->xregion, &r);
if (dx > 0)
{
r.left += dx - dx/2;
r.right -= dx/2;
}
if (dy > 0)
{
r.top += dy - dy/2;
r.bottom -= dy/2;
}
shrunken_bbox = CreateRectRgnIndirect (&r);
CombineRgn (private->xregion, private->xregion,
shrunken_bbox, RGN_AND);
DeleteObject (shrunken_bbox);
}
else
{
/* Do nothing if the regions is expanded? XXX */
}
}
GdkRegion*
gdk_region_union_with_rect (GdkRegion *region,
GdkRectangle *rect)
{
GdkRegionPrivate *private;
GdkRegion *res;
GdkRegionPrivate *res_private;
RECT xrect;
HRGN rectangle;
g_return_val_if_fail (region != NULL, NULL);
private = (GdkRegionPrivate *) region;
xrect.left = rect->x;
xrect.top = rect->y;
xrect.right = rect->x + rect->width;
xrect.bottom = rect->y + rect->height;
res = gdk_region_new ();
res_private = (GdkRegionPrivate *) res;
rectangle = CreateRectRgnIndirect (&xrect);
CombineRgn (res_private->xregion, private->xregion,
rectangle, RGN_OR);
DeleteObject (rectangle);
return res;
}
static GdkRegion *
gdk_regions_op (GdkRegion *source1,
GdkRegion *source2,
guint op)
{
GdkRegionPrivate *private1;
GdkRegionPrivate *private2;
GdkRegion *res;
GdkRegionPrivate *res_private;
g_return_val_if_fail (source1 != NULL, NULL);
g_return_val_if_fail (source2 != NULL, NULL);
private1 = (GdkRegionPrivate *) source1;
private2 = (GdkRegionPrivate *) source2;
res = gdk_region_new ();
res_private = (GdkRegionPrivate *) res;
CombineRgn (res_private->xregion, private1->xregion, private2->xregion, op);
return res;
}
GdkRegion*
gdk_regions_intersect (GdkRegion *source1,
GdkRegion *source2)
{
return gdk_regions_op (source1, source2, RGN_AND);
}
GdkRegion*
gdk_regions_union (GdkRegion *source1,
GdkRegion *source2)
{
return gdk_regions_op (source1, source2, RGN_OR);
}
GdkRegion*
gdk_regions_subtract (GdkRegion *source1,
GdkRegion *source2)
{
return gdk_regions_op (source1, source2, RGN_DIFF);
}
GdkRegion*
gdk_regions_xor (GdkRegion *source1,
GdkRegion *source2)
{
return gdk_regions_op (source1, source2, RGN_XOR);
}

View File

@ -24,16 +24,11 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <string.h>
#include "gdkproperty.h"
#include "gdkselection.h"
#include "gdkinternals.h"
#include "gdkprivate.h"
#include "gdkprivate-win32.h"
#include "gdkwindow-win32.h"
/* We emulate the GDK_SELECTION window properties by storing
* it's data in a per-window hashtable.

View File

@ -24,13 +24,10 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <stdlib.h>
#include "gdkvisual.h"
#include "gdkprivate-win32.h"
//#include "gdkinternals.h"
#include <stdlib.h>
static void gdk_visual_decompose_mask (gulong mask,
gint *shift,

View File

@ -37,310 +37,11 @@
#include <windows.h>
#include <commctrl.h>
#include <gdk/win32/gdkwindow-win32.h>
#include <gdk/win32/gdkpixmap-win32.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Make up for some minor w32api header lossage */
/* PS_JOIN_MASK is missing */
#ifndef PS_JOIN_MASK
#define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
#endif
/* CLR_INVALID is missing */
#ifndef CLR_INVALID
#define CLR_INVALID CLR_NONE
#endif
/* Some charsets are missing */
#ifndef JOHAB_CHARSET
#define JOHAB_CHARSET 130
#endif
#ifndef VIETNAMESE_CHARSET
#define VIETNAMESE_CHARSET 163
#endif
#ifndef FS_VIETNAMESE
#define FS_VIETNAMESE 0x100
#endif
/* Some virtual keycodes are missing */
#ifndef VM_OEM_PLUS
#define VK_OEM_PLUS 0xBB
#endif
#ifndef VK_OEM_COMMA
#define VK_OEM_COMMA 0xBC
#endif
#ifndef VK_OEM_MINUS
#define VK_OEM_MINUS 0xBD
#endif
#ifndef VK_OEM_PERIOD
#define VK_OEM_PERIOD 0xBE
#endif
#ifndef VK_OEM_1
#define VK_OEM_1 0xBA
#endif
#ifndef VK_OEM_2
#define VK_OEM_2 0xBF
#endif
#ifndef VK_OEM_3
#define VK_OEM_3 0xC0
#endif
#ifndef VK_OEM_4
#define VK_OEM_4 0xDB
#endif
#ifndef VK_OEM_5
#define VK_OEM_5 0xDC
#endif
#ifndef VK_OEM_6
#define VK_OEM_6 0xDD
#endif
#ifndef VK_OEM_7
#define VK_OEM_7 0xDE
#endif
#ifndef VK_OEM_8
#define VK_OEM_8 0xDF
#endif
/* Missing messages */
#ifndef WM_SYNCPAINT
#define WM_SYNCPAINT 0x88
#endif
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0X20A
#endif
#ifndef WM_GETOBJECT
#define WM_GETOBJECT 0x3D
#endif
#ifndef WM_NCXBUTTONDOWN
#define WM_NCXBUTTONDOWN 0xAB
#endif
#ifndef WM_NCXBUTTONUP
#define WM_NCXBUTTONUP 0xAC
#endif
#ifndef WM_NCXBUTTONDBLCLK
#define WM_NCXBUTTONDBLCLK 0xAD
#endif
#ifndef WM_MENURBUTTONUP
#define WM_MENURBUTTONUP 0x122
#endif
#ifndef WM_MENUDRAG
#define WM_MENUDRAG 0x123
#endif
#ifndef WM_MENUGETOBJECT
#define WM_MENUGETOBJECT 0x124
#endif
#ifndef WM_UNINITMENUPOPUP
#define WM_UNINITMENUPOPUP 0x125
#endif
#ifndef WM_MENUCOMMAND
#define WM_MENUCOMMAND 0x126
#endif
#ifndef WM_CHANGEUISTATE
#define WM_CHANGEUISTATE 0x127
#endif
#ifndef WM_UPDATEUISTATE
#define WM_UPDATEUISTATE 0x128
#endif
#ifndef WM_QUERYUISTATE
#define WM_QUERYUISTATE 0x129
#endif
#ifndef WM_XBUTTONDOWN
#define WM_XBUTTONDOWN 0x20B
#endif
#ifndef WM_XBUTTONUP
#define WM_XBUTTONUP 0x20C
#endif
#ifndef WM_XBUTTONDBLCLK
#define WM_XBUTTONDBLCLK 0x20D
#endif
#ifndef WM_IME_REQUEST
#define WM_IME_REQUEST 0x288
#endif
#ifndef WM_MOUSEHOVER
#define WM_MOUSEHOVER 0x2A1
#endif
#ifndef WM_MOUSELEAVE
#define WM_MOUSELEAVE 0x2A3
#endif
#ifndef WM_NCMOUSEHOVER
#define WM_NCMOUSEHOVER 0x2A0
#endif
#ifndef WM_NCMOUSELEAVE
#define WM_NCMOUSELEAVE 0x2A2
#endif
#ifndef WM_APPCOMMAND
#define WM_APPCOMMAND 0x319
#endif
#ifndef WM_HANDHELDFIRST
#define WM_HANDHELDFIRST 0x358
#endif
#ifndef WM_HANDHELDLAST
#define WM_HANDHELDLAST 0x35F
#endif
#ifndef WM_AFXFIRST
#define WM_AFXFIRST 0x360
#endif
#ifndef WM_AFXLAST
#define WM_AFXLAST 0x37F
#endif
#ifndef CopyCursor
#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
#endif
G_BEGIN_DECLS
#ifdef INSIDE_GDK_WIN32
#include <gdk/gdkprivate.h>
/* Define corresponding Windows types for some X11 types, just for laziness. */
typedef PALETTEENTRY XColor;
/* Some structs are somewhat useful to emulate internally, just to
* keep the code less #ifdefed.
*/
typedef struct {
HPALETTE palette; /* Palette handle used when drawing. */
guint size; /* Number of entries in the palette. */
gboolean stale; /* 1 if palette needs to be realized,
* otherwise 0. */
gboolean *in_use;
gboolean rc_palette; /* If RC_PALETTE is on in the RASTERCAPS */
gulong sizepalette; /* SIZEPALETTE if rc_palette */
} ColormapStruct, *Colormap;
typedef struct {
gint map_entries;
guint visualid;
guint bitspixel;
} Visual;
typedef struct {
Colormap colormap;
unsigned long red_max;
unsigned long red_mult;
unsigned long green_max;
unsigned long green_mult;
unsigned long blue_max;
unsigned long blue_mult;
unsigned long base_pixel;
} XStandardColormap;
typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
typedef struct _GdkFontPrivateWin32 GdkFontPrivateWin32;
typedef struct _GdkImagePrivateWin32 GdkImagePrivateWin32;
typedef struct _GdkVisualPrivate GdkVisualPrivate;
struct _GdkCursorPrivate
{
GdkCursor cursor;
HCURSOR hcursor;
};
struct _GdkWin32SingleFont
{
HFONT hfont;
UINT charset;
UINT codepage;
FONTSIGNATURE fs;
};
struct _GdkFontPrivateWin32
{
GdkFontPrivate base;
GSList *fonts; /* List of GdkWin32SingleFonts */
GSList *names;
};
struct _GdkVisualClass
{
GObjectClass parent_class;
};
struct _GdkVisualPrivate
{
GdkVisual visual;
Visual *xvisual;
};
struct _GdkColormapPrivateWin32
{
Colormap xcolormap;
gint private_val;
GHashTable *hash;
GdkColorInfo *info;
DWORD last_sync_time;
};
struct _GdkImagePrivateWin32
{
HBITMAP hbitmap;
};
typedef struct _GdkGCWin32 GdkGCWin32;
typedef struct _GdkGCWin32Class GdkGCWin32Class;
#define GDK_TYPE_GC_WIN32 (_gdk_gc_win32_get_type ())
#define GDK_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_WIN32, GdkGCWin32))
#define GDK_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
#define GDK_IS_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_WIN32))
#define GDK_IS_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_WIN32))
#define GDK_GC_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
struct _GdkGCWin32
{
GdkGC parent_instance;
/* A Windows Device Context (DC) is not equivalent to an X11
* GC. We can use a DC only in the window for which it was
* allocated, or (in the case of a memory DC) with the bitmap that
* has been selected into it. Thus, we have to release and
* reallocate a DC each time the GdkGC is used to paint into a new
* window or pixmap. We thus keep all the necessary values in the
* GdkGCWin32 object.
*/
HDC hdc;
GdkRegion *clip_region;
HRGN hcliprgn;
GdkGCValuesMask values_mask;
gulong foreground; /* Pixel values from GdkColor, */
gulong background; /* not Win32 COLORREFs */
GdkFont *font;
gint rop2;
GdkFill fill_style;
GdkPixmap *tile;
GdkPixmap *stipple;
GdkSubwindowMode subwindow_mode;
gint graphics_exposures;
gint pen_width;
DWORD pen_style;
HANDLE hwnd; /* If a HDC is allocated, for which window,
* or what bitmap is selected into it
*/
int saved_dc;
};
struct _GdkGCWin32Class
{
GdkGCClass parent_class;
};
GType _gdk_gc_win32_get_type (void);
#include "gdkprivate-win32.h"
#undef GDK_ROOT_PARENT /* internal access is direct */
#define GDK_ROOT_PARENT() ((GdkWindow *) _gdk_parent_root)
@ -383,8 +84,6 @@ void gdk_win32_hdc_release (GdkDrawable *drawable,
GdkGC *gc,
GdkGCValuesMask usage);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GDK_WIN32_H__ */

View File

@ -31,7 +31,6 @@
#include "gdkevents.h"
#include "gdkpixmap.h"
#include "gdkwindow.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
#include "gdkinput-win32.h"
@ -314,15 +313,12 @@ RegisterGdkClass (GdkWindowType wtype)
hAppIcon = ExtractIcon (gdk_app_hmodule, sLoc, 0);
if (0 == hAppIcon)
{
char *gdklibname = g_strdup_printf ("gdk-%s.dll", GDK_VERSION);
hAppIcon = ExtractIcon (gdk_app_hmodule, gdklibname, 0);
g_free (gdklibname);
if (0 != GetModuleFileName (gdk_dll_hinstance, sLoc, _MAX_PATH))
hAppIcon = ExtractIcon (gdk_dll_hinstance, sLoc, 0);
}
if (0 == hAppIcon)
hAppIcon = LoadIcon (NULL, IDI_APPLICATION);
}
if (0 == hAppIcon)
hAppIcon = LoadIcon (NULL, IDI_APPLICATION);
}
wcl.lpszMenuName = NULL;

View File

@ -15,7 +15,7 @@ GTK_VER=1.3
CFLAGS = -I. -I.. -I..\.. $(GLIB_CFLAGS) $(PANGO_CFLAGS) \
-I$(WTKIT)\include -I$(GLIB) \
$(G_DEBUGGING) -DHAVE_CONFIG_H -DINSIDE_GDK_WIN32 -DGDK_VERSION=\"$(GTK_VER)\"
$(G_DEBUGGING) -DHAVE_CONFIG_H -DINSIDE_GDK_WIN32
all: \
..\..\config.h \

View File

@ -1,3 +1,5 @@
Makefile
Makefile.in
gdk.rc
.libs
_libs

View File

@ -2,3 +2,10 @@ EXTRA_DIST = \
gdk.rc \
gdk.rc.in \
gtk.ico
if USE_WIN32
noinst_DATA = gdk-win32res.lo
endif
gdk-win32res.lo : gdk.rc
$(top_srcdir)/build/win32/lt-compile-resource gdk.rc gdk-win32res.lo

View File

@ -15,13 +15,13 @@ VS_VERSION_INFO VERSIONINFO
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "The GTK+ developer community"
VALUE "CompanyName", "The GTK developer community"
VALUE "FileDescription", "GIMP Drawing Kit"
VALUE "FileVersion", "@GTK_VERSION@.BUILDNUMBER"
VALUE "InternalName", "gdk-win32-@GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@"
VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2000."
VALUE "OriginalFilename", "gdk-win32-@GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@.dll"
VALUE "ProductName", "GTK+"
VALUE "InternalName", "libgdk-win32-@GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@-@LT_CURRENT_MINUS_AGE@"
VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2001."
VALUE "OriginalFilename", "libgdk-win32-@GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@-@LT_CURRENT_MINUS_AGE@.dll"
VALUE "ProductName", "GTK"
VALUE "ProductVersion", "@GTK_VERSION@"
END
END