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

removed the "Move to Screen" hack.

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

	* app/display/gimpdisplayshell-callbacks.c: removed the
	"Move to Screen" hack.

	* app/gui/dialogs-commands.[ch]
	* app/gui/view-commands.[ch]
	* app/gui/dialogs-menu.c
	* app/gui/image-menu.c: added proper menu items to the
	<Image>/View and the <Dialogs> menus so all image windows and
	docks can be sent to other screens. Hide the menu items when
	there is just one screen.

	* app/widgets/gimphelp-ids.h: new help IDd for the new menu items.
parent 5d0df6fd
2003-11-10 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-callbacks.c: removed the
"Move to Screen" hack.
* app/gui/dialogs-commands.[ch]
* app/gui/view-commands.[ch]
* app/gui/dialogs-menu.c
* app/gui/image-menu.c: added proper menu items to the
<Image>/View and the <Dialogs> menus so all image windows and
docks can be sent to other screens. Hide the menu items when
there is just one screen.
* app/widgets/gimphelp-ids.h: new help IDd for the new menu items.
2003-11-10 Sven Neumann <sven@gimp.org>
 
* app/display/Makefile.am
......@@ -22,6 +22,8 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "widgets/gimpcontainerview.h"
......@@ -361,6 +363,74 @@ dialogs_toggle_auto_cmd_callback (GtkWidget *widget,
GTK_CHECK_MENU_ITEM (widget)->active);
}
static void
dialogs_change_screen_confirm_callback (GtkWidget *query_box,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
dialogs_change_screen_destroy_callback (GtkWidget *query_box,
GtkWidget *dock)
{
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL);
}
void
dialogs_change_screen_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
GtkWidget *dock;
GdkScreen *screen;
GdkDisplay *display;
gint cur_screen;
gint num_screens;
GtkWidget *qbox;
dock = GTK_WIDGET (dockbook->dock);
qbox = g_object_get_data (G_OBJECT (dock), "gimp-change-screen-dialog");
if (qbox)
{
gtk_window_present (GTK_WINDOW (qbox));
return;
}
screen = gtk_widget_get_screen (dock);
display = gtk_widget_get_display (dock);
cur_screen = gdk_screen_get_number (screen);
num_screens = gdk_display_get_n_screens (display);
qbox = gimp_query_int_box ("Move Dock to Screen",
dock,
NULL, 0,
"Enter Destination Screen:",
cur_screen, 0, num_screens - 1,
G_OBJECT (dock), "destroy",
dialogs_change_screen_confirm_callback,
dock);
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", qbox);
g_signal_connect (qbox, "destroy",
G_CALLBACK (dialogs_change_screen_destroy_callback),
dock);
gtk_widget_show (qbox);
}
void
dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
......
......@@ -56,6 +56,9 @@ void dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
void dialogs_toggle_auto_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_change_screen_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
......
......@@ -151,33 +151,6 @@ view_dot_for_dot_cmd_callback (GtkWidget *widget,
}
}
void
view_fullscreen_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gboolean fullscreen;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_fullscreen (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
fullscreen = (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
if (fullscreen != GTK_CHECK_MENU_ITEM (widget)->active)
{
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);
}
}
void
view_info_window_cmd_callback (GtkWidget *widget,
gpointer data)
......@@ -411,3 +384,96 @@ view_shrink_wrap_cmd_callback (GtkWidget *widget,
gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (gdisp->shell));
}
void
view_fullscreen_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gboolean fullscreen;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_fullscreen (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
fullscreen = (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
if (fullscreen != GTK_CHECK_MENU_ITEM (widget)->active)
{
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);
}
}
static void
view_change_screen_confirm_callback (GtkWidget *query_box,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
view_change_screen_destroy_callback (GtkWidget *query_box,
GtkWidget *shell)
{
g_object_set_data (G_OBJECT (shell), "gimp-change-screen-dialog", NULL);
}
void
view_change_screen_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GdkScreen *screen;
GdkDisplay *display;
gint cur_screen;
gint num_screens;
GtkWidget *qbox;
return_if_no_display (gdisp, data);
qbox = g_object_get_data (G_OBJECT (gdisp->shell),
"gimp-change-screen-dialog");
if (qbox)
{
gtk_window_present (GTK_WINDOW (qbox));
return;
}
screen = gtk_widget_get_screen (gdisp->shell);
display = gtk_widget_get_display (gdisp->shell);
cur_screen = gdk_screen_get_number (screen);
num_screens = gdk_display_get_n_screens (display);
qbox = gimp_query_int_box ("Move Display to Screen",
gdisp->shell,
NULL, 0,
"Enter Destination Screen:",
cur_screen, 0, num_screens - 1,
G_OBJECT (gdisp->shell), "destroy",
view_change_screen_confirm_callback,
gdisp->shell);
g_object_set_data (G_OBJECT (gdisp->shell), "gimp-change-screen-dialog", qbox);
g_signal_connect (qbox, "destroy",
G_CALLBACK (view_change_screen_destroy_callback),
gdisp->shell);
gtk_widget_show (qbox);
}
......@@ -33,8 +33,6 @@ void view_zoom_other_cmd_callback (GtkWidget *widget,
gpointer data);
void view_dot_for_dot_cmd_callback (GtkWidget *widget,
gpointer data);
void view_fullscreen_cmd_callback (GtkWidget *widget,
gpointer data);
void view_info_window_cmd_callback (GtkWidget *widget,
gpointer data);
void view_navigation_window_cmd_callback (GtkWidget *widget,
......@@ -63,8 +61,13 @@ void view_snap_to_grid_cmd_callback (GtkWidget *widget,
gpointer data);
void view_new_view_cmd_callback (GtkWidget *widget,
gpointer data);
void view_shrink_wrap_cmd_callback (GtkWidget *widget,
gpointer data);
void view_fullscreen_cmd_callback (GtkWidget *widget,
gpointer data);
void view_change_screen_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __VIEW_COMMANDS_H__ */
......@@ -1317,20 +1317,6 @@ gimp_display_shell_vruler_button_press (GtkWidget *widget,
return FALSE;
}
static void
gimp_display_shell_change_screen_callback (GtkWidget *query_box,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
gboolean
gimp_display_shell_origin_button_press (GtkWidget *widget,
GdkEventButton *event,
......@@ -1339,33 +1325,7 @@ gimp_display_shell_origin_button_press (GtkWidget *widget,
if (! shell->gdisp->gimage->gimp->busy)
{
if (event->button == 1)
{
gimp_display_shell_popup_menu (GTK_WIDGET (shell));
}
else if (event->button == 2)
{
GdkScreen *screen;
GdkDisplay *display;
gint cur_screen;
gint num_screens;
GtkWidget *qbox;
screen = gtk_widget_get_screen (widget);
display = gtk_widget_get_display (widget);
cur_screen = gdk_screen_get_number (screen);
num_screens = gdk_display_get_n_screens (display);
qbox = gimp_query_int_box ("Move Display to Screen",
GTK_WIDGET (shell),
NULL, 0,
"Enter Destination Screen:",
cur_screen, 0, num_screens - 1,
G_OBJECT (shell), "destroy",
gimp_display_shell_change_screen_callback,
shell);
gtk_widget_show (qbox);
}
gimp_display_shell_popup_menu (GTK_WIDGET (shell));
}
/* Return TRUE to stop signal emission so the button doesn't grab the
......
......@@ -22,6 +22,8 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "widgets/gimpcontainerview.h"
......@@ -361,6 +363,74 @@ dialogs_toggle_auto_cmd_callback (GtkWidget *widget,
GTK_CHECK_MENU_ITEM (widget)->active);
}
static void
dialogs_change_screen_confirm_callback (GtkWidget *query_box,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
dialogs_change_screen_destroy_callback (GtkWidget *query_box,
GtkWidget *dock)
{
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL);
}
void
dialogs_change_screen_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
GtkWidget *dock;
GdkScreen *screen;
GdkDisplay *display;
gint cur_screen;
gint num_screens;
GtkWidget *qbox;
dock = GTK_WIDGET (dockbook->dock);
qbox = g_object_get_data (G_OBJECT (dock), "gimp-change-screen-dialog");
if (qbox)
{
gtk_window_present (GTK_WINDOW (qbox));
return;
}
screen = gtk_widget_get_screen (dock);
display = gtk_widget_get_display (dock);
cur_screen = gdk_screen_get_number (screen);
num_screens = gdk_display_get_n_screens (display);
qbox = gimp_query_int_box ("Move Dock to Screen",
dock,
NULL, 0,
"Enter Destination Screen:",
cur_screen, 0, num_screens - 1,
G_OBJECT (dock), "destroy",
dialogs_change_screen_confirm_callback,
dock);
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", qbox);
g_signal_connect (qbox, "destroy",
G_CALLBACK (dialogs_change_screen_destroy_callback),
dock);
gtk_widget_show (qbox);
}
void
dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
......
......@@ -56,6 +56,9 @@ void dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
void dialogs_toggle_auto_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_change_screen_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
......
......@@ -180,7 +180,11 @@ GimpItemFactoryEntry dialogs_menu_entries[] =
{ { N_("/Auto Follow Active _Image"), NULL,
dialogs_toggle_auto_cmd_callback, 0, "<ToggleItem>" },
NULL,
GIMP_HELP_DOCK_AUTO_BUTTON, NULL }
GIMP_HELP_DOCK_AUTO_BUTTON, NULL },
{ { N_("/Move to Screen..."), NULL,
dialogs_change_screen_cmd_callback, 0, NULL },
NULL,
GIMP_HELP_DOCK_CHANGE_SCREEN, NULL }
};
#undef ADD_TAB
......@@ -204,6 +208,7 @@ dialogs_menu_update (GtkItemFactory *factory,
GimpPreviewSize preview_size = -1;
GimpTabStyle tab_style = -1;
gint n_pages = 0;
gint n_screens = 1;
if (GIMP_IS_DOCKBOOK (data))
{
......@@ -356,6 +361,9 @@ dialogs_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/View as List", list_view_available);
}
n_screens = gdk_display_get_n_screens
(gtk_widget_get_display (GTK_WIDGET (dockbook->dock)));
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
GimpImageDock *image_dock = GIMP_IMAGE_DOCK (dockbook->dock);
......@@ -369,11 +377,13 @@ dialogs_menu_update (GtkItemFactory *factory,
}
else
{
SET_VISIBLE ("/image-menu-separator", FALSE);
SET_VISIBLE ("/image-menu-separator", n_screens > 1);
SET_VISIBLE ("/Show Image Menu", FALSE);
SET_VISIBLE ("/Auto Follow Active Image", FALSE);
}
SET_VISIBLE ("/Move to Screen...", n_screens > 1);
#undef SET_ACTIVE
#undef SET_VISIBLE
#undef SET_SENSITIVE
......
......@@ -482,6 +482,11 @@ GimpItemFactoryEntry image_menu_entries[] =
NULL,
GIMP_HELP_VIEW_FULLSCREEN, NULL },
{ { N_("/View/Move to Screen..."), NULL,
view_change_screen_cmd_callback, 0, NULL },
NULL,
GIMP_HELP_VIEW_CHANGE_SCREEN, NULL },
/* <Image>/Image */
MENU_BRANCH (N_("/_Image")),
......@@ -1322,6 +1327,7 @@ image_menu_update (GtkItemFactory *item_factory,
gint lind = -1;
gint lnum = -1;
gboolean fullscreen = FALSE;
gint n_screens = 1;
gimp = GIMP_ITEM_FACTORY (item_factory)->gimp;
......@@ -1371,6 +1377,9 @@ image_menu_update (GtkItemFactory *item_factory,
fullscreen = gimp_display_shell_get_fullscreen (shell);
options = fullscreen ? shell->fullscreen_options : shell->options;
n_screens =
gdk_display_get_n_screens (gtk_widget_get_display (GTK_WIDGET (shell)));
}
gimp_context_get_foreground (gimp_get_user_context (gimp), &fg);
......@@ -1378,6 +1387,8 @@ image_menu_update (GtkItemFactory *item_factory,
#define SET_ACTIVE(menu,condition) \
gimp_item_factory_set_active (item_factory, menu, (condition) != 0)
#define SET_VISIBLE(menu,condition) \
gimp_item_factory_set_visible (item_factory, menu, (condition) != 0)
#define SET_LABEL(menu,label) \
gimp_item_factory_set_label (item_factory, menu, (label))
#define SET_SENSITIVE(menu,condition) \
......@@ -1509,10 +1520,10 @@ image_menu_update (GtkItemFactory *item_factory,
SET_SENSITIVE ("/View/Show Statusbar", gdisp);
SET_ACTIVE ("/View/Show Statusbar", gdisp && options->show_statusbar);
SET_SENSITIVE ("/View/Shrink Wrap", gdisp);
SET_SENSITIVE ("/View/Fullscreen", gdisp);
SET_ACTIVE ("/View/Fullscreen", gdisp && fullscreen);
SET_SENSITIVE ("/View/Shrink Wrap", gdisp);
SET_SENSITIVE ("/View/Fullscreen", gdisp);
SET_ACTIVE ("/View/Fullscreen", gdisp && fullscreen);
SET_VISIBLE ("/View/Move to Screen...", gdisp && n_screens > 1);
/* Image */
......@@ -1600,6 +1611,7 @@ image_menu_update (GtkItemFactory *item_factory,
SET_SENSITIVE ("/Layer/Transform/Offset...", lp);
#undef SET_ACTIVE
#undef SET_VISIBLE
#undef SET_LABEL
#undef SET_SENSITIVE
......
......@@ -151,33 +151,6 @@ view_dot_for_dot_cmd_callback (GtkWidget *widget,
}
}
void
view_fullscreen_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gboolean fullscreen;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_fullscreen (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
fullscreen = (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
if (fullscreen != GTK_CHECK_MENU_ITEM (widget)->active)
{
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);
}
}
void
view_info_window_cmd_callback (GtkWidget *widget,
gpointer data)
......@@ -411,3 +384,96 @@ view_shrink_wrap_cmd_callback (GtkWidget *widget,
gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (gdisp->shell));
}
void
view_fullscreen_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gboolean fullscreen;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_set_fullscreen (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
fullscreen = (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
if (fullscreen != GTK_CHECK_MENU_ITEM (widget)->active)
{
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);
}
}
static void
view_change_screen_confirm_callback (GtkWidget *query_box,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
view_change_screen_destroy_callback (GtkWidget *query_box,
GtkWidget *shell)
{
g_object_set_data (G_OBJECT (shell), "gimp-change-screen-dialog", NULL);
}
void