Commit a53f14a6 authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist
Browse files

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.
parent 47dc8d4d
## 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
......@@ -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);
......
......@@ -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"
......
......@@ -25,8 +25,6 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <string.h>
/* #define OLE2_DND */
......
......@@ -29,7 +29,6 @@
#include <pango/pangowin32.h>
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
static void gdk_win32_draw_rectangle (GdkDrawable *drawable,
......
......@@ -28,6 +28,7 @@
#define __GDK_DRAWABLE_WIN32_H__
#include <gdk/gdkdrawable.h>
#include <gdk/win32/gdkwin32.h>
#ifdef __cplusplus
extern "C" {
......
......@@ -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));
......
......@@ -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);
......
......@@ -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,
......
......@@ -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;
......
......@@ -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;
......@@ -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;
......
......@@ -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,
......
......@@ -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)
......
......@@ -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);
......
#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,