Commit 78bf44dd authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

update shell->popup_factory only if this is the active display or we will

2003-11-11  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell-appearance.c: update
	shell->popup_factory only if this is the active display or we will
	change another display's options when creating a new display.
	Fixes bug #126668.

	* app/display/gimpdisplayshell-callbacks.c
	* app/gui/view-commands.c
	* app/tools/gimpimagemaptool.c: do the same here. Can't really
	happen in these places but it's more correct to have the check
	for the active display.

	* app/display/gimpdisplay.c (gimp_display_flush_whenever): get the
	active display from the user_context, not the current_context.

	* app/gui/image-menu.c (image_menu_update): removed unused code.
parent 5728a40c
2003-11-11 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-appearance.c: update
shell->popup_factory only if this is the active display or we will
change another display's options when creating a new display.
Fixes bug #126668.
* app/display/gimpdisplayshell-callbacks.c
* app/gui/view-commands.c
* app/tools/gimpimagemaptool.c: do the same here. Can't really
happen in these places but it's more correct to have the check
for the active display.
* app/display/gimpdisplay.c (gimp_display_flush_whenever): get the
active display from the user_context, not the current_context.
* app/gui/image-menu.c (image_menu_update): removed unused code.
2003-11-11 Sven Neumann <sven@gimp.org>
 
* app/display/gimpdisplayshell-selection.[ch]: removed
......@@ -55,6 +55,10 @@
if (! gdisp) \
return
#define IS_ACTIVE_DISPLAY(gdisp) \
((gdisp) == \
gimp_context_get_display (gimp_get_user_context ((gdisp)->gimage->gimp)))
void
view_zoom_out_cmd_callback (GtkWidget *widget,
......@@ -145,9 +149,11 @@ view_dot_for_dot_cmd_callback (GtkWidget *widget,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Dot for Dot",
shell->dot_for_dot);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Dot for Dot",
shell->dot_for_dot);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Dot for Dot",
shell->dot_for_dot);
}
}
......@@ -319,9 +325,11 @@ view_snap_to_guides_cmd_callback (GtkWidget *widget,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Snap to Guides",
shell->snap_to_guides);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Guides",
shell->snap_to_guides);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Guides",
shell->snap_to_guides);
}
}
......@@ -358,9 +366,11 @@ view_snap_to_grid_cmd_callback (GtkWidget *widget,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Snap to Grid",
shell->snap_to_grid);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Grid",
shell->snap_to_grid);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Grid",
shell->snap_to_grid);
}
}
......@@ -406,9 +416,11 @@ view_fullscreen_cmd_callback (GtkWidget *widget,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Fullscreen",
fullscreen);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Fullscreen",
fullscreen);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Fullscreen",
fullscreen);
}
}
......
......@@ -502,13 +502,13 @@ gimp_display_flush_whenever (GimpDisplay *gdisp,
/* ensure the consistency of the menus */
if (! now)
{
GimpContext *context;
GimpContext *user_context;
gimp_item_factory_update (shell->menubar_factory, shell);
context = gimp_get_current_context (gdisp->gimage->gimp);
user_context = gimp_get_user_context (gdisp->gimage->gimp);
if (gdisp == gimp_context_get_display (context))
if (gdisp == gimp_context_get_display (user_context))
gimp_item_factory_update (shell->popup_factory, shell);
}
}
......
......@@ -502,13 +502,13 @@ gimp_display_flush_whenever (GimpDisplay *gdisp,
/* ensure the consistency of the menus */
if (! now)
{
GimpContext *context;
GimpContext *user_context;
gimp_item_factory_update (shell->menubar_factory, shell);
context = gimp_get_current_context (gdisp->gimage->gimp);
user_context = gimp_get_user_context (gdisp->gimage->gimp);
if (gdisp == gimp_context_get_display (context))
if (gdisp == gimp_context_get_display (user_context))
gimp_item_factory_update (shell->popup_factory, shell);
}
}
......
......@@ -25,6 +25,8 @@
#include "display-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpitemfactory.h"
......@@ -40,8 +42,14 @@
#include "gimpdisplayshell-render.h"
#define GET_OPTIONS(shell) (gimp_display_shell_get_fullscreen (shell) ? \
shell->fullscreen_options : shell->options)
#define GET_OPTIONS(shell) \
(gimp_display_shell_get_fullscreen (shell) ? \
shell->fullscreen_options : shell->options)
#define IS_ACTIVE_DISPLAY(shell) \
((shell)->gdisp == \
gimp_context_get_display (gimp_get_user_context \
((shell)->gdisp->gimage->gimp)))
void
......@@ -96,8 +104,10 @@ gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Menubar", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Menubar", show);
if (IS_ACTIVE_DISPLAY (shell))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Menubar", show);
}
gboolean
......@@ -144,8 +154,10 @@ gimp_display_shell_set_show_rulers (GimpDisplayShell *shell,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Rulers", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Rulers", show);
if (IS_ACTIVE_DISPLAY (shell))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Rulers", show);
}
gboolean
......@@ -198,8 +210,10 @@ gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Scrollbars", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Scrollbars", show);
if (IS_ACTIVE_DISPLAY (shell))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Scrollbars", show);
}
gboolean
......@@ -237,8 +251,10 @@ gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Statusbar", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Statusbar", show);
if (IS_ACTIVE_DISPLAY (shell))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Statusbar", show);
}
gboolean
......@@ -266,8 +282,10 @@ gimp_display_shell_set_show_selection (GimpDisplayShell *shell,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Selection", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Selection", show);
if (IS_ACTIVE_DISPLAY (shell))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Selection", show);
}
gboolean
......@@ -295,8 +313,10 @@ gimp_display_shell_set_show_layer (GimpDisplayShell *shell,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Layer Boundary", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Layer Boundary", show);
if (IS_ACTIVE_DISPLAY (shell))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Layer Boundary", show);
}
gboolean
......@@ -324,8 +344,10 @@ gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Grid", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Grid", show);
if (IS_ACTIVE_DISPLAY (shell))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Grid", show);
}
gboolean
......@@ -348,8 +370,10 @@ gimp_display_shell_set_snap_to_grid (GimpDisplayShell *shell,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Snap to Grid", snap);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Grid", snap);
if (IS_ACTIVE_DISPLAY (shell))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Grid", snap);
}
}
......@@ -378,8 +402,10 @@ gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Guides", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Guides", show);
if (IS_ACTIVE_DISPLAY (shell))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Guides", show);
}
gboolean
......
......@@ -223,6 +223,9 @@ gimp_display_shell_events (GtkWidget *widget,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Fullscreen", fullscreen);
if (shell->gdisp ==
gimp_context_get_display (gimp_get_user_context (gimp)))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Fullscreen", fullscreen);
}
......
......@@ -1313,8 +1313,6 @@ image_menu_update (GtkItemFactory *item_factory,
GimpLayer *layer = NULL;
GimpVectors *vectors = NULL;
GimpImageType drawable_type = -1;
GimpRGB fg;
GimpRGB bg;
gboolean is_rgb = FALSE;
gboolean is_gray = FALSE;
gboolean is_indexed = FALSE;
......@@ -1382,9 +1380,6 @@ image_menu_update (GtkItemFactory *item_factory,
gdk_display_get_n_screens (gtk_widget_get_display (GTK_WIDGET (shell)));
}
gimp_context_get_foreground (gimp_get_user_context (gimp), &fg);
gimp_context_get_background (gimp_get_user_context (gimp), &bg);
#define SET_ACTIVE(menu,condition) \
gimp_item_factory_set_active (item_factory, menu, (condition) != 0)
#define SET_VISIBLE(menu,condition) \
......
......@@ -55,6 +55,10 @@
if (! gdisp) \
return
#define IS_ACTIVE_DISPLAY(gdisp) \
((gdisp) == \
gimp_context_get_display (gimp_get_user_context ((gdisp)->gimage->gimp)))
void
view_zoom_out_cmd_callback (GtkWidget *widget,
......@@ -145,9 +149,11 @@ view_dot_for_dot_cmd_callback (GtkWidget *widget,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Dot for Dot",
shell->dot_for_dot);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Dot for Dot",
shell->dot_for_dot);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Dot for Dot",
shell->dot_for_dot);
}
}
......@@ -319,9 +325,11 @@ view_snap_to_guides_cmd_callback (GtkWidget *widget,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Snap to Guides",
shell->snap_to_guides);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Guides",
shell->snap_to_guides);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Guides",
shell->snap_to_guides);
}
}
......@@ -358,9 +366,11 @@ view_snap_to_grid_cmd_callback (GtkWidget *widget,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Snap to Grid",
shell->snap_to_grid);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Grid",
shell->snap_to_grid);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Grid",
shell->snap_to_grid);
}
}
......@@ -406,9 +416,11 @@ view_fullscreen_cmd_callback (GtkWidget *widget,
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Fullscreen",
fullscreen);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Fullscreen",
fullscreen);
if (IS_ACTIVE_DISPLAY (gdisp))
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Fullscreen",
fullscreen);
}
}
......
......@@ -1313,8 +1313,6 @@ image_menu_update (GtkItemFactory *item_factory,
GimpLayer *layer = NULL;
GimpVectors *vectors = NULL;
GimpImageType drawable_type = -1;
GimpRGB fg;
GimpRGB bg;
gboolean is_rgb = FALSE;
gboolean is_gray = FALSE;
gboolean is_indexed = FALSE;
......@@ -1382,9 +1380,6 @@ image_menu_update (GtkItemFactory *item_factory,
gdk_display_get_n_screens (gtk_widget_get_display (GTK_WIDGET (shell)));
}
gimp_context_get_foreground (gimp_get_user_context (gimp), &fg);
gimp_context_get_background (gimp_get_user_context (gimp), &bg);
#define SET_ACTIVE(menu,condition) \
gimp_item_factory_set_active (item_factory, menu, (condition) != 0)
#define SET_VISIBLE(menu,condition) \
......
......@@ -24,6 +24,8 @@
#include "tools-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-pick-color.h"
......@@ -347,7 +349,7 @@ gimp_image_map_tool_response (GtkWidget *widget,
GimpDisplayShell *shell;
GimpTool *tool;
tool = GIMP_TOOL (image_map_tool);
tool = GIMP_TOOL (image_map_tool);
switch (response_id)
{
......@@ -357,7 +359,7 @@ gimp_image_map_tool_response (GtkWidget *widget,
break;
case GTK_RESPONSE_OK:
/* Fix for bug #126524 - only set shell in the case
/* Fix for bug #126524 - only set shell in the case
* where we need it */
shell = GIMP_DISPLAY_SHELL (tool->gdisp->shell);
gtk_widget_hide (image_map_tool->shell);
......@@ -378,7 +380,10 @@ gimp_image_map_tool_response (GtkWidget *widget,
gimp_tool_control_set_preserve (tool->control, FALSE);
gimp_item_factory_update (shell->menubar_factory, shell);
gimp_item_factory_update (shell->popup_factory, shell);
if (shell->gdisp == gimp_context_get_display
(gimp_get_user_context (shell->gdisp->gimage->gimp)))
gimp_item_factory_update (shell->popup_factory, shell);
tool->gdisp = NULL;
tool->drawable = NULL;
......
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