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);
|
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[] =
|
static const GimpActionEntry windows_actions[] =
|
||||||
{
|
{
|
||||||
{ "windows-menu", NULL, NC_("windows-action",
|
{ "windows-menu", NULL, NC_("windows-action",
|
||||||
|
@ -91,19 +98,24 @@ static const GimpActionEntry windows_actions[] =
|
||||||
"_Recently Closed Docks") },
|
"_Recently Closed Docks") },
|
||||||
{ "windows-dialogs-menu", NULL, NC_("windows-action",
|
{ "windows-dialogs-menu", NULL, NC_("windows-action",
|
||||||
"_Dockable Dialogs") },
|
"_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[] =
|
static const GimpToggleActionEntry windows_toggle_actions[] =
|
||||||
{
|
{
|
||||||
{ "windows-hide-docks", NULL,
|
{ "windows-hide-docks", NULL,
|
||||||
NC_("windows-action", "Hide Docks"),
|
NC_("windows-action", "Hide Docks"), "Tab",
|
||||||
/* 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", "When enabled docks and other dialogs are hidden, leaving only image windows."),
|
NC_("windows-action", "When enabled docks and other dialogs are hidden, leaving only image windows."),
|
||||||
G_CALLBACK (windows_hide_docks_cmd_callback),
|
G_CALLBACK (windows_hide_docks_cmd_callback),
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
|
@ -46,8 +46,8 @@ void
|
||||||
windows_hide_docks_cmd_callback (GtkAction *action,
|
windows_hide_docks_cmd_callback (GtkAction *action,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||||
Gimp *gimp = NULL;
|
Gimp *gimp;
|
||||||
return_if_no_gimp (gimp, data);
|
return_if_no_gimp (gimp, data);
|
||||||
|
|
||||||
if (GIMP_GUI_CONFIG (gimp->config)->hide_docks == active)
|
if (GIMP_GUI_CONFIG (gimp->config)->hide_docks == active)
|
||||||
|
@ -63,7 +63,7 @@ windows_use_single_window_mode_cmd_callback (GtkAction *action,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||||
Gimp *gimp = NULL;
|
Gimp *gimp;
|
||||||
return_if_no_gimp (gimp, data);
|
return_if_no_gimp (gimp, data);
|
||||||
|
|
||||||
if (GIMP_GUI_CONFIG (gimp->config)->single_window_mode == active)
|
if (GIMP_GUI_CONFIG (gimp->config)->single_window_mode == active)
|
||||||
|
@ -74,11 +74,55 @@ windows_use_single_window_mode_cmd_callback (GtkAction *action,
|
||||||
NULL);
|
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
|
void
|
||||||
windows_show_display_cmd_callback (GtkAction *action,
|
windows_show_display_cmd_callback (GtkAction *action,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpDisplay *display = g_object_get_data (G_OBJECT (action), "display");
|
GimpDisplay *display = g_object_get_data (G_OBJECT (action), "display");
|
||||||
|
|
||||||
gimp_display_shell_present (gimp_display_get_shell (display));
|
gimp_display_shell_present (gimp_display_get_shell (display));
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,11 @@ void windows_hide_docks_cmd_callback (GtkAction *action,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
void windows_use_single_window_mode_cmd_callback (GtkAction *action,
|
void windows_use_single_window_mode_cmd_callback (GtkAction *action,
|
||||||
gpointer data);
|
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,
|
void windows_show_display_cmd_callback (GtkAction *action,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
void windows_show_dock_cmd_callback (GtkAction *action,
|
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);
|
gboolean *update_software_cursor);
|
||||||
|
|
||||||
static void gimp_display_shell_toggle_hide_docks (GimpDisplayShell *shell);
|
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);
|
||||||
|
|
||||||
|
@ -259,8 +261,11 @@ 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)
|
||||||
{
|
{
|
||||||
gimp_display_shell_toggle_hide_docks (shell);
|
if (! (kevent->state & GDK_MOD1_MASK))
|
||||||
return TRUE;
|
{
|
||||||
|
gimp_display_shell_toggle_hide_docks (shell);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1073,6 +1078,13 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||||
-1, kevent->time);
|
-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
|
else
|
||||||
{
|
{
|
||||||
gimp_display_shell_toggle_hide_docks (shell);
|
gimp_display_shell_toggle_hide_docks (shell);
|
||||||
|
@ -1414,6 +1426,28 @@ gimp_display_shell_toggle_hide_docks (GimpDisplayShell *shell)
|
||||||
"windows-hide-docks");
|
"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,
|
||||||
|
|
Loading…
Reference in New Issue