forked from AuroraMiddleware/gtk
README.win32 Add HAVE_WINTAB. Undefine it if bulding without the Wintab
* README.win32 * config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without the Wintab SDK. * gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work OK, but getting closer. Guard against bogus tilt data from Wacom ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to enable easier building without Wintab. * gdk/win32/gdkinput.h * gdk/win32/gdkevents.c * gdk/win32/gdkwindow.c: Minor changes related related to above. * gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11 code. As we have just one visual on Win32, no sense to have it in a table, and no need for the hash table.
This commit is contained in:
parent
b0a2c890a7
commit
51046a9fbf
23
ChangeLog
23
ChangeLog
@ -1,11 +1,30 @@
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
1999-07-25 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32
|
||||
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
|
||||
the Wintab SDK.
|
||||
|
||||
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
|
||||
OK, but getting closer. Guard against bogus tilt data from Wacom
|
||||
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
|
||||
enable easier building without Wintab.
|
||||
|
||||
* gdk/win32/gdkinput.h
|
||||
* gdk/win32/gdkevents.c
|
||||
* gdk/win32/gdkwindow.c: Minor changes related related to above.
|
||||
|
||||
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
|
||||
code. As we have just one visual on Win32, no sense to have it in a
|
||||
table, and no need for the hash table.
|
||||
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32: Update gcc build instructions. Mention gettext is
|
||||
GPL.
|
||||
|
||||
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
|
||||
supported cursor size with GetSystemMetrics.
|
||||
|
||||
|
||||
* gdk/win32/gdkfont.c
|
||||
* gtk/gtkfontsel.c: Guard against some font weight and charset
|
||||
symbols being undefined (in mingw32 headers).
|
||||
|
@ -1,11 +1,30 @@
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
1999-07-25 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32
|
||||
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
|
||||
the Wintab SDK.
|
||||
|
||||
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
|
||||
OK, but getting closer. Guard against bogus tilt data from Wacom
|
||||
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
|
||||
enable easier building without Wintab.
|
||||
|
||||
* gdk/win32/gdkinput.h
|
||||
* gdk/win32/gdkevents.c
|
||||
* gdk/win32/gdkwindow.c: Minor changes related related to above.
|
||||
|
||||
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
|
||||
code. As we have just one visual on Win32, no sense to have it in a
|
||||
table, and no need for the hash table.
|
||||
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32: Update gcc build instructions. Mention gettext is
|
||||
GPL.
|
||||
|
||||
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
|
||||
supported cursor size with GetSystemMetrics.
|
||||
|
||||
|
||||
* gdk/win32/gdkfont.c
|
||||
* gtk/gtkfontsel.c: Guard against some font weight and charset
|
||||
symbols being undefined (in mingw32 headers).
|
||||
|
@ -1,11 +1,30 @@
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
1999-07-25 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32
|
||||
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
|
||||
the Wintab SDK.
|
||||
|
||||
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
|
||||
OK, but getting closer. Guard against bogus tilt data from Wacom
|
||||
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
|
||||
enable easier building without Wintab.
|
||||
|
||||
* gdk/win32/gdkinput.h
|
||||
* gdk/win32/gdkevents.c
|
||||
* gdk/win32/gdkwindow.c: Minor changes related related to above.
|
||||
|
||||
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
|
||||
code. As we have just one visual on Win32, no sense to have it in a
|
||||
table, and no need for the hash table.
|
||||
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32: Update gcc build instructions. Mention gettext is
|
||||
GPL.
|
||||
|
||||
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
|
||||
supported cursor size with GetSystemMetrics.
|
||||
|
||||
|
||||
* gdk/win32/gdkfont.c
|
||||
* gtk/gtkfontsel.c: Guard against some font weight and charset
|
||||
symbols being undefined (in mingw32 headers).
|
||||
|
@ -1,11 +1,30 @@
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
1999-07-25 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32
|
||||
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
|
||||
the Wintab SDK.
|
||||
|
||||
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
|
||||
OK, but getting closer. Guard against bogus tilt data from Wacom
|
||||
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
|
||||
enable easier building without Wintab.
|
||||
|
||||
* gdk/win32/gdkinput.h
|
||||
* gdk/win32/gdkevents.c
|
||||
* gdk/win32/gdkwindow.c: Minor changes related related to above.
|
||||
|
||||
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
|
||||
code. As we have just one visual on Win32, no sense to have it in a
|
||||
table, and no need for the hash table.
|
||||
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32: Update gcc build instructions. Mention gettext is
|
||||
GPL.
|
||||
|
||||
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
|
||||
supported cursor size with GetSystemMetrics.
|
||||
|
||||
|
||||
* gdk/win32/gdkfont.c
|
||||
* gtk/gtkfontsel.c: Guard against some font weight and charset
|
||||
symbols being undefined (in mingw32 headers).
|
||||
|
@ -1,11 +1,30 @@
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
1999-07-25 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32
|
||||
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
|
||||
the Wintab SDK.
|
||||
|
||||
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
|
||||
OK, but getting closer. Guard against bogus tilt data from Wacom
|
||||
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
|
||||
enable easier building without Wintab.
|
||||
|
||||
* gdk/win32/gdkinput.h
|
||||
* gdk/win32/gdkevents.c
|
||||
* gdk/win32/gdkwindow.c: Minor changes related related to above.
|
||||
|
||||
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
|
||||
code. As we have just one visual on Win32, no sense to have it in a
|
||||
table, and no need for the hash table.
|
||||
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32: Update gcc build instructions. Mention gettext is
|
||||
GPL.
|
||||
|
||||
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
|
||||
supported cursor size with GetSystemMetrics.
|
||||
|
||||
|
||||
* gdk/win32/gdkfont.c
|
||||
* gtk/gtkfontsel.c: Guard against some font weight and charset
|
||||
symbols being undefined (in mingw32 headers).
|
||||
|
@ -1,11 +1,30 @@
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
1999-07-25 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32
|
||||
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
|
||||
the Wintab SDK.
|
||||
|
||||
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
|
||||
OK, but getting closer. Guard against bogus tilt data from Wacom
|
||||
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
|
||||
enable easier building without Wintab.
|
||||
|
||||
* gdk/win32/gdkinput.h
|
||||
* gdk/win32/gdkevents.c
|
||||
* gdk/win32/gdkwindow.c: Minor changes related related to above.
|
||||
|
||||
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
|
||||
code. As we have just one visual on Win32, no sense to have it in a
|
||||
table, and no need for the hash table.
|
||||
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32: Update gcc build instructions. Mention gettext is
|
||||
GPL.
|
||||
|
||||
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
|
||||
supported cursor size with GetSystemMetrics.
|
||||
|
||||
|
||||
* gdk/win32/gdkfont.c
|
||||
* gtk/gtkfontsel.c: Guard against some font weight and charset
|
||||
symbols being undefined (in mingw32 headers).
|
||||
|
@ -1,11 +1,30 @@
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
1999-07-25 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32
|
||||
* config.h.win32: Add HAVE_WINTAB. Undefine it if bulding without
|
||||
the Wintab SDK.
|
||||
|
||||
* gdk/win32/gdkinput.c: Hack some more. Still doesn't quite work
|
||||
OK, but getting closer. Guard against bogus tilt data from Wacom
|
||||
ArtPad II with the 3.40 driver. Add ifdefs for HAVE_WINTAB to
|
||||
enable easier building without Wintab.
|
||||
|
||||
* gdk/win32/gdkinput.h
|
||||
* gdk/win32/gdkevents.c
|
||||
* gdk/win32/gdkwindow.c: Minor changes related related to above.
|
||||
|
||||
* gdk/win32/gdkvisual.c: Simplify a lot, remove leftovers from X11
|
||||
code. As we have just one visual on Win32, no sense to have it in a
|
||||
table, and no need for the hash table.
|
||||
|
||||
1999-07-21 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32: Update gcc build instructions. Mention gettext is
|
||||
GPL.
|
||||
|
||||
* gdk/win32/gdkcursor.c (gdk_cursor_new_from_pixmap): Get correct
|
||||
supported cursor size with GetSystemMetrics.
|
||||
|
||||
|
||||
* gdk/win32/gdkfont.c
|
||||
* gtk/gtkfontsel.c: Guard against some font weight and charset
|
||||
symbols being undefined (in mingw32 headers).
|
||||
|
@ -14,7 +14,8 @@ See the README.win32 file in the GLib distribution for instructions
|
||||
how to build with gcc.
|
||||
|
||||
The tablet support uses the Wintab API. The Wintab development kit can
|
||||
be downloaded from http://www.pointing.com.
|
||||
be downloaded from http://www.pointing.com. If you don't care for
|
||||
that, undefine HAVE_WINTAB in config.h.win32 before building.
|
||||
|
||||
GTk+ wants to be built with the GNU gettext library for
|
||||
internationalisation (i18n). Get the version ported to Win32 (not a
|
||||
|
@ -182,3 +182,6 @@
|
||||
|
||||
/* define if compiled symbols have a leading underscore */
|
||||
/* #undef WITH_SYMBOL_UNDERSCORE */
|
||||
|
||||
/* Define if you have the Wintab programmer's kit */
|
||||
#define HAVE_WINTAB 1
|
||||
|
@ -28,9 +28,13 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include "gdkx.h"
|
||||
#ifdef HAVE_WINTAB
|
||||
#include <wintab.h>
|
||||
#endif
|
||||
#include "gdkinput.h"
|
||||
|
||||
#define PING() printf("%s: %d\n",__FILE__,__LINE__),fflush(stdout)
|
||||
@ -2782,6 +2786,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
return_val = window_private && !window_private->destroyed;
|
||||
break;
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
/* Handle WINTAB events here, as we know that gdkinput.c will
|
||||
* use the fixed WT_DEFBASE as lcMsgBase, and we thus can use the
|
||||
* constants as case labels.
|
||||
@ -2801,9 +2806,11 @@ gdk_event_translate (GdkEvent *event,
|
||||
g_print ("WT_PROXIMITY: %#x %d %d\n",
|
||||
xevent->wParam,
|
||||
LOWORD (xevent->lParam), HIWORD (xevent->lParam)));
|
||||
/* Fall through */
|
||||
wintab:
|
||||
return_val = gdk_input_vtable.other_event(event, xevent);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
bypass_switch:
|
||||
|
@ -28,9 +28,13 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include "gdkx.h"
|
||||
#ifdef HAVE_WINTAB
|
||||
#include <wintab.h>
|
||||
#endif
|
||||
#include "gdkinput.h"
|
||||
|
||||
#define PING() printf("%s: %d\n",__FILE__,__LINE__),fflush(stdout)
|
||||
@ -2782,6 +2786,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
return_val = window_private && !window_private->destroyed;
|
||||
break;
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
/* Handle WINTAB events here, as we know that gdkinput.c will
|
||||
* use the fixed WT_DEFBASE as lcMsgBase, and we thus can use the
|
||||
* constants as case labels.
|
||||
@ -2801,9 +2806,11 @@ gdk_event_translate (GdkEvent *event,
|
||||
g_print ("WT_PROXIMITY: %#x %d %d\n",
|
||||
xevent->wParam,
|
||||
LOWORD (xevent->lParam), HIWORD (xevent->lParam)));
|
||||
/* Fall through */
|
||||
wintab:
|
||||
return_val = gdk_input_vtable.other_event(event, xevent);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
bypass_switch:
|
||||
|
@ -33,8 +33,49 @@
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdkx.h"
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
#include <wintab.h>
|
||||
#define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION)
|
||||
#define PACKETMODE (PK_BUTTONS)
|
||||
#include <pktdef.h>
|
||||
#endif
|
||||
|
||||
#include "gdkinput.h"
|
||||
|
||||
struct _GdkDevicePrivate {
|
||||
GdkDeviceInfo info;
|
||||
|
||||
/* information about the axes */
|
||||
GdkAxisInfo *axes;
|
||||
|
||||
/* reverse lookup on axis use type */
|
||||
gint axis_for_use[GDK_AXIS_LAST];
|
||||
|
||||
/* true if we need to select a different set of events, but
|
||||
* can't because this is the core pointer
|
||||
*/
|
||||
gint needs_update;
|
||||
|
||||
/* State of buttons */
|
||||
gint button_state;
|
||||
|
||||
gint *last_axis_data;
|
||||
gint last_buttons;
|
||||
#ifdef HAVE_WINTAB
|
||||
/* WINTAB stuff: */
|
||||
HCTX hctx;
|
||||
/* Cursor number */
|
||||
UINT cursor;
|
||||
/* The cursor's CSR_PKTDATA */
|
||||
WTPKT pktdata;
|
||||
/* CSR_NPBTNMARKS */
|
||||
UINT npbtnmarks[2];
|
||||
/* Azimuth and altitude axis */
|
||||
AXIS orientation_axes[2];
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
@ -47,12 +88,33 @@
|
||||
* good at all.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
#define DEBUG_WINTAB 1
|
||||
#endif
|
||||
|
||||
#define TWOPI (2.*M_PI)
|
||||
|
||||
#define PING() g_print("%s: %d\n",__FILE__,__LINE__)
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
static gint gdk_input_enable_window (GdkWindow *window,
|
||||
GdkDevicePrivate *gdkdev);
|
||||
static gint gdk_input_disable_window (GdkWindow *window,
|
||||
GdkDevicePrivate *gdkdev);
|
||||
static void gdk_input_none_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask);
|
||||
|
||||
static GdkDevicePrivate *gdk_input_find_device (guint32 deviceid);
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
|
||||
static gint gdk_input_win32_set_mode (guint32 deviceid,
|
||||
GdkInputMode mode);
|
||||
static void gdk_input_win32_get_pointer (GdkWindow *window,
|
||||
@ -63,14 +125,6 @@ static void gdk_input_win32_get_pointer (GdkWindow *window,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask);
|
||||
static void gdk_input_none_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask);
|
||||
static gint gdk_input_win32_grab_pointer (GdkWindow * window,
|
||||
gint owner_events,
|
||||
GdkEventMask event_mask,
|
||||
@ -89,10 +143,12 @@ static gint gdk_input_win32_disable_window (GdkWindow *window,
|
||||
GdkDevicePrivate *gdkdev);
|
||||
|
||||
static GdkInputWindow *gdk_input_window_find (GdkWindow *window);
|
||||
#if !USE_SYSCONTEXT
|
||||
static GdkInputWindow *gdk_input_window_find_within (GdkWindow *window);
|
||||
static GdkDevicePrivate *gdk_input_find_device (guint32 deviceid);
|
||||
#endif
|
||||
static GdkDevicePrivate *gdk_input_find_dev_from_ctx (HCTX hctx,
|
||||
UINT id);
|
||||
#endif /* HAVE_WINTAB */
|
||||
|
||||
/* Local variables */
|
||||
|
||||
@ -126,7 +182,7 @@ GdkInputVTable gdk_input_vtable;
|
||||
gint gdk_input_ignore_core;
|
||||
gint gdk_input_ignore_wintab = FALSE;
|
||||
|
||||
#if 0
|
||||
#if DEBUG_WINTAB
|
||||
|
||||
static void
|
||||
print_lc(LOGCONTEXT *lc)
|
||||
@ -228,6 +284,8 @@ print_lc(LOGCONTEXT *lc)
|
||||
void
|
||||
gdk_input_init (void)
|
||||
{
|
||||
guint32 deviceid_counter = 0;
|
||||
#ifdef HAVE_WINTAB
|
||||
GdkDevicePrivate *gdkdev;
|
||||
GdkWindowPrivate *window_private;
|
||||
GdkWindowAttr wa;
|
||||
@ -235,10 +293,11 @@ gdk_input_init (void)
|
||||
LOGCONTEXT defcontext;
|
||||
HCTX *hctx;
|
||||
UINT ndevices, ncursors, ncsrtypes, firstcsr, hardware;
|
||||
AXIS axis_x, axis_y, axis_npressure, axis_orientation[3];
|
||||
BOOL active;
|
||||
AXIS axis_x, axis_y, axis_npressure, axis_or[3];
|
||||
int i, j, k;
|
||||
int devix, cursorix;
|
||||
char devname[100], csrname[100];
|
||||
guint32 deviceid_counter = 0;
|
||||
|
||||
gdk_input_devices = NULL;
|
||||
wintab_contexts = NULL;
|
||||
@ -247,18 +306,25 @@ gdk_input_init (void)
|
||||
WTInfo (0, 0, NULL))
|
||||
{
|
||||
WTInfo (WTI_INTERFACE, IFC_SPECVERSION, &specversion);
|
||||
|
||||
GDK_NOTE (MISC, g_print ("Wintab interface version %d.%d\n",
|
||||
HIBYTE (specversion), LOBYTE (specversion)));
|
||||
#if USE_SYSCONTEXT
|
||||
WTInfo (WTI_DEFSYSCTX, 0, &defcontext);
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, (g_print("DEFSYSCTX:\n"), print_lc(&defcontext)));
|
||||
#endif
|
||||
#else
|
||||
WTInfo (WTI_DEFCONTEXT, 0, &defcontext);
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, (g_print("DEFCONTEXT:\n"), print_lc(&defcontext)));
|
||||
#endif
|
||||
#if 0
|
||||
g_print("DEFCONTEXT:\n"); print_lc(&defcontext);
|
||||
#endif
|
||||
WTInfo (WTI_INTERFACE, IFC_NDEVICES, &ndevices);
|
||||
WTInfo (WTI_INTERFACE, IFC_NCURSORS, &ncursors);
|
||||
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, g_print ("NDEVICES: %d, NCURSORS: %d\n",
|
||||
ndevices, ncursors));
|
||||
#endif
|
||||
/* Create a dummy window to receive wintab events */
|
||||
wa.wclass = GDK_INPUT_OUTPUT;
|
||||
wa.event_mask = GDK_ALL_EVENTS_MASK;
|
||||
@ -275,61 +341,64 @@ gdk_input_init (void)
|
||||
gdk_window_ref (wintab_window);
|
||||
window_private = (GdkWindowPrivate *) wintab_window;
|
||||
|
||||
for (i = 0; i < ndevices; i++)
|
||||
for (devix = 0; devix < ndevices; devix++)
|
||||
{
|
||||
LOGCONTEXT lc;
|
||||
|
||||
WTInfo (WTI_DEVICES + i, DVC_NAME, devname);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_NAME, devname);
|
||||
|
||||
WTInfo (WTI_DEVICES + i, DVC_NCSRTYPES, &ncsrtypes);
|
||||
WTInfo (WTI_DEVICES + i, DVC_FIRSTCSR, &firstcsr);
|
||||
WTInfo (WTI_DEVICES + i, DVC_HARDWARE, &hardware);
|
||||
WTInfo (WTI_DEVICES + i, DVC_X, &axis_x);
|
||||
WTInfo (WTI_DEVICES + i, DVC_Y, &axis_y);
|
||||
WTInfo (WTI_DEVICES + i, DVC_NPRESSURE, &axis_npressure);
|
||||
WTInfo (WTI_DEVICES + i, DVC_ORIENTATION, axis_orientation);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_NCSRTYPES, &ncsrtypes);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_FIRSTCSR, &firstcsr);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_HARDWARE, &hardware);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_X, &axis_x);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_Y, &axis_y);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_NPRESSURE, &axis_npressure);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_ORIENTATION, axis_or);
|
||||
|
||||
if (HIBYTE (specversion) > 1 || LOBYTE (specversion) >= 1)
|
||||
{
|
||||
WTInfo (WTI_DDCTXS + i, CTX_NAME, lc.lcName);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_OPTIONS, &lc.lcOptions);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_NAME, lc.lcName);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_OPTIONS, &lc.lcOptions);
|
||||
lc.lcOptions |= CXO_MESSAGES;
|
||||
#if USE_SYSCONTEXT
|
||||
lc.lcOptions |= CXO_SYSTEM;
|
||||
#endif
|
||||
lc.lcStatus = 0;
|
||||
WTInfo (WTI_DDCTXS + i, CTX_LOCKS, &lc.lcLocks);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_LOCKS, &lc.lcLocks);
|
||||
lc.lcMsgBase = WT_DEFBASE;
|
||||
lc.lcDevice = i;
|
||||
lc.lcPktRate = 20;
|
||||
lc.lcDevice = devix;
|
||||
lc.lcPktRate = 50;
|
||||
lc.lcPktData = PACKETDATA;
|
||||
lc.lcPktMode = PK_BUTTONS; /* We want buttons in relative mode */
|
||||
lc.lcMoveMask = PACKETDATA;
|
||||
lc.lcBtnDnMask = lc.lcBtnUpMask = ~0;
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INORGX, &lc.lcInOrgX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INORGY, &lc.lcInOrgY);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INORGZ, &lc.lcInOrgZ);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INEXTX, &lc.lcInExtX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INEXTY, &lc.lcInExtY);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INEXTZ, &lc.lcInExtZ);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INORGX, &lc.lcInOrgX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INORGY, &lc.lcInOrgY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INORGZ, &lc.lcInOrgZ);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INEXTX, &lc.lcInExtX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INEXTY, &lc.lcInExtY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INEXTZ, &lc.lcInExtZ);
|
||||
lc.lcOutOrgX = axis_x.axMin;
|
||||
lc.lcOutOrgY = axis_y.axMin;
|
||||
lc.lcOutExtX = axis_x.axMax - axis_x.axMin;
|
||||
lc.lcOutExtY = axis_y.axMax - axis_y.axMin;
|
||||
lc.lcOutExtY = -lc.lcOutExtY; /* We want Y growing downward */
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SENSX, &lc.lcSensX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SENSY, &lc.lcSensY);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SENSZ, &lc.lcSensZ);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSMODE, &lc.lcSysMode);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SENSX, &lc.lcSensX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SENSY, &lc.lcSensY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SENSZ, &lc.lcSensZ);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSMODE, &lc.lcSysMode);
|
||||
lc.lcSysOrgX = lc.lcSysOrgY = 0;
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSEXTX, &lc.lcSysExtX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSEXTY, &lc.lcSysExtY);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSSENSX, &lc.lcSysSensX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSSENSY, &lc.lcSysSensY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSEXTX, &lc.lcSysExtX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSEXTY, &lc.lcSysExtY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSSENSX, &lc.lcSysSensX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSSENSY, &lc.lcSysSensY);
|
||||
}
|
||||
else
|
||||
{
|
||||
lc = defcontext;
|
||||
lc.lcOptions |= CXO_MESSAGES;
|
||||
lc.lcMsgBase = WT_DEFBASE;
|
||||
lc.lcPktRate = 20; /* Slow down the packets a bit */
|
||||
lc.lcPktRate = 50;
|
||||
lc.lcPktData = PACKETDATA;
|
||||
lc.lcPktMode = PACKETMODE;
|
||||
lc.lcMoveMask = PACKETDATA;
|
||||
@ -344,8 +413,9 @@ gdk_input_init (void)
|
||||
lc.lcOutExtY = -lc.lcOutExtY; /* We want Y growing downward */
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
g_print("context for device %d:\n", i); print_lc(&lc);
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, (g_print("context for device %d:\n", devix),
|
||||
print_lc(&lc)));
|
||||
#endif
|
||||
hctx = g_new (HCTX, 1);
|
||||
if ((*hctx = WTOpen (window_private->xwindow, &lc, TRUE)) == NULL)
|
||||
@ -353,8 +423,8 @@ gdk_input_init (void)
|
||||
g_warning ("gdk_input_init: WTOpen failed");
|
||||
return;
|
||||
}
|
||||
GDK_NOTE (MISC, g_print ("gdk_input_init: opened Wintab device %d %#x\n",
|
||||
i, *hctx));
|
||||
GDK_NOTE (MISC, g_print ("opened Wintab device %d %#x\n",
|
||||
devix, *hctx));
|
||||
|
||||
wintab_contexts = g_list_append (wintab_contexts, hctx);
|
||||
#if 0
|
||||
@ -362,13 +432,18 @@ gdk_input_init (void)
|
||||
#endif
|
||||
WTOverlap (*hctx, TRUE);
|
||||
|
||||
#if 0
|
||||
g_print("context for device %d after WTOpen:\n", i); print_lc(&lc);
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, (g_print("context for device %d after WTOpen:\n", devix),
|
||||
print_lc(&lc)));
|
||||
#endif
|
||||
for (j = firstcsr; j < firstcsr + ncsrtypes; j++)
|
||||
for (cursorix = firstcsr; cursorix < firstcsr + ncsrtypes; cursorix++)
|
||||
{
|
||||
active = FALSE;
|
||||
WTInfo (WTI_CURSORS + cursorix, CSR_ACTIVE, &active);
|
||||
if (!active)
|
||||
continue;
|
||||
gdkdev = g_new (GdkDevicePrivate, 1);
|
||||
WTInfo (WTI_CURSORS + j, CSR_NAME, csrname);
|
||||
WTInfo (WTI_CURSORS + cursorix, CSR_NAME, csrname);
|
||||
gdkdev->info.name = g_strconcat (devname, " ", csrname, NULL);
|
||||
gdkdev->info.deviceid = deviceid_counter++;
|
||||
gdkdev->info.source = GDK_SOURCE_PEN;
|
||||
@ -379,8 +454,8 @@ gdk_input_init (void)
|
||||
gdkdev->info.has_cursor = FALSE;
|
||||
#endif
|
||||
gdkdev->hctx = *hctx;
|
||||
gdkdev->cursor = j;
|
||||
WTInfo (WTI_CURSORS + j, CSR_PKTDATA, &gdkdev->pktdata);
|
||||
gdkdev->cursor = cursorix;
|
||||
WTInfo (WTI_CURSORS + cursorix, CSR_PKTDATA, &gdkdev->pktdata);
|
||||
gdkdev->info.num_axes = 0;
|
||||
if (gdkdev->pktdata & PK_X)
|
||||
gdkdev->info.num_axes++;
|
||||
@ -388,9 +463,18 @@ gdk_input_init (void)
|
||||
gdkdev->info.num_axes++;
|
||||
if (gdkdev->pktdata & PK_NORMAL_PRESSURE)
|
||||
gdkdev->info.num_axes++;
|
||||
/* The wintab driver for the Wacom ArtPad II reports
|
||||
* PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't
|
||||
* actually sense tilt. Catch this by noticing that the
|
||||
* orientation axis's azimuth resolution is zero.
|
||||
*/
|
||||
if ((gdkdev->pktdata & PK_ORIENTATION)
|
||||
&& axis_or[0].axResolution == 0)
|
||||
gdkdev->pktdata &= ~PK_ORIENTATION;
|
||||
|
||||
if (gdkdev->pktdata & PK_ORIENTATION)
|
||||
gdkdev->info.num_axes += 2; /* x and y tilt */
|
||||
WTInfo (WTI_CURSORS + j, CSR_NPBTNMARKS, &gdkdev->npbtnmarks);
|
||||
WTInfo (WTI_CURSORS + cursorix, CSR_NPBTNMARKS, &gdkdev->npbtnmarks);
|
||||
gdkdev->axes = g_new (GdkAxisInfo, gdkdev->info.num_axes);
|
||||
gdkdev->info.axes = g_new (GdkAxisUse, gdkdev->info.num_axes);
|
||||
gdkdev->last_axis_data = g_new (gint, gdkdev->info.num_axes);
|
||||
@ -439,10 +523,13 @@ gdk_input_init (void)
|
||||
{
|
||||
GdkAxisUse axis;
|
||||
|
||||
gdkdev->orientation_axes[0] = axis_orientation[0];
|
||||
gdkdev->orientation_axes[1] = axis_orientation[1];
|
||||
gdkdev->orientation_axes[0] = axis_or[0];
|
||||
gdkdev->orientation_axes[1] = axis_or[1];
|
||||
for (axis = GDK_AXIS_XTILT; axis <= GDK_AXIS_YTILT; axis++)
|
||||
{
|
||||
/* Wintab gives us aximuth and altitude, which
|
||||
* we convert to x and y tilt in the -1000..1000 range
|
||||
*/
|
||||
gdkdev->axes[k].xresolution =
|
||||
gdkdev->axes[k].resolution = 1000;
|
||||
gdkdev->axes[k].xmin_value =
|
||||
@ -457,13 +544,37 @@ gdk_input_init (void)
|
||||
gdkdev->info.num_keys = 0;
|
||||
gdkdev->info.keys = NULL;
|
||||
GDK_NOTE (EVENTS,
|
||||
g_print ("gdk_input_init: device: %d axes: %d\n",
|
||||
gdkdev->info.deviceid,
|
||||
gdkdev->info.num_axes));
|
||||
(g_print ("device: %d (%d) %s axes: %d\n",
|
||||
gdkdev->info.deviceid, cursorix,
|
||||
gdkdev->info.name,
|
||||
gdkdev->info.num_axes),
|
||||
g_print ("axes: X:%d, Y:%d, PRESSURE:%d, "
|
||||
"XTILT:%d, YTILT:%d\n",
|
||||
gdkdev->axis_for_use[GDK_AXIS_X],
|
||||
gdkdev->axis_for_use[GDK_AXIS_Y],
|
||||
gdkdev->axis_for_use[GDK_AXIS_PRESSURE],
|
||||
gdkdev->axis_for_use[GDK_AXIS_XTILT],
|
||||
gdkdev->axis_for_use[GDK_AXIS_YTILT])));
|
||||
for (i = 0; i < gdkdev->info.num_axes; i++)
|
||||
GDK_NOTE (EVENTS,
|
||||
g_print ("...axis %d: %d--%d@%d (%d--%d@%d)\n",
|
||||
i,
|
||||
gdkdev->axes[i].xmin_value,
|
||||
gdkdev->axes[i].xmax_value,
|
||||
gdkdev->axes[i].xresolution,
|
||||
gdkdev->axes[i].min_value,
|
||||
gdkdev->axes[i].max_value,
|
||||
gdkdev->axes[i].resolution));
|
||||
gdk_input_devices = g_list_append (gdk_input_devices,
|
||||
gdkdev);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_WINTAB */
|
||||
|
||||
if (deviceid_counter > 0)
|
||||
{
|
||||
#ifdef HAVE_WINTAB
|
||||
gdk_input_vtable.set_mode = gdk_input_win32_set_mode;
|
||||
gdk_input_vtable.set_axes = NULL;
|
||||
gdk_input_vtable.set_key = NULL;
|
||||
@ -480,6 +591,9 @@ gdk_input_init (void)
|
||||
gdk_input_root_width = gdk_screen_width ();
|
||||
gdk_input_root_height = gdk_screen_height ();
|
||||
gdk_input_ignore_core = FALSE;
|
||||
#else
|
||||
g_assert_not_reached ();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -501,21 +615,70 @@ gdk_input_init (void)
|
||||
gdk_input_devices = g_list_append (gdk_input_devices, &gdk_input_core_info);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_get_root_relative_geometry (HWND w,
|
||||
int *x_ret,
|
||||
int *y_ret)
|
||||
gint
|
||||
gdk_input_set_mode (guint32 deviceid,
|
||||
GdkInputMode mode)
|
||||
{
|
||||
RECT rect;
|
||||
if (deviceid == GDK_CORE_POINTER)
|
||||
return FALSE;
|
||||
|
||||
GetWindowRect (w, &rect);
|
||||
|
||||
if (x_ret)
|
||||
*x_ret = rect.left;
|
||||
if (y_ret)
|
||||
*y_ret = rect.top;
|
||||
if (gdk_input_vtable.set_mode)
|
||||
return gdk_input_vtable.set_mode (deviceid, mode);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_input_set_axes (guint32 deviceid,
|
||||
GdkAxisUse *axes)
|
||||
{
|
||||
int i;
|
||||
GdkDevicePrivate *gdkdev = gdk_input_find_device (deviceid);
|
||||
g_return_if_fail (gdkdev != NULL);
|
||||
|
||||
if (deviceid == GDK_CORE_POINTER)
|
||||
return;
|
||||
|
||||
for (i = GDK_AXIS_IGNORE; i < GDK_AXIS_LAST; i++)
|
||||
{
|
||||
gdkdev->axis_for_use[i] = -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < gdkdev->info.num_axes; i++)
|
||||
{
|
||||
gdkdev->info.axes[i] = axes[i];
|
||||
gdkdev->axis_for_use[axes[i]] = i;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_none_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
gint x_int, y_int;
|
||||
|
||||
gdk_window_get_pointer (window, &x_int, &y_int, mask);
|
||||
|
||||
if (x)
|
||||
*x = x_int;
|
||||
if (y)
|
||||
*y = y_int;
|
||||
if (pressure)
|
||||
*pressure = 0.5;
|
||||
if (xtilt)
|
||||
*xtilt = 0;
|
||||
if (ytilt)
|
||||
*ytilt = 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
|
||||
static void
|
||||
gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
|
||||
GdkInputWindow *input_window,
|
||||
@ -625,42 +788,6 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_input_set_mode (guint32 deviceid,
|
||||
GdkInputMode mode)
|
||||
{
|
||||
if (deviceid == GDK_CORE_POINTER)
|
||||
return FALSE;
|
||||
|
||||
if (gdk_input_vtable.set_mode)
|
||||
return gdk_input_vtable.set_mode (deviceid, mode);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_input_set_axes (guint32 deviceid,
|
||||
GdkAxisUse *axes)
|
||||
{
|
||||
int i;
|
||||
GdkDevicePrivate *gdkdev = gdk_input_find_device (deviceid);
|
||||
g_return_if_fail (gdkdev != NULL);
|
||||
|
||||
if (deviceid == GDK_CORE_POINTER)
|
||||
return;
|
||||
|
||||
for (i = GDK_AXIS_IGNORE; i < GDK_AXIS_LAST; i++)
|
||||
{
|
||||
gdkdev->axis_for_use[i] = -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < gdkdev->info.num_axes; i++)
|
||||
{
|
||||
gdkdev->info.axes[i] = axes[i];
|
||||
gdkdev->axis_for_use[axes[i]] = i;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_win32_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
@ -714,29 +841,18 @@ gdk_input_win32_get_pointer (GdkWindow *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_none_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask)
|
||||
gdk_input_get_root_relative_geometry (HWND w,
|
||||
int *x_ret,
|
||||
int *y_ret)
|
||||
{
|
||||
gint x_int, y_int;
|
||||
RECT rect;
|
||||
|
||||
gdk_window_get_pointer (window, &x_int, &y_int, mask);
|
||||
GetWindowRect (w, &rect);
|
||||
|
||||
if (x)
|
||||
*x = x_int;
|
||||
if (y)
|
||||
*y = y_int;
|
||||
if (pressure)
|
||||
*pressure = 0.5;
|
||||
if (xtilt)
|
||||
*xtilt = 0;
|
||||
if (ytilt)
|
||||
*ytilt = 0;
|
||||
if (x_ret)
|
||||
*x_ret = rect.left;
|
||||
if (y_ret)
|
||||
*y_ret = rect.top;
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -850,6 +966,22 @@ decode_tilt (gint *axis_data,
|
||||
axis_data[1] = sin (az) * cos (el) * 1000;
|
||||
}
|
||||
|
||||
static GdkDevicePrivate *
|
||||
gdk_input_find_dev_from_ctx (HCTX hctx,
|
||||
UINT cursor)
|
||||
{
|
||||
GList *tmp_list = gdk_input_devices;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *) (tmp_list->data);
|
||||
if (gdkdev->hctx == hctx && gdkdev->cursor == cursor)
|
||||
return gdkdev;
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
static gint
|
||||
gdk_input_win32_other_event (GdkEvent *event,
|
||||
MSG *xevent)
|
||||
@ -1021,13 +1153,14 @@ gdk_input_win32_other_event (GdkEvent *event,
|
||||
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
|
||||
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
|
||||
| GDK_BUTTON5_MASK));
|
||||
GDK_NOTE (EVENTS, g_print ("WINTAB button %s: %d %d %g,%g %g\n",
|
||||
GDK_NOTE (EVENTS, g_print ("WINTAB button %s: %d %d %g,%g %g %g,%g\n",
|
||||
(event->button.type == GDK_BUTTON_PRESS ?
|
||||
"press" : "release"),
|
||||
event->button.deviceid,
|
||||
event->button.button,
|
||||
event->button.x, event->button.y,
|
||||
event->button.pressure));
|
||||
event->button.pressure,
|
||||
event->button.xtilt, event->button.ytilt));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1049,10 +1182,11 @@ gdk_input_win32_other_event (GdkEvent *event,
|
||||
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
|
||||
| GDK_BUTTON5_MASK));
|
||||
|
||||
GDK_NOTE (EVENTS, g_print ("WINTAB motion: %d %g,%g %g\n",
|
||||
GDK_NOTE (EVENTS, g_print ("WINTAB motion: %d %g,%g %g %g,%g\n",
|
||||
event->motion.deviceid,
|
||||
event->motion.x, event->motion.y,
|
||||
event->motion.pressure));
|
||||
event->motion.pressure,
|
||||
event->motion.xtilt, event->motion.ytilt));
|
||||
|
||||
/* Check for missing release or press events for the normal
|
||||
* pressure button. At least on my ArtPadII I sometimes miss a
|
||||
@ -1114,7 +1248,6 @@ gdk_input_win32_other_event (GdkEvent *event,
|
||||
event->proximity.deviceid));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1188,6 +1321,7 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER)
|
||||
{
|
||||
#if 0
|
||||
/* XXX */
|
||||
gdk_input_find_events (window, gdkdev,
|
||||
event_mask,
|
||||
event_classes, &num_classes);
|
||||
@ -1215,6 +1349,7 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
|
||||
((gdkdev->button_state != 0) || need_ungrab))
|
||||
{
|
||||
#if 0
|
||||
/* XXX */
|
||||
XUngrabDevice (gdk_display, gdkdev->xdevice, time);
|
||||
#endif
|
||||
gdkdev->button_state = 0;
|
||||
@ -1255,6 +1390,7 @@ gdk_input_win32_ungrab_pointer (guint32 time)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
#if 0
|
||||
/* XXX */
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice)
|
||||
XUngrabDevice (gdk_display, gdkdev->xdevice, time);
|
||||
#endif
|
||||
@ -1263,6 +1399,8 @@ gdk_input_win32_ungrab_pointer (guint32 time)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_WINTAB */
|
||||
|
||||
GList *
|
||||
gdk_input_list_devices (void)
|
||||
{
|
||||
@ -1308,6 +1446,25 @@ gdk_input_motion_events (GdkWindow *window,
|
||||
return NULL; /* ??? */
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_input_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
|
||||
{
|
||||
if (gdk_input_vtable.enable_window)
|
||||
return gdk_input_vtable.enable_window (window, gdkdev);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
|
||||
{
|
||||
if (gdk_input_vtable.disable_window)
|
||||
return gdk_input_vtable.disable_window(window,gdkdev);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static GdkInputWindow *
|
||||
gdk_input_window_find (GdkWindow *window)
|
||||
{
|
||||
@ -1320,6 +1477,8 @@ gdk_input_window_find (GdkWindow *window)
|
||||
return NULL; /* Not found */
|
||||
}
|
||||
|
||||
#if !USE_SYSCONTEXT
|
||||
|
||||
static GdkInputWindow *
|
||||
gdk_input_window_find_within (GdkWindow *window)
|
||||
{
|
||||
@ -1346,6 +1505,8 @@ gdk_input_window_find_within (GdkWindow *window)
|
||||
return candidate;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* FIXME: this routine currently needs to be called between creation
|
||||
and the corresponding configure event (because it doesn't get the
|
||||
root_relative_geometry). This should work with
|
||||
@ -1406,9 +1567,9 @@ gdk_input_set_extension_events (GdkWindow *window,
|
||||
{
|
||||
if (mask != 0 && gdkdev->info.mode != GDK_MODE_DISABLED
|
||||
&& (gdkdev->info.has_cursor || mode == GDK_EXTENSION_EVENTS_ALL))
|
||||
gdk_input_win32_enable_window (window, gdkdev);
|
||||
gdk_input_enable_window (window, gdkdev);
|
||||
else
|
||||
gdk_input_win32_disable_window (window, gdkdev);
|
||||
gdk_input_disable_window (window, gdkdev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1428,6 +1589,7 @@ gdk_input_window_destroy (GdkWindow *window)
|
||||
void
|
||||
gdk_input_exit (void)
|
||||
{
|
||||
#ifdef HAVE_WINTAB
|
||||
GList *tmp_list;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
|
||||
@ -1453,6 +1615,10 @@ gdk_input_exit (void)
|
||||
g_free (tmp_list->data);
|
||||
}
|
||||
g_list_free (gdk_input_windows);
|
||||
gdk_input_windows = NULL;
|
||||
|
||||
gdk_window_unref (wintab_window);
|
||||
wintab_window = NULL;
|
||||
|
||||
#if 1
|
||||
for (tmp_list = wintab_contexts; tmp_list; tmp_list = tmp_list->next)
|
||||
@ -1463,27 +1629,30 @@ gdk_input_exit (void)
|
||||
#ifdef _MSC_VER
|
||||
/* For some reason WTEnable and/or WTClose tend to crash here.
|
||||
* Protect with __try/__except to avoid a message box.
|
||||
* When compiling with gcc, we cannot use __try/__except, so
|
||||
* don't call WTClose. I think this means that we'll
|
||||
* eventually run out of Wintab contexts, sigh.
|
||||
*/
|
||||
__try {
|
||||
#endif /* _MSC_VER */
|
||||
#if 0
|
||||
WTEnable (*hctx, FALSE);
|
||||
#endif
|
||||
result = WTClose (*hctx);
|
||||
#ifdef _MSC_VER
|
||||
}
|
||||
__except (/* GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? */
|
||||
EXCEPTION_EXECUTE_HANDLER /*:
|
||||
EXCEPTION_CONTINUE_SEARCH */) {
|
||||
result = FALSE;
|
||||
}
|
||||
#endif /* _MSC_VER */
|
||||
if (!result)
|
||||
g_warning ("gdk_input_exit: Closing Wintab context %#x failed", *hctx);
|
||||
#endif /* _MSC_VER */
|
||||
g_free (hctx);
|
||||
}
|
||||
#endif
|
||||
g_list_free (wintab_contexts);
|
||||
wintab_contexts = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static GdkDevicePrivate *
|
||||
@ -1502,23 +1671,6 @@ gdk_input_find_device (guint32 id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GdkDevicePrivate *
|
||||
gdk_input_find_dev_from_ctx (HCTX hctx,
|
||||
UINT cursor)
|
||||
{
|
||||
GList *tmp_list = gdk_input_devices;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *) (tmp_list->data);
|
||||
if (gdkdev->hctx == hctx && gdkdev->cursor == cursor)
|
||||
return gdkdev;
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_input_window_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
|
@ -33,8 +33,49 @@
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdkx.h"
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
#include <wintab.h>
|
||||
#define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION)
|
||||
#define PACKETMODE (PK_BUTTONS)
|
||||
#include <pktdef.h>
|
||||
#endif
|
||||
|
||||
#include "gdkinput.h"
|
||||
|
||||
struct _GdkDevicePrivate {
|
||||
GdkDeviceInfo info;
|
||||
|
||||
/* information about the axes */
|
||||
GdkAxisInfo *axes;
|
||||
|
||||
/* reverse lookup on axis use type */
|
||||
gint axis_for_use[GDK_AXIS_LAST];
|
||||
|
||||
/* true if we need to select a different set of events, but
|
||||
* can't because this is the core pointer
|
||||
*/
|
||||
gint needs_update;
|
||||
|
||||
/* State of buttons */
|
||||
gint button_state;
|
||||
|
||||
gint *last_axis_data;
|
||||
gint last_buttons;
|
||||
#ifdef HAVE_WINTAB
|
||||
/* WINTAB stuff: */
|
||||
HCTX hctx;
|
||||
/* Cursor number */
|
||||
UINT cursor;
|
||||
/* The cursor's CSR_PKTDATA */
|
||||
WTPKT pktdata;
|
||||
/* CSR_NPBTNMARKS */
|
||||
UINT npbtnmarks[2];
|
||||
/* Azimuth and altitude axis */
|
||||
AXIS orientation_axes[2];
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
@ -47,12 +88,33 @@
|
||||
* good at all.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
#define DEBUG_WINTAB 1
|
||||
#endif
|
||||
|
||||
#define TWOPI (2.*M_PI)
|
||||
|
||||
#define PING() g_print("%s: %d\n",__FILE__,__LINE__)
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
static gint gdk_input_enable_window (GdkWindow *window,
|
||||
GdkDevicePrivate *gdkdev);
|
||||
static gint gdk_input_disable_window (GdkWindow *window,
|
||||
GdkDevicePrivate *gdkdev);
|
||||
static void gdk_input_none_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask);
|
||||
|
||||
static GdkDevicePrivate *gdk_input_find_device (guint32 deviceid);
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
|
||||
static gint gdk_input_win32_set_mode (guint32 deviceid,
|
||||
GdkInputMode mode);
|
||||
static void gdk_input_win32_get_pointer (GdkWindow *window,
|
||||
@ -63,14 +125,6 @@ static void gdk_input_win32_get_pointer (GdkWindow *window,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask);
|
||||
static void gdk_input_none_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask);
|
||||
static gint gdk_input_win32_grab_pointer (GdkWindow * window,
|
||||
gint owner_events,
|
||||
GdkEventMask event_mask,
|
||||
@ -89,10 +143,12 @@ static gint gdk_input_win32_disable_window (GdkWindow *window,
|
||||
GdkDevicePrivate *gdkdev);
|
||||
|
||||
static GdkInputWindow *gdk_input_window_find (GdkWindow *window);
|
||||
#if !USE_SYSCONTEXT
|
||||
static GdkInputWindow *gdk_input_window_find_within (GdkWindow *window);
|
||||
static GdkDevicePrivate *gdk_input_find_device (guint32 deviceid);
|
||||
#endif
|
||||
static GdkDevicePrivate *gdk_input_find_dev_from_ctx (HCTX hctx,
|
||||
UINT id);
|
||||
#endif /* HAVE_WINTAB */
|
||||
|
||||
/* Local variables */
|
||||
|
||||
@ -126,7 +182,7 @@ GdkInputVTable gdk_input_vtable;
|
||||
gint gdk_input_ignore_core;
|
||||
gint gdk_input_ignore_wintab = FALSE;
|
||||
|
||||
#if 0
|
||||
#if DEBUG_WINTAB
|
||||
|
||||
static void
|
||||
print_lc(LOGCONTEXT *lc)
|
||||
@ -228,6 +284,8 @@ print_lc(LOGCONTEXT *lc)
|
||||
void
|
||||
gdk_input_init (void)
|
||||
{
|
||||
guint32 deviceid_counter = 0;
|
||||
#ifdef HAVE_WINTAB
|
||||
GdkDevicePrivate *gdkdev;
|
||||
GdkWindowPrivate *window_private;
|
||||
GdkWindowAttr wa;
|
||||
@ -235,10 +293,11 @@ gdk_input_init (void)
|
||||
LOGCONTEXT defcontext;
|
||||
HCTX *hctx;
|
||||
UINT ndevices, ncursors, ncsrtypes, firstcsr, hardware;
|
||||
AXIS axis_x, axis_y, axis_npressure, axis_orientation[3];
|
||||
BOOL active;
|
||||
AXIS axis_x, axis_y, axis_npressure, axis_or[3];
|
||||
int i, j, k;
|
||||
int devix, cursorix;
|
||||
char devname[100], csrname[100];
|
||||
guint32 deviceid_counter = 0;
|
||||
|
||||
gdk_input_devices = NULL;
|
||||
wintab_contexts = NULL;
|
||||
@ -247,18 +306,25 @@ gdk_input_init (void)
|
||||
WTInfo (0, 0, NULL))
|
||||
{
|
||||
WTInfo (WTI_INTERFACE, IFC_SPECVERSION, &specversion);
|
||||
|
||||
GDK_NOTE (MISC, g_print ("Wintab interface version %d.%d\n",
|
||||
HIBYTE (specversion), LOBYTE (specversion)));
|
||||
#if USE_SYSCONTEXT
|
||||
WTInfo (WTI_DEFSYSCTX, 0, &defcontext);
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, (g_print("DEFSYSCTX:\n"), print_lc(&defcontext)));
|
||||
#endif
|
||||
#else
|
||||
WTInfo (WTI_DEFCONTEXT, 0, &defcontext);
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, (g_print("DEFCONTEXT:\n"), print_lc(&defcontext)));
|
||||
#endif
|
||||
#if 0
|
||||
g_print("DEFCONTEXT:\n"); print_lc(&defcontext);
|
||||
#endif
|
||||
WTInfo (WTI_INTERFACE, IFC_NDEVICES, &ndevices);
|
||||
WTInfo (WTI_INTERFACE, IFC_NCURSORS, &ncursors);
|
||||
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, g_print ("NDEVICES: %d, NCURSORS: %d\n",
|
||||
ndevices, ncursors));
|
||||
#endif
|
||||
/* Create a dummy window to receive wintab events */
|
||||
wa.wclass = GDK_INPUT_OUTPUT;
|
||||
wa.event_mask = GDK_ALL_EVENTS_MASK;
|
||||
@ -275,61 +341,64 @@ gdk_input_init (void)
|
||||
gdk_window_ref (wintab_window);
|
||||
window_private = (GdkWindowPrivate *) wintab_window;
|
||||
|
||||
for (i = 0; i < ndevices; i++)
|
||||
for (devix = 0; devix < ndevices; devix++)
|
||||
{
|
||||
LOGCONTEXT lc;
|
||||
|
||||
WTInfo (WTI_DEVICES + i, DVC_NAME, devname);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_NAME, devname);
|
||||
|
||||
WTInfo (WTI_DEVICES + i, DVC_NCSRTYPES, &ncsrtypes);
|
||||
WTInfo (WTI_DEVICES + i, DVC_FIRSTCSR, &firstcsr);
|
||||
WTInfo (WTI_DEVICES + i, DVC_HARDWARE, &hardware);
|
||||
WTInfo (WTI_DEVICES + i, DVC_X, &axis_x);
|
||||
WTInfo (WTI_DEVICES + i, DVC_Y, &axis_y);
|
||||
WTInfo (WTI_DEVICES + i, DVC_NPRESSURE, &axis_npressure);
|
||||
WTInfo (WTI_DEVICES + i, DVC_ORIENTATION, axis_orientation);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_NCSRTYPES, &ncsrtypes);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_FIRSTCSR, &firstcsr);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_HARDWARE, &hardware);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_X, &axis_x);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_Y, &axis_y);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_NPRESSURE, &axis_npressure);
|
||||
WTInfo (WTI_DEVICES + devix, DVC_ORIENTATION, axis_or);
|
||||
|
||||
if (HIBYTE (specversion) > 1 || LOBYTE (specversion) >= 1)
|
||||
{
|
||||
WTInfo (WTI_DDCTXS + i, CTX_NAME, lc.lcName);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_OPTIONS, &lc.lcOptions);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_NAME, lc.lcName);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_OPTIONS, &lc.lcOptions);
|
||||
lc.lcOptions |= CXO_MESSAGES;
|
||||
#if USE_SYSCONTEXT
|
||||
lc.lcOptions |= CXO_SYSTEM;
|
||||
#endif
|
||||
lc.lcStatus = 0;
|
||||
WTInfo (WTI_DDCTXS + i, CTX_LOCKS, &lc.lcLocks);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_LOCKS, &lc.lcLocks);
|
||||
lc.lcMsgBase = WT_DEFBASE;
|
||||
lc.lcDevice = i;
|
||||
lc.lcPktRate = 20;
|
||||
lc.lcDevice = devix;
|
||||
lc.lcPktRate = 50;
|
||||
lc.lcPktData = PACKETDATA;
|
||||
lc.lcPktMode = PK_BUTTONS; /* We want buttons in relative mode */
|
||||
lc.lcMoveMask = PACKETDATA;
|
||||
lc.lcBtnDnMask = lc.lcBtnUpMask = ~0;
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INORGX, &lc.lcInOrgX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INORGY, &lc.lcInOrgY);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INORGZ, &lc.lcInOrgZ);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INEXTX, &lc.lcInExtX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INEXTY, &lc.lcInExtY);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_INEXTZ, &lc.lcInExtZ);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INORGX, &lc.lcInOrgX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INORGY, &lc.lcInOrgY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INORGZ, &lc.lcInOrgZ);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INEXTX, &lc.lcInExtX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INEXTY, &lc.lcInExtY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_INEXTZ, &lc.lcInExtZ);
|
||||
lc.lcOutOrgX = axis_x.axMin;
|
||||
lc.lcOutOrgY = axis_y.axMin;
|
||||
lc.lcOutExtX = axis_x.axMax - axis_x.axMin;
|
||||
lc.lcOutExtY = axis_y.axMax - axis_y.axMin;
|
||||
lc.lcOutExtY = -lc.lcOutExtY; /* We want Y growing downward */
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SENSX, &lc.lcSensX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SENSY, &lc.lcSensY);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SENSZ, &lc.lcSensZ);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSMODE, &lc.lcSysMode);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SENSX, &lc.lcSensX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SENSY, &lc.lcSensY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SENSZ, &lc.lcSensZ);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSMODE, &lc.lcSysMode);
|
||||
lc.lcSysOrgX = lc.lcSysOrgY = 0;
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSEXTX, &lc.lcSysExtX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSEXTY, &lc.lcSysExtY);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSSENSX, &lc.lcSysSensX);
|
||||
WTInfo (WTI_DDCTXS + i, CTX_SYSSENSY, &lc.lcSysSensY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSEXTX, &lc.lcSysExtX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSEXTY, &lc.lcSysExtY);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSSENSX, &lc.lcSysSensX);
|
||||
WTInfo (WTI_DDCTXS + devix, CTX_SYSSENSY, &lc.lcSysSensY);
|
||||
}
|
||||
else
|
||||
{
|
||||
lc = defcontext;
|
||||
lc.lcOptions |= CXO_MESSAGES;
|
||||
lc.lcMsgBase = WT_DEFBASE;
|
||||
lc.lcPktRate = 20; /* Slow down the packets a bit */
|
||||
lc.lcPktRate = 50;
|
||||
lc.lcPktData = PACKETDATA;
|
||||
lc.lcPktMode = PACKETMODE;
|
||||
lc.lcMoveMask = PACKETDATA;
|
||||
@ -344,8 +413,9 @@ gdk_input_init (void)
|
||||
lc.lcOutExtY = -lc.lcOutExtY; /* We want Y growing downward */
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
g_print("context for device %d:\n", i); print_lc(&lc);
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, (g_print("context for device %d:\n", devix),
|
||||
print_lc(&lc)));
|
||||
#endif
|
||||
hctx = g_new (HCTX, 1);
|
||||
if ((*hctx = WTOpen (window_private->xwindow, &lc, TRUE)) == NULL)
|
||||
@ -353,8 +423,8 @@ gdk_input_init (void)
|
||||
g_warning ("gdk_input_init: WTOpen failed");
|
||||
return;
|
||||
}
|
||||
GDK_NOTE (MISC, g_print ("gdk_input_init: opened Wintab device %d %#x\n",
|
||||
i, *hctx));
|
||||
GDK_NOTE (MISC, g_print ("opened Wintab device %d %#x\n",
|
||||
devix, *hctx));
|
||||
|
||||
wintab_contexts = g_list_append (wintab_contexts, hctx);
|
||||
#if 0
|
||||
@ -362,13 +432,18 @@ gdk_input_init (void)
|
||||
#endif
|
||||
WTOverlap (*hctx, TRUE);
|
||||
|
||||
#if 0
|
||||
g_print("context for device %d after WTOpen:\n", i); print_lc(&lc);
|
||||
#if DEBUG_WINTAB
|
||||
GDK_NOTE (MISC, (g_print("context for device %d after WTOpen:\n", devix),
|
||||
print_lc(&lc)));
|
||||
#endif
|
||||
for (j = firstcsr; j < firstcsr + ncsrtypes; j++)
|
||||
for (cursorix = firstcsr; cursorix < firstcsr + ncsrtypes; cursorix++)
|
||||
{
|
||||
active = FALSE;
|
||||
WTInfo (WTI_CURSORS + cursorix, CSR_ACTIVE, &active);
|
||||
if (!active)
|
||||
continue;
|
||||
gdkdev = g_new (GdkDevicePrivate, 1);
|
||||
WTInfo (WTI_CURSORS + j, CSR_NAME, csrname);
|
||||
WTInfo (WTI_CURSORS + cursorix, CSR_NAME, csrname);
|
||||
gdkdev->info.name = g_strconcat (devname, " ", csrname, NULL);
|
||||
gdkdev->info.deviceid = deviceid_counter++;
|
||||
gdkdev->info.source = GDK_SOURCE_PEN;
|
||||
@ -379,8 +454,8 @@ gdk_input_init (void)
|
||||
gdkdev->info.has_cursor = FALSE;
|
||||
#endif
|
||||
gdkdev->hctx = *hctx;
|
||||
gdkdev->cursor = j;
|
||||
WTInfo (WTI_CURSORS + j, CSR_PKTDATA, &gdkdev->pktdata);
|
||||
gdkdev->cursor = cursorix;
|
||||
WTInfo (WTI_CURSORS + cursorix, CSR_PKTDATA, &gdkdev->pktdata);
|
||||
gdkdev->info.num_axes = 0;
|
||||
if (gdkdev->pktdata & PK_X)
|
||||
gdkdev->info.num_axes++;
|
||||
@ -388,9 +463,18 @@ gdk_input_init (void)
|
||||
gdkdev->info.num_axes++;
|
||||
if (gdkdev->pktdata & PK_NORMAL_PRESSURE)
|
||||
gdkdev->info.num_axes++;
|
||||
/* The wintab driver for the Wacom ArtPad II reports
|
||||
* PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't
|
||||
* actually sense tilt. Catch this by noticing that the
|
||||
* orientation axis's azimuth resolution is zero.
|
||||
*/
|
||||
if ((gdkdev->pktdata & PK_ORIENTATION)
|
||||
&& axis_or[0].axResolution == 0)
|
||||
gdkdev->pktdata &= ~PK_ORIENTATION;
|
||||
|
||||
if (gdkdev->pktdata & PK_ORIENTATION)
|
||||
gdkdev->info.num_axes += 2; /* x and y tilt */
|
||||
WTInfo (WTI_CURSORS + j, CSR_NPBTNMARKS, &gdkdev->npbtnmarks);
|
||||
WTInfo (WTI_CURSORS + cursorix, CSR_NPBTNMARKS, &gdkdev->npbtnmarks);
|
||||
gdkdev->axes = g_new (GdkAxisInfo, gdkdev->info.num_axes);
|
||||
gdkdev->info.axes = g_new (GdkAxisUse, gdkdev->info.num_axes);
|
||||
gdkdev->last_axis_data = g_new (gint, gdkdev->info.num_axes);
|
||||
@ -439,10 +523,13 @@ gdk_input_init (void)
|
||||
{
|
||||
GdkAxisUse axis;
|
||||
|
||||
gdkdev->orientation_axes[0] = axis_orientation[0];
|
||||
gdkdev->orientation_axes[1] = axis_orientation[1];
|
||||
gdkdev->orientation_axes[0] = axis_or[0];
|
||||
gdkdev->orientation_axes[1] = axis_or[1];
|
||||
for (axis = GDK_AXIS_XTILT; axis <= GDK_AXIS_YTILT; axis++)
|
||||
{
|
||||
/* Wintab gives us aximuth and altitude, which
|
||||
* we convert to x and y tilt in the -1000..1000 range
|
||||
*/
|
||||
gdkdev->axes[k].xresolution =
|
||||
gdkdev->axes[k].resolution = 1000;
|
||||
gdkdev->axes[k].xmin_value =
|
||||
@ -457,13 +544,37 @@ gdk_input_init (void)
|
||||
gdkdev->info.num_keys = 0;
|
||||
gdkdev->info.keys = NULL;
|
||||
GDK_NOTE (EVENTS,
|
||||
g_print ("gdk_input_init: device: %d axes: %d\n",
|
||||
gdkdev->info.deviceid,
|
||||
gdkdev->info.num_axes));
|
||||
(g_print ("device: %d (%d) %s axes: %d\n",
|
||||
gdkdev->info.deviceid, cursorix,
|
||||
gdkdev->info.name,
|
||||
gdkdev->info.num_axes),
|
||||
g_print ("axes: X:%d, Y:%d, PRESSURE:%d, "
|
||||
"XTILT:%d, YTILT:%d\n",
|
||||
gdkdev->axis_for_use[GDK_AXIS_X],
|
||||
gdkdev->axis_for_use[GDK_AXIS_Y],
|
||||
gdkdev->axis_for_use[GDK_AXIS_PRESSURE],
|
||||
gdkdev->axis_for_use[GDK_AXIS_XTILT],
|
||||
gdkdev->axis_for_use[GDK_AXIS_YTILT])));
|
||||
for (i = 0; i < gdkdev->info.num_axes; i++)
|
||||
GDK_NOTE (EVENTS,
|
||||
g_print ("...axis %d: %d--%d@%d (%d--%d@%d)\n",
|
||||
i,
|
||||
gdkdev->axes[i].xmin_value,
|
||||
gdkdev->axes[i].xmax_value,
|
||||
gdkdev->axes[i].xresolution,
|
||||
gdkdev->axes[i].min_value,
|
||||
gdkdev->axes[i].max_value,
|
||||
gdkdev->axes[i].resolution));
|
||||
gdk_input_devices = g_list_append (gdk_input_devices,
|
||||
gdkdev);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_WINTAB */
|
||||
|
||||
if (deviceid_counter > 0)
|
||||
{
|
||||
#ifdef HAVE_WINTAB
|
||||
gdk_input_vtable.set_mode = gdk_input_win32_set_mode;
|
||||
gdk_input_vtable.set_axes = NULL;
|
||||
gdk_input_vtable.set_key = NULL;
|
||||
@ -480,6 +591,9 @@ gdk_input_init (void)
|
||||
gdk_input_root_width = gdk_screen_width ();
|
||||
gdk_input_root_height = gdk_screen_height ();
|
||||
gdk_input_ignore_core = FALSE;
|
||||
#else
|
||||
g_assert_not_reached ();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -501,21 +615,70 @@ gdk_input_init (void)
|
||||
gdk_input_devices = g_list_append (gdk_input_devices, &gdk_input_core_info);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_get_root_relative_geometry (HWND w,
|
||||
int *x_ret,
|
||||
int *y_ret)
|
||||
gint
|
||||
gdk_input_set_mode (guint32 deviceid,
|
||||
GdkInputMode mode)
|
||||
{
|
||||
RECT rect;
|
||||
if (deviceid == GDK_CORE_POINTER)
|
||||
return FALSE;
|
||||
|
||||
GetWindowRect (w, &rect);
|
||||
|
||||
if (x_ret)
|
||||
*x_ret = rect.left;
|
||||
if (y_ret)
|
||||
*y_ret = rect.top;
|
||||
if (gdk_input_vtable.set_mode)
|
||||
return gdk_input_vtable.set_mode (deviceid, mode);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_input_set_axes (guint32 deviceid,
|
||||
GdkAxisUse *axes)
|
||||
{
|
||||
int i;
|
||||
GdkDevicePrivate *gdkdev = gdk_input_find_device (deviceid);
|
||||
g_return_if_fail (gdkdev != NULL);
|
||||
|
||||
if (deviceid == GDK_CORE_POINTER)
|
||||
return;
|
||||
|
||||
for (i = GDK_AXIS_IGNORE; i < GDK_AXIS_LAST; i++)
|
||||
{
|
||||
gdkdev->axis_for_use[i] = -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < gdkdev->info.num_axes; i++)
|
||||
{
|
||||
gdkdev->info.axes[i] = axes[i];
|
||||
gdkdev->axis_for_use[axes[i]] = i;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_none_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
gint x_int, y_int;
|
||||
|
||||
gdk_window_get_pointer (window, &x_int, &y_int, mask);
|
||||
|
||||
if (x)
|
||||
*x = x_int;
|
||||
if (y)
|
||||
*y = y_int;
|
||||
if (pressure)
|
||||
*pressure = 0.5;
|
||||
if (xtilt)
|
||||
*xtilt = 0;
|
||||
if (ytilt)
|
||||
*ytilt = 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WINTAB
|
||||
|
||||
static void
|
||||
gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
|
||||
GdkInputWindow *input_window,
|
||||
@ -625,42 +788,6 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_input_set_mode (guint32 deviceid,
|
||||
GdkInputMode mode)
|
||||
{
|
||||
if (deviceid == GDK_CORE_POINTER)
|
||||
return FALSE;
|
||||
|
||||
if (gdk_input_vtable.set_mode)
|
||||
return gdk_input_vtable.set_mode (deviceid, mode);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_input_set_axes (guint32 deviceid,
|
||||
GdkAxisUse *axes)
|
||||
{
|
||||
int i;
|
||||
GdkDevicePrivate *gdkdev = gdk_input_find_device (deviceid);
|
||||
g_return_if_fail (gdkdev != NULL);
|
||||
|
||||
if (deviceid == GDK_CORE_POINTER)
|
||||
return;
|
||||
|
||||
for (i = GDK_AXIS_IGNORE; i < GDK_AXIS_LAST; i++)
|
||||
{
|
||||
gdkdev->axis_for_use[i] = -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < gdkdev->info.num_axes; i++)
|
||||
{
|
||||
gdkdev->info.axes[i] = axes[i];
|
||||
gdkdev->axis_for_use[axes[i]] = i;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_win32_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
@ -714,29 +841,18 @@ gdk_input_win32_get_pointer (GdkWindow *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_none_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask)
|
||||
gdk_input_get_root_relative_geometry (HWND w,
|
||||
int *x_ret,
|
||||
int *y_ret)
|
||||
{
|
||||
gint x_int, y_int;
|
||||
RECT rect;
|
||||
|
||||
gdk_window_get_pointer (window, &x_int, &y_int, mask);
|
||||
GetWindowRect (w, &rect);
|
||||
|
||||
if (x)
|
||||
*x = x_int;
|
||||
if (y)
|
||||
*y = y_int;
|
||||
if (pressure)
|
||||
*pressure = 0.5;
|
||||
if (xtilt)
|
||||
*xtilt = 0;
|
||||
if (ytilt)
|
||||
*ytilt = 0;
|
||||
if (x_ret)
|
||||
*x_ret = rect.left;
|
||||
if (y_ret)
|
||||
*y_ret = rect.top;
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -850,6 +966,22 @@ decode_tilt (gint *axis_data,
|
||||
axis_data[1] = sin (az) * cos (el) * 1000;
|
||||
}
|
||||
|
||||
static GdkDevicePrivate *
|
||||
gdk_input_find_dev_from_ctx (HCTX hctx,
|
||||
UINT cursor)
|
||||
{
|
||||
GList *tmp_list = gdk_input_devices;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *) (tmp_list->data);
|
||||
if (gdkdev->hctx == hctx && gdkdev->cursor == cursor)
|
||||
return gdkdev;
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
static gint
|
||||
gdk_input_win32_other_event (GdkEvent *event,
|
||||
MSG *xevent)
|
||||
@ -1021,13 +1153,14 @@ gdk_input_win32_other_event (GdkEvent *event,
|
||||
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
|
||||
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
|
||||
| GDK_BUTTON5_MASK));
|
||||
GDK_NOTE (EVENTS, g_print ("WINTAB button %s: %d %d %g,%g %g\n",
|
||||
GDK_NOTE (EVENTS, g_print ("WINTAB button %s: %d %d %g,%g %g %g,%g\n",
|
||||
(event->button.type == GDK_BUTTON_PRESS ?
|
||||
"press" : "release"),
|
||||
event->button.deviceid,
|
||||
event->button.button,
|
||||
event->button.x, event->button.y,
|
||||
event->button.pressure));
|
||||
event->button.pressure,
|
||||
event->button.xtilt, event->button.ytilt));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1049,10 +1182,11 @@ gdk_input_win32_other_event (GdkEvent *event,
|
||||
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
|
||||
| GDK_BUTTON5_MASK));
|
||||
|
||||
GDK_NOTE (EVENTS, g_print ("WINTAB motion: %d %g,%g %g\n",
|
||||
GDK_NOTE (EVENTS, g_print ("WINTAB motion: %d %g,%g %g %g,%g\n",
|
||||
event->motion.deviceid,
|
||||
event->motion.x, event->motion.y,
|
||||
event->motion.pressure));
|
||||
event->motion.pressure,
|
||||
event->motion.xtilt, event->motion.ytilt));
|
||||
|
||||
/* Check for missing release or press events for the normal
|
||||
* pressure button. At least on my ArtPadII I sometimes miss a
|
||||
@ -1114,7 +1248,6 @@ gdk_input_win32_other_event (GdkEvent *event,
|
||||
event->proximity.deviceid));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1188,6 +1321,7 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER)
|
||||
{
|
||||
#if 0
|
||||
/* XXX */
|
||||
gdk_input_find_events (window, gdkdev,
|
||||
event_mask,
|
||||
event_classes, &num_classes);
|
||||
@ -1215,6 +1349,7 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
|
||||
((gdkdev->button_state != 0) || need_ungrab))
|
||||
{
|
||||
#if 0
|
||||
/* XXX */
|
||||
XUngrabDevice (gdk_display, gdkdev->xdevice, time);
|
||||
#endif
|
||||
gdkdev->button_state = 0;
|
||||
@ -1255,6 +1390,7 @@ gdk_input_win32_ungrab_pointer (guint32 time)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
#if 0
|
||||
/* XXX */
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice)
|
||||
XUngrabDevice (gdk_display, gdkdev->xdevice, time);
|
||||
#endif
|
||||
@ -1263,6 +1399,8 @@ gdk_input_win32_ungrab_pointer (guint32 time)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_WINTAB */
|
||||
|
||||
GList *
|
||||
gdk_input_list_devices (void)
|
||||
{
|
||||
@ -1308,6 +1446,25 @@ gdk_input_motion_events (GdkWindow *window,
|
||||
return NULL; /* ??? */
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_input_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
|
||||
{
|
||||
if (gdk_input_vtable.enable_window)
|
||||
return gdk_input_vtable.enable_window (window, gdkdev);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
|
||||
{
|
||||
if (gdk_input_vtable.disable_window)
|
||||
return gdk_input_vtable.disable_window(window,gdkdev);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static GdkInputWindow *
|
||||
gdk_input_window_find (GdkWindow *window)
|
||||
{
|
||||
@ -1320,6 +1477,8 @@ gdk_input_window_find (GdkWindow *window)
|
||||
return NULL; /* Not found */
|
||||
}
|
||||
|
||||
#if !USE_SYSCONTEXT
|
||||
|
||||
static GdkInputWindow *
|
||||
gdk_input_window_find_within (GdkWindow *window)
|
||||
{
|
||||
@ -1346,6 +1505,8 @@ gdk_input_window_find_within (GdkWindow *window)
|
||||
return candidate;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* FIXME: this routine currently needs to be called between creation
|
||||
and the corresponding configure event (because it doesn't get the
|
||||
root_relative_geometry). This should work with
|
||||
@ -1406,9 +1567,9 @@ gdk_input_set_extension_events (GdkWindow *window,
|
||||
{
|
||||
if (mask != 0 && gdkdev->info.mode != GDK_MODE_DISABLED
|
||||
&& (gdkdev->info.has_cursor || mode == GDK_EXTENSION_EVENTS_ALL))
|
||||
gdk_input_win32_enable_window (window, gdkdev);
|
||||
gdk_input_enable_window (window, gdkdev);
|
||||
else
|
||||
gdk_input_win32_disable_window (window, gdkdev);
|
||||
gdk_input_disable_window (window, gdkdev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1428,6 +1589,7 @@ gdk_input_window_destroy (GdkWindow *window)
|
||||
void
|
||||
gdk_input_exit (void)
|
||||
{
|
||||
#ifdef HAVE_WINTAB
|
||||
GList *tmp_list;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
|
||||
@ -1453,6 +1615,10 @@ gdk_input_exit (void)
|
||||
g_free (tmp_list->data);
|
||||
}
|
||||
g_list_free (gdk_input_windows);
|
||||
gdk_input_windows = NULL;
|
||||
|
||||
gdk_window_unref (wintab_window);
|
||||
wintab_window = NULL;
|
||||
|
||||
#if 1
|
||||
for (tmp_list = wintab_contexts; tmp_list; tmp_list = tmp_list->next)
|
||||
@ -1463,27 +1629,30 @@ gdk_input_exit (void)
|
||||
#ifdef _MSC_VER
|
||||
/* For some reason WTEnable and/or WTClose tend to crash here.
|
||||
* Protect with __try/__except to avoid a message box.
|
||||
* When compiling with gcc, we cannot use __try/__except, so
|
||||
* don't call WTClose. I think this means that we'll
|
||||
* eventually run out of Wintab contexts, sigh.
|
||||
*/
|
||||
__try {
|
||||
#endif /* _MSC_VER */
|
||||
#if 0
|
||||
WTEnable (*hctx, FALSE);
|
||||
#endif
|
||||
result = WTClose (*hctx);
|
||||
#ifdef _MSC_VER
|
||||
}
|
||||
__except (/* GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? */
|
||||
EXCEPTION_EXECUTE_HANDLER /*:
|
||||
EXCEPTION_CONTINUE_SEARCH */) {
|
||||
result = FALSE;
|
||||
}
|
||||
#endif /* _MSC_VER */
|
||||
if (!result)
|
||||
g_warning ("gdk_input_exit: Closing Wintab context %#x failed", *hctx);
|
||||
#endif /* _MSC_VER */
|
||||
g_free (hctx);
|
||||
}
|
||||
#endif
|
||||
g_list_free (wintab_contexts);
|
||||
wintab_contexts = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static GdkDevicePrivate *
|
||||
@ -1502,23 +1671,6 @@ gdk_input_find_device (guint32 id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GdkDevicePrivate *
|
||||
gdk_input_find_dev_from_ctx (HCTX hctx,
|
||||
UINT cursor)
|
||||
{
|
||||
GList *tmp_list = gdk_input_devices;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *) (tmp_list->data);
|
||||
if (gdkdev->hctx == hctx && gdkdev->cursor == cursor)
|
||||
return gdkdev;
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_input_window_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
|
@ -27,11 +27,6 @@
|
||||
#ifndef __GDK_INPUT_H__
|
||||
#define __GDK_INPUT_H__
|
||||
|
||||
#include <wintab.h>
|
||||
#define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION)
|
||||
#define PACKETMODE (PK_BUTTONS)
|
||||
#include <pktdef.h>
|
||||
|
||||
typedef struct _GdkAxisInfo GdkAxisInfo;
|
||||
typedef struct _GdkInputVTable GdkInputVTable;
|
||||
typedef struct _GdkDevicePrivate GdkDevicePrivate;
|
||||
@ -89,40 +84,6 @@ struct _GdkAxisInfo
|
||||
gint min_value, max_value;
|
||||
};
|
||||
|
||||
#define GDK_INPUT_NUM_EVENTC 6
|
||||
|
||||
struct _GdkDevicePrivate {
|
||||
GdkDeviceInfo info;
|
||||
|
||||
/* information about the axes */
|
||||
GdkAxisInfo *axes;
|
||||
|
||||
/* reverse lookup on axis use type */
|
||||
gint axis_for_use[GDK_AXIS_LAST];
|
||||
|
||||
/* true if we need to select a different set of events, but
|
||||
* can't because this is the core pointer
|
||||
*/
|
||||
gint needs_update;
|
||||
|
||||
/* State of buttons */
|
||||
gint button_state;
|
||||
|
||||
gint *last_axis_data;
|
||||
gint last_buttons;
|
||||
|
||||
/* WINTAB stuff: */
|
||||
HCTX hctx;
|
||||
/* Cursor number */
|
||||
UINT cursor;
|
||||
/* The cursor's CSR_PKTDATA */
|
||||
WTPKT pktdata;
|
||||
/* CSR_NPBTNMARKS */
|
||||
UINT npbtnmarks[2];
|
||||
/* Azimuth and altitude axis */
|
||||
AXIS orientation_axes[2];
|
||||
};
|
||||
|
||||
struct _GdkInputWindow
|
||||
{
|
||||
/* gdk window */
|
||||
|
@ -29,24 +29,15 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdkx.h"
|
||||
|
||||
static void gdk_visual_add (GdkVisual *visual);
|
||||
static void gdk_visual_decompose_mask (gulong mask,
|
||||
gint *shift,
|
||||
gint *prec);
|
||||
static guint gdk_visual_hash (Visual *key);
|
||||
static gint gdk_visual_compare (Visual *a,
|
||||
Visual *b);
|
||||
|
||||
|
||||
static GdkVisualPrivate *system_visual;
|
||||
static GdkVisualPrivate *visuals;
|
||||
static gint nvisuals;
|
||||
|
||||
static gint available_depths[7];
|
||||
static gint navailable_depths;
|
||||
static gint available_depths[1];
|
||||
|
||||
static GdkVisualType available_types[6];
|
||||
static gint navailable_types;
|
||||
static GdkVisualType available_types[1];
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
@ -62,8 +53,6 @@ static const gchar* visual_names[] =
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
static GHashTable *visual_hash = NULL;
|
||||
|
||||
void
|
||||
gdk_visual_init (void)
|
||||
{
|
||||
@ -94,242 +83,156 @@ gdk_visual_init (void)
|
||||
|
||||
int rastercaps, numcolors, sizepalette, colorres, bitspixel;
|
||||
Visual *default_xvisual;
|
||||
GdkVisualPrivate temp_visual;
|
||||
int nxvisuals;
|
||||
int i, j;
|
||||
|
||||
nxvisuals = 1;
|
||||
visuals = g_new (GdkVisualPrivate, nxvisuals);
|
||||
system_visual = g_new (GdkVisualPrivate, 1);
|
||||
|
||||
nvisuals = 0;
|
||||
for (i = 0; i < nxvisuals; i++)
|
||||
bitspixel = GetDeviceCaps (gdk_DC, BITSPIXEL);
|
||||
rastercaps = GetDeviceCaps (gdk_DC, RASTERCAPS);
|
||||
default_xvisual = g_new (Visual, 1);
|
||||
system_visual->xvisual = default_xvisual;
|
||||
system_visual->xvisual->visualid = 0;
|
||||
system_visual->xvisual->bitspixel = bitspixel;
|
||||
|
||||
if (rastercaps & RC_PALETTE)
|
||||
{
|
||||
if (1)
|
||||
{
|
||||
bitspixel = GetDeviceCaps (gdk_DC, BITSPIXEL);
|
||||
rastercaps = GetDeviceCaps (gdk_DC, RASTERCAPS);
|
||||
default_xvisual = g_new (Visual, 1);
|
||||
visuals[nvisuals].xvisual = default_xvisual;
|
||||
visuals[nvisuals].xvisual->visualid = nvisuals;
|
||||
visuals[nvisuals].xvisual->bitspixel = bitspixel;
|
||||
|
||||
if (rastercaps & RC_PALETTE)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_PSEUDO_COLOR;
|
||||
numcolors = GetDeviceCaps (gdk_DC, NUMCOLORS);
|
||||
sizepalette = GetDeviceCaps (gdk_DC, SIZEPALETTE);
|
||||
colorres = GetDeviceCaps (gdk_DC, COLORRES);
|
||||
visuals[nvisuals].xvisual->map_entries = sizepalette;
|
||||
}
|
||||
else if (bitspixel == 1)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_GRAY;
|
||||
visuals[nvisuals].xvisual->map_entries = 2;
|
||||
}
|
||||
else if (bitspixel == 4)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_COLOR;
|
||||
visuals[nvisuals].xvisual->map_entries = 16;
|
||||
}
|
||||
else if (bitspixel == 8)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_COLOR;
|
||||
visuals[nvisuals].xvisual->map_entries = 256;
|
||||
}
|
||||
else if (bitspixel == 16)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_TRUE_COLOR;
|
||||
system_visual->visual.type = GDK_VISUAL_PSEUDO_COLOR;
|
||||
numcolors = GetDeviceCaps (gdk_DC, NUMCOLORS);
|
||||
sizepalette = GetDeviceCaps (gdk_DC, SIZEPALETTE);
|
||||
colorres = GetDeviceCaps (gdk_DC, COLORRES);
|
||||
system_visual->xvisual->map_entries = sizepalette;
|
||||
}
|
||||
else if (bitspixel == 1)
|
||||
{
|
||||
system_visual->visual.type = GDK_VISUAL_STATIC_GRAY;
|
||||
system_visual->xvisual->map_entries = 2;
|
||||
}
|
||||
else if (bitspixel == 4)
|
||||
{
|
||||
system_visual->visual.type = GDK_VISUAL_STATIC_COLOR;
|
||||
system_visual->xvisual->map_entries = 16;
|
||||
}
|
||||
else if (bitspixel == 8)
|
||||
{
|
||||
system_visual->visual.type = GDK_VISUAL_STATIC_COLOR;
|
||||
system_visual->xvisual->map_entries = 256;
|
||||
}
|
||||
else if (bitspixel == 16)
|
||||
{
|
||||
system_visual->visual.type = GDK_VISUAL_TRUE_COLOR;
|
||||
#if 1
|
||||
/* This code by Mike Enright,
|
||||
* see http://www.users.cts.com/sd/m/menright/display.html
|
||||
*/
|
||||
memset (&bmi, 0, sizeof (bmi));
|
||||
bmi.bi.biSize = sizeof (bmi.bi);
|
||||
|
||||
hbm = CreateCompatibleBitmap (gdk_DC, 1, 1);
|
||||
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
|
||||
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
|
||||
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
|
||||
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
|
||||
DeleteObject (hbm);
|
||||
/* This code by Mike Enright,
|
||||
* see http://www.users.cts.com/sd/m/menright/display.html
|
||||
*/
|
||||
memset (&bmi, 0, sizeof (bmi));
|
||||
bmi.bi.biSize = sizeof (bmi.bi);
|
||||
|
||||
if (bmi.bi.biCompression != BI_BITFIELDS)
|
||||
{
|
||||
/* Either BI_RGB or BI_RLE_something
|
||||
* .... or perhaps (!!) something else.
|
||||
* Theoretically biCompression might be
|
||||
* mmioFourCC('c','v','i','d') but I doubt it.
|
||||
*/
|
||||
if (bmi.bi.biCompression == BI_RGB)
|
||||
{
|
||||
/* It's 555 */
|
||||
bitspixel = 15;
|
||||
visuals[nvisuals].visual.red_mask = 0x00007C00;
|
||||
visuals[nvisuals].visual.green_mask = 0x000003E0;
|
||||
visuals[nvisuals].visual.blue_mask = 0x0000001F;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD allmasks =
|
||||
bmi.u.fields[0] | bmi.u.fields[1] | bmi.u.fields[2];
|
||||
int k = 0;
|
||||
while (allmasks)
|
||||
{
|
||||
if (allmasks&1)
|
||||
k++;
|
||||
allmasks/=2;
|
||||
}
|
||||
bitspixel = k;
|
||||
visuals[nvisuals].visual.red_mask = bmi.u.fields[0];
|
||||
visuals[nvisuals].visual.green_mask = bmi.u.fields[1];
|
||||
visuals[nvisuals].visual.blue_mask = bmi.u.fields[2];
|
||||
}
|
||||
hbm = CreateCompatibleBitmap (gdk_DC, 1, 1);
|
||||
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
|
||||
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
|
||||
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
|
||||
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
|
||||
DeleteObject (hbm);
|
||||
|
||||
if (bmi.bi.biCompression != BI_BITFIELDS)
|
||||
{
|
||||
/* Either BI_RGB or BI_RLE_something
|
||||
* .... or perhaps (!!) something else.
|
||||
* Theoretically biCompression might be
|
||||
* mmioFourCC('c','v','i','d') but I doubt it.
|
||||
*/
|
||||
if (bmi.bi.biCompression == BI_RGB)
|
||||
{
|
||||
/* It's 555 */
|
||||
bitspixel = 15;
|
||||
system_visual->visual.red_mask = 0x00007C00;
|
||||
system_visual->visual.green_mask = 0x000003E0;
|
||||
system_visual->visual.blue_mask = 0x0000001F;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD allmasks =
|
||||
bmi.u.fields[0] | bmi.u.fields[1] | bmi.u.fields[2];
|
||||
int k = 0;
|
||||
while (allmasks)
|
||||
{
|
||||
if (allmasks&1)
|
||||
k++;
|
||||
allmasks/=2;
|
||||
}
|
||||
bitspixel = k;
|
||||
system_visual->visual.red_mask = bmi.u.fields[0];
|
||||
system_visual->visual.green_mask = bmi.u.fields[1];
|
||||
system_visual->visual.blue_mask = bmi.u.fields[2];
|
||||
}
|
||||
#else
|
||||
/* Old, incorrect (but still working) code. */
|
||||
/* Old, incorrect (but still working) code. */
|
||||
#if 0
|
||||
visuals[nvisuals].visual.red_mask = 0x0000F800;
|
||||
visuals[nvisuals].visual.green_mask = 0x000007E0;
|
||||
visuals[nvisuals].visual.blue_mask = 0x0000001F;
|
||||
system_visual->visual.red_mask = 0x0000F800;
|
||||
system_visual->visual.green_mask = 0x000007E0;
|
||||
system_visual->visual.blue_mask = 0x0000001F;
|
||||
#else
|
||||
visuals[nvisuals].visual.red_mask = 0x00007C00;
|
||||
visuals[nvisuals].visual.green_mask = 0x000003E0;
|
||||
visuals[nvisuals].visual.blue_mask = 0x0000001F;
|
||||
system_visual->visual.red_mask = 0x00007C00;
|
||||
system_visual->visual.green_mask = 0x000003E0;
|
||||
system_visual->visual.blue_mask = 0x0000001F;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else if (bitspixel == 24 || bitspixel == 32)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_TRUE_COLOR;
|
||||
visuals[nvisuals].visual.red_mask = 0x00FF0000;
|
||||
visuals[nvisuals].visual.green_mask = 0x0000FF00;
|
||||
visuals[nvisuals].visual.blue_mask = 0x000000FF;
|
||||
}
|
||||
else
|
||||
g_error ("gdk_visual_init: unsupported BITSPIXEL: %d\n", bitspixel);
|
||||
|
||||
visuals[nvisuals].visual.depth = bitspixel;
|
||||
visuals[nvisuals].visual.byte_order = GDK_LSB_FIRST;
|
||||
visuals[nvisuals].visual.bits_per_rgb = 42; /* Not used? */
|
||||
|
||||
if ((visuals[nvisuals].visual.type == GDK_VISUAL_TRUE_COLOR) ||
|
||||
(visuals[nvisuals].visual.type == GDK_VISUAL_DIRECT_COLOR))
|
||||
{
|
||||
gdk_visual_decompose_mask (visuals[nvisuals].visual.red_mask,
|
||||
&visuals[nvisuals].visual.red_shift,
|
||||
&visuals[nvisuals].visual.red_prec);
|
||||
|
||||
gdk_visual_decompose_mask (visuals[nvisuals].visual.green_mask,
|
||||
&visuals[nvisuals].visual.green_shift,
|
||||
&visuals[nvisuals].visual.green_prec);
|
||||
|
||||
gdk_visual_decompose_mask (visuals[nvisuals].visual.blue_mask,
|
||||
&visuals[nvisuals].visual.blue_shift,
|
||||
&visuals[nvisuals].visual.blue_prec);
|
||||
visuals[nvisuals].xvisual->map_entries =
|
||||
1 << (MAX (visuals[nvisuals].visual.red_prec,
|
||||
MAX (visuals[nvisuals].visual.green_prec,
|
||||
visuals[nvisuals].visual.blue_prec)));
|
||||
}
|
||||
else
|
||||
{
|
||||
visuals[nvisuals].visual.red_mask = 0;
|
||||
visuals[nvisuals].visual.red_shift = 0;
|
||||
visuals[nvisuals].visual.red_prec = 0;
|
||||
|
||||
visuals[nvisuals].visual.green_mask = 0;
|
||||
visuals[nvisuals].visual.green_shift = 0;
|
||||
visuals[nvisuals].visual.green_prec = 0;
|
||||
|
||||
visuals[nvisuals].visual.blue_mask = 0;
|
||||
visuals[nvisuals].visual.blue_shift = 0;
|
||||
visuals[nvisuals].visual.blue_prec = 0;
|
||||
}
|
||||
visuals[nvisuals].visual.colormap_size = visuals[nvisuals].xvisual->map_entries;
|
||||
|
||||
nvisuals += 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
else if (bitspixel == 24 || bitspixel == 32)
|
||||
{
|
||||
for (j = i+1; j < nvisuals; j++)
|
||||
{
|
||||
if (visuals[j].visual.depth >= visuals[i].visual.depth)
|
||||
{
|
||||
if ((visuals[j].visual.depth == 8) && (visuals[i].visual.depth == 8))
|
||||
{
|
||||
if (visuals[j].visual.type == GDK_VISUAL_PSEUDO_COLOR)
|
||||
{
|
||||
temp_visual = visuals[j];
|
||||
visuals[j] = visuals[i];
|
||||
visuals[i] = temp_visual;
|
||||
}
|
||||
else if ((visuals[i].visual.type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
visuals[j].visual.type > visuals[i].visual.type)
|
||||
{
|
||||
temp_visual = visuals[j];
|
||||
visuals[j] = visuals[i];
|
||||
visuals[i] = temp_visual;
|
||||
}
|
||||
}
|
||||
else if ((visuals[j].visual.depth > visuals[i].visual.depth) ||
|
||||
((visuals[j].visual.depth == visuals[i].visual.depth) &&
|
||||
(visuals[j].visual.type > visuals[i].visual.type)))
|
||||
{
|
||||
temp_visual = visuals[j];
|
||||
visuals[j] = visuals[i];
|
||||
visuals[i] = temp_visual;
|
||||
}
|
||||
}
|
||||
}
|
||||
system_visual->visual.type = GDK_VISUAL_TRUE_COLOR;
|
||||
system_visual->visual.red_mask = 0x00FF0000;
|
||||
system_visual->visual.green_mask = 0x0000FF00;
|
||||
system_visual->visual.blue_mask = 0x000000FF;
|
||||
}
|
||||
else
|
||||
g_error ("gdk_visual_init: unsupported BITSPIXEL: %d\n", bitspixel);
|
||||
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if (default_xvisual->visualid == visuals[i].xvisual->visualid)
|
||||
{
|
||||
system_visual = &visuals[i];
|
||||
break;
|
||||
}
|
||||
system_visual->visual.depth = bitspixel;
|
||||
system_visual->visual.byte_order = GDK_LSB_FIRST;
|
||||
system_visual->visual.bits_per_rgb = 42; /* Not used? */
|
||||
|
||||
navailable_depths = 0;
|
||||
for (i = 0; i < npossible_depths; i++)
|
||||
if ((system_visual->visual.type == GDK_VISUAL_TRUE_COLOR) ||
|
||||
(system_visual->visual.type == GDK_VISUAL_DIRECT_COLOR))
|
||||
{
|
||||
for (j = 0; j < nvisuals; j++)
|
||||
{
|
||||
if (visuals[j].visual.depth == possible_depths[i])
|
||||
{
|
||||
available_depths[navailable_depths++] = visuals[j].visual.depth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
gdk_visual_decompose_mask (system_visual->visual.red_mask,
|
||||
&system_visual->visual.red_shift,
|
||||
&system_visual->visual.red_prec);
|
||||
|
||||
gdk_visual_decompose_mask (system_visual->visual.green_mask,
|
||||
&system_visual->visual.green_shift,
|
||||
&system_visual->visual.green_prec);
|
||||
|
||||
gdk_visual_decompose_mask (system_visual->visual.blue_mask,
|
||||
&system_visual->visual.blue_shift,
|
||||
&system_visual->visual.blue_prec);
|
||||
system_visual->xvisual->map_entries =
|
||||
1 << (MAX (system_visual->visual.red_prec,
|
||||
MAX (system_visual->visual.green_prec,
|
||||
system_visual->visual.blue_prec)));
|
||||
}
|
||||
|
||||
if (navailable_depths == 0)
|
||||
g_error ("unable to find a usable depth");
|
||||
|
||||
navailable_types = 0;
|
||||
for (i = 0; i < npossible_types; i++)
|
||||
else
|
||||
{
|
||||
for (j = 0; j < nvisuals; j++)
|
||||
{
|
||||
if (visuals[j].visual.type == possible_types[i])
|
||||
{
|
||||
available_types[navailable_types++] = visuals[j].visual.type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
system_visual->visual.red_mask = 0;
|
||||
system_visual->visual.red_shift = 0;
|
||||
system_visual->visual.red_prec = 0;
|
||||
|
||||
system_visual->visual.green_mask = 0;
|
||||
system_visual->visual.green_shift = 0;
|
||||
system_visual->visual.green_prec = 0;
|
||||
|
||||
system_visual->visual.blue_mask = 0;
|
||||
system_visual->visual.blue_shift = 0;
|
||||
system_visual->visual.blue_prec = 0;
|
||||
}
|
||||
system_visual->visual.colormap_size = system_visual->xvisual->map_entries;
|
||||
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
gdk_visual_add ((GdkVisual*) &visuals[i]);
|
||||
|
||||
if (npossible_types == 0)
|
||||
g_error ("unable to find a usable visual type");
|
||||
available_depths[0] = system_visual->visual.depth;
|
||||
available_types[0] = system_visual->visual.type;
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
@ -365,67 +268,43 @@ gdk_visual_get_system (void)
|
||||
GdkVisual*
|
||||
gdk_visual_get_best (void)
|
||||
{
|
||||
return ((GdkVisual*) &(visuals[0]));
|
||||
return ((GdkVisual*) system_visual);
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_best_with_depth (gint depth)
|
||||
{
|
||||
GdkVisual *return_val;
|
||||
int i;
|
||||
|
||||
return_val = NULL;
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if (depth == visuals[i].visual.depth)
|
||||
{
|
||||
return_val = (GdkVisual*) &(visuals[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
if (depth == system_visual->visual.depth)
|
||||
return (GdkVisual*) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_best_with_type (GdkVisualType visual_type)
|
||||
{
|
||||
GdkVisual *return_val;
|
||||
int i;
|
||||
|
||||
return_val = NULL;
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if (visual_type == visuals[i].visual.type)
|
||||
{
|
||||
return_val = (GdkVisual*) &(visuals[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
if (visual_type == system_visual->visual.type)
|
||||
return (GdkVisual*) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_best_with_both (gint depth,
|
||||
GdkVisualType visual_type)
|
||||
{
|
||||
GdkVisual *return_val;
|
||||
int i;
|
||||
|
||||
return_val = NULL;
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if ((depth == visuals[i].visual.depth) &&
|
||||
(visual_type == visuals[i].visual.type))
|
||||
{
|
||||
return_val = (GdkVisual*) &(visuals[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
if ((depth == system_visual->visual.depth) &&
|
||||
(visual_type == system_visual->visual.type))
|
||||
return (GdkVisual*) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_query_depths (gint **depths,
|
||||
gint *count)
|
||||
{
|
||||
*count = navailable_depths;
|
||||
*count = 1;
|
||||
*depths = available_depths;
|
||||
}
|
||||
|
||||
@ -433,59 +312,32 @@ void
|
||||
gdk_query_visual_types (GdkVisualType **visual_types,
|
||||
gint *count)
|
||||
{
|
||||
*count = navailable_types;
|
||||
*count = 1;
|
||||
*visual_types = available_types;
|
||||
}
|
||||
|
||||
GList*
|
||||
gdk_list_visuals (void)
|
||||
{
|
||||
GList *list;
|
||||
guint i;
|
||||
|
||||
list = NULL;
|
||||
for (i = 0; i < nvisuals; ++i)
|
||||
list = g_list_append (list, (gpointer) &visuals[i]);
|
||||
|
||||
return list;
|
||||
return g_list_append (NULL, (gpointer) system_visual);
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_lookup (Visual *xvisual)
|
||||
{
|
||||
GdkVisual *visual;
|
||||
|
||||
if (!visual_hash)
|
||||
if (system_visual->xvisual == xvisual)
|
||||
return (GdkVisual *) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
|
||||
visual = g_hash_table_lookup (visual_hash, xvisual);
|
||||
return visual;
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdkx_visual_get (VisualID xvisualid)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if (xvisualid == visuals[i].xvisual->visualid)
|
||||
return (GdkVisual*) &visuals[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_visual_add (GdkVisual *visual)
|
||||
{
|
||||
GdkVisualPrivate *private;
|
||||
|
||||
if (!visual_hash)
|
||||
visual_hash = g_hash_table_new ((GHashFunc) gdk_visual_hash,
|
||||
(GCompareFunc) gdk_visual_compare);
|
||||
|
||||
private = (GdkVisualPrivate*) visual;
|
||||
|
||||
g_hash_table_insert (visual_hash, private->xvisual, visual);
|
||||
if (xvisualid == system_visual->xvisual->visualid)
|
||||
return (GdkVisual*) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -508,19 +360,3 @@ gdk_visual_decompose_mask (gulong mask,
|
||||
mask >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* This hash stuff is pretty useless on Windows, as there is only
|
||||
one visual... */
|
||||
|
||||
static guint
|
||||
gdk_visual_hash (Visual *key)
|
||||
{
|
||||
return key->visualid;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_visual_compare (Visual *a,
|
||||
Visual *b)
|
||||
{
|
||||
return (a->visualid == b->visualid);
|
||||
}
|
||||
|
@ -29,24 +29,15 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdkx.h"
|
||||
|
||||
static void gdk_visual_add (GdkVisual *visual);
|
||||
static void gdk_visual_decompose_mask (gulong mask,
|
||||
gint *shift,
|
||||
gint *prec);
|
||||
static guint gdk_visual_hash (Visual *key);
|
||||
static gint gdk_visual_compare (Visual *a,
|
||||
Visual *b);
|
||||
|
||||
|
||||
static GdkVisualPrivate *system_visual;
|
||||
static GdkVisualPrivate *visuals;
|
||||
static gint nvisuals;
|
||||
|
||||
static gint available_depths[7];
|
||||
static gint navailable_depths;
|
||||
static gint available_depths[1];
|
||||
|
||||
static GdkVisualType available_types[6];
|
||||
static gint navailable_types;
|
||||
static GdkVisualType available_types[1];
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
@ -62,8 +53,6 @@ static const gchar* visual_names[] =
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
static GHashTable *visual_hash = NULL;
|
||||
|
||||
void
|
||||
gdk_visual_init (void)
|
||||
{
|
||||
@ -94,242 +83,156 @@ gdk_visual_init (void)
|
||||
|
||||
int rastercaps, numcolors, sizepalette, colorres, bitspixel;
|
||||
Visual *default_xvisual;
|
||||
GdkVisualPrivate temp_visual;
|
||||
int nxvisuals;
|
||||
int i, j;
|
||||
|
||||
nxvisuals = 1;
|
||||
visuals = g_new (GdkVisualPrivate, nxvisuals);
|
||||
system_visual = g_new (GdkVisualPrivate, 1);
|
||||
|
||||
nvisuals = 0;
|
||||
for (i = 0; i < nxvisuals; i++)
|
||||
bitspixel = GetDeviceCaps (gdk_DC, BITSPIXEL);
|
||||
rastercaps = GetDeviceCaps (gdk_DC, RASTERCAPS);
|
||||
default_xvisual = g_new (Visual, 1);
|
||||
system_visual->xvisual = default_xvisual;
|
||||
system_visual->xvisual->visualid = 0;
|
||||
system_visual->xvisual->bitspixel = bitspixel;
|
||||
|
||||
if (rastercaps & RC_PALETTE)
|
||||
{
|
||||
if (1)
|
||||
{
|
||||
bitspixel = GetDeviceCaps (gdk_DC, BITSPIXEL);
|
||||
rastercaps = GetDeviceCaps (gdk_DC, RASTERCAPS);
|
||||
default_xvisual = g_new (Visual, 1);
|
||||
visuals[nvisuals].xvisual = default_xvisual;
|
||||
visuals[nvisuals].xvisual->visualid = nvisuals;
|
||||
visuals[nvisuals].xvisual->bitspixel = bitspixel;
|
||||
|
||||
if (rastercaps & RC_PALETTE)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_PSEUDO_COLOR;
|
||||
numcolors = GetDeviceCaps (gdk_DC, NUMCOLORS);
|
||||
sizepalette = GetDeviceCaps (gdk_DC, SIZEPALETTE);
|
||||
colorres = GetDeviceCaps (gdk_DC, COLORRES);
|
||||
visuals[nvisuals].xvisual->map_entries = sizepalette;
|
||||
}
|
||||
else if (bitspixel == 1)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_GRAY;
|
||||
visuals[nvisuals].xvisual->map_entries = 2;
|
||||
}
|
||||
else if (bitspixel == 4)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_COLOR;
|
||||
visuals[nvisuals].xvisual->map_entries = 16;
|
||||
}
|
||||
else if (bitspixel == 8)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_COLOR;
|
||||
visuals[nvisuals].xvisual->map_entries = 256;
|
||||
}
|
||||
else if (bitspixel == 16)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_TRUE_COLOR;
|
||||
system_visual->visual.type = GDK_VISUAL_PSEUDO_COLOR;
|
||||
numcolors = GetDeviceCaps (gdk_DC, NUMCOLORS);
|
||||
sizepalette = GetDeviceCaps (gdk_DC, SIZEPALETTE);
|
||||
colorres = GetDeviceCaps (gdk_DC, COLORRES);
|
||||
system_visual->xvisual->map_entries = sizepalette;
|
||||
}
|
||||
else if (bitspixel == 1)
|
||||
{
|
||||
system_visual->visual.type = GDK_VISUAL_STATIC_GRAY;
|
||||
system_visual->xvisual->map_entries = 2;
|
||||
}
|
||||
else if (bitspixel == 4)
|
||||
{
|
||||
system_visual->visual.type = GDK_VISUAL_STATIC_COLOR;
|
||||
system_visual->xvisual->map_entries = 16;
|
||||
}
|
||||
else if (bitspixel == 8)
|
||||
{
|
||||
system_visual->visual.type = GDK_VISUAL_STATIC_COLOR;
|
||||
system_visual->xvisual->map_entries = 256;
|
||||
}
|
||||
else if (bitspixel == 16)
|
||||
{
|
||||
system_visual->visual.type = GDK_VISUAL_TRUE_COLOR;
|
||||
#if 1
|
||||
/* This code by Mike Enright,
|
||||
* see http://www.users.cts.com/sd/m/menright/display.html
|
||||
*/
|
||||
memset (&bmi, 0, sizeof (bmi));
|
||||
bmi.bi.biSize = sizeof (bmi.bi);
|
||||
|
||||
hbm = CreateCompatibleBitmap (gdk_DC, 1, 1);
|
||||
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
|
||||
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
|
||||
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
|
||||
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
|
||||
DeleteObject (hbm);
|
||||
/* This code by Mike Enright,
|
||||
* see http://www.users.cts.com/sd/m/menright/display.html
|
||||
*/
|
||||
memset (&bmi, 0, sizeof (bmi));
|
||||
bmi.bi.biSize = sizeof (bmi.bi);
|
||||
|
||||
if (bmi.bi.biCompression != BI_BITFIELDS)
|
||||
{
|
||||
/* Either BI_RGB or BI_RLE_something
|
||||
* .... or perhaps (!!) something else.
|
||||
* Theoretically biCompression might be
|
||||
* mmioFourCC('c','v','i','d') but I doubt it.
|
||||
*/
|
||||
if (bmi.bi.biCompression == BI_RGB)
|
||||
{
|
||||
/* It's 555 */
|
||||
bitspixel = 15;
|
||||
visuals[nvisuals].visual.red_mask = 0x00007C00;
|
||||
visuals[nvisuals].visual.green_mask = 0x000003E0;
|
||||
visuals[nvisuals].visual.blue_mask = 0x0000001F;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD allmasks =
|
||||
bmi.u.fields[0] | bmi.u.fields[1] | bmi.u.fields[2];
|
||||
int k = 0;
|
||||
while (allmasks)
|
||||
{
|
||||
if (allmasks&1)
|
||||
k++;
|
||||
allmasks/=2;
|
||||
}
|
||||
bitspixel = k;
|
||||
visuals[nvisuals].visual.red_mask = bmi.u.fields[0];
|
||||
visuals[nvisuals].visual.green_mask = bmi.u.fields[1];
|
||||
visuals[nvisuals].visual.blue_mask = bmi.u.fields[2];
|
||||
}
|
||||
hbm = CreateCompatibleBitmap (gdk_DC, 1, 1);
|
||||
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
|
||||
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
|
||||
GetDIBits (gdk_DC, hbm, 0, 1, NULL,
|
||||
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
|
||||
DeleteObject (hbm);
|
||||
|
||||
if (bmi.bi.biCompression != BI_BITFIELDS)
|
||||
{
|
||||
/* Either BI_RGB or BI_RLE_something
|
||||
* .... or perhaps (!!) something else.
|
||||
* Theoretically biCompression might be
|
||||
* mmioFourCC('c','v','i','d') but I doubt it.
|
||||
*/
|
||||
if (bmi.bi.biCompression == BI_RGB)
|
||||
{
|
||||
/* It's 555 */
|
||||
bitspixel = 15;
|
||||
system_visual->visual.red_mask = 0x00007C00;
|
||||
system_visual->visual.green_mask = 0x000003E0;
|
||||
system_visual->visual.blue_mask = 0x0000001F;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD allmasks =
|
||||
bmi.u.fields[0] | bmi.u.fields[1] | bmi.u.fields[2];
|
||||
int k = 0;
|
||||
while (allmasks)
|
||||
{
|
||||
if (allmasks&1)
|
||||
k++;
|
||||
allmasks/=2;
|
||||
}
|
||||
bitspixel = k;
|
||||
system_visual->visual.red_mask = bmi.u.fields[0];
|
||||
system_visual->visual.green_mask = bmi.u.fields[1];
|
||||
system_visual->visual.blue_mask = bmi.u.fields[2];
|
||||
}
|
||||
#else
|
||||
/* Old, incorrect (but still working) code. */
|
||||
/* Old, incorrect (but still working) code. */
|
||||
#if 0
|
||||
visuals[nvisuals].visual.red_mask = 0x0000F800;
|
||||
visuals[nvisuals].visual.green_mask = 0x000007E0;
|
||||
visuals[nvisuals].visual.blue_mask = 0x0000001F;
|
||||
system_visual->visual.red_mask = 0x0000F800;
|
||||
system_visual->visual.green_mask = 0x000007E0;
|
||||
system_visual->visual.blue_mask = 0x0000001F;
|
||||
#else
|
||||
visuals[nvisuals].visual.red_mask = 0x00007C00;
|
||||
visuals[nvisuals].visual.green_mask = 0x000003E0;
|
||||
visuals[nvisuals].visual.blue_mask = 0x0000001F;
|
||||
system_visual->visual.red_mask = 0x00007C00;
|
||||
system_visual->visual.green_mask = 0x000003E0;
|
||||
system_visual->visual.blue_mask = 0x0000001F;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else if (bitspixel == 24 || bitspixel == 32)
|
||||
{
|
||||
visuals[nvisuals].visual.type = GDK_VISUAL_TRUE_COLOR;
|
||||
visuals[nvisuals].visual.red_mask = 0x00FF0000;
|
||||
visuals[nvisuals].visual.green_mask = 0x0000FF00;
|
||||
visuals[nvisuals].visual.blue_mask = 0x000000FF;
|
||||
}
|
||||
else
|
||||
g_error ("gdk_visual_init: unsupported BITSPIXEL: %d\n", bitspixel);
|
||||
|
||||
visuals[nvisuals].visual.depth = bitspixel;
|
||||
visuals[nvisuals].visual.byte_order = GDK_LSB_FIRST;
|
||||
visuals[nvisuals].visual.bits_per_rgb = 42; /* Not used? */
|
||||
|
||||
if ((visuals[nvisuals].visual.type == GDK_VISUAL_TRUE_COLOR) ||
|
||||
(visuals[nvisuals].visual.type == GDK_VISUAL_DIRECT_COLOR))
|
||||
{
|
||||
gdk_visual_decompose_mask (visuals[nvisuals].visual.red_mask,
|
||||
&visuals[nvisuals].visual.red_shift,
|
||||
&visuals[nvisuals].visual.red_prec);
|
||||
|
||||
gdk_visual_decompose_mask (visuals[nvisuals].visual.green_mask,
|
||||
&visuals[nvisuals].visual.green_shift,
|
||||
&visuals[nvisuals].visual.green_prec);
|
||||
|
||||
gdk_visual_decompose_mask (visuals[nvisuals].visual.blue_mask,
|
||||
&visuals[nvisuals].visual.blue_shift,
|
||||
&visuals[nvisuals].visual.blue_prec);
|
||||
visuals[nvisuals].xvisual->map_entries =
|
||||
1 << (MAX (visuals[nvisuals].visual.red_prec,
|
||||
MAX (visuals[nvisuals].visual.green_prec,
|
||||
visuals[nvisuals].visual.blue_prec)));
|
||||
}
|
||||
else
|
||||
{
|
||||
visuals[nvisuals].visual.red_mask = 0;
|
||||
visuals[nvisuals].visual.red_shift = 0;
|
||||
visuals[nvisuals].visual.red_prec = 0;
|
||||
|
||||
visuals[nvisuals].visual.green_mask = 0;
|
||||
visuals[nvisuals].visual.green_shift = 0;
|
||||
visuals[nvisuals].visual.green_prec = 0;
|
||||
|
||||
visuals[nvisuals].visual.blue_mask = 0;
|
||||
visuals[nvisuals].visual.blue_shift = 0;
|
||||
visuals[nvisuals].visual.blue_prec = 0;
|
||||
}
|
||||
visuals[nvisuals].visual.colormap_size = visuals[nvisuals].xvisual->map_entries;
|
||||
|
||||
nvisuals += 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
else if (bitspixel == 24 || bitspixel == 32)
|
||||
{
|
||||
for (j = i+1; j < nvisuals; j++)
|
||||
{
|
||||
if (visuals[j].visual.depth >= visuals[i].visual.depth)
|
||||
{
|
||||
if ((visuals[j].visual.depth == 8) && (visuals[i].visual.depth == 8))
|
||||
{
|
||||
if (visuals[j].visual.type == GDK_VISUAL_PSEUDO_COLOR)
|
||||
{
|
||||
temp_visual = visuals[j];
|
||||
visuals[j] = visuals[i];
|
||||
visuals[i] = temp_visual;
|
||||
}
|
||||
else if ((visuals[i].visual.type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
visuals[j].visual.type > visuals[i].visual.type)
|
||||
{
|
||||
temp_visual = visuals[j];
|
||||
visuals[j] = visuals[i];
|
||||
visuals[i] = temp_visual;
|
||||
}
|
||||
}
|
||||
else if ((visuals[j].visual.depth > visuals[i].visual.depth) ||
|
||||
((visuals[j].visual.depth == visuals[i].visual.depth) &&
|
||||
(visuals[j].visual.type > visuals[i].visual.type)))
|
||||
{
|
||||
temp_visual = visuals[j];
|
||||
visuals[j] = visuals[i];
|
||||
visuals[i] = temp_visual;
|
||||
}
|
||||
}
|
||||
}
|
||||
system_visual->visual.type = GDK_VISUAL_TRUE_COLOR;
|
||||
system_visual->visual.red_mask = 0x00FF0000;
|
||||
system_visual->visual.green_mask = 0x0000FF00;
|
||||
system_visual->visual.blue_mask = 0x000000FF;
|
||||
}
|
||||
else
|
||||
g_error ("gdk_visual_init: unsupported BITSPIXEL: %d\n", bitspixel);
|
||||
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if (default_xvisual->visualid == visuals[i].xvisual->visualid)
|
||||
{
|
||||
system_visual = &visuals[i];
|
||||
break;
|
||||
}
|
||||
system_visual->visual.depth = bitspixel;
|
||||
system_visual->visual.byte_order = GDK_LSB_FIRST;
|
||||
system_visual->visual.bits_per_rgb = 42; /* Not used? */
|
||||
|
||||
navailable_depths = 0;
|
||||
for (i = 0; i < npossible_depths; i++)
|
||||
if ((system_visual->visual.type == GDK_VISUAL_TRUE_COLOR) ||
|
||||
(system_visual->visual.type == GDK_VISUAL_DIRECT_COLOR))
|
||||
{
|
||||
for (j = 0; j < nvisuals; j++)
|
||||
{
|
||||
if (visuals[j].visual.depth == possible_depths[i])
|
||||
{
|
||||
available_depths[navailable_depths++] = visuals[j].visual.depth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
gdk_visual_decompose_mask (system_visual->visual.red_mask,
|
||||
&system_visual->visual.red_shift,
|
||||
&system_visual->visual.red_prec);
|
||||
|
||||
gdk_visual_decompose_mask (system_visual->visual.green_mask,
|
||||
&system_visual->visual.green_shift,
|
||||
&system_visual->visual.green_prec);
|
||||
|
||||
gdk_visual_decompose_mask (system_visual->visual.blue_mask,
|
||||
&system_visual->visual.blue_shift,
|
||||
&system_visual->visual.blue_prec);
|
||||
system_visual->xvisual->map_entries =
|
||||
1 << (MAX (system_visual->visual.red_prec,
|
||||
MAX (system_visual->visual.green_prec,
|
||||
system_visual->visual.blue_prec)));
|
||||
}
|
||||
|
||||
if (navailable_depths == 0)
|
||||
g_error ("unable to find a usable depth");
|
||||
|
||||
navailable_types = 0;
|
||||
for (i = 0; i < npossible_types; i++)
|
||||
else
|
||||
{
|
||||
for (j = 0; j < nvisuals; j++)
|
||||
{
|
||||
if (visuals[j].visual.type == possible_types[i])
|
||||
{
|
||||
available_types[navailable_types++] = visuals[j].visual.type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
system_visual->visual.red_mask = 0;
|
||||
system_visual->visual.red_shift = 0;
|
||||
system_visual->visual.red_prec = 0;
|
||||
|
||||
system_visual->visual.green_mask = 0;
|
||||
system_visual->visual.green_shift = 0;
|
||||
system_visual->visual.green_prec = 0;
|
||||
|
||||
system_visual->visual.blue_mask = 0;
|
||||
system_visual->visual.blue_shift = 0;
|
||||
system_visual->visual.blue_prec = 0;
|
||||
}
|
||||
system_visual->visual.colormap_size = system_visual->xvisual->map_entries;
|
||||
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
gdk_visual_add ((GdkVisual*) &visuals[i]);
|
||||
|
||||
if (npossible_types == 0)
|
||||
g_error ("unable to find a usable visual type");
|
||||
available_depths[0] = system_visual->visual.depth;
|
||||
available_types[0] = system_visual->visual.type;
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
@ -365,67 +268,43 @@ gdk_visual_get_system (void)
|
||||
GdkVisual*
|
||||
gdk_visual_get_best (void)
|
||||
{
|
||||
return ((GdkVisual*) &(visuals[0]));
|
||||
return ((GdkVisual*) system_visual);
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_best_with_depth (gint depth)
|
||||
{
|
||||
GdkVisual *return_val;
|
||||
int i;
|
||||
|
||||
return_val = NULL;
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if (depth == visuals[i].visual.depth)
|
||||
{
|
||||
return_val = (GdkVisual*) &(visuals[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
if (depth == system_visual->visual.depth)
|
||||
return (GdkVisual*) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_best_with_type (GdkVisualType visual_type)
|
||||
{
|
||||
GdkVisual *return_val;
|
||||
int i;
|
||||
|
||||
return_val = NULL;
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if (visual_type == visuals[i].visual.type)
|
||||
{
|
||||
return_val = (GdkVisual*) &(visuals[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
if (visual_type == system_visual->visual.type)
|
||||
return (GdkVisual*) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_best_with_both (gint depth,
|
||||
GdkVisualType visual_type)
|
||||
{
|
||||
GdkVisual *return_val;
|
||||
int i;
|
||||
|
||||
return_val = NULL;
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if ((depth == visuals[i].visual.depth) &&
|
||||
(visual_type == visuals[i].visual.type))
|
||||
{
|
||||
return_val = (GdkVisual*) &(visuals[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
if ((depth == system_visual->visual.depth) &&
|
||||
(visual_type == system_visual->visual.type))
|
||||
return (GdkVisual*) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_query_depths (gint **depths,
|
||||
gint *count)
|
||||
{
|
||||
*count = navailable_depths;
|
||||
*count = 1;
|
||||
*depths = available_depths;
|
||||
}
|
||||
|
||||
@ -433,59 +312,32 @@ void
|
||||
gdk_query_visual_types (GdkVisualType **visual_types,
|
||||
gint *count)
|
||||
{
|
||||
*count = navailable_types;
|
||||
*count = 1;
|
||||
*visual_types = available_types;
|
||||
}
|
||||
|
||||
GList*
|
||||
gdk_list_visuals (void)
|
||||
{
|
||||
GList *list;
|
||||
guint i;
|
||||
|
||||
list = NULL;
|
||||
for (i = 0; i < nvisuals; ++i)
|
||||
list = g_list_append (list, (gpointer) &visuals[i]);
|
||||
|
||||
return list;
|
||||
return g_list_append (NULL, (gpointer) system_visual);
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_lookup (Visual *xvisual)
|
||||
{
|
||||
GdkVisual *visual;
|
||||
|
||||
if (!visual_hash)
|
||||
if (system_visual->xvisual == xvisual)
|
||||
return (GdkVisual *) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
|
||||
visual = g_hash_table_lookup (visual_hash, xvisual);
|
||||
return visual;
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdkx_visual_get (VisualID xvisualid)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
if (xvisualid == visuals[i].xvisual->visualid)
|
||||
return (GdkVisual*) &visuals[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_visual_add (GdkVisual *visual)
|
||||
{
|
||||
GdkVisualPrivate *private;
|
||||
|
||||
if (!visual_hash)
|
||||
visual_hash = g_hash_table_new ((GHashFunc) gdk_visual_hash,
|
||||
(GCompareFunc) gdk_visual_compare);
|
||||
|
||||
private = (GdkVisualPrivate*) visual;
|
||||
|
||||
g_hash_table_insert (visual_hash, private->xvisual, visual);
|
||||
if (xvisualid == system_visual->xvisual->visualid)
|
||||
return (GdkVisual*) system_visual;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -508,19 +360,3 @@ gdk_visual_decompose_mask (gulong mask,
|
||||
mask >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* This hash stuff is pretty useless on Windows, as there is only
|
||||
one visual... */
|
||||
|
||||
static guint
|
||||
gdk_visual_hash (Visual *key)
|
||||
{
|
||||
return key->visualid;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_visual_compare (Visual *a,
|
||||
Visual *b)
|
||||
{
|
||||
return (a->visualid == b->visualid);
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <stdio.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkinput.h"
|
||||
|
||||
/* The Win API function AdjustWindowRect may return negative values
|
||||
* resulting in obscured title bars. This helper function is coreccting it.
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <stdio.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkinput.h"
|
||||
|
||||
/* The Win API function AdjustWindowRect may return negative values
|
||||
* resulting in obscured title bars. This helper function is coreccting it.
|
||||
|
Loading…
Reference in New Issue
Block a user