app: gimpdisplayshell-tool-events.c: move Tab handling to a utility function
instead of having separate utility functions for the different functions triggered by various Tab combinations.
This commit is contained in:
@ -84,6 +84,9 @@ static void gimp_display_shell_space_released (GimpDisplayShell
|
|||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
const GimpCoords *image_coords);
|
const GimpCoords *image_coords);
|
||||||
|
|
||||||
|
static gboolean gimp_display_shell_tab_pressed (GimpDisplayShell *shell,
|
||||||
|
GdkEventKey *event);
|
||||||
|
|
||||||
static void gimp_display_shell_update_focus (GimpDisplayShell *shell,
|
static void gimp_display_shell_update_focus (GimpDisplayShell *shell,
|
||||||
gboolean focus_in,
|
gboolean focus_in,
|
||||||
const GimpCoords *image_coords,
|
const GimpCoords *image_coords,
|
||||||
@ -108,10 +111,6 @@ static void gimp_display_shell_untransform_event_coords (GimpDisplayShell
|
|||||||
GimpCoords *image_coords,
|
GimpCoords *image_coords,
|
||||||
gboolean *update_software_cursor);
|
gboolean *update_software_cursor);
|
||||||
|
|
||||||
static void gimp_display_shell_toggle_hide_docks (GimpDisplayShell *shell);
|
|
||||||
static void gimp_display_shell_show_display_next (GimpDisplayShell *shell);
|
|
||||||
static void gimp_display_shell_show_display_previous (GimpDisplayShell *shell);
|
|
||||||
|
|
||||||
static GdkEvent * gimp_display_shell_compress_motion (GimpDisplayShell *shell);
|
static GdkEvent * gimp_display_shell_compress_motion (GimpDisplayShell *shell);
|
||||||
|
|
||||||
|
|
||||||
@ -261,11 +260,7 @@ gimp_display_shell_canvas_no_image_events (GtkWidget *canvas,
|
|||||||
if (kevent->keyval == GDK_KEY_Tab ||
|
if (kevent->keyval == GDK_KEY_Tab ||
|
||||||
kevent->keyval == GDK_KEY_ISO_Left_Tab)
|
kevent->keyval == GDK_KEY_ISO_Left_Tab)
|
||||||
{
|
{
|
||||||
if (! (kevent->state & GDK_MOD1_MASK))
|
return gimp_display_shell_tab_pressed (shell, kevent);
|
||||||
{
|
|
||||||
gimp_display_shell_toggle_hide_docks (shell);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1066,30 +1061,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||||||
|
|
||||||
case GDK_KEY_Tab:
|
case GDK_KEY_Tab:
|
||||||
case GDK_KEY_ISO_Left_Tab:
|
case GDK_KEY_ISO_Left_Tab:
|
||||||
if (state & GDK_CONTROL_MASK)
|
gimp_display_shell_tab_pressed (shell, kevent);
|
||||||
{
|
|
||||||
if (! gimp_image_is_empty (image))
|
|
||||||
{
|
|
||||||
if (kevent->keyval == GDK_KEY_Tab)
|
|
||||||
gimp_display_shell_layer_select_init (shell,
|
|
||||||
1, kevent->time);
|
|
||||||
else
|
|
||||||
gimp_display_shell_layer_select_init (shell,
|
|
||||||
-1, kevent->time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (state & GDK_MOD1_MASK)
|
|
||||||
{
|
|
||||||
if (kevent->keyval == GDK_KEY_Tab)
|
|
||||||
gimp_display_shell_show_display_next (shell);
|
|
||||||
else
|
|
||||||
gimp_display_shell_show_display_previous (shell);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gimp_display_shell_toggle_hide_docks (shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
return_val = TRUE;
|
return_val = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1415,39 +1387,6 @@ gimp_display_shell_check_device_cursor (GimpDisplayShell *shell)
|
|||||||
shell->draw_cursor = ! gimp_device_info_has_cursor (current_device);
|
shell->draw_cursor = ! gimp_device_info_has_cursor (current_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_display_shell_toggle_hide_docks (GimpDisplayShell *shell)
|
|
||||||
{
|
|
||||||
GimpImageWindow *window = gimp_display_shell_get_window (shell);
|
|
||||||
|
|
||||||
if (window)
|
|
||||||
gimp_ui_manager_activate_action (gimp_image_window_get_ui_manager (window),
|
|
||||||
"windows",
|
|
||||||
"windows-hide-docks");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_display_shell_show_display_next (GimpDisplayShell *shell)
|
|
||||||
{
|
|
||||||
GimpImageWindow *window = gimp_display_shell_get_window (shell);
|
|
||||||
|
|
||||||
if (window)
|
|
||||||
gimp_ui_manager_activate_action (gimp_image_window_get_ui_manager (window),
|
|
||||||
"windows",
|
|
||||||
"windows-show-display-next");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_display_shell_show_display_previous (GimpDisplayShell *shell)
|
|
||||||
{
|
|
||||||
GimpImageWindow *window = gimp_display_shell_get_window (shell);
|
|
||||||
|
|
||||||
if (window)
|
|
||||||
gimp_ui_manager_activate_action (gimp_image_window_get_ui_manager (window),
|
|
||||||
"windows",
|
|
||||||
"windows-show-display-previous");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
|
gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
|
||||||
gint x,
|
gint x,
|
||||||
@ -1596,6 +1535,53 @@ gimp_display_shell_space_released (GimpDisplayShell *shell,
|
|||||||
shell->space_release_pending = FALSE;
|
shell->space_release_pending = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gimp_display_shell_tab_pressed (GimpDisplayShell *shell,
|
||||||
|
GdkEventKey *kevent)
|
||||||
|
{
|
||||||
|
GimpImageWindow *window = gimp_display_shell_get_window (shell);
|
||||||
|
GimpUIManager *manager = gimp_image_window_get_ui_manager (window);
|
||||||
|
GimpImage *image = gimp_display_get_image (shell->display);
|
||||||
|
|
||||||
|
if (kevent->state & GDK_CONTROL_MASK)
|
||||||
|
{
|
||||||
|
if (image && ! gimp_image_is_empty (image))
|
||||||
|
{
|
||||||
|
if (kevent->keyval == GDK_KEY_Tab)
|
||||||
|
gimp_display_shell_layer_select_init (shell,
|
||||||
|
1, kevent->time);
|
||||||
|
else
|
||||||
|
gimp_display_shell_layer_select_init (shell,
|
||||||
|
-1, kevent->time);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (kevent->state & GDK_MOD1_MASK)
|
||||||
|
{
|
||||||
|
if (image)
|
||||||
|
{
|
||||||
|
if (kevent->keyval == GDK_KEY_Tab)
|
||||||
|
gimp_ui_manager_activate_action (manager, "windows",
|
||||||
|
"windows-show-display-next");
|
||||||
|
else
|
||||||
|
gimp_ui_manager_activate_action (manager, "windows",
|
||||||
|
"windows-show-display-previous");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gimp_ui_manager_activate_action (manager, "windows",
|
||||||
|
"windows-hide-docks");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_display_shell_update_focus (GimpDisplayShell *shell,
|
gimp_display_shell_update_focus (GimpDisplayShell *shell,
|
||||||
gboolean focus_in,
|
gboolean focus_in,
|
||||||
|
Reference in New Issue
Block a user