Commit 958de4c2 authored by Martin Nordholts's avatar Martin Nordholts

Bug 554125 – Tab key doesn't hide utility windows when there is no

image open.
	
* app/widgets/gimpdialogfactory.[ch]: Add 'toggle_visibility' to
GimpDialogFactory and as a parameter to gimp_dialog_factory_new(),
and set it there.

(gimp_dialog_factories_hide_foreach): Don't hide dialogs belonging
to factories with toggle_visibility FALSE.

* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_canvas_tool_events): Move no-image event
handling to a new helper function, and make pressing Tab hide
windows.

* app/dialogs/dialogs.c (dialogs_init): Allow toggling visibility
for all factories except the display-factory.

svn path=/trunk/; revision=27077
parent 8938cca4
2008-09-29 Martin Nordholts <martinn@svn.gnome.org>
Bug 554125 – Tab key doesn't hide utility windows when there is no
image open.
* app/widgets/gimpdialogfactory.[ch]: Add 'toggle_visibility' to
GimpDialogFactory and as a parameter to gimp_dialog_factory_new(),
and set it there.
(gimp_dialog_factories_hide_foreach): Don't hide dialogs belonging
to factories with toggle_visibility FALSE.
* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_canvas_tool_events): Move no-image event
handling to a new helper function, and make pressing Tab hide
windows.
* app/dialogs/dialogs.c (dialogs_init): Allow toggling visibility
for all factories except the display-factory.
2008-09-29 Michael Natterer <mitch@gimp.org>
* app/core/gimpcurve.c (gimp_curve_copy): no need to memcpy() the
......
......@@ -249,26 +249,30 @@ dialogs_init (Gimp *gimp,
global_dialog_factory = gimp_dialog_factory_new ("toplevel",
gimp_get_user_context (gimp),
menu_factory,
NULL);
NULL,
TRUE);
global_toolbox_factory = gimp_dialog_factory_new ("toolbox",
gimp_get_user_context (gimp),
menu_factory,
dialogs_toolbox_get);
dialogs_toolbox_get,
TRUE);
gimp_dialog_factory_set_constructor (global_toolbox_factory,
dialogs_dockable_constructor);
global_dock_factory = gimp_dialog_factory_new ("dock",
gimp_get_user_context (gimp),
menu_factory,
dialogs_dock_new);
dialogs_dock_new,
TRUE);
gimp_dialog_factory_set_constructor (global_dock_factory,
dialogs_dockable_constructor);
global_display_factory = gimp_dialog_factory_new ("display",
gimp_get_user_context (gimp),
menu_factory,
NULL);
NULL,
FALSE);
for (i = 0; i < G_N_ELEMENTS (toplevel_entries); i++)
gimp_dialog_factory_register_entry (global_dialog_factory,
......
......@@ -539,6 +539,46 @@ gimp_display_shell_update_focus (GimpDisplayShell *shell,
shell->display);
}
static gboolean
gimp_display_shell_canvas_no_image_events (GtkWidget *canvas,
GdkEvent *event,
GimpDisplayShell *shell)
{
switch (event->type)
{
case GDK_BUTTON_PRESS:
{
GdkEventButton *bevent = (GdkEventButton *) event;
if (bevent->button == 3)
{
gimp_ui_manager_ui_popup (shell->popup_manager,
"/dummy-menubar/image-popup",
GTK_WIDGET (shell),
NULL, NULL, NULL, NULL);
}
}
break;
case GDK_KEY_PRESS:
{
GdkEventKey *kevent = (GdkEventKey *) event;
if (kevent->keyval == GDK_Tab ||
kevent->keyval == GDK_ISO_Left_Tab)
{
gimp_dialog_factories_toggle ();
}
}
break;
default:
break;
}
return TRUE;
}
gboolean
gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
GdkEvent *event,
......@@ -573,16 +613,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
if (! image)
{
if (event->type == GDK_BUTTON_PRESS &&
((GdkEventButton *) event)->button == 3)
{
gimp_ui_manager_ui_popup (shell->popup_manager,
"/dummy-menubar/image-popup",
GTK_WIDGET (shell),
NULL, NULL, NULL, NULL);
}
return TRUE;
return gimp_display_shell_canvas_no_image_events (canvas, event, shell);
}
gdk_display = gtk_widget_get_display (canvas);
......
......@@ -146,6 +146,7 @@ gimp_dialog_factory_init (GimpDialogFactory *factory)
factory->registered_dialogs = NULL;
factory->session_infos = NULL;
factory->open_dialogs = NULL;
factory->toggle_visibility = FALSE;
}
static void
......@@ -237,7 +238,8 @@ GimpDialogFactory *
gimp_dialog_factory_new (const gchar *name,
GimpContext *context,
GimpMenuFactory *menu_factory,
GimpDialogNewFunc new_dock_func)
GimpDialogNewFunc new_dock_func,
gboolean toggle_visibility)
{
GimpDialogFactory *factory;
gpointer key;
......@@ -267,9 +269,10 @@ gimp_dialog_factory_new (const gchar *name,
g_hash_table_insert (GIMP_DIALOG_FACTORY_GET_CLASS (factory)->factories,
key, factory);
factory->context = context;
factory->menu_factory = menu_factory;
factory->new_dock_func = new_dock_func;
factory->context = context;
factory->menu_factory = menu_factory;
factory->new_dock_func = new_dock_func;
factory->toggle_visibility = toggle_visibility;
return factory;
}
......@@ -1405,6 +1408,9 @@ gimp_dialog_factories_hide_foreach (gconstpointer key,
{
GList *list;
if (! factory->toggle_visibility)
return;
for (list = factory->open_dialogs; list; list = g_list_next (list))
{
GtkWidget *widget = list->data;
......
......@@ -87,6 +87,7 @@ struct _GimpDialogFactory
GList *session_infos;
GList *open_dialogs;
gboolean toggle_visibility;
};
struct _GimpDialogFactoryClass
......@@ -107,7 +108,8 @@ GType gimp_dialog_factory_get_type (void) G_GNUC_CONST;
GimpDialogFactory * gimp_dialog_factory_new (const gchar *name,
GimpContext *context,
GimpMenuFactory *menu_factory,
GimpDialogNewFunc new_dock_func);
GimpDialogNewFunc new_dock_func,
gboolean toggle_visibility);
GimpDialogFactory * gimp_dialog_factory_from_name (const gchar *name);
......
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