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

To be multihead safe, each new window or menu needs to be associated with

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

	To be multihead safe, each new window or menu needs to be
	associated with a GdkScreen or it will pop up on the default
	screen.

	* libgimpwidgets/gimpquerybox.[ch]
	* app/display/gimpdisplayshell-layer-select.[ch]
	* app/widgets/widgets-types.h
	* app/widgets/gimpitemfactory.[ch]
	* app/widgets/gimpitemtreeview.[ch]
	* app/widgets/gimptemplateview.[ch]
	* app/widgets/gimptooldialog.[ch]
	* app/widgets/gimpviewabledialog.[ch]
	* app/gui/channels-commands.[ch]
	* app/gui/color-notebook.[ch]
	* app/gui/convert-dialog.[ch]
	* app/gui/edit-commands.[ch]
	* app/gui/grid-dialog.[ch]
	* app/gui/image-commands.[ch]
	* app/gui/info-dialog.[ch]
	* app/gui/layers-commands.[ch]
	* app/gui/offset-dialog.[ch]
	* app/gui/resize-dialog.[ch]
	* app/gui/stroke-dialog.[ch]
	* app/gui/templates-commands.[ch]
	* app/gui/vectors-commands.[ch]: added "GtkWidget *parent"
	paramaters to all functions which create menus, popups or windows
	and pass "parent" to gimp_dialog_new() or one of the various
	wrappers around it. As a side effect, this fixes bug #61092.

	* app/widgets/gimpdialogfactory.[ch]: added "GdkScreen *screen"
	instead of "parent" here since there are no possible parent
	windows on startup.

	* app/display/gimpdisplayshell-callbacks.c
	(gimp_display_shell_origin_button_press): added a quick hack to
	send a display to another screen: click the origin button with the
	middle mouse button.

	* app/display/gimpdisplayshell.c
	(gimp_display_shell_screen_changed): don't chain up
	undonditionally (don't crash).

	* libgimpwidgets/gimpdialog.c (gimp_dialog_new_valist): set the
	dialog's screen from a non-GtkWidget parent widget. The rest of
	non-window parent widget handling is still unimplemented.

	* libgimpwidgets/gimpcolorbutton.c
	* app/widgets/gimpcolormapeditor.c
	* app/widgets/gimpcolorpanel.c
	* app/widgets/gimpcomponenteditor.c
	* app/widgets/gimpcontainereditor.c
	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimpcontainerpopup.c
	* app/widgets/gimpcontainertreeview.c
	* app/widgets/gimpdatafactoryview.c
	* app/widgets/gimpdevicestatus.c
	* app/widgets/gimpdockable.c
	* app/widgets/gimpdrawabletreeview.c
	* app/widgets/gimperrorconsole.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimphelp.c
	* app/widgets/gimppaletteeditor.c
	* app/widgets/gimppreview-popup.c
	* app/widgets/gimpselectioneditor.c
	* app/widgets/gimpsessioninfo.c
	* app/widgets/gimptoolbox-color-area.c
	* app/widgets/gimptoolbox-indicator-area.c
	* app/widgets/gimptoolbox.c
	* app/widgets/gimptooloptionseditor.c
	* app/widgets/gimpvectorstreeview.c
	* app/widgets/gimpwidgets-utils.c
	* app/display/gimpdisplayshell-scale.c
	* app/display/gimpnavigationview.c
	* app/gui/module-browser.c
	* app/gui/dialogs-commands.c
	* app/gui/dialogs-constructors.c
	* app/gui/drawable-commands.c
	* app/gui/file-commands.c
	* app/gui/file-new-dialog.c
	* app/gui/file-save-dialog.c
	* app/gui/gradient-editor-commands.c
	* app/gui/gui-vtable.c
	* app/gui/gui.c
	* app/gui/info-window.c
	* app/gui/palette-import-dialog.c
	* app/gui/palettes-commands.c
	* app/gui/qmask-commands.c
	* app/gui/select-commands.c
	* app/gui/tool-options-commands.c
	* app/gui/view-commands.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimptransformtool.c
	* plug-ins/FractalExplorer/FractalExplorer.c
	* plug-ins/gfig/gfig.c
	* plug-ins/gflare/gflare.c: changed accordingly. Changed all
	menu_position funcs to place the menu on the right screen.
parent bcd9794a
......@@ -311,6 +311,7 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool)
g_return_if_fail (tool->drawable != NULL);
picker_tool->dialog = gimp_tool_dialog_new (tool->tool_info,
GIMP_TOOL (picker_tool)->gdisp->shell,
_("Color Picker Information"),
GTK_STOCK_CLOSE,
......
......@@ -957,6 +957,7 @@ crop_info_create (GimpCropTool *crop)
GIMP_OBJECT (tool->tool_info)->name,
stock_id,
_("Crop & Resize Information"),
GTK_WIDGET (shell),
gimp_standard_help_func,
tool->tool_info->help_id);
......
......@@ -212,7 +212,9 @@ gimp_image_map_tool_initialize (GimpTool *tool,
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
image_map_tool->shell = shell =
gimp_tool_dialog_new (tool_info, image_map_tool->shell_desc,
gimp_tool_dialog_new (tool_info,
gdisp->shell,
image_map_tool->shell_desc,
GIMP_STOCK_RESET, RESPONSE_RESET,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......
......@@ -827,12 +827,13 @@ gimp_measure_tool_dialog_update (GimpMeasureTool *mtool,
static GtkWidget *
gimp_measure_tool_dialog_new (GimpMeasureTool *mtool)
{
GtkWidget *dialog;
GtkWidget *hbox;
GtkWidget *table;
GtkWidget *label;
GtkWidget *dialog;
GtkWidget *hbox;
GtkWidget *table;
GtkWidget *label;
dialog = gimp_tool_dialog_new (GIMP_TOOL (mtool)->tool_info,
GIMP_TOOL (mtool)->gdisp->shell,
_("Measure Distances and Angles"),
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
......
......@@ -1275,6 +1275,7 @@ gimp_transform_tool_dialog (GimpTransformTool *tr_tool)
GIMP_OBJECT (tool_info)->name,
stock_id,
tr_tool->shell_desc,
GIMP_TOOL (tr_tool)->gdisp->shell,
gimp_standard_help_func,
tool_info->help_id);
......
......@@ -770,6 +770,7 @@ gimp_colormap_preview_button_press (GtkWidget *widget,
gimp_colormap_editor_set_index (editor, col);
gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory,
GIMP_EDITOR (editor)->item_factory_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
return TRUE;
......@@ -928,6 +929,7 @@ gimp_colormap_edit_clicked (GtkWidget *widget,
_("Edit Indexed Color"),
GIMP_STOCK_CONVERT_INDEXED,
_("Edit Indexed Image Palette Color"),
GTK_WIDGET (editor),
toplevel_factory,
"gimp-colormap-editor-color-dialog",
(const GimpRGB *) &color,
......
......@@ -94,7 +94,7 @@ gimp_color_panel_get_type (void)
"GimpColorPanel",
&panel_info, 0);
}
return panel_type;
}
......@@ -110,7 +110,7 @@ gimp_color_panel_class_init (GimpColorPanelClass *klass)
widget_class = GTK_WIDGET_CLASS (klass);
button_class = GTK_BUTTON_CLASS (klass);
color_button_class = GIMP_COLOR_BUTTON_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_color_panel_destroy;
......@@ -132,7 +132,7 @@ gimp_color_panel_destroy (GtkObject *object)
GimpColorPanel *panel;
g_return_if_fail (GIMP_IS_COLOR_PANEL (object));
panel = GIMP_COLOR_PANEL (object);
if (panel->color_notebook)
......@@ -258,6 +258,7 @@ gimp_color_panel_clicked (GtkButton *button)
{
panel->color_notebook =
color_notebook_new (GIMP_COLOR_BUTTON (button)->title,
GTK_WIDGET (button),
NULL, NULL,
(const GimpRGB *) &color,
gimp_color_panel_select_callback,
......
......@@ -492,6 +492,7 @@ gimp_component_editor_button_press (GtkWidget *widget,
case 3:
gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory,
GIMP_EDITOR (editor)->item_factory_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
break;
......
......@@ -264,6 +264,7 @@ gimp_container_editor_real_context_item (GimpContainerEditor *editor,
if (gimp_editor->item_factory)
gimp_item_factory_popup_with_data (gimp_editor->item_factory,
gimp_editor->item_factory_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
}
}
......
......@@ -373,7 +373,9 @@ gimp_container_grid_view_menu_position (GtkMenu *menu,
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
screen = gtk_widget_get_screen (widget);
gtk_menu_set_screen (menu, screen);
if (*x + requisition.width > gdk_screen_get_width (screen))
*x -= requisition.width;
......@@ -401,6 +403,7 @@ gimp_container_grid_view_popup_menu (GtkWidget *widget)
{
gimp_item_factory_popup_with_data (editor->item_factory,
editor->item_factory_data,
GTK_WIDGET (editor),
gimp_container_grid_view_menu_position,
grid_view->selected_item,
NULL);
......
......@@ -591,6 +591,7 @@ gimp_container_popup_dialog_clicked (GtkWidget *button,
GimpContainerPopup *popup)
{
gimp_dialog_factory_dialog_raise (popup->dialog_factory,
gtk_widget_get_screen (button),
popup->dialog_identifier, -1);
g_signal_emit (popup, popup_signals[CONFIRM], 0);
}
......@@ -317,7 +317,9 @@ gimp_container_tree_view_menu_position (GtkMenu *menu,
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
screen = gtk_widget_get_screen (widget);
gtk_menu_set_screen (menu, screen);
if (*x + requisition.width > gdk_screen_get_width (screen))
*x -= requisition.width;
......@@ -346,6 +348,7 @@ gimp_container_tree_view_popup_menu (GtkWidget *widget)
{
gimp_item_factory_popup_with_data (editor->item_factory,
editor->item_factory_data,
GTK_WIDGET (editor),
gimp_container_tree_view_menu_position,
editor,
NULL);
......
......@@ -403,6 +403,7 @@ gimp_data_factory_view_delete_clicked (GtkWidget *widget,
GIMP_OBJECT (data)->name);
dialog = gimp_query_boolean_box (_("Delete Data Object"),
GTK_WIDGET (view),
gimp_standard_help_func, NULL,
GIMP_STOCK_QUESTION,
str,
......
......@@ -433,5 +433,7 @@ gimp_device_status_preview_clicked (GtkWidget *widget,
dialog_factory = gimp_dialog_factory_from_name ("dock");
gimp_dialog_factory_dialog_raise (dialog_factory, identifier, -1);
gimp_dialog_factory_dialog_raise (dialog_factory,
gtk_widget_get_screen (widget),
identifier, -1);
}
......@@ -374,6 +374,7 @@ gimp_dialog_factory_find_session_info (GimpDialogFactory *factory,
static GtkWidget *
gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
GdkScreen *screen,
GimpContext *context,
const gchar *identifier,
gint preview_size,
......@@ -427,7 +428,7 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
{
GtkWidget *dockbook;
dock = gimp_dialog_factory_dock_new (factory);
dock = gimp_dialog_factory_dock_new (factory, screen);
dockbook = gimp_dockbook_new (factory->menu_factory);
gimp_dock_add_book (GIMP_DOCK (dock),
......@@ -509,6 +510,7 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
{
if (GTK_WIDGET_TOPLEVEL (dialog))
{
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
gtk_window_present (GTK_WINDOW (dialog));
}
else if (GIMP_IS_DOCKABLE (dialog))
......@@ -559,13 +561,16 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
**/
GtkWidget *
gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
GdkScreen *screen,
const gchar *identifier,
gint preview_size)
{
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
g_return_val_if_fail (identifier != NULL, NULL);
return gimp_dialog_factory_dialog_new_internal (factory,
screen,
factory->context,
identifier,
preview_size,
......@@ -588,13 +593,16 @@ gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
**/
GtkWidget *
gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
GdkScreen *screen,
const gchar *identifier,
gint preview_size)
{
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
g_return_val_if_fail (identifier != NULL, NULL);
return gimp_dialog_factory_dialog_new_internal (factory,
screen,
NULL,
identifier,
preview_size,
......@@ -630,6 +638,7 @@ gimp_dialog_factory_dockable_new (GimpDialogFactory *factory,
g_return_val_if_fail (identifier != NULL, NULL);
return gimp_dialog_factory_dialog_new_internal (factory,
gtk_widget_get_screen (GTK_WIDGET (dock)),
dock->context,
identifier,
preview_size,
......@@ -648,17 +657,21 @@ gimp_dialog_factory_dockable_new (GimpDialogFactory *factory,
* Return value: the newly created #GimpDock.
**/
GtkWidget *
gimp_dialog_factory_dock_new (GimpDialogFactory *factory)
gimp_dialog_factory_dock_new (GimpDialogFactory *factory,
GdkScreen *screen)
{
GtkWidget *dock;
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
g_return_val_if_fail (factory->new_dock_func != NULL, NULL);
dock = factory->new_dock_func (factory, factory->context, 0);
if (dock)
{
gtk_window_set_screen (GTK_WINDOW (dock), screen);
gimp_dialog_factory_set_widget_data (dock, factory, NULL);
gimp_dialog_factory_add_dialog (factory, dock);
......
......@@ -103,16 +103,19 @@ GimpSessionInfo * gimp_dialog_factory_find_session_info
const gchar *identifier);
GtkWidget * gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
GdkScreen *screen,
const gchar *identifier,
gint preview_size);
GtkWidget * gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
GdkScreen *screen,
const gchar *identifier,
gint preview_size);
GtkWidget * gimp_dialog_factory_dockable_new (GimpDialogFactory *factory,
GimpDock *dock,
const gchar *identifier,
gint preview_size);
GtkWidget * gimp_dialog_factory_dock_new (GimpDialogFactory *factory);
GtkWidget * gimp_dialog_factory_dock_new (GimpDialogFactory *factory,
GdkScreen *screen);
void gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
GtkWidget *dialog);
......
......@@ -809,7 +809,8 @@ gimp_dockable_detach (GimpDockable *dockable)
src_dock = dockable->dockbook->dock;
dock = gimp_dialog_factory_dock_new (src_dock->dialog_factory);
dock = gimp_dialog_factory_dock_new (src_dock->dialog_factory,
gtk_widget_get_screen (GTK_WIDGET (dockable)));
gimp_dock_setup (GIMP_DOCK (dock), src_dock);
gtk_window_set_position (GTK_WINDOW (dock), GTK_WIN_POS_MOUSE);
......@@ -954,6 +955,7 @@ gimp_dockable_show_menu (GimpDockable *dockable)
gimp_item_factory_popup_with_data (dockbook_item_factory,
dockable,
GTK_WIDGET (dockable),
gimp_dockable_menu_position,
dockable,
(GtkDestroyNotify) gimp_dockable_menu_end);
......
......@@ -218,7 +218,7 @@ gimp_drawable_tree_view_new_dropped (GimpItemTreeView *view,
gimp_image_undo_group_start (view->gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
_("New Layer"));
view->new_item_func (view->gimage, NULL, FALSE);
view->new_item_func (view->gimage, NULL, FALSE, GTK_WIDGET (view));
drawable = gimp_image_active_drawable (view->gimage);
......
......@@ -303,6 +303,7 @@ gimp_error_console_button_press (GtkWidget *widget,
gimp_item_factory_popup_with_data (editor->item_factory,
editor->item_factory_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
return TRUE;
}
......
......@@ -713,6 +713,7 @@ preview_events (GtkWidget *widget,
gimp_item_factory_popup_with_data (gimp_editor->item_factory,
gimp_editor->item_factory_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
}
break;
......@@ -1152,6 +1153,7 @@ control_button_press (GimpGradientEditor *editor,
gimp_item_factory_popup_with_data (gimp_editor->item_factory,
gimp_editor->item_factory_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
return;
}
......
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