--- gimp-2.6.9/app/config/gimpguiconfig.c 2009-08-06 04:18:54 +0900 +++ gimp-painter--2.6.9/app/config/gimpguiconfig.c 2010-06-26 05:01:45 +0900 @@ -84,6 +84,8 @@ PROP_DOCK_WINDOW_HINT, PROP_TRANSIENT_DOCKS, PROP_CURSOR_FORMAT, + PROP_SYSTEM_COORDS_STYLUS, + PROP_SYSTEM_COORDS_PUCK, /* ignored, only for backward compatibility: */ PROP_INFO_WINDOW_PER_DISPLAY, @@ -273,6 +275,16 @@ GIMP_TYPE_CURSOR_FORMAT, GIMP_CURSOR_FORMAT_PIXBUF, GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SYSTEM_COORDS_STYLUS, + "system-coords-stylus", + SYSTEM_COORDS_STYLUS_BLURB, + FALSE, + GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SYSTEM_COORDS_PUCK, + "system-coords-puck", + SYSTEM_COORDS_PUCK_BLURB, + FALSE, + GIMP_PARAM_STATIC_STRINGS); /* only for backward compatibility: */ GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INFO_WINDOW_PER_DISPLAY, @@ -423,6 +435,12 @@ case PROP_CURSOR_FORMAT: gui_config->cursor_format = g_value_get_enum (value); break; + case PROP_SYSTEM_COORDS_STYLUS: + gui_config->system_coords_stylus = g_value_get_boolean (value); + break; + case PROP_SYSTEM_COORDS_PUCK: + gui_config->system_coords_puck = g_value_get_boolean (value); + break; case PROP_INFO_WINDOW_PER_DISPLAY: case PROP_SHOW_TOOL_TIPS: @@ -542,6 +560,12 @@ case PROP_CURSOR_FORMAT: g_value_set_enum (value, gui_config->cursor_format); break; + case PROP_SYSTEM_COORDS_STYLUS: + g_value_set_boolean (value, gui_config->system_coords_stylus); + break; + case PROP_SYSTEM_COORDS_PUCK: + g_value_set_boolean (value, gui_config->system_coords_puck); + break; case PROP_INFO_WINDOW_PER_DISPLAY: case PROP_SHOW_TOOL_TIPS: --- gimp-2.6.9/app/config/gimpguiconfig.h 2009-07-21 05:20:50 +0900 +++ gimp-painter--2.6.9/app/config/gimpguiconfig.h 2010-06-26 05:01:45 +0900 @@ -72,6 +72,8 @@ GimpWindowHint dock_window_hint; gboolean transient_docks; GimpCursorFormat cursor_format; + gboolean system_coords_stylus; + gboolean system_coords_puck; gint last_tip; /* saved in sessionrc */ }; --- gimp-2.6.9/app/config/gimprc-blurbs.h 2009-07-21 05:20:50 +0900 +++ gimp-painter--2.6.9/app/config/gimprc-blurbs.h 2010-06-26 05:01:45 +0900 @@ -450,5 +450,11 @@ #define ZOOM_QUALITY_BLURB \ "There's a tradeoff between speed and quality of the zoomed-out display." +#define SYSTEM_COORDS_STYLUS_BLURB \ +"Try to turn on when the cursor position is not correctly with stylus pen." + +#define SYSTEM_COORDS_PUCK_BLURB \ +"Try to turn on when the cursor position is not correctly with tablet mouse." + #endif /* __GIMP_RC_BLURBS_H__ */ --- gimp-2.6.9/app/dialogs/preferences-dialog.c 2009-07-21 05:20:50 +0900 +++ gimp-painter--2.6.9/app/dialogs/preferences-dialog.c 2010-06-26 05:01:45 +0900 @@ -2589,6 +2602,23 @@ g_object_set_data (G_OBJECT (button), "clear-button", button2); + /* Device coords */ + vbox2 = prefs_frame_new (_("Use System Coords"), + GTK_CONTAINER (vbox), FALSE); + + button = prefs_check_button_add (object, "system-coords-stylus", + _("_Stylus and Eraser"), + GTK_BOX (vbox2)); + + button2 = prefs_check_button_add (object, "system-coords-puck", + _("_Mouse and Lens Cursor"), + GTK_BOX (vbox2)); + +#ifndef G_OS_WIN32 + gtk_widget_set_sensitive (button, FALSE); + gtk_widget_set_sensitive (button2, FALSE); +#endif + /****************************/ /* Additional Controllers */ --- gimp-2.6.9/app/display/gimpdisplay.c 2009-07-21 05:20:51 +0900 +++ gimp-painter--2.6.9/app/display/gimpdisplay.c 2010-06-26 05:01:45 +0900 @@ -26,6 +26,7 @@ #include "tools/tools-types.h" #include "config/gimpdisplayconfig.h" +#include "config/gimpguiconfig.h" #include "core/gimp.h" #include "core/gimparea.h" @@ -187,6 +188,7 @@ case PROP_GIMP: display->gimp = g_value_get_object (value); /* don't ref the gimp */ display->config = GIMP_DISPLAY_CONFIG (display->gimp->config); + display->gui_config = GIMP_GUI_CONFIG (display->gimp->config); break; case PROP_IMAGE: --- gimp-2.6.9/app/display/gimpdisplay.h 2009-07-21 05:20:51 +0900 +++ gimp-painter--2.6.9/app/display/gimpdisplay.h 2010-06-26 05:01:45 +0900 @@ -41,6 +41,7 @@ Gimp *gimp; /* global gimp instance */ GimpDisplayConfig *config; + GimpGuiConfig *gui_config; GimpImage *image; /* pointer to the associated image */ gint instance; /* the instance # of this display as */ --- gimp-2.6.9/app/display/gimpdisplayshell-callbacks.c 2009-08-14 03:25:25 +0900 +++ gimp-painter--2.6.9/app/display/gimpdisplayshell-callbacks.c 2010-06-26 05:01:45 +0900 @@ -24,6 +24,10 @@ #include #include +#ifdef G_OS_WIN32 +#include +#endif + #include "libgimpmath/gimpmath.h" #include "libgimpcolor/gimpcolor.h" #include "libgimpwidgets/gimpwidgets.h" @@ -32,6 +36,7 @@ #include "tools/tools-types.h" #include "config/gimpdisplayconfig.h" +#include "config/gimpguiconfig.h" #include "core/gimp.h" #include "core/gimpcontext.h" @@ -1752,6 +1763,32 @@ } +#ifdef G_OS_WIN32 +gboolean +gimp_display_shell_motion_notify (GimpDisplayShell *shell, + GdkEventMotion *event) +{ + GimpGuiConfig *gui_config = shell->display->gui_config; + GdkDevice *device = event->device; + + if ((gui_config->system_coords_stylus && + (device->source == GDK_SOURCE_PEN || device->source == GDK_SOURCE_ERASER))|| + (gui_config->system_coords_puck && device->source == GDK_SOURCE_CURSOR)) + { + GdkDevice *core_pointer = gdk_device_get_core_pointer (); + gdouble axes[GDK_AXIS_LAST]; + + gdk_device_get_state (core_pointer, shell->canvas->window, axes, NULL); + + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_X, &event->x); + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_Y, &event->y); + } + + return FALSE; +} +#endif + + /* private functions */ static void --- gimp-2.6.9/app/display/gimpdisplayshell-callbacks.h 2009-07-21 05:20:51 +0900 +++ gimp-painter--2.6.9/app/display/gimpdisplayshell-callbacks.h 2010-06-26 05:01:45 +0900 @@ -57,5 +57,10 @@ GdkEventButton *bevent, GimpDisplayShell *shell); +#ifdef G_OS_WIN32 +gboolean gimp_display_shell_motion_notify (GimpDisplayShell *shell, + GdkEventMotion *event); +#endif + #endif /* __GIMP_DISPLAY_SHELL_CALLBACKS_H__ */ --- gimp-2.6.9/app/display/gimpdisplayshell-coords.c 2010-02-01 05:13:12 +0900 +++ gimp-painter--2.6.9/app/display/gimpdisplayshell-coords.c 2010-06-27 01:12:06 +0900 @@ -24,6 +24,9 @@ #include "display-types.h" +#include "config/gimpguiconfig.h" + +#include "gimpdisplay.h" #include "gimpdisplayshell.h" #include "gimpdisplayshell-coords.h" @@ -45,10 +48,37 @@ if (gdk_event_get_axis (event, GDK_AXIS_X, &x)) { +#ifdef G_OS_WIN32 + GimpGuiConfig *gui_config = shell->display->gui_config; + + *coords = default_coords; + + if ((gui_config->system_coords_stylus && + (device->source == GDK_SOURCE_PEN || device->source == GDK_SOURCE_ERASER))|| + (gui_config->system_coords_puck && device->source == GDK_SOURCE_CURSOR)) + { + GdkDevice *core_pointer = gdk_device_get_core_pointer (); + gdouble axes[GDK_AXIS_LAST]; + + gdk_device_get_state (core_pointer, shell->canvas->window, axes, NULL); + + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_X, &coords->x); + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_Y, &coords->y); + + event->motion.x = coords->x; + event->motion.y = coords->y; + } + else + { + coords->x = x; + gdk_event_get_axis (event, GDK_AXIS_Y, &coords->y); + } +#else *coords = default_coords; coords->x = x; gdk_event_get_axis (event, GDK_AXIS_Y, &coords->y); +#endif /* CLAMP() the return value of each *_get_axis() call to be safe * against buggy XInput drivers. @@ -87,10 +117,34 @@ *coords = default_coords; +#ifdef G_OS_WIN32 + GimpGuiConfig *gui_config = shell->display->gui_config; +#endif + gdk_device_get_state (device, shell->canvas->window, axes, NULL); +#ifdef G_OS_WIN32 + if ((gui_config->system_coords_stylus && + (device->source == GDK_SOURCE_PEN || device->source == GDK_SOURCE_ERASER)) || + (gui_config->system_coords_puck && device->source == GDK_SOURCE_CURSOR)) + { + GdkDevice *core_pointer = gdk_device_get_core_pointer (); + gdouble _axes[GDK_AXIS_LAST]; + + gdk_device_get_state (core_pointer, shell->canvas->window, axes, NULL); + + gdk_device_get_axis (core_pointer, _axes, GDK_AXIS_X, &coords->x); + gdk_device_get_axis (core_pointer, _axes, GDK_AXIS_Y, &coords->y); + } + else + { + gdk_device_get_axis (device, axes, GDK_AXIS_X, &coords->x); + gdk_device_get_axis (device, axes, GDK_AXIS_Y, &coords->y); + } +#else gdk_device_get_axis (device, axes, GDK_AXIS_X, &coords->x); gdk_device_get_axis (device, axes, GDK_AXIS_Y, &coords->y); +#endif /* CLAMP() the return value of each *_get_axis() call to be safe * against buggy XInput drivers. --- gimp-2.6.9/app/display/gimpdisplayshell.c 2009-07-21 05:20:51 +0900 +++ gimp-painter--2.6.9/app/display/gimpdisplayshell.c 2010-06-26 21:51:26 +0900 @@ -1041,11 +1041,29 @@ gimp_display_shell_dnd_init (shell); gimp_display_shell_selection_init (shell); +#ifdef G_OS_WIN32 + /* Modify the x-y coords of motion event before invoking default handler */ + g_signal_connect_swapped (shell->canvas, "motion-notify-event", + G_CALLBACK (gimp_display_shell_motion_notify), + shell); + g_signal_connect_swapped (shell->vsb, "motion-notify-event", + G_CALLBACK (gimp_display_shell_motion_notify), + shell); + g_signal_connect_swapped (shell->hsb, "motion-notify-event", + G_CALLBACK (gimp_display_shell_motion_notify), + shell); +#endif + /* the horizontal ruler */ shell->hrule = gimp_ruler_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_events (GTK_WIDGET (shell->hrule), GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); +#ifdef G_OS_WIN32 + g_signal_connect_swapped (shell->hrule, "motion-notify-event", + G_CALLBACK (gimp_display_shell_motion_notify), + shell); +#endif g_signal_connect_swapped (shell->canvas, "motion-notify-event", G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->hrule)->motion_notify_event), shell->hrule); @@ -1060,6 +1078,11 @@ gtk_widget_set_events (GTK_WIDGET (shell->vrule), GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); +#ifdef G_OS_WIN32 + g_signal_connect_swapped (shell->vrule, "motion-notify-event", + G_CALLBACK (gimp_display_shell_motion_notify), + shell); +#endif g_signal_connect_swapped (shell->canvas, "motion-notify-event", G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->vrule)->motion_notify_event), shell->vrule); --- gimp-2.6.6/app/widgets/gimpdeviceinfo.c 2008-11-21 07:43:05 +0900 +++ gimp-painter--2.6.6-20100627/app/widgets/gimpdeviceinfo.c 2010-06-27 02:14:19 +0900 @@ -428,6 +428,18 @@ device_info->num_keys = device->num_keys; device_info->keys = NULL; +#ifdef G_OS_WIN32 + //g_printerr ("- - - ->> device name : %s\n", device->name); + { + gchar *name = g_ascii_strdown (device->name, -1); + + if (g_strrstr (name, "puck")) + gdk_device_set_source (device, GDK_SOURCE_CURSOR); + + g_free (name); + } +#endif + return device_info; } --- gimp-2.6.9/app/widgets/gimpnavigationview.c 2009-07-21 05:20:51 +0900 +++ gimp-painter--2.6.9/app/widgets/gimpnavigationview.c 2010-06-26 22:24:40 +0900 @@ -352,6 +352,15 @@ { GimpNavigationView *nav_view = GIMP_NAVIGATION_VIEW (widget); GimpView *view = GIMP_VIEW (widget); +#ifdef G_OS_WIN32 + GdkDevice *core_pointer = gdk_device_get_core_pointer (); + + gdouble axes[GDK_AXIS_LAST]; + + gdk_device_get_state (core_pointer, gtk_widget_get_parent_window (widget), axes, NULL); + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_X, &mevent->x); + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_Y, &mevent->y); +#endif if (! nav_view->has_grab) {