mirror of https://github.com/GNOME/gimp.git
app: make Alt+Tab and Alt+Shift+Tab cycle through all open displays
in both multi- and single-window mode. This is useful especially in multi-window mode because in single-window we can already cycle through all tabs with Ctrl+PageUp/Down.
This commit is contained in:
parent
edad544e73
commit
8e5f18fb9e
|
@ -83,6 +83,13 @@ static void windows_actions_single_window_mode_notify (GimpDisplayConfig *confi
|
|||
GimpActionGroup *group);
|
||||
|
||||
|
||||
/* The only reason we have "Tab" in the action entries below is to
|
||||
* give away the hardcoded keyboard shortcut. If the user changes the
|
||||
* shortcut to something else, both that shortcut and Tab will
|
||||
* work. The reason we have the shortcut hardcoded is beccause
|
||||
* gtk_accelerator_valid() returns FALSE for GDK_tab.
|
||||
*/
|
||||
|
||||
static const GimpActionEntry windows_actions[] =
|
||||
{
|
||||
{ "windows-menu", NULL, NC_("windows-action",
|
||||
|
@ -91,19 +98,24 @@ static const GimpActionEntry windows_actions[] =
|
|||
"_Recently Closed Docks") },
|
||||
{ "windows-dialogs-menu", NULL, NC_("windows-action",
|
||||
"_Dockable Dialogs") },
|
||||
|
||||
{ "windows-show-display-next", NULL,
|
||||
NC_("windows-action", "Next Image"), "<alt>Tab",
|
||||
NC_("windows-action", "Switch to the next image"),
|
||||
G_CALLBACK (windows_show_display_next_cmd_callback),
|
||||
NULL },
|
||||
|
||||
{ "windows-show-display-previous", NULL,
|
||||
NC_("windows-action", "Previous Image"), "<alt><shift>Tab",
|
||||
NC_("windows-action", "Switch to the previous image"),
|
||||
G_CALLBACK (windows_show_display_previous_cmd_callback),
|
||||
NULL }
|
||||
};
|
||||
|
||||
static const GimpToggleActionEntry windows_toggle_actions[] =
|
||||
{
|
||||
{ "windows-hide-docks", NULL,
|
||||
NC_("windows-action", "Hide Docks"),
|
||||
/* The only reason we have Tab here is to give away the hardcoded
|
||||
* keyboard shortcut. If the user changes the shortcut to
|
||||
* something else, both that shortcut and Tab will work. The
|
||||
* reason we have the shortcut hardcoded is beccause
|
||||
* gtk_accelerator_valid() returns FALSE for GDK_tab.
|
||||
*/
|
||||
"Tab",
|
||||
NC_("windows-action", "Hide Docks"), "Tab",
|
||||
NC_("windows-action", "When enabled docks and other dialogs are hidden, leaving only image windows."),
|
||||
G_CALLBACK (windows_hide_docks_cmd_callback),
|
||||
FALSE,
|
||||
|
|
|
@ -47,7 +47,7 @@ windows_hide_docks_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||
Gimp *gimp = NULL;
|
||||
Gimp *gimp;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
if (GIMP_GUI_CONFIG (gimp->config)->hide_docks == active)
|
||||
|
@ -63,7 +63,7 @@ windows_use_single_window_mode_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||
Gimp *gimp = NULL;
|
||||
Gimp *gimp;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
if (GIMP_GUI_CONFIG (gimp->config)->single_window_mode == active)
|
||||
|
@ -74,6 +74,50 @@ windows_use_single_window_mode_cmd_callback (GtkAction *action,
|
|||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
windows_show_display_next_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *display;
|
||||
Gimp *gimp;
|
||||
gint index;
|
||||
return_if_no_display (display, data);
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
index = gimp_container_get_child_index (gimp->displays,
|
||||
GIMP_OBJECT (display));
|
||||
index++;
|
||||
|
||||
if (index >= gimp_container_get_n_children (gimp->displays))
|
||||
index = 0;
|
||||
|
||||
display = GIMP_DISPLAY (gimp_container_get_child_by_index (gimp->displays,
|
||||
index));
|
||||
gimp_display_shell_present (gimp_display_get_shell (display));
|
||||
}
|
||||
|
||||
void
|
||||
windows_show_display_previous_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *display;
|
||||
Gimp *gimp;
|
||||
gint index;
|
||||
return_if_no_display (display, data);
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
index = gimp_container_get_child_index (gimp->displays,
|
||||
GIMP_OBJECT (display));
|
||||
index--;
|
||||
|
||||
if (index < 0)
|
||||
index = gimp_container_get_n_children (gimp->displays) - 1;
|
||||
|
||||
display = GIMP_DISPLAY (gimp_container_get_child_by_index (gimp->displays,
|
||||
index));
|
||||
gimp_display_shell_present (gimp_display_get_shell (display));
|
||||
}
|
||||
|
||||
void
|
||||
windows_show_display_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
|
|
|
@ -23,6 +23,11 @@ void windows_hide_docks_cmd_callback (GtkAction *action,
|
|||
gpointer data);
|
||||
void windows_use_single_window_mode_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void windows_show_display_next_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void windows_show_display_previous_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void windows_show_display_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void windows_show_dock_cmd_callback (GtkAction *action,
|
||||
|
|
|
@ -109,6 +109,8 @@ static void gimp_display_shell_untransform_event_coords (GimpDisplayShell
|
|||
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);
|
||||
|
||||
|
@ -258,11 +260,14 @@ gimp_display_shell_canvas_no_image_events (GtkWidget *canvas,
|
|||
|
||||
if (kevent->keyval == GDK_KEY_Tab ||
|
||||
kevent->keyval == GDK_KEY_ISO_Left_Tab)
|
||||
{
|
||||
if (! (kevent->state & GDK_MOD1_MASK))
|
||||
{
|
||||
gimp_display_shell_toggle_hide_docks (shell);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1073,6 +1078,13 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
-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);
|
||||
|
@ -1414,6 +1426,28 @@ gimp_display_shell_toggle_hide_docks (GimpDisplayShell *shell)
|
|||
"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
|
||||
gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
|
||||
gint x,
|
||||
|
|
Loading…
Reference in New Issue