"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gdk/win32/gdkdevicemanager-win32.c" between
gtk+-3.24.26.tar.xz and gtk+-3.24.27.tar.xz

About: GTK+ 3 (the GIMP Toolkit; version 3) is a library for creating graphical user interfaces for the X Window System.

gdkdevicemanager-win32.c  (gtk+-3.24.26.tar.xz):gdkdevicemanager-win32.c  (gtk+-3.24.27.tar.xz)
skipping to change at line 37 skipping to change at line 37
#include "gdkdevicemanager-win32.h" #include "gdkdevicemanager-win32.h"
#include "gdkdeviceprivate.h" #include "gdkdeviceprivate.h"
#include "gdkdevice-win32.h" #include "gdkdevice-win32.h"
#include "gdkdevice-virtual.h" #include "gdkdevice-virtual.h"
#include "gdkdevice-wintab.h" #include "gdkdevice-wintab.h"
#include "gdkdisplayprivate.h" #include "gdkdisplayprivate.h"
#include "gdkseatdefaultprivate.h" #include "gdkseatdefaultprivate.h"
#define WINTAB32_DLL "Wintab32.dll" #define WINTAB32_DLL "Wintab32.dll"
#define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORM AL_PRESSURE | PK_ORIENTATION) #define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORM AL_PRESSURE | PK_ORIENTATION | PK_TANGENT_PRESSURE)
/* We want everything in absolute mode */ /* We want everything in absolute mode */
#define PACKETMODE (0) #define PACKETMODE (0)
#include <pktdef.h> #include <pktdef.h>
#define DEBUG_WINTAB 1 /* Verbose debug messages enabled */ #define DEBUG_WINTAB 1 /* Verbose debug messages enabled */
#define TWOPI (2 * G_PI) #define TWOPI (2 * G_PI)
static GList *wintab_contexts = NULL; static GList *wintab_contexts = NULL;
static GdkWindow *wintab_window = NULL; static GdkWindow *wintab_window = NULL;
extern gint _gdk_input_ignore_core; extern gint _gdk_input_ignore_core;
skipping to change at line 73 skipping to change at line 73
static t_WTGetA p_WTGetA; static t_WTGetA p_WTGetA;
static t_WTSetA p_WTSetA; static t_WTSetA p_WTSetA;
static t_WTOverlap p_WTOverlap; static t_WTOverlap p_WTOverlap;
static t_WTPacket p_WTPacket; static t_WTPacket p_WTPacket;
static t_WTQueueSizeSet p_WTQueueSizeSet; static t_WTQueueSizeSet p_WTQueueSizeSet;
static gboolean default_display_opened = FALSE; static gboolean default_display_opened = FALSE;
G_DEFINE_TYPE (GdkDeviceManagerWin32, gdk_device_manager_win32, GDK_TYPE_DEVICE_ MANAGER) G_DEFINE_TYPE (GdkDeviceManagerWin32, gdk_device_manager_win32, GDK_TYPE_DEVICE_ MANAGER)
static GdkDeviceWintab *gdk_device_manager_find_wintab_device (GdkDeviceManagerW
in32 *, HCTX, UINT);
UINT _wintab_recognize_new_cursors (GdkDeviceManagerWin32 *, HCTX);
int _gdk_find_wintab_device_index (HCTX);
static GdkDevice * static GdkDevice *
create_pointer (GdkDeviceManager *device_manager, create_pointer (GdkDeviceManager *device_manager,
GType g_type, GType g_type,
const char *name, const char *name,
GdkDeviceType type) GdkDeviceType type)
{ {
return g_object_new (g_type, return g_object_new (g_type,
"name", name, "name", name,
"type", type, "type", type,
"input-source", GDK_SOURCE_MOUSE, "input-source", GDK_SOURCE_MOUSE,
skipping to change at line 358 skipping to change at line 362
} }
} }
#endif #endif
static void static void
wintab_init_check (GdkDeviceManagerWin32 *device_manager) wintab_init_check (GdkDeviceManagerWin32 *device_manager)
{ {
GdkDisplay *display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (devi ce_manager)); GdkDisplay *display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (devi ce_manager));
GdkWindow *root = gdk_screen_get_root_window (gdk_display_get_default_screen ( display)); GdkWindow *root = gdk_screen_get_root_window (gdk_display_get_default_screen ( display));
static gboolean wintab_initialized = FALSE; static gboolean wintab_initialized = FALSE;
GdkDeviceWintab *device;
GdkWindowAttr wa; GdkWindowAttr wa;
WORD specversion; WORD specversion;
HCTX *hctx; HCTX *hctx;
UINT ndevices, ncursors, ncsrtypes, firstcsr, hardware; UINT ndevices, ncursors;
BOOL active; UINT devix;
DWORD physid; AXIS axis_x, axis_y;
AXIS axis_x, axis_y, axis_npressure, axis_or[3]; int i;
UINT devix, cursorix; wchar_t devname[100];
int i, num_axes = 0; gchar *devname_utf8;
wchar_t devname[100], csrname[100];
gchar *devname_utf8, *csrname_utf8, *device_name;
BOOL defcontext_done; BOOL defcontext_done;
HMODULE wintab32; HMODULE wintab32;
char *wintab32_dll_path; char *wintab32_dll_path;
char dummy; char dummy;
int n, k; int n, k;
if (wintab_initialized) if (wintab_initialized)
return; return;
wintab_initialized = TRUE; wintab_initialized = TRUE;
skipping to change at line 468 skipping to change at line 469
* can there even be several, probably not?) as a system * can there even be several, probably not?) as a system
* pointing device, i.e. it controls the normal Windows * pointing device, i.e. it controls the normal Windows
* cursor. This seems much more natural. * cursor. This seems much more natural.
*/ */
(*p_WTInfoW) (WTI_DEVICES + devix, DVC_NAME, devname); (*p_WTInfoW) (WTI_DEVICES + devix, DVC_NAME, devname);
devname_utf8 = g_utf16_to_utf8 (devname, -1, NULL, NULL, NULL); devname_utf8 = g_utf16_to_utf8 (devname, -1, NULL, NULL, NULL);
#ifdef DEBUG_WINTAB #ifdef DEBUG_WINTAB
GDK_NOTE (INPUT, (g_print("Device %u: %s\n", devix, devname_utf8))); GDK_NOTE (INPUT, (g_print("Device %u: %s\n", devix, devname_utf8)));
#endif #endif
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_NCSRTYPES, &ncsrtypes);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_FIRSTCSR, &firstcsr);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_HARDWARE, &hardware);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_X, &axis_x); (*p_WTInfoA) (WTI_DEVICES + devix, DVC_X, &axis_x);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_Y, &axis_y); (*p_WTInfoA) (WTI_DEVICES + devix, DVC_Y, &axis_y);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_NPRESSURE, &axis_npressure);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_ORIENTATION, axis_or);
defcontext_done = FALSE; defcontext_done = FALSE;
if (HIBYTE (specversion) > 1 || LOBYTE (specversion) >= 1) if (HIBYTE (specversion) > 1 || LOBYTE (specversion) >= 1)
{ {
/* Try to get device-specific default context */ /* Try to get device-specific default context */
/* Some drivers, e.g. Aiptek, don't provide this info */ /* Some drivers, e.g. Aiptek, don't provide this info */
if ((*p_WTInfoA) (WTI_DSCTXS + devix, 0, &lc) > 0) if ((*p_WTInfoA) (WTI_DSCTXS + devix, 0, &lc) > 0)
defcontext_done = TRUE; defcontext_done = TRUE;
#if DEBUG_WINTAB #if DEBUG_WINTAB
if (defcontext_done) if (defcontext_done)
skipping to change at line 547 skipping to change at line 543
for (i = 128; i >= 1; i >>= 1) for (i = 128; i >= 1; i >>= 1)
{ {
if ((*p_WTQueueSizeSet) (*hctx, i)) if ((*p_WTQueueSizeSet) (*hctx, i))
{ {
GDK_NOTE (INPUT, g_print("Queue size set to %d\n", i)); GDK_NOTE (INPUT, g_print("Queue size set to %d\n", i));
break; break;
} }
} }
if (!i) if (!i)
GDK_NOTE (INPUT, g_print("Whoops, no queue size could be set\n")); GDK_NOTE (INPUT, g_print("Whoops, no queue size could be set\n"));
for (cursorix = firstcsr; cursorix < firstcsr + ncsrtypes; cursorix++)
{ /* Get the cursors that Wintab is currently aware of */
_wintab_recognize_new_cursors(device_manager, *hctx);
}
}
UINT
_wintab_recognize_new_cursors (GdkDeviceManagerWin32 *device_manager,
HCTX hctx)
{
GdkDisplay *display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (devi
ce_manager));
int devix;
wchar_t devname[100], csrname[100];
gchar *devname_utf8, *csrname_utf8, *device_name;
UINT ncsrtypes, firstcsr, cursorix;
BOOL active;
DWORD physid;
AXIS axis_x, axis_y, axis_npressure, axis_or[3], axis_tpressure;
GdkDeviceWintab *device;
LOGCONTEXT lc;
int num_axes;
UINT num_new_cursors = 0;
devix = _gdk_find_wintab_device_index(hctx);
if (devix == -1)
return num_new_cursors;
(*p_WTInfoW) (WTI_DEVICES + devix, DVC_NAME, devname);
devname_utf8 = g_utf16_to_utf8 (devname, -1, NULL, NULL, NULL);
#ifdef DEBUG_WINTAB #ifdef DEBUG_WINTAB
GDK_NOTE (INPUT, (g_print("Cursor %u:\n", cursorix), print_cursor (cur sorix))); GDK_NOTE (INPUT, (g_print("Finding cursors for device %u: %s\n", devix, devnam e_utf8)));
#endif #endif
active = FALSE;
(*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_ACTIVE, &active);
if (!active)
continue;
/* Wacom tablets seem to report cursors corresponding to
* nonexistent pens or pucks. At least my ArtPad II reports
* six cursors: a puck, pressure stylus and eraser stylus,
* and then the same three again. I only have a
* pressure-sensitive pen. The puck instances, and the
* second instances of the styluses report physid zero. So
* at least for Wacom, skip cursors with physid zero.
*/
(*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_PHYSID, &physid);
if (wcscmp (devname, L"WACOM Tablet") == 0 && physid == 0)
continue;
(*p_WTInfoW) (WTI_CURSORS + cursorix, CSR_NAME, csrname);
csrname_utf8 = g_utf16_to_utf8 (csrname, -1, NULL, NULL, NULL);
device_name = g_strconcat (devname_utf8, " ", csrname_utf8, NULL);
device = g_object_new (GDK_TYPE_DEVICE_WINTAB,
"name", device_name,
"type", GDK_DEVICE_TYPE_FLOATING,
"input-source", GDK_SOURCE_PEN,
"input-mode", GDK_MODE_SCREEN,
"has-cursor", lc.lcOptions & CXO_SYSTEM,
"display", display,
"device-manager", device_manager,
NULL);
device->sends_core = lc.lcOptions & CXO_SYSTEM; (*p_WTInfoA) (WTI_DEVICES + devix, DVC_FIRSTCSR, &firstcsr);
if (device->sends_core) (*p_WTInfoA) (WTI_DEVICES + devix, DVC_NCSRTYPES, &ncsrtypes);
{ for (cursorix = firstcsr; cursorix < firstcsr + ncsrtypes; cursorix++)
_gdk_device_set_associated_device (device_manager->system_pointer, {
GDK_DEVICE (device)); #ifdef DEBUG_WINTAB
_gdk_device_add_slave (device_manager->core_pointer, GDK_DEVICE (de GDK_NOTE (INPUT, (g_print("Cursor %u:\n", cursorix), print_cursor (cursori
vice)); x)));
} #endif
/* Skip cursors that are already known to us */
if (gdk_device_manager_find_wintab_device(device_manager, hctx, cursorix)
!= NULL)
continue;
active = FALSE;
(*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_ACTIVE, &active);
if (!active)
continue;
/* Wacom tablets iterate through all possible cursors,
* even if the cursor's presence has not been recognized.
* Unrecognized cursors have a physid of zero and are ignored.
* Recognized cursors have a non-zero physid and we create a
* Wintab device object for each of them.
*/
(*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_PHYSID, &physid);
if (wcscmp (devname, L"WACOM Tablet") == 0 && physid == 0)
continue;
g_free (csrname_utf8); if (!(*p_WTGetA) (hctx, &lc))
{
g_warning ("wintab_recognize_new_cursors: Failed to retrieve device LO
GCONTEXT");
continue;
}
device->hctx = *hctx; /* Create a Wintab device for this cursor */
device->cursor = cursorix; (*p_WTInfoA) (WTI_DEVICES + devix, DVC_X, &axis_x);
(*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_PKTDATA, &device->pktdata); (*p_WTInfoA) (WTI_DEVICES + devix, DVC_Y, &axis_y);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_NPRESSURE, &axis_npressure);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_ORIENTATION, axis_or);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_TPRESSURE, &axis_tpressure);
(*p_WTInfoW) (WTI_CURSORS + cursorix, CSR_NAME, csrname);
csrname_utf8 = g_utf16_to_utf8 (csrname, -1, NULL, NULL, NULL);
device_name = g_strconcat (devname_utf8, " ", csrname_utf8, NULL);
g_free (csrname_utf8);
device = g_object_new (GDK_TYPE_DEVICE_WINTAB,
"name", device_name,
"type", GDK_DEVICE_TYPE_FLOATING,
"input-source", GDK_SOURCE_PEN,
"input-mode", GDK_MODE_SCREEN,
"has-cursor", lc.lcOptions & CXO_SYSTEM,
"display", display,
"device-manager", device_manager,
NULL);
if (device->pktdata & PK_X) device->sends_core = lc.lcOptions & CXO_SYSTEM;
{ if (device->sends_core)
_gdk_device_add_axis (GDK_DEVICE (device), {
GDK_NONE, _gdk_device_set_associated_device (device_manager->system_pointer, GDK
GDK_AXIS_X, _DEVICE (device));
axis_x.axMin, _gdk_device_add_slave (device_manager->core_pointer, GDK_DEVICE (devic
axis_x.axMax, e));
axis_x.axResolution / 65535); }
num_axes++;
}
if (device->pktdata & PK_Y) device->hctx = hctx;
{ device->cursor = cursorix;
_gdk_device_add_axis (GDK_DEVICE (device), (*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_PKTDATA, &device->pktdata);
GDK_NONE, num_axes = 0;
GDK_AXIS_Y,
axis_y.axMin,
axis_y.axMax,
axis_y.axResolution / 65535);
num_axes++;
}
if (device->pktdata & PK_NORMAL_PRESSURE) if (device->pktdata & PK_X)
{ {
_gdk_device_add_axis (GDK_DEVICE (device), _gdk_device_add_axis (GDK_DEVICE (device),
GDK_NONE, GDK_NONE,
GDK_AXIS_PRESSURE, GDK_AXIS_X,
axis_npressure.axMin, axis_x.axMin,
axis_npressure.axMax, axis_x.axMax,
axis_npressure.axResolution / 65535); axis_x.axResolution / 65535);
num_axes++; num_axes++;
} }
if (device->pktdata & PK_ORIENTATION) if (device->pktdata & PK_Y)
{ {
device->orientation_axes[0] = axis_or[0]; _gdk_device_add_axis (GDK_DEVICE (device),
device->orientation_axes[1] = axis_or[1]; GDK_NONE,
GDK_AXIS_Y,
axis_y.axMin,
axis_y.axMax,
axis_y.axResolution / 65535);
num_axes++;
}
/* Wintab gives us azimuth and altitude, which if (device->pktdata & PK_NORMAL_PRESSURE)
* we convert to x and y tilt in the -1000..1000 range {
_gdk_device_add_axis (GDK_DEVICE (device),
GDK_NONE,
GDK_AXIS_PRESSURE,
axis_npressure.axMin,
axis_npressure.axMax,
axis_npressure.axResolution / 65535);
num_axes++;
}
if (device->pktdata & PK_ORIENTATION)
{
if (device->pktdata & PK_TANGENT_PRESSURE) /* If we have a wheel, disa
ble the twist axis */
axis_or[2].axResolution = 0;
device->orientation_axes[0] = axis_or[0];
device->orientation_axes[1] = axis_or[1];
device->orientation_axes[2] = axis_or[2];
/* Wintab gives us azimuth and altitude, which
* we convert to x and y tilt in the -1000..1000 range
*/
_gdk_device_add_axis (GDK_DEVICE (device),
GDK_NONE,
GDK_AXIS_XTILT,
-1000,
1000,
1000);
_gdk_device_add_axis (GDK_DEVICE (device),
GDK_NONE,
GDK_AXIS_YTILT,
-1000,
1000,
1000);
num_axes += 2;
if (axis_or[2].axResolution != 0) /* If twist is present */
{
/* Wacom's Wintab driver returns the rotation
* of an Art Pen as the orientation twist value.
* We're using GDK_AXIS_WHEEL as it's actually
* called Wheel/Rotation to the user.
* axMin and axMax are back to front on purpose. If you put them
* the "correct" way round, rotation will be flipped!
*/ */
_gdk_device_add_axis (GDK_DEVICE (device), _gdk_device_add_axis (GDK_DEVICE (device),
GDK_NONE, GDK_NONE,
GDK_AXIS_XTILT, GDK_AXIS_WHEEL,
-1000, axis_or[2].axMax,
1000, axis_or[2].axMin,
1000); axis_or[2].axResolution / 65535);
num_axes++;
_gdk_device_add_axis (GDK_DEVICE (device),
GDK_NONE,
GDK_AXIS_YTILT,
-1000,
1000,
1000);
num_axes += 2;
} }
}
device->last_axis_data = g_new (gint, num_axes); if (device->pktdata & PK_TANGENT_PRESSURE)
{
/* This is the finger wheel on a Wacom Airbrush
*/
_gdk_device_add_axis (GDK_DEVICE (device),
GDK_NONE,
GDK_AXIS_WHEEL,
axis_tpressure.axMin,
axis_tpressure.axMax,
axis_tpressure.axResolution / 65535);
num_axes++;
}
device->last_axis_data = g_new (gint, num_axes);
GDK_NOTE (INPUT, g_print ("device: (%u) %s axes: %d\n", GDK_NOTE (INPUT, g_print ("device: (%u) %s axes: %d\n",
cursorix, cursorix,
device_name, device_name,
num_axes)); num_axes));
#if 0 #if 0
for (i = 0; i < gdkdev->info.num_axes; i++) for (i = 0; i < gdkdev->info.num_axes; i++)
GDK_NOTE (INPUT, g_print ("... axis %d: %d--%d@%d\n", GDK_NOTE (INPUT, g_print ("... axis %d: %d--%d@%d\n",
i, i,
gdkdev->axes[i].min_value, gdkdev->axes[i].min_value,
gdkdev->axes[i].max_value, gdkdev->axes[i].max_value,
gdkdev->axes[i].resolution)); gdkdev->axes[i].resolution));
#endif #endif
device_manager->wintab_devices = g_list_append (device_manager->wintab device_manager->wintab_devices = g_list_append (device_manager->wintab_dev
_devices, ices,
device); device);
num_new_cursors++;
g_free (device_name); g_free (device_name);
}
g_free (devname_utf8);
} }
g_free (devname_utf8);
return num_new_cursors;
} }
/* Only initialize Wintab after the default display is set for /* Only initialize Wintab after the default display is set for
* the first time. WTOpenA() executes code beyond our control, * the first time. WTOpenA() executes code beyond our control,
* and it can cause messages to be sent to the application even * and it can cause messages to be sent to the application even
* before a window is opened. GDK has to be in a fit state to * before a window is opened. GDK has to be in a fit state to
* handle them when they come. * handle them when they come.
* *
* https://bugzilla.gnome.org/show_bug.cgi?id=774379 * https://bugzilla.gnome.org/show_bug.cgi?id=774379
*/ */
skipping to change at line 870 skipping to change at line 949
/* The wintab driver for the Wacom ArtPad II reports /* The wintab driver for the Wacom ArtPad II reports
* PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't * PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't
* actually sense tilt. Catch this by noticing that the * actually sense tilt. Catch this by noticing that the
* orientation axis's azimuth resolution is zero. * orientation axis's azimuth resolution is zero.
* *
* The same is true of the Huion H610PRO, but in this case * The same is true of the Huion H610PRO, but in this case
* it's the altitude resolution that's zero. GdkEvents with * it's the altitude resolution that's zero. GdkEvents with
* sensible tilts will need both, so only add the GDK tilt axes * sensible tilts will need both, so only add the GDK tilt axes
* if both wintab axes are going to be well-behaved in use. * if both wintab axes are going to be well-behaved in use.
*/ */
if ((axes == NULL) || if (axes == NULL)
(axes[0].axResolution == 0) || return;
if ((axes[0].axResolution == 0) ||
(axes[1].axResolution == 0)) (axes[1].axResolution == 0))
{ {
axis_data[0] = 0; axis_data[0] = 0;
axis_data[1] = 0; axis_data[1] = 0;
return; }
else
{
/*
* Tested with a Wacom Intuos 5 touch M (PTH-650) + Wacom drivers 6.3.18-5
.
* Wintab's reference angle leads gdk's by 90 degrees.
*/
az = TWOPI * packet->pkOrientation.orAzimuth /
(axes[0].axResolution / 65536.);
az -= G_PI / 2;
el = TWOPI * packet->pkOrientation.orAltitude /
(axes[1].axResolution / 65536.);
/* X tilt */
axis_data[0] = cos (az) * cos (el) * 1000;
/* Y tilt */
axis_data[1] = sin (az) * cos (el) * 1000;
} }
/* /* Twist (Rotation) if present */
* Tested with a Wacom Intuos 5 touch M (PTH-650) + Wacom drivers 6.3.18-5. if (axes[2].axResolution != 0)
* Wintab's reference angle leads gdk's by 90 degrees. axis_data[2] = packet->pkOrientation.orTwist;
*/
az = TWOPI * packet->pkOrientation.orAzimuth /
(axes[0].axResolution / 65536.);
az -= G_PI / 2;
el = TWOPI * packet->pkOrientation.orAltitude /
(axes[1].axResolution / 65536.);
/* X tilt */
axis_data[0] = cos (az) * cos (el) * 1000;
/* Y tilt */
axis_data[1] = sin (az) * cos (el) * 1000;
} }
/* /*
* Get the currently active keyboard modifiers (ignoring the mouse buttons) * Get the currently active keyboard modifiers (ignoring the mouse buttons)
* We could use gdk_window_get_pointer but that function does a lot of other * We could use gdk_window_get_pointer but that function does a lot of other
* expensive things besides getting the modifiers. This code is somewhat based * expensive things besides getting the modifiers. This code is somewhat based
* on build_pointer_event_state from gdkevents-win32.c * on build_pointer_event_state from gdkevents-win32.c
*/ */
static guint static guint
get_modifier_key_state (void) get_modifier_key_state (void)
skipping to change at line 920 skipping to change at line 1006
if (GetKeyState (VK_SHIFT) < 0) if (GetKeyState (VK_SHIFT) < 0)
state |= GDK_SHIFT_MASK; state |= GDK_SHIFT_MASK;
if (GetKeyState (VK_MENU) < 0) if (GetKeyState (VK_MENU) < 0)
state |= GDK_MOD1_MASK; state |= GDK_MOD1_MASK;
if (GetKeyState (VK_CAPITAL) & 0x1) if (GetKeyState (VK_CAPITAL) & 0x1)
state |= GDK_LOCK_MASK; state |= GDK_LOCK_MASK;
return state; return state;
} }
int
_gdk_find_wintab_device_index (HCTX hctx)
{
GList *tmp_list;
int devix;
/* Find the index of the Wintab driver's input device (probably zero) */
if (!wintab_contexts)
return -1; /* No tablet devices found or Wintab not initialized yet */
tmp_list = wintab_contexts;
devix = 0;
while (tmp_list)
{
if ((*(HCTX *) (tmp_list->data)) == hctx)
return devix;
else
{
devix++;
tmp_list = tmp_list->next;
}
}
return -1;
}
static GdkDeviceWintab * static GdkDeviceWintab *
gdk_device_manager_find_wintab_device (GdkDeviceManagerWin32 *device_manager, gdk_device_manager_find_wintab_device (GdkDeviceManagerWin32 *device_manager,
HCTX hctx, HCTX hctx,
UINT cursor) UINT cursor)
{ {
GdkDeviceWintab *device; GdkDeviceWintab *device;
GList *tmp_list; GList *tmp_list;
for (tmp_list = device_manager->wintab_devices; tmp_list != NULL; tmp_list = t mp_list->next) for (tmp_list = device_manager->wintab_devices; tmp_list != NULL; tmp_list = t mp_list->next)
{ {
skipping to change at line 1075 skipping to change at line 1186
if (source_device->pktdata & PK_X) if (source_device->pktdata & PK_X)
source_device->last_axis_data[num_axes++] = packet.pkX; source_device->last_axis_data[num_axes++] = packet.pkX;
if (source_device->pktdata & PK_Y) if (source_device->pktdata & PK_Y)
source_device->last_axis_data[num_axes++] = packet.pkY; source_device->last_axis_data[num_axes++] = packet.pkY;
if (source_device->pktdata & PK_NORMAL_PRESSURE) if (source_device->pktdata & PK_NORMAL_PRESSURE)
source_device->last_axis_data[num_axes++] = packet.pkNormalPressure; source_device->last_axis_data[num_axes++] = packet.pkNormalPressure;
if (source_device->pktdata & PK_ORIENTATION) if (source_device->pktdata & PK_ORIENTATION)
{ {
decode_tilt (source_device->last_axis_data + num_axes, decode_tilt (source_device->last_axis_data + num_axes,
source_device->orientation_axes, &packet); source_device->orientation_axes, &packet);
num_axes += 2; /* we could have 3 axes if twist is present */
if (source_device->orientation_axes[2].axResolution == 0)
{
num_axes += 2;
}
else
{
num_axes += 3;
}
} }
if (source_device->pktdata & PK_TANGENT_PRESSURE)
source_device->last_axis_data[num_axes++] = packet.pkTangentPressure;
translated_buttons = button_map[packet.pkButtons & 0x07] | (packet.pkButto ns & ~0x07); translated_buttons = button_map[packet.pkButtons & 0x07] | (packet.pkButto ns & ~0x07);
if (translated_buttons != source_device->button_state) if (translated_buttons != source_device->button_state)
{ {
/* At least one button has changed state so produce a button event /* At least one button has changed state so produce a button event
* If more than one button has changed state (unlikely), * If more than one button has changed state (unlikely),
* just care about the first and act on the next the next time * just care about the first and act on the next the next time
* we get a packet * we get a packet
*/ */
skipping to change at line 1223 skipping to change at line 1344
| GDK_BUTTON5_MASK)); | GDK_BUTTON5_MASK));
GDK_NOTE (EVENTS_OR_INPUT, GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB motion: %g,%g\n", g_print ("WINTAB motion: %g,%g\n",
event->motion.x, event->motion.y)); event->motion.x, event->motion.y));
} }
return TRUE; return TRUE;
case WT_CSRCHANGE: case WT_CSRCHANGE:
if (device_manager->dev_entered_proximity > 0) if (device_manager->dev_entered_proximity > 0)
device_manager->dev_entered_proximity -= 1; device_manager->dev_entered_proximity -= 1;
if ((source_device = gdk_device_manager_find_wintab_device (device_manager if ((source_device =
, gdk_device_manager_find_wintab_device (device_manager,
(HCTX) msg->lPa
ram, (HCTX) msg->lParam,
packet.pkCursor
)) == NULL) packet.pkCursor)) == NULL)
return FALSE; {
/* Check for new cursors and try again */
if (_wintab_recognize_new_cursors(device_manager,
(HCTX) msg->lParam) == 0)
return FALSE;
if ((source_device =
gdk_device_manager_find_wintab_device (device_manager,
(HCTX) msg->lParam,
packet.pkCursor)) == NULL)
return FALSE;
}
if (source_device->sends_core && if (source_device->sends_core &&
gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED) gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISA
{ BLED)
_gdk_device_virtual_set_active (device_manager->core_pointer, {
GDK_DEVICE (source_device)); _gdk_device_virtual_set_active (device_manager->core_pointer,
_gdk_input_ignore_core += 1; GDK_DEVIC
} E (source_device));
_gdk_input_ignore_core += 1;
}
return FALSE; return FALSE;
case WT_PROXIMITY: case WT_PROXIMITY:
if (LOWORD (msg->lParam) == 0) if (LOWORD (msg->lParam) == 0)
{ {
if (_gdk_input_ignore_core > 0) if (_gdk_input_ignore_core > 0)
{ {
_gdk_input_ignore_core -= 1; _gdk_input_ignore_core -= 1;
if (_gdk_input_ignore_core == 0) if (_gdk_input_ignore_core == 0)
 End of changes. 33 change blocks. 
162 lines changed or deleted 301 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)