app: add gimp_devices_add_widget()
which is supposed to set up a widget for tablet events and make sure the context changes on device changes. "supposed" because everything is currently horribly broken on GTK+ 2.x. Use the function for all affected widgets except for the canvas.
This commit is contained in:
@ -46,6 +46,7 @@
|
||||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimptemplate.h"
|
||||
|
||||
#include "widgets/gimpdevices.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpuimanager.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
@ -544,11 +545,8 @@ gimp_display_shell_constructor (GType type,
|
||||
|
||||
gimp_help_set_help_data (shell->vrule, NULL, GIMP_HELP_IMAGE_WINDOW_RULER);
|
||||
|
||||
/* Workaround for GTK+ Wintab bug on Windows when creating guides by
|
||||
* dragging from the rulers. See bug #168516.
|
||||
*/
|
||||
gtk_widget_set_extension_events (shell->hrule, GDK_EXTENSION_EVENTS_ALL);
|
||||
gtk_widget_set_extension_events (shell->vrule, GDK_EXTENSION_EVENTS_ALL);
|
||||
gimp_devices_add_widget (shell->display->gimp, shell->hrule);
|
||||
gimp_devices_add_widget (shell->display->gimp, shell->vrule);
|
||||
|
||||
g_signal_connect (shell->canvas, "realize",
|
||||
G_CALLBACK (gimp_display_shell_canvas_realize),
|
||||
|
@ -309,6 +309,20 @@ gimp_devices_get_current (Gimp *gimp)
|
||||
return manager->current_device;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_devices_add_widget (Gimp *gimp,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
gtk_widget_set_extension_events (widget, GDK_EXTENSION_EVENTS_ALL);
|
||||
|
||||
g_signal_connect (widget, "motion-notify-event",
|
||||
G_CALLBACK (gimp_devices_check_callback),
|
||||
gimp);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_devices_check_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
@ -317,7 +331,8 @@ gimp_devices_check_callback (GtkWidget *widget,
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
|
||||
gimp_devices_check_change (gimp, event);
|
||||
if (! gimp->busy)
|
||||
gimp_devices_check_change (gimp, event);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ gboolean gimp_devices_clear (Gimp *gimp,
|
||||
GimpContainer * gimp_devices_get_list (Gimp *gimp);
|
||||
GimpDeviceInfo * gimp_devices_get_current (Gimp *gimp);
|
||||
|
||||
void gimp_devices_add_widget (Gimp *gimp,
|
||||
GtkWidget *widget);
|
||||
|
||||
gboolean gimp_devices_check_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
Gimp *gimp);
|
||||
|
@ -305,13 +305,8 @@ gimp_toolbox_constructed (GObject *object)
|
||||
|
||||
if (! list) /* all devices have cursor */
|
||||
{
|
||||
g_signal_connect (toolbox, "motion-notify-event",
|
||||
G_CALLBACK (gimp_devices_check_callback),
|
||||
toolbox->p->context->gimp);
|
||||
|
||||
gtk_widget_add_events (GTK_WIDGET (toolbox), GDK_POINTER_MOTION_MASK);
|
||||
gtk_widget_set_extension_events (GTK_WIDGET (toolbox),
|
||||
GDK_EXTENSION_EVENTS_CURSOR);
|
||||
gimp_devices_add_widget (toolbox->p->context->gimp, GTK_WIDGET (toolbox));
|
||||
}
|
||||
|
||||
toolbox->p->color_area = toolbox_create_color_area (toolbox,
|
||||
|
Reference in New Issue
Block a user