/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1999 Tor Lillqvist
+ * Copyright (C) 1998-2002 Tor Lillqvist
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#endif /* HAVE_WINTAB */
-gboolean
-gdk_device_get_history (GdkDevice *device,
- GdkWindow *window,
- guint32 start,
- guint32 stop,
- GdkTimeCoord ***events,
- gint *n_events)
-{
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
- g_return_val_if_fail (events != NULL, FALSE);
- g_return_val_if_fail (n_events != NULL, FALSE);
-
- *n_events = 0;
- *events = NULL;
-
- if (GDK_WINDOW_DESTROYED (window))
- return FALSE;
-
- if (GDK_IS_CORE (device))
- return FALSE;
- else
- return _gdk_device_get_history (device, window, start, stop, events, n_events);
-}
-
#ifdef HAVE_WINTAB
static GdkDevicePrivate *
gdk_input_find_dev_from_ctx (HCTX hctx,
UINT cursor)
{
- GList *tmp_list = gdk_input_devices;
+ GList *tmp_list = _gdk_input_devices;
GdkDevicePrivate *gdkdev;
while (tmp_list)
if (lc->lcMoveMask & PK_ROTATION) g_print (" PK_ROTATION");
g_print ("\n");
g_print ("lcBtnDnMask = %#x, lcBtnUpMask = %#x\n",
- lc->lcBtnDnMask, lc->lcBtnUpMask);
- g_print ("lcInOrgX = %d, lcInOrgY = %d, lcInOrgZ = %d\n",
+ (guint) lc->lcBtnDnMask, (guint) lc->lcBtnUpMask);
+ g_print ("lcInOrgX = %ld, lcInOrgY = %ld, lcInOrgZ = %ld\n",
lc->lcInOrgX, lc->lcInOrgY, lc->lcInOrgZ);
- g_print ("lcInExtX = %d, lcInExtY = %d, lcInExtZ = %d\n",
+ g_print ("lcInExtX = %ld, lcInExtY = %ld, lcInExtZ = %ld\n",
lc->lcInExtX, lc->lcInExtY, lc->lcInExtZ);
- g_print ("lcOutOrgX = %d, lcOutOrgY = %d, lcOutOrgZ = %d\n",
+ g_print ("lcOutOrgX = %ld, lcOutOrgY = %ld, lcOutOrgZ = %ld\n",
lc->lcOutOrgX, lc->lcOutOrgY, lc->lcOutOrgZ);
- g_print ("lcOutExtX = %d, lcOutExtY = %d, lcOutExtZ = %d\n",
+ g_print ("lcOutExtX = %ld, lcOutExtY = %ld, lcOutExtZ = %ld\n",
lc->lcOutExtX, lc->lcOutExtY, lc->lcOutExtZ);
g_print ("lcSensX = %g, lcSensY = %g, lcSensZ = %g\n",
lc->lcSensX / 65536., lc->lcSensY / 65536., lc->lcSensZ / 65536.);
UINT ndevices, ncursors, ncsrtypes, firstcsr, hardware;
BOOL active;
AXIS axis_x, axis_y, axis_npressure, axis_or[3];
- int i, j, k;
+ int i, k;
int devix, cursorix;
char devname[100], csrname[100];
- gdk_input_devices = NULL;
+ _gdk_input_devices = NULL;
wintab_contexts = NULL;
- if (!gdk_input_ignore_wintab &&
+ if (!_gdk_input_ignore_wintab &&
WTInfo (0, 0, NULL))
{
WTInfo (WTI_INTERFACE, IFC_SPECVERSION, &specversion);
- GDK_NOTE (MISC, g_print ("Wintab interface version %d.%d\n",
+ GDK_NOTE (INPUT, 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)));
+ GDK_NOTE (INPUT, (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)));
+ GDK_NOTE (INPUT, (g_print("DEFCONTEXT:\n"), print_lc(&defcontext)));
#endif
#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",
+ GDK_NOTE (INPUT, g_print ("NDEVICES: %d, NCURSORS: %d\n",
ndevices, ncursors));
#endif
/* Create a dummy window to receive wintab events */
wa.window_type = GDK_WINDOW_TOPLEVEL;
if ((wintab_window = gdk_window_new (NULL, &wa, GDK_WA_X|GDK_WA_Y)) == NULL)
{
- g_warning ("gdk_input_init: gdk_window_new failed");
+ g_warning ("gdk_input_wintab_init: gdk_window_new failed");
return;
}
gdk_drawable_ref (wintab_window);
#endif
}
#if DEBUG_WINTAB
- GDK_NOTE (MISC, (g_print("context for device %d:\n", devix),
+ GDK_NOTE (INPUT, (g_print("context for device %d:\n", devix),
print_lc(&lc)));
#endif
hctx = g_new (HCTX, 1);
if ((*hctx = WTOpen (GDK_WINDOW_HWND (wintab_window), &lc, TRUE)) == NULL)
{
- g_warning ("gdk_input_init: WTOpen failed");
+ g_warning ("gdk_input_wintab_init: WTOpen failed");
return;
}
- GDK_NOTE (MISC, g_print ("opened Wintab device %d %#x\n",
+ GDK_NOTE (INPUT, g_print ("opened Wintab device %d %p\n",
devix, *hctx));
wintab_contexts = g_list_append (wintab_contexts, hctx);
WTOverlap (*hctx, TRUE);
#if DEBUG_WINTAB
- GDK_NOTE (MISC, (g_print("context for device %d after WTOpen:\n", devix),
+ GDK_NOTE (INPUT, (g_print("context for device %d after WTOpen:\n", devix),
print_lc(&lc)));
#endif
for (cursorix = firstcsr; cursorix < firstcsr + ncsrtypes; cursorix++)
WTInfo (WTI_CURSORS + cursorix, CSR_ACTIVE, &active);
if (!active)
continue;
- gdkdev = g_new (GdkDevicePrivate, 1);
+ gdkdev = g_object_new (GDK_TYPE_DEVICE, NULL);
WTInfo (WTI_CURSORS + cursorix, CSR_NAME, csrname);
gdkdev->info.name = g_strconcat (devname, " ", csrname, NULL);
gdkdev->info.source = GDK_SOURCE_PEN;
}
gdkdev->info.num_keys = 0;
gdkdev->info.keys = NULL;
- GDK_NOTE (EVENTS,
+ GDK_NOTE (INPUT,
g_print ("device: (%d) %s axes: %d\n",
cursorix,
gdkdev->info.name,
gdkdev->info.num_axes));
for (i = 0; i < gdkdev->info.num_axes; i++)
- GDK_NOTE (EVENTS,
+ GDK_NOTE (INPUT,
g_print ("...axis %d: %d--%d@%d (%d--%d@%d)\n",
i,
gdkdev->axes[i].xmin_value,
gdkdev->axes[i].min_value,
gdkdev->axes[i].max_value,
gdkdev->axes[i].resolution));
- gdk_input_devices = g_list_append (gdk_input_devices,
+ _gdk_input_devices = g_list_append (_gdk_input_devices,
gdkdev);
}
}
GdkWindow *tmpw;
GdkInputWindow *candidate = NULL;
- for (list = gdk_input_windows; list != NULL; list = list->next)
+ for (list = _gdk_input_windows; list != NULL; list = list->next)
{
tmpw = ((GdkInputWindow *) (tmp_list->data))->window;
if (tmpw == window
if (gdkdev->info.mode == GDK_MODE_SCREEN)
{
- x_scale = gdk_screen_width() / device_width;
- y_scale = gdk_screen_height() / device_height;
+ x_scale = GetSystemMetrics (SM_CXSCREEN) / device_width;
+ y_scale = GetSystemMetrics (SM_CYSCREEN) / device_height;
x_offset = - input_window->root_x;
y_offset = - input_window->root_y;
GdkInputWindow *input_window;
int root_x, root_y;
- input_window = gdk_input_window_find (window);
+ input_window = _gdk_input_window_find (window);
g_return_if_fail (window != NULL);
gdk_input_get_root_relative_geometry (GDK_WINDOW_HWND (window),
GdkInputWindow *input_window;
int root_x, root_y;
- input_window = gdk_input_window_find (window);
+ input_window = _gdk_input_window_find (window);
g_return_if_fail (window != NULL);
gdk_input_get_root_relative_geometry (GDK_WINDOW_HWND (window), &root_x, &root_y);
#if !USE_SYSCONTEXT
GdkWindow *current_window;
#endif
+ GdkDisplay *display;
GdkWindowObject *obj;
GdkWindowImplWin32 *impl;
GdkInputWindow *input_window;
- GdkDevicePrivate *gdkdev;
+ GdkDevicePrivate *gdkdev = NULL;
GdkEventMask masktest;
POINT pt;
#if USE_SYSCONTEXT
window = gdk_window_at_pointer (&x, &y);
if (window == NULL)
- window = gdk_parent_root;
+ window = _gdk_parent_root;
gdk_drawable_ref (window);
+ display = gdk_drawable_get_display (window);
- GDK_NOTE (EVENTS,
- g_print ("gdk_input_win32_other_event: window=%#x (%d,%d)\n",
+ GDK_NOTE (EVENTS_OR_INPUT,
+ g_print ("gdk_input_win32_other_event: window=%p (%d,%d)\n",
GDK_WINDOW_HWND (window), x, y));
#else
switch (msg->message)
{
case WT_PACKET:
- if (window == gdk_parent_root)
+ if (window == _gdk_parent_root)
{
- GDK_NOTE (EVENTS, g_print ("...is root\n"));
+ GDK_NOTE (EVENTS_OR_INPUT, g_print ("...is root\n"));
return FALSE;
}
if (!impl->extension_events_selected
|| !(obj->extension_events & masktest))
{
- GDK_NOTE (EVENTS, g_print ("...not selected\n"));
+ GDK_NOTE (EVENTS_OR_INPUT, g_print ("...not selected\n"));
- if (obj->parent == GDK_WINDOW_OBJECT (gdk_parent_root))
+ if (obj->parent == GDK_WINDOW_OBJECT (_gdk_parent_root))
return FALSE;
pt.x = x;
ScreenToClient (GDK_WINDOW_HWND (window), &pt);
x = pt.x;
y = pt.y;
- GDK_NOTE (EVENTS, g_print ("...propagating to %#x, (%d,%d)\n",
- GDK_WINDOW_HWND (window), x, y));
+ GDK_NOTE (EVENTS_OR_INPUT, g_print ("...propagating to %p (%d,%d)\n",
+ GDK_WINDOW_HWND (window), x, y));
goto dijkstra;
}
- input_window = gdk_input_window_find (window);
+ input_window = _gdk_input_window_find (window);
g_assert (input_window != NULL);
if (event->any.type == GDK_BUTTON_PRESS
|| event->any.type == GDK_BUTTON_RELEASE)
{
- event->button.time = msg->time;
+ event->button.time = _gdk_win32_get_next_tick (msg->time);
event->button.device = &gdkdev->info;
#if 0
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
- GDK_NOTE (EVENTS, g_print ("WINTAB button %s:%d %g,%g\n",
- (event->button.type == GDK_BUTTON_PRESS ?
- "press" : "release"),
- event->button.button,
- event->button.x, event->button.y));
+ GDK_NOTE (EVENTS_OR_INPUT,
+ g_print ("WINTAB button %s:%d %g,%g\n",
+ (event->button.type == GDK_BUTTON_PRESS ?
+ "press" : "release"),
+ event->button.button,
+ event->button.x, event->button.y));
}
else
{
- event->motion.time = msg->time;
+ event->motion.time = _gdk_win32_get_next_tick (msg->time);
event->motion.is_hint = FALSE;
event->motion.device = &gdkdev->info;
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
- GDK_NOTE (EVENTS, g_print ("WINTAB motion: %g,%g\n",
- event->motion.x, event->motion.y));
+ GDK_NOTE (EVENTS_OR_INPUT,
+ g_print ("WINTAB motion: %g,%g\n",
+ event->motion.x, event->motion.y));
/* Check for missing release or press events for the normal
* pressure button. At least on my ArtPadII I sometimes miss a
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
event2->button.button = 1;
- GDK_NOTE (EVENTS, g_print ("WINTAB synthesized button %s: %d %g,%gg\n",
- (event2->button.type == GDK_BUTTON_PRESS ?
- "press" : "release"),
- event2->button.button,
- event2->button.x,
- event2->button.y));
- gdk_event_queue_append (event2);
+ GDK_NOTE (EVENTS_OR_INPUT,
+ g_print ("WINTAB synthesized button %s: %d %g,%gg\n",
+ (event2->button.type == GDK_BUTTON_PRESS ?
+ "press" : "release"),
+ event2->button.button,
+ event2->button.x,
+ event2->button.y));
+ _gdk_event_queue_append (display, event2);
}
}
return TRUE;
if (LOWORD (msg->lParam) == 0)
{
event->proximity.type = GDK_PROXIMITY_OUT;
- gdk_input_ignore_core = FALSE;
+ _gdk_input_ignore_core = FALSE;
}
else
{
event->proximity.type = GDK_PROXIMITY_IN;
- gdk_input_ignore_core = TRUE;
+ _gdk_input_ignore_core = TRUE;
}
- event->proximity.time = msg->time;
+ event->proximity.time = _gdk_win32_get_next_tick (msg->time);
event->proximity.device = &gdkdev->info;
- GDK_NOTE (EVENTS, g_print ("WINTAB proximity %s\n",
- (event->proximity.type == GDK_PROXIMITY_IN ?
- "in" : "out")));
+ GDK_NOTE (EVENTS_OR_INPUT,
+ g_print ("WINTAB proximity %s\n",
+ (event->proximity.type == GDK_PROXIMITY_IN ?
+ "in" : "out")));
return TRUE;
}
#endif
gboolean need_ungrab;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
- gint result;
- tmp_list = gdk_input_windows;
+ tmp_list = _gdk_input_windows;
new_window = NULL;
need_ungrab = FALSE;
- GDK_NOTE (MISC, g_print ("gdk_input_win32_grab_pointer: %#x %d %#x\n",
+ GDK_NOTE (INPUT, g_print ("gdk_input_win32_grab_pointer: %p %d %p\n",
GDK_WINDOW_HWND (window),
owner_events,
(confine_to ? GDK_WINDOW_HWND (confine_to) : 0)));
{
new_window->grabbed = TRUE;
- tmp_list = gdk_input_devices;
+ tmp_list = _gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
}
else
{
- tmp_list = gdk_input_devices;
+ tmp_list = _gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
- GDK_NOTE (MISC, g_print ("gdk_input_win32_ungrab_pointer\n"));
+ GDK_NOTE (INPUT, g_print ("gdk_input_win32_ungrab_pointer\n"));
- tmp_list = gdk_input_windows;
+ tmp_list = _gdk_input_windows;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
{
input_window->grabbed = FALSE;
- tmp_list = gdk_input_devices;
+ tmp_list = _gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
gdouble *axes,
GdkModifierType *mask)
{
- gint i;
-
g_return_if_fail (device != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
gdk_window_get_pointer (window, NULL, NULL, mask);
gdkdev = (GdkDevicePrivate *)device;
- input_window = gdk_input_window_find (window);
+ input_window = _gdk_input_window_find (window);
g_return_if_fail (input_window != NULL);
#if 0 /* FIXME */
}
void
-gdk_input_init (void)
+_gdk_input_init (GdkDisplay *display)
{
- gdk_input_ignore_core = FALSE;
- gdk_input_devices = NULL;
+ _gdk_input_ignore_core = FALSE;
+ _gdk_input_devices = NULL;
+ _gdk_init_input_core (display);
#ifdef HAVE_WINTAB
gdk_input_wintab_init ();
#endif /* HAVE_WINTAB */
- gdk_input_devices = g_list_append (gdk_input_devices, &gdk_input_core_info);
+ _gdk_input_devices = g_list_append (_gdk_input_devices, display->core_pointer);
}