2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2005-11-18 04:16:07 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2005-11-18 04:16:07 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2005-11-18 04:16:07 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2005-11-18 04:16:07 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2005-11-24 08:39:12 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2013-11-02 05:28:18 +08:00
|
|
|
#include <gegl.h>
|
2005-11-18 04:16:07 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "actions-types.h"
|
|
|
|
|
2005-11-24 08:39:12 +08:00
|
|
|
#include "widgets/gimpmessagebox.h"
|
|
|
|
#include "widgets/gimpmessagedialog.h"
|
|
|
|
|
2005-11-18 04:16:07 +08:00
|
|
|
#include "actions.h"
|
|
|
|
#include "window-commands.h"
|
|
|
|
|
2017-02-12 23:06:34 +08:00
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
2005-11-18 04:16:07 +08:00
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
void
|
2019-07-02 22:12:18 +08:00
|
|
|
window_close_cmd_callback (GimpAction *action,
|
2019-07-04 07:11:48 +08:00
|
|
|
GVariant *value,
|
2019-07-02 22:12:18 +08:00
|
|
|
gpointer data)
|
2005-11-18 04:16:07 +08:00
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2009-10-18 00:59:40 +08:00
|
|
|
if (! gtk_widget_is_toplevel (widget))
|
2005-11-18 04:16:07 +08:00
|
|
|
widget = gtk_widget_get_toplevel (widget);
|
|
|
|
|
2011-04-08 09:09:15 +08:00
|
|
|
if (widget && gtk_widget_get_window (widget))
|
2005-11-18 04:16:07 +08:00
|
|
|
{
|
|
|
|
GdkEvent *event = gdk_event_new (GDK_DELETE);
|
|
|
|
|
2009-10-09 17:20:10 +08:00
|
|
|
event->any.window = g_object_ref (gtk_widget_get_window (widget));
|
2005-11-18 04:16:07 +08:00
|
|
|
event->any.send_event = TRUE;
|
|
|
|
|
|
|
|
gtk_main_do_event (event);
|
|
|
|
gdk_event_free (event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-24 08:39:12 +08:00
|
|
|
void
|
2019-07-02 22:12:18 +08:00
|
|
|
window_open_display_cmd_callback (GimpAction *action,
|
2019-07-04 07:11:48 +08:00
|
|
|
GVariant *value,
|
2019-07-02 22:12:18 +08:00
|
|
|
gpointer data)
|
2005-11-24 08:39:12 +08:00
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *entry;
|
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
dialog = gimp_message_dialog_new ("Open Display", GIMP_ICON_WILBER_EEK,
|
2005-11-24 08:39:12 +08:00
|
|
|
widget, GTK_DIALOG_MODAL,
|
|
|
|
NULL, NULL,
|
|
|
|
|
2017-02-12 23:06:34 +08:00
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
_("_OK"), GTK_RESPONSE_OK,
|
2005-11-24 08:39:12 +08:00
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
2018-05-10 23:04:37 +08:00
|
|
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
2007-10-09 21:30:36 +08:00
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
2005-11-24 08:39:12 +08:00
|
|
|
|
|
|
|
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
|
|
|
"Experimental multi-display stuff!\n"
|
|
|
|
"Click OK and have fun crashing GIMP...");
|
|
|
|
|
|
|
|
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
|
|
|
"Please enter the name of the new display:");
|
|
|
|
|
|
|
|
entry = gtk_entry_new ();
|
|
|
|
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
|
2010-10-30 20:56:00 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GIMP_MESSAGE_DIALOG (dialog)->box), entry,
|
|
|
|
TRUE, TRUE, 0);
|
2005-11-24 08:39:12 +08:00
|
|
|
|
|
|
|
gtk_widget_grab_focus (entry);
|
|
|
|
gtk_widget_show_all (dialog);
|
|
|
|
|
|
|
|
while (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
|
|
|
|
{
|
|
|
|
gchar *screen_name;
|
|
|
|
|
|
|
|
screen_name = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
|
|
|
|
|
|
|
|
if (strcmp (screen_name, ""))
|
|
|
|
{
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (dialog, FALSE);
|
|
|
|
|
|
|
|
display = gdk_display_open (screen_name);
|
|
|
|
|
|
|
|
if (! display)
|
|
|
|
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
|
|
|
"Can't open display '%s'. "
|
|
|
|
"Please try another one:",
|
|
|
|
screen_name);
|
|
|
|
|
|
|
|
g_free (screen_name);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (dialog, TRUE);
|
|
|
|
|
|
|
|
if (display)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_grab_focus (entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
}
|
|
|
|
|
2005-11-18 04:16:07 +08:00
|
|
|
void
|
2019-07-02 22:12:18 +08:00
|
|
|
window_move_to_screen_cmd_callback (GimpAction *action,
|
2019-07-04 07:11:48 +08:00
|
|
|
GVariant *value,
|
2019-07-02 22:12:18 +08:00
|
|
|
gpointer data)
|
2005-11-18 04:16:07 +08:00
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2019-09-05 00:03:47 +08:00
|
|
|
#if 0
|
2005-11-18 04:16:07 +08:00
|
|
|
GdkScreen *screen;
|
2019-09-05 00:03:47 +08:00
|
|
|
#endif
|
2005-11-18 04:16:07 +08:00
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2019-07-04 07:11:48 +08:00
|
|
|
#if 0
|
2009-10-18 00:59:40 +08:00
|
|
|
if (! gtk_widget_is_toplevel (widget))
|
2005-11-18 04:16:07 +08:00
|
|
|
widget = gtk_widget_get_toplevel (widget);
|
|
|
|
|
|
|
|
screen = g_object_get_data (G_OBJECT (current), "screen");
|
|
|
|
|
|
|
|
if (GDK_IS_SCREEN (screen) && screen != gtk_widget_get_screen (widget))
|
|
|
|
{
|
|
|
|
gtk_window_set_screen (GTK_WINDOW (widget), screen);
|
|
|
|
}
|
2019-07-04 07:11:48 +08:00
|
|
|
#endif
|
2005-11-18 04:16:07 +08:00
|
|
|
}
|