Commit 23456dc2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/display/gimpdisplayshell-callbacks.c

2008-02-16  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell-callbacks.c
	* app/tools/gimpforegroundselecttool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimppolygonselecttool.c
	* app/tools/gimprectangletool.c
	* app/tools/gimptransformtool.c
	* app/tools/gimpvectortool.c
	* app/widgets/gimpcontainerpopup.c
	* app/widgets/gimppaletteview.c
	* libgimpwidgets/gimpcolorhexentry.c
	* libgimpwidgets/gimpnumberpairentry.c
	* plug-ins/script-fu/script-fu-console.c: Unify the handling of
	various "Enter" and "Space" keysyms all over the place. Fixes bug
	#516544 (also see gtk bug #515047).


svn path=/trunk/; revision=24894
parent ac980710
2008-02-16 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-callbacks.c
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpimagemaptool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimppolygonselecttool.c
* app/tools/gimprectangletool.c
* app/tools/gimptransformtool.c
* app/tools/gimpvectortool.c
* app/widgets/gimpcontainerpopup.c
* app/widgets/gimppaletteview.c
* libgimpwidgets/gimpcolorhexentry.c
* libgimpwidgets/gimpnumberpairentry.c
* plug-ins/script-fu/script-fu-console.c: Unify the handling of
various "Enter" and "Space" keysyms all over the place. Fixes bug
#516544 (also see gtk bug #515047).
2008-02-15 Kevin Cozens <kcozens@cvs.gnome.org>
* configure.in: Adding a ; to the end of the list of mime types in
......
......@@ -141,7 +141,8 @@ gimp_display_shell_events (GtkWidget *widget,
if (event->type == GDK_KEY_PRESS)
{
if (kevent->keyval == GDK_space && shell->space_release_pending)
if ((kevent->keyval == GDK_space ||
kevent->keyval == GDK_KP_Space) && shell->space_release_pending)
{
shell->space_pressed = TRUE;
shell->space_release_pending = FALSE;
......@@ -149,7 +150,8 @@ gimp_display_shell_events (GtkWidget *widget,
}
else
{
if (kevent->keyval == GDK_space && shell->space_pressed)
if ((kevent->keyval == GDK_space ||
kevent->keyval == GDK_KP_Space) && shell->space_pressed)
{
shell->space_pressed = FALSE;
shell->space_release_pending = TRUE;
......@@ -164,12 +166,15 @@ gimp_display_shell_events (GtkWidget *widget,
case GDK_Left: case GDK_Right:
case GDK_Up: case GDK_Down:
case GDK_space:
case GDK_KP_Space:
case GDK_Tab:
case GDK_ISO_Left_Tab:
case GDK_Alt_L: case GDK_Alt_R:
case GDK_Shift_L: case GDK_Shift_R:
case GDK_Control_L: case GDK_Control_R:
case GDK_Return: case GDK_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
case GDK_BackSpace: case GDK_Delete:
break;
......@@ -1346,6 +1351,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
case GDK_BackSpace:
case GDK_Delete:
case GDK_Escape:
......@@ -1369,6 +1375,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
break;
case GDK_space:
case GDK_KP_Space:
gimp_display_shell_space_pressed (shell, state, time);
return_val = TRUE;
break;
......@@ -1460,6 +1467,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
switch (kevent->keyval)
{
case GDK_space:
case GDK_KP_Space:
gimp_display_shell_space_released (shell, state, time);
return_val = TRUE;
break;
......
......@@ -398,8 +398,9 @@ gimp_foreground_select_tool_key_press (GimpTool *tool,
switch (kevent->keyval)
{
case GDK_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
gimp_foreground_select_tool_apply (fg_select, display);
return TRUE;
......
......@@ -476,8 +476,9 @@ gimp_image_map_tool_key_press (GimpTool *tool,
{
switch (kevent->keyval)
{
case GDK_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
gimp_image_map_tool_response (NULL, GTK_RESPONSE_OK, image_map_tool);
return TRUE;
......
......@@ -1060,8 +1060,9 @@ gimp_iscissors_tool_key_press (GimpTool *tool,
switch (kevent->keyval)
{
case GDK_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
if (iscissors->connected && iscissors->mask)
{
gimp_iscissors_tool_apply (iscissors, display);
......
......@@ -412,8 +412,9 @@ gimp_polygon_select_tool_key_press (GimpTool *tool,
handled_key = TRUE;
break;
case GDK_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
gimp_polygon_select_tool_commit (poly_sel_tool, display);
handled_key = TRUE;
break;
......
......@@ -1350,8 +1350,9 @@ gimp_rectangle_tool_key_press (GimpTool *tool,
dy = 1;
break;
case GDK_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
if (gimp_rectangle_tool_execute (rect_tool))
gimp_rectangle_tool_halt (rect_tool);
return TRUE;
......
......@@ -505,8 +505,9 @@ gimp_transform_tool_key_press (GimpTool *tool,
{
switch (kevent->keyval)
{
case GDK_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
gimp_transform_tool_response (NULL, GTK_RESPONSE_OK, trans_tool);
return TRUE;
......
......@@ -767,8 +767,9 @@ gimp_vector_tool_key_press (GimpTool *tool,
switch (kevent->keyval)
{
case GDK_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
gimp_vector_tool_to_selection_extended (vector_tool, kevent->state);
break;
......
......@@ -123,8 +123,12 @@ gimp_container_popup_class_init (GimpContainerPopupClass *klass)
"confirm", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0,
"confirm", 0);
gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0,
"confirm", 0);
gtk_binding_entry_add_signal (binding_set, GDK_space, 0,
"confirm", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, 0,
"confirm", 0);
}
static void
......
......@@ -266,9 +266,11 @@ gimp_palette_view_key_press (GtkWidget *widget,
GimpPaletteView *view = GIMP_PALETTE_VIEW (widget);
if (view->selected &&
(kevent->keyval == GDK_space ||
kevent->keyval == GDK_Return ||
kevent->keyval == GDK_KP_Enter))
(kevent->keyval == GDK_space ||
kevent->keyval == GDK_KP_Space ||
kevent->keyval == GDK_Return ||
kevent->keyval == GDK_KP_Enter ||
kevent->keyval == GDK_ISO_Enter))
{
g_signal_emit (view, view_signals[ENTRY_CLICKED], 0,
view->selected, kevent->state);
......
......@@ -216,39 +216,48 @@ gimp_color_hex_entry_events (GtkWidget *widget,
GdkEvent *event)
{
GimpColorHexEntry *entry = GIMP_COLOR_HEX_ENTRY (widget);
const gchar *text;
gchar buffer[8];
guchar r, g, b;
switch (event->type)
{
case GDK_KEY_PRESS:
if (((GdkEventKey *) event)->keyval != GDK_Return)
break;
/* else fall through */
{
GdkEventKey *kevent = (GdkEventKey *) event;
case GDK_FOCUS_CHANGE:
text = gtk_entry_get_text (GTK_ENTRY (widget));
if (kevent->keyval != GDK_Return &&
kevent->keyval != GDK_KP_Enter &&
kevent->keyval != GDK_ISO_Enter)
break;
/* else fall through */
}
gimp_rgb_get_uchar (&entry->color, &r, &g, &b);
g_snprintf (buffer, sizeof (buffer), "%.2x%.2x%.2x", r, g, b);
if (g_ascii_strcasecmp (buffer, text) != 0)
{
GimpRGB color;
gsize len = strlen (text);
if (len > 0 &&
(gimp_rgb_parse_hex (&color, text, len) ||
gimp_rgb_parse_name (&color, text, -1)))
{
gimp_color_hex_entry_set_color (entry, &color);
}
else
{
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
}
}
case GDK_FOCUS_CHANGE:
{
const gchar *text;
gchar buffer[8];
guchar r, g, b;
text = gtk_entry_get_text (GTK_ENTRY (widget));
gimp_rgb_get_uchar (&entry->color, &r, &g, &b);
g_snprintf (buffer, sizeof (buffer), "%.2x%.2x%.2x", r, g, b);
if (g_ascii_strcasecmp (buffer, text) != 0)
{
GimpRGB color;
gsize len = strlen (text);
if (len > 0 &&
(gimp_rgb_parse_hex (&color, text, len) ||
gimp_rgb_parse_name (&color, text, -1)))
{
gimp_color_hex_entry_set_color (entry, &color);
}
else
{
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
}
}
}
break;
default:
......
......@@ -818,7 +818,9 @@ gimp_number_pair_entry_events (GtkWidget *widget,
{
GdkEventKey *kevent = (GdkEventKey *) event;
if (kevent->keyval != GDK_Return)
if (kevent->keyval != GDK_Return &&
kevent->keyval != GDK_KP_Enter &&
kevent->keyval != GDK_ISO_Enter)
break;
/* If parsing was done due to widgets focus being lost, we only change
......
......@@ -564,6 +564,8 @@ script_fu_cc_key_function (GtkWidget *widget,
switch (event->keyval)
{
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
if (script_fu_cc_is_empty (console))
return TRUE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment