[gimp/gtk3-port: 256/274] Port a lot of stuff from GdkScreen/monitor_number to GdkMonitor
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 256/274] Port a lot of stuff from GdkScreen/monitor_number to GdkMonitor
- Date: Tue, 1 May 2018 21:48:30 +0000 (UTC)
commit a0e83830af58248758f438af6651a28723683ca1
Author: Michael Natterer <mitch gimp org>
Date: Sun Apr 29 17:27:47 2018 +0200
Port a lot of stuff from GdkScreen/monitor_number to GdkMonitor
including some fixes for getting pointer coords, and needed
API changes in libgimpwidgets.
app/actions/buffers-commands.c | 3 +-
app/actions/data-commands.c | 9 +-
app/actions/dialogs-commands.c | 2 -
app/actions/documents-commands.c | 3 +-
app/actions/edit-commands.c | 4 +-
app/actions/file-commands.c | 8 +--
app/actions/image-commands.c | 4 +-
app/actions/images-commands.c | 3 +-
app/actions/palettes-commands.c | 1 -
app/actions/select-commands.c | 1 -
app/actions/templates-commands.c | 3 +-
app/actions/tool-options-commands.c | 1 -
app/actions/view-commands.c | 4 +-
app/actions/windows-commands.c | 1 -
app/app.c | 9 +-
app/core/gimp-gui.c | 19 ++--
app/core/gimp-gui.h | 14 +--
app/dialogs/dialogs.c | 16 +--
app/dialogs/file-open-dialog.c | 3 +-
app/dialogs/file-open-location-dialog.c | 3 +-
app/dialogs/image-new-dialog.c | 3 +-
app/dialogs/preferences-dialog.c | 8 +-
app/display/gimpdisplay.c | 7 +-
app/display/gimpdisplay.h | 3 +-
app/display/gimpdisplayshell-dnd.c | 18 +---
app/display/gimpdisplayshell-handlers.c | 3 +-
app/display/gimpdisplayshell.c | 36 ++-----
app/display/gimpdisplayshell.h | 6 +-
app/display/gimpimagewindow.c | 86 +++++-----------
app/display/gimpimagewindow.h | 3 +-
app/display/gimpmultiwindowstrategy.c | 8 +-
app/display/gimpsinglewindowstrategy.c | 12 +--
app/display/gimptooldialog.c | 4 +-
app/display/gimptooldialog.h | 3 +-
app/display/gimptoolgui.c | 20 ++---
app/display/gimptoolgui.h | 6 +-
app/file/file-open.c | 19 ++--
app/file/file-open.h | 9 +-
app/gui/gimpdbusservice.c | 4 +-
app/gui/gimpuiconfigurer.c | 8 +-
app/gui/gui-message.c | 23 ++---
app/gui/gui-vtable.c | 62 +++++++-----
app/gui/gui-vtable.h | 5 +-
app/gui/gui.c | 39 +++-----
app/gui/session.c | 9 +-
app/gui/session.h | 17 ++--
app/gui/splash.c | 19 ++--
app/gui/splash.h | 3 +-
app/pdb/display-cmds.c | 2 +-
app/plug-in/gimppluginmanager-call.c | 7 +-
app/tests/gimp-app-test-utils.c | 4 +-
app/tools/gimpcolorpickertool.c | 1 -
app/tools/gimpcolortool.c | 6 +-
app/tools/gimpfiltertool.c | 1 -
app/tools/gimpforegroundselecttool.c | 1 -
app/tools/gimpgradienttool-editor.c | 1 -
app/tools/gimpmeasuretool.c | 1 -
app/tools/gimptexttool-editor.c | 1 -
app/tools/gimptransformtool.c | 1 -
app/tools/gimpwarptool.c | 3 +-
app/widgets/gimpcairo-wilber.c | 7 +-
app/widgets/gimpcolordialog.c | 1 -
app/widgets/gimpcontainerpopup.c | 1 -
app/widgets/gimpcontrollereditor.c | 1 -
app/widgets/gimpcontrollerlist.c | 1 -
app/widgets/gimpdashboard.c | 9 +-
app/widgets/gimpdevicestatus.c | 1 -
app/widgets/gimpdialogfactory.c | 50 ++++------
app/widgets/gimpdialogfactory.h | 15 +--
app/widgets/gimpdockable.c | 1 -
app/widgets/gimpsessioninfo-dock.c | 9 +-
app/widgets/gimpsessioninfo-dock.h | 3 +-
app/widgets/gimpsessioninfo-private.h | 3 +-
app/widgets/gimpsessioninfo.c | 138 ++++++++++++--------------
app/widgets/gimpsessioninfo.h | 6 +-
app/widgets/gimptoolbox-dnd.c | 15 +--
app/widgets/gimptoolbox-image-area.c | 1 -
app/widgets/gimptoolbox-indicator-area.c | 3 -
app/widgets/gimptoolbox.c | 3 +-
app/widgets/gimptoolpalette.c | 1 -
app/widgets/gimpviewablebox.c | 1 -
app/widgets/gimpwidgets-utils.c | 28 +++---
app/widgets/gimpwidgets-utils.h | 6 +-
app/widgets/gimpwindow.c | 24 ++---
app/widgets/gimpwindow.h | 3 +-
app/widgets/gimpwindowstrategy.c | 4 +-
app/widgets/gimpwindowstrategy.h | 6 +-
app/widgets/widgets-types.h | 3 +-
libgimpwidgets/gimppickbutton-default.c | 9 +-
libgimpwidgets/gimpwidgetsutils.c | 90 +++++++++--------
libgimpwidgets/gimpwidgetsutils.h | 7 +-
pdb/groups/display.pdb | 2 +-
plug-ins/screenshot/screenshot-freedesktop.c | 5 +-
plug-ins/screenshot/screenshot-freedesktop.h | 2 +-
plug-ins/screenshot/screenshot-gnome-shell.c | 11 +-
plug-ins/screenshot/screenshot-gnome-shell.h | 2 +-
plug-ins/screenshot/screenshot-kwin.c | 5 +-
plug-ins/screenshot/screenshot-kwin.h | 2 +-
plug-ins/screenshot/screenshot-win32.h | 2 +-
plug-ins/screenshot/screenshot-x11.c | 48 +++++-----
plug-ins/screenshot/screenshot-x11.h | 2 +-
plug-ins/screenshot/screenshot.c | 31 +++---
plug-ins/screenshot/screenshot.h | 2 +-
103 files changed, 462 insertions(+), 685 deletions(-)
---
diff --git a/app/actions/buffers-commands.c b/app/actions/buffers-commands.c
index 8af8962..e3f5763 100644
--- a/app/actions/buffers-commands.c
+++ b/app/actions/buffers-commands.c
@@ -118,8 +118,7 @@ buffers_paste_as_new_image_cmd_callback (GtkAction *action,
GIMP_OBJECT (buffer));
gimp_create_display (context->gimp, new_image,
GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (new_image);
}
}
diff --git a/app/actions/data-commands.c b/app/actions/data-commands.c
index 1bb6e16..ea63a90 100644
--- a/app/actions/data-commands.c
+++ b/app/actions/data-commands.c
@@ -79,8 +79,7 @@ data_open_as_image_cmd_callback (GtkAction *action,
image = file_open_with_display (context->gimp, context, NULL,
file, FALSE,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget),
+ G_OBJECT (gimp_widget_get_monitor (widget)),
&status, &error);
if (! image && status != GIMP_PDB_CANCEL)
@@ -278,15 +277,13 @@ data_edit_cmd_callback (GtkAction *action,
if (data && gimp_data_factory_view_have (view, GIMP_OBJECT (data)))
{
- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (view));
- gint monitor = gimp_widget_get_monitor (GTK_WIDGET (view));
- GtkWidget *dockable;
+ GdkMonitor *monitor = gimp_widget_get_monitor (GTK_WIDGET (view));
+ GtkWidget *dockable;
dockable =
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy
(context->gimp)),
context->gimp,
gimp_dialog_factory_get_singleton (),
- screen,
monitor,
value);
diff --git a/app/actions/dialogs-commands.c b/app/actions/dialogs-commands.c
index f75ba4d..4a0fe0c 100644
--- a/app/actions/dialogs-commands.c
+++ b/app/actions/dialogs-commands.c
@@ -46,7 +46,6 @@ dialogs_create_toplevel_cmd_callback (GtkAction *action,
if (value)
gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
NULL /*ui_manager*/,
value, -1, TRUE);
@@ -66,7 +65,6 @@ dialogs_create_dockable_cmd_callback (GtkAction *action,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (gimp)),
gimp,
gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
value);
}
diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c
index 8689a33..0c2aa5c 100644
--- a/app/actions/documents-commands.c
+++ b/app/actions/documents-commands.c
@@ -373,8 +373,7 @@ documents_open_image (GtkWidget *editor,
file = gimp_imagefile_get_file (imagefile);
image = file_open_with_display (context->gimp, context, NULL, file, FALSE,
- G_OBJECT (gtk_widget_get_screen (editor)),
- gimp_widget_get_monitor (editor),
+ G_OBJECT (gimp_widget_get_monitor (editor)),
&status, &error);
if (! image && status != GIMP_PDB_CANCEL)
diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c
index fb60dbb..618fc80 100644
--- a/app/actions/edit-commands.c
+++ b/app/actions/edit-commands.c
@@ -384,8 +384,7 @@ edit_paste_as_new_image_cmd_callback (GtkAction *action,
if (image)
{
gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (image);
}
else
@@ -468,7 +467,6 @@ edit_named_paste_cmd_callback (GtkAction *action,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (gimp)),
gimp,
gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-buffer-list|gimp-buffer-grid");
}
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index dd7d1db..d691438 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -148,7 +148,6 @@ file_open_location_cmd_callback (GtkAction *action,
return_if_no_widget (widget, data);
gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
NULL /*ui_manager*/,
"gimp-file-open-location-dialog", -1, TRUE);
@@ -195,8 +194,7 @@ file_open_recent_cmd_callback (GtkAction *action,
image = file_open_with_display (gimp, action_data_get_context (data),
progress,
file, FALSE,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget),
+ G_OBJECT (gimp_widget_get_monitor (widget)),
&status, &error);
if (! image && status != GIMP_PDB_CANCEL)
@@ -464,7 +462,6 @@ file_close_all_cmd_callback (GtkAction *action,
return_if_no_widget (widget, data);
gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-close-all-dialog", -1);
}
@@ -557,7 +554,6 @@ file_open_dialog_show (Gimp *gimp,
GtkWidget *dialog;
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (parent),
gimp_widget_get_monitor (parent),
NULL /*ui_manager*/,
"gimp-file-open-dialog", -1, FALSE);
@@ -611,7 +607,6 @@ file_save_dialog_show (Gimp *gimp,
if (! dialog)
{
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (parent),
gimp_widget_get_monitor (parent),
NULL /*ui_manager*/,
"gimp-file-save-dialog",
@@ -693,7 +688,6 @@ file_export_dialog_show (Gimp *gimp,
if (! dialog)
{
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (parent),
gimp_widget_get_monitor (parent),
NULL /*ui_manager*/,
"gimp-file-export-dialog",
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index c7af7b7..694c462 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -188,7 +188,6 @@ image_new_cmd_callback (GtkAction *action,
return_if_no_widget (widget, data);
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
NULL /*ui_manager*/,
"gimp-image-new-dialog", -1, FALSE);
@@ -220,8 +219,7 @@ image_duplicate_cmd_callback (GtkAction *action,
gimp_create_display (new_image->gimp, new_image, shell->unit,
gimp_zoom_model_get_factor (shell->zoom),
- G_OBJECT (gtk_widget_get_screen (GTK_WIDGET (shell))),
- gimp_widget_get_monitor (GTK_WIDGET (shell)));
+ G_OBJECT (gimp_widget_get_monitor (GTK_WIDGET (shell))));
g_object_unref (new_image);
}
diff --git a/app/actions/images-commands.c b/app/actions/images-commands.c
index f7260a3..c4ea4d6 100644
--- a/app/actions/images-commands.c
+++ b/app/actions/images-commands.c
@@ -87,8 +87,7 @@ images_new_view_cmd_callback (GtkAction *action,
if (image && gimp_container_have (container, GIMP_OBJECT (image)))
{
gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (GTK_WIDGET (editor))),
- gimp_widget_get_monitor (GTK_WIDGET (editor)));
+ G_OBJECT (gimp_widget_get_monitor (GTK_WIDGET (editor))));
}
}
diff --git a/app/actions/palettes-commands.c b/app/actions/palettes-commands.c
index f3f1f5f..b203108 100644
--- a/app/actions/palettes-commands.c
+++ b/app/actions/palettes-commands.c
@@ -61,7 +61,6 @@ palettes_import_cmd_callback (GtkAction *action,
return_if_no_widget (widget, data);
gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
NULL /*ui_manager*/,
"gimp-palette-import-dialog", -1, TRUE);
diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c
index acf90f3..4237025 100644
--- a/app/actions/select-commands.c
+++ b/app/actions/select-commands.c
@@ -405,7 +405,6 @@ select_save_cmd_callback (GtkAction *action,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (image->gimp)),
image->gimp,
gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-channel-list");
}
diff --git a/app/actions/templates-commands.c b/app/actions/templates-commands.c
index 4ff8458..1aba871 100644
--- a/app/actions/templates-commands.c
+++ b/app/actions/templates-commands.c
@@ -102,8 +102,7 @@ templates_create_image_cmd_callback (GtkAction *action,
image = gimp_image_new_from_template (gimp, template, context);
gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (image);
gimp_image_new_set_last_template (gimp, template);
diff --git a/app/actions/tool-options-commands.c b/app/actions/tool-options-commands.c
index 1ad56ec..a76107b 100644
--- a/app/actions/tool-options-commands.c
+++ b/app/actions/tool-options-commands.c
@@ -244,7 +244,6 @@ tool_options_show_preset_editor (Gimp *gimp,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (gimp)),
gimp,
gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (GTK_WIDGET (editor)),
gimp_widget_get_monitor (GTK_WIDGET (editor)),
"gimp-tool-preset-editor");
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index a567741..a8c1da5 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -104,8 +104,7 @@ view_new_cmd_callback (GtkAction *action,
gimp_create_display (display->gimp,
gimp_display_get_image (display),
shell->unit, gimp_zoom_model_get_factor (shell->zoom),
- G_OBJECT (gtk_widget_get_screen (GTK_WIDGET (shell))),
- gimp_widget_get_monitor (GTK_WIDGET (shell)));
+ G_OBJECT (gimp_widget_get_monitor (GTK_WIDGET (shell))));
}
void
@@ -472,7 +471,6 @@ view_navigation_window_cmd_callback (GtkAction *action,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (gimp)),
gimp,
gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
"gimp-navigation-view");
}
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index 4a3f88c..ec7e91a 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -193,7 +193,6 @@ windows_open_recent_cmd_callback (GtkAction *action,
info);
gimp_session_info_restore (info, gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget));
g_object_unref (info);
diff --git a/app/app.c b/app/app.c
index 9c5fca5..b0bd388 100644
--- a/app/app.c
+++ b/app/app.c
@@ -94,8 +94,7 @@ GType gimp_convert_dither_type_compat_get_type (void); /* compat cruft */
/* local variables */
-static GObject *initial_screen = NULL;
-static gint initial_monitor = 0;
+static GObject *initial_monitor = NULL;
/* public functions */
@@ -372,7 +371,6 @@ app_run (const gchar *full_prog_name,
gimp_get_user_context (gimp),
NULL,
file, as_new,
- initial_screen,
initial_monitor,
&status, &error);
if (image)
@@ -415,7 +413,6 @@ app_run (const gchar *full_prog_name,
GFile *file = g_file_new_for_commandline_arg (filenames[i]);
file_open_from_command_line (gimp, file, as_new,
- initial_screen,
initial_monitor);
g_object_unref (file);
@@ -470,12 +467,14 @@ static void
app_restore_after_callback (Gimp *gimp,
GimpInitStatusFunc status_callback)
{
+ gint dummy;
+
/* Getting the display name for a -1 display returns the initial
* monitor during startup. Need to call this from a restore_after
* callback, because before restore(), the GUI can't return anything,
* after after restore() the initial monitor gets reset.
*/
- g_free (gimp_get_display_name (gimp, -1, &initial_screen, &initial_monitor));
+ g_free (gimp_get_display_name (gimp, -1, &initial_monitor, &dummy));
}
static gboolean
diff --git a/app/core/gimp-gui.c b/app/core/gimp-gui.c
index 1c899db..7c77b3d 100644
--- a/app/core/gimp-gui.c
+++ b/app/core/gimp-gui.c
@@ -219,18 +219,18 @@ gimp_get_program_class (Gimp *gimp)
gchar *
gimp_get_display_name (Gimp *gimp,
gint display_ID,
- GObject **screen,
- gint *monitor)
+ GObject **monitor,
+ gint *monitor_number)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
- g_return_val_if_fail (screen != NULL, NULL);
g_return_val_if_fail (monitor != NULL, NULL);
+ g_return_val_if_fail (monitor_number != NULL, NULL);
if (gimp->gui.get_display_name)
- return gimp->gui.get_display_name (gimp, display_ID, screen, monitor);
+ return gimp->gui.get_display_name (gimp, display_ID,
+ monitor, monitor_number);
- *screen = NULL;
- *monitor = 0;
+ *monitor = NULL;
return NULL;
}
@@ -343,15 +343,14 @@ gimp_create_display (Gimp *gimp,
GimpImage *image,
GimpUnit unit,
gdouble scale,
- GObject *screen,
- gint monitor)
+ GObject *monitor)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
- g_return_val_if_fail (screen == NULL || G_IS_OBJECT (screen), NULL);
+ g_return_val_if_fail (monitor == NULL || G_IS_OBJECT (monitor), NULL);
if (gimp->gui.display_create)
- return gimp->gui.display_create (gimp, image, unit, scale, screen, monitor);
+ return gimp->gui.display_create (gimp, image, unit, scale, monitor);
return NULL;
}
diff --git a/app/core/gimp-gui.h b/app/core/gimp-gui.h
index 6118765..aa374df 100644
--- a/app/core/gimp-gui.h
+++ b/app/core/gimp-gui.h
@@ -44,8 +44,8 @@ struct _GimpGui
const gchar * (* get_program_class) (Gimp *gimp);
gchar * (* get_display_name) (Gimp *gimp,
gint display_ID,
- GObject **screen,
- gint *monitor);
+ GObject **monitor,
+ gint *monitor_number);
guint32 (* get_user_time) (Gimp *gimp);
GFile * (* get_theme_dir) (Gimp *gimp);
@@ -61,8 +61,7 @@ struct _GimpGui
GimpImage *image,
GimpUnit unit,
gdouble scale,
- GObject *screen,
- gint monitor);
+ GObject *monitor);
void (* display_delete) (GimpObject *display);
void (* displays_reconnect) (Gimp *gimp,
GimpImage *old_image,
@@ -128,8 +127,7 @@ GimpObject * gimp_create_display (Gimp *gimp,
GimpImage *image,
GimpUnit unit,
gdouble scale,
- GObject *screen,
- gint monitor);
+ GObject *monitor);
void gimp_delete_display (Gimp *gimp,
GimpObject *display);
void gimp_reconnect_displays (Gimp *gimp,
@@ -158,8 +156,8 @@ void gimp_free_progress (Gimp *gimp,
const gchar * gimp_get_program_class (Gimp *gimp);
gchar * gimp_get_display_name (Gimp *gimp,
gint display_ID,
- GObject **screen,
- gint *monitor);
+ GObject **monitor,
+ gint *monitor_number);
guint32 gimp_get_user_time (Gimp *gimp);
GFile * gimp_get_theme_dir (Gimp *gimp);
GFile * gimp_get_icon_theme_dir (Gimp *gimp);
diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c
index 0445962..077f2af 100644
--- a/app/dialogs/dialogs.c
+++ b/app/dialogs/dialogs.c
@@ -211,12 +211,10 @@ GimpContainer *global_recent_docks = NULL;
static GtkWidget * dialogs_restore_dialog (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpSessionInfo *info);
static GtkWidget * dialogs_restore_window (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpSessionInfo *info);
@@ -448,7 +446,6 @@ static const GimpDialogFactoryEntry entries[] =
* dialogs_restore_dialog:
* @factory:
* @screen:
- * @monitor:
* @info:
*
* Creates a top level widget based on the given session info object
@@ -459,8 +456,7 @@ static const GimpDialogFactoryEntry entries[] =
**/
static GtkWidget *
dialogs_restore_dialog (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpSessionInfo *info)
{
GtkWidget *dialog;
@@ -471,7 +467,7 @@ dialogs_restore_dialog (GimpDialogFactory *factory,
info);
dialog =
- gimp_dialog_factory_dialog_new (factory, screen, monitor,
+ gimp_dialog_factory_dialog_new (factory, monitor,
NULL /*ui_manager*/,
gimp_session_info_get_factory_entry (info)->identifier,
gimp_session_info_get_factory_entry (info)->view_size,
@@ -488,7 +484,6 @@ dialogs_restore_dialog (GimpDialogFactory *factory,
/**
* dialogs_restore_window:
* @factory:
- * @screen:
* @monitor:
* @info:
*
@@ -500,8 +495,7 @@ dialogs_restore_dialog (GimpDialogFactory *factory,
**/
static GtkWidget *
dialogs_restore_window (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpSessionInfo *info)
{
Gimp *gimp = gimp_dialog_factory_get_context (factory)->gimp;
diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c
index abddf71..935e90f 100644
--- a/app/dialogs/file-open-dialog.c
+++ b/app/dialogs/file-open-dialog.c
@@ -202,8 +202,7 @@ file_open_dialog_open_image (GtkWidget *dialog,
GIMP_PROGRESS (dialog),
file, file, FALSE,
load_proc,
- G_OBJECT (gtk_widget_get_screen (dialog)),
- gimp_widget_get_monitor (dialog),
+ G_OBJECT (gimp_widget_get_monitor (dialog)),
&status, &error);
if (! image && status != GIMP_PDB_CANCEL)
diff --git a/app/dialogs/file-open-location-dialog.c b/app/dialogs/file-open-location-dialog.c
index 1c8fc8b..4d708c5 100644
--- a/app/dialogs/file-open-location-dialog.c
+++ b/app/dialogs/file-open-location-dialog.c
@@ -208,8 +208,7 @@ file_open_location_response (GtkDialog *dialog,
GIMP_PROGRESS (box),
file, entered_file,
FALSE, NULL,
- G_OBJECT (gtk_widget_get_screen (entry)),
- gimp_widget_get_monitor (entry),
+ G_OBJECT (gimp_widget_get_monitor (entry)),
&status, &error);
gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, TRUE);
diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c
index c8784ff..0863aa7 100644
--- a/app/dialogs/image-new-dialog.c
+++ b/app/dialogs/image-new-dialog.c
@@ -368,8 +368,7 @@ image_new_create_image (ImageNewDialog *private)
image = gimp_image_new_from_template (gimp, template,
gimp_get_user_context (gimp));
gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0,
- G_OBJECT (gtk_widget_get_screen (private->dialog)),
- gimp_widget_get_monitor (private->dialog));
+ G_OBJECT (gimp_widget_get_monitor (private->dialog)));
g_object_unref (image);
gtk_widget_destroy (private->dialog);
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 563209f..5057ecb 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -528,8 +528,7 @@ prefs_resolution_source_callback (GtkWidget *widget,
if (from_gdk)
{
- gimp_get_monitor_resolution (gtk_widget_get_screen (widget),
- gimp_widget_get_monitor (widget),
+ gimp_get_monitor_resolution (gimp_widget_get_monitor (widget),
&xres, &yres);
}
else
@@ -571,7 +570,6 @@ prefs_input_devices_dialog (GtkWidget *widget,
Gimp *gimp)
{
gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-input-devices-dialog", 0);
}
@@ -581,7 +579,6 @@ prefs_keyboard_shortcuts_dialog (GtkWidget *widget,
Gimp *gimp)
{
gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-keyboard-shortcuts-dialog", 0);
}
@@ -2597,8 +2594,7 @@ prefs_dialog_new (Gimp *gimp,
gdouble yres;
gchar *str;
- gimp_get_monitor_resolution (gdk_screen_get_default (), /* FIXME monitor */
- 0, /* FIXME monitor */
+ gimp_get_monitor_resolution (gdk_display_get_monitor (gdk_display_get_default (), 0),
&xres, &yres);
str = g_strdup_printf (_("_Detect automatically (currently %d × %d ppi)"),
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index 5966b66..51e044c 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -389,8 +389,7 @@ gimp_display_new (Gimp *gimp,
gdouble scale,
GimpUIManager *popup_manager,
GimpDialogFactory *dialog_factory,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GimpDisplay *display;
GimpDisplayPrivate *private;
@@ -399,7 +398,7 @@ gimp_display_new (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+ g_return_val_if_fail (GDK_IS_MONITOR (monitor), NULL);
/* If there isn't an interface, never create a display */
if (gimp->no_interface)
@@ -441,14 +440,12 @@ gimp_display_new (Gimp *gimp,
window = gimp_image_window_new (gimp,
private->image,
dialog_factory,
- screen,
monitor);
}
/* create the shell for the image */
private->shell = gimp_display_shell_new (display, unit, scale,
popup_manager,
- screen,
monitor);
shell = gimp_display_get_shell (display);
diff --git a/app/display/gimpdisplay.h b/app/display/gimpdisplay.h
index 759a0ac..c041631 100644
--- a/app/display/gimpdisplay.h
+++ b/app/display/gimpdisplay.h
@@ -55,8 +55,7 @@ GimpDisplay * gimp_display_new (Gimp *gimp,
gdouble scale,
GimpUIManager *popup_manager,
GimpDialogFactory *dialog_factory,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
void gimp_display_delete (GimpDisplay *display);
void gimp_display_close (GimpDisplay *display);
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index 767b265..9569b3f 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -225,8 +225,7 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
image = gimp_image_new_from_drawable (shell->display->gimp,
GIMP_DRAWABLE (viewable));
gimp_create_display (shell->display->gimp, image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (image);
return;
@@ -460,8 +459,7 @@ gimp_display_shell_drop_buffer (GtkWidget *widget,
image = gimp_image_new_from_buffer (shell->display->gimp,
GIMP_BUFFER (viewable));
gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (image);
return;
@@ -584,8 +582,7 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
new_image = file_open_with_display (shell->display->gimp, context,
NULL,
file, FALSE,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget),
+ G_OBJECT (gimp_widget_get_monitor (widget)),
&status, &error);
if (! new_image && status != GIMP_PDB_CANCEL)
@@ -597,8 +594,7 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
image = file_open_with_display (shell->display->gimp, context,
GIMP_PROGRESS (shell->display),
file, FALSE,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget),
+ G_OBJECT (gimp_widget_get_monitor (widget)),
&status, &error);
if (! image && status != GIMP_PDB_CANCEL)
@@ -648,8 +644,7 @@ gimp_display_shell_drop_component (GtkWidget *widget,
dest_image = gimp_image_new_from_component (image->gimp,
image, component);
gimp_create_display (dest_image->gimp, dest_image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (dest_image);
return;
@@ -706,8 +701,7 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
image = gimp_image_new_from_pixbuf (shell->display->gimp, pixbuf,
_("Dropped Buffer"));
gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (image);
return;
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index dacae45..f1b7b56 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -1017,8 +1017,7 @@ gimp_display_shell_monitor_res_notify_handler (GObject *config,
{
if (GIMP_DISPLAY_CONFIG (config)->monitor_res_from_gdk)
{
- gimp_get_monitor_resolution (gtk_widget_get_screen (GTK_WIDGET (shell)),
- gimp_widget_get_monitor (GTK_WIDGET (shell)),
+ gimp_get_monitor_resolution (gimp_widget_get_monitor (GTK_WIDGET (shell)),
&shell->monitor_xres,
&shell->monitor_yres);
}
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index abec7cc..63408bb 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -92,7 +92,6 @@ enum
{
PROP_0,
PROP_POPUP_MANAGER,
- PROP_INITIAL_SCREEN,
PROP_INITIAL_MONITOR,
PROP_DISPLAY,
PROP_UNIT,
@@ -259,20 +258,13 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class, PROP_INITIAL_SCREEN,
- g_param_spec_object ("initial-screen",
+ g_object_class_install_property (object_class, PROP_INITIAL_MONITOR,
+ g_param_spec_object ("initial-monitor",
NULL, NULL,
- GDK_TYPE_SCREEN,
+ GDK_TYPE_MONITOR,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class, PROP_INITIAL_MONITOR,
- g_param_spec_int ("initial-monitor",
- NULL, NULL,
- 0, 16, 0,
- GIMP_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
g_object_class_install_property (object_class, PROP_DISPLAY,
g_param_spec_object ("display", NULL, NULL,
GIMP_TYPE_DISPLAY,
@@ -424,8 +416,7 @@ gimp_display_shell_constructed (GObject *object)
if (config->monitor_res_from_gdk)
{
- gimp_get_monitor_resolution (shell->initial_screen,
- shell->initial_monitor,
+ gimp_get_monitor_resolution (shell->initial_monitor,
&shell->monitor_xres, &shell->monitor_yres);
}
else
@@ -895,11 +886,8 @@ gimp_display_shell_set_property (GObject *object,
case PROP_POPUP_MANAGER:
shell->popup_manager = g_value_get_object (value);
break;
- case PROP_INITIAL_SCREEN:
- shell->initial_screen = g_value_get_object (value);
- break;
case PROP_INITIAL_MONITOR:
- shell->initial_monitor = g_value_get_int (value);
+ shell->initial_monitor = g_value_get_object (value);
break;
case PROP_DISPLAY:
shell->display = g_value_get_object (value);
@@ -940,11 +928,8 @@ gimp_display_shell_get_property (GObject *object,
case PROP_POPUP_MANAGER:
g_value_set_object (value, shell->popup_manager);
break;
- case PROP_INITIAL_SCREEN:
- g_value_set_object (value, shell->initial_screen);
- break;
case PROP_INITIAL_MONITOR:
- g_value_set_int (value, shell->initial_monitor);
+ g_value_set_object (value, shell->initial_monitor);
break;
case PROP_DISPLAY:
g_value_set_object (value, shell->display);
@@ -990,8 +975,7 @@ gimp_display_shell_screen_changed (GtkWidget *widget,
if (shell->display->config->monitor_res_from_gdk)
{
- gimp_get_monitor_resolution (gtk_widget_get_screen (widget),
- gimp_widget_get_monitor (widget),
+ gimp_get_monitor_resolution (gimp_widget_get_monitor (widget),
&shell->monitor_xres,
&shell->monitor_yres);
}
@@ -1245,16 +1229,14 @@ gimp_display_shell_new (GimpDisplay *display,
GimpUnit unit,
gdouble scale,
GimpUIManager *popup_manager,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
g_return_val_if_fail (GIMP_IS_UI_MANAGER (popup_manager), NULL);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+ g_return_val_if_fail (GDK_IS_MONITOR (monitor), NULL);
return g_object_new (GIMP_TYPE_DISPLAY_SHELL,
"popup-manager", popup_manager,
- "initial-screen", screen,
"initial-monitor", monitor,
"display", display,
"unit", unit,
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index 813ce66..1fa0b47 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -52,8 +52,7 @@ struct _GimpDisplayShell
GimpDisplay *display;
GimpUIManager *popup_manager;
- GdkScreen *initial_screen;
- gint initial_monitor;
+ GdkMonitor *initial_monitor;
GimpDisplayOptions *options;
GimpDisplayOptions *fullscreen_options;
@@ -237,8 +236,7 @@ GtkWidget * gimp_display_shell_new (GimpDisplay *display,
GimpUnit unit,
gdouble scale,
GimpUIManager *popup_manager,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
void gimp_display_shell_add_overlay (GimpDisplayShell *shell,
GtkWidget *child,
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 44096da..5b27109 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -100,7 +100,6 @@ enum
PROP_0,
PROP_GIMP,
PROP_DIALOG_FACTORY,
- PROP_INITIAL_SCREEN,
PROP_INITIAL_MONITOR
};
@@ -129,8 +128,7 @@ struct _GimpImageWindowPrivate
const gchar *entry_id;
- GdkScreen *initial_screen;
- gint initial_monitor;
+ GdkMonitor *initial_monitor;
gint suspend_keep_pos;
@@ -182,8 +180,7 @@ static gboolean gimp_image_window_window_state_event (GtkWidget *wid
static void gimp_image_window_style_updated (GtkWidget *widget);
static void gimp_image_window_monitor_changed (GimpWindow *window,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
static GList * gimp_image_window_get_docks (GimpDockContainer *dock_container);
static GimpDialogFactory *
@@ -208,13 +205,11 @@ static void gimp_image_window_config_notify (GimpImageWindow *win
static void gimp_image_window_session_clear (GimpImageWindow *window);
static void gimp_image_window_session_apply (GimpImageWindow *window,
const gchar *entry_id,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
static void gimp_image_window_session_update (GimpImageWindow *window,
GimpDisplay *new_display,
const gchar *new_entry_id,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
static const gchar *
gimp_image_window_config_to_entry_id (GimpGuiConfig *config);
static void gimp_image_window_show_tooltip (GimpUIManager *manager,
@@ -319,18 +314,12 @@ gimp_image_window_class_init (GimpImageWindowClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class, PROP_INITIAL_SCREEN,
- g_param_spec_object ("initial-screen",
+ g_object_class_install_property (object_class, PROP_INITIAL_MONITOR,
+ g_param_spec_object ("initial-monitor",
NULL, NULL,
- GDK_TYPE_SCREEN,
+ GDK_TYPE_MONITOR,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class, PROP_INITIAL_MONITOR,
- g_param_spec_int ("initial-monitor",
- NULL, NULL,
- 0, 16, 0,
- GIMP_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private (klass, sizeof (GimpImageWindowPrivate));
@@ -511,7 +500,6 @@ gimp_image_window_constructed (GObject *object)
gimp_image_window_session_update (window,
NULL /*new_display*/,
gimp_image_window_config_to_entry_id (config),
- private->initial_screen,
private->initial_monitor);
}
@@ -570,11 +558,8 @@ gimp_image_window_set_property (GObject *object,
case PROP_DIALOG_FACTORY:
private->dialog_factory = g_value_get_object (value);
break;
- case PROP_INITIAL_SCREEN:
- private->initial_screen = g_value_get_object (value);
- break;
case PROP_INITIAL_MONITOR:
- private->initial_monitor = g_value_get_int (value);
+ private->initial_monitor = g_value_get_object (value);
break;
default:
@@ -600,11 +585,8 @@ gimp_image_window_get_property (GObject *object,
case PROP_DIALOG_FACTORY:
g_value_set_object (value, private->dialog_factory);
break;
- case PROP_INITIAL_SCREEN:
- g_value_set_object (value, private->initial_screen);
- break;
case PROP_INITIAL_MONITOR:
- g_value_set_int (value, private->initial_monitor);
+ g_value_set_object (value, private->initial_monitor);
break;
default:
@@ -810,8 +792,7 @@ gimp_image_window_style_updated (GtkWidget *widget)
static void
gimp_image_window_monitor_changed (GimpWindow *window,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
GList *list;
@@ -1125,8 +1106,7 @@ GimpImageWindow *
gimp_image_window_new (Gimp *gimp,
GimpImage *image,
GimpDialogFactory *dialog_factory,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GimpImageWindow *window;
GimpImageWindowPrivate *private;
@@ -1134,12 +1114,11 @@ gimp_image_window_new (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+ g_return_val_if_fail (GDK_IS_MONITOR (monitor), NULL);
window = g_object_new (GIMP_TYPE_IMAGE_WINDOW,
"gimp", gimp,
"dialog-factory", dialog_factory,
- "initial-screen", screen,
"initial-monitor", monitor,
/* The window position will be overridden by the
* dialog factory, it is only really used on first
@@ -1155,23 +1134,21 @@ gimp_image_window_new (Gimp *gimp,
if (! GIMP_GUI_CONFIG (private->gimp->config)->single_window_mode)
{
- GdkScreen *pointer_screen;
- gint pointer_monitor;
+ GdkMonitor *pointer_monitor;
- pointer_monitor = gimp_get_monitor_at_pointer (&pointer_screen);
+ pointer_monitor = gimp_get_monitor_at_pointer ();
/* If we are supposed to go to a monitor other than where the
* pointer is, place the window on that monitor manually,
* otherwise simply let the window manager place the window on
* the poiner's monitor.
*/
- if (pointer_screen != screen ||
- pointer_monitor != monitor)
+ if (pointer_monitor != monitor)
{
GdkRectangle rect;
gchar geom[32];
- gdk_screen_get_monitor_workarea (screen, monitor, &rect);
+ gdk_monitor_get_workarea (monitor, &rect);
/* FIXME: image window placement
*
@@ -1466,9 +1443,8 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
GimpImage *image;
GtkWidget *widget;
GtkAllocation allocation;
- GdkScreen *screen;
+ GdkMonitor *monitor;
GdkRectangle rect;
- gint monitor;
gint disp_width, disp_height;
gdouble x, y;
gdouble width, height;
@@ -1490,14 +1466,12 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
image = gimp_display_get_image (active_shell->display);
- widget = GTK_WIDGET (window);
- screen = gtk_widget_get_screen (widget);
+ widget = GTK_WIDGET (window);
+ monitor = gimp_widget_get_monitor (widget);
gtk_widget_get_allocation (widget, &allocation);
- monitor = gdk_screen_get_monitor_at_window (screen,
- gtk_widget_get_window (widget));
- gdk_screen_get_monitor_workarea (screen, monitor, &rect);
+ gdk_monitor_get_workarea (monitor, &rect);
gimp_display_shell_transform_bounds (active_shell,
0, 0,
@@ -1878,7 +1852,6 @@ gimp_image_window_config_notify (GimpImageWindow *window,
gimp_image_window_session_update (window,
NULL /*new_display*/,
gimp_image_window_config_to_entry_id (config),
- gtk_widget_get_screen (GTK_WIDGET (window)),
gimp_widget_get_monitor (GTK_WIDGET (window)));
}
}
@@ -2020,7 +1993,6 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
gimp_image_window_session_update (window,
active_display,
NULL /*new_entry_id*/,
- gtk_widget_get_screen (GTK_WIDGET (window)),
gimp_widget_get_monitor (GTK_WIDGET (window)));
}
else
@@ -2032,7 +2004,6 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
gimp_image_window_session_update (window,
active_display,
NULL /*new_entry_id*/,
- private->initial_screen,
private->initial_monitor);
}
@@ -2139,7 +2110,6 @@ gimp_image_window_image_notify (GimpDisplay *display,
gimp_image_window_session_update (window,
display,
NULL /*new_entry_id*/,
- gtk_widget_get_screen (GTK_WIDGET (window)),
gimp_widget_get_monitor (GTK_WIDGET (window)));
tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (private->notebook),
@@ -2168,8 +2138,7 @@ gimp_image_window_session_clear (GimpImageWindow *window)
static void
gimp_image_window_session_apply (GimpImageWindow *window,
const gchar *entry_id,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
GimpSessionInfo *session_info = NULL;
@@ -2203,7 +2172,6 @@ gimp_image_window_session_apply (GimpImageWindow *window,
gimp_dialog_factory_add_foreign (private->dialog_factory,
entry_id,
GTK_WIDGET (window),
- screen,
monitor);
gtk_window_unmaximize (GTK_WINDOW (window));
@@ -2214,8 +2182,7 @@ static void
gimp_image_window_session_update (GimpImageWindow *window,
GimpDisplay *new_display,
const gchar *new_entry_id,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
@@ -2231,8 +2198,7 @@ gimp_image_window_session_update (GimpImageWindow *window,
*/
if (strcmp (new_entry_id, GIMP_SINGLE_IMAGE_WINDOW_ENTRY_ID) == 0)
{
- gimp_image_window_session_apply (window, new_entry_id,
- screen, monitor);
+ gimp_image_window_session_apply (window, new_entry_id, monitor);
}
}
else if (strcmp (private->entry_id, new_entry_id) != 0)
@@ -2253,7 +2219,7 @@ gimp_image_window_session_update (GimpImageWindow *window,
g_list_length (private->shells) <= 1)
{
gimp_image_window_session_apply (window, new_entry_id,
- screen, monitor);
+ monitor);
}
}
else if (strcmp (new_entry_id, GIMP_SINGLE_IMAGE_WINDOW_ENTRY_ID) == 0)
@@ -2263,7 +2229,7 @@ gimp_image_window_session_update (GimpImageWindow *window,
* is exited
*/
gimp_image_window_session_apply (window, new_entry_id,
- screen, monitor);
+ monitor);
}
}
@@ -2291,7 +2257,7 @@ gimp_image_window_session_update (GimpImageWindow *window,
* contain images) we should become the empty image window
*/
gimp_image_window_session_apply (window, private->entry_id,
- screen, monitor);
+ monitor);
}
}
}
diff --git a/app/display/gimpimagewindow.h b/app/display/gimpimagewindow.h
index a3d8207..5fa6437 100644
--- a/app/display/gimpimagewindow.h
+++ b/app/display/gimpimagewindow.h
@@ -48,8 +48,7 @@ GType gimp_image_window_get_type (void) G_GNUC_CONST;
GimpImageWindow * gimp_image_window_new (Gimp *gimp,
GimpImage *image,
GimpDialogFactory *dialog_factory,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
void gimp_image_window_destroy (GimpImageWindow *window);
GimpUIManager * gimp_image_window_get_ui_manager (GimpImageWindow *window);
diff --git a/app/display/gimpmultiwindowstrategy.c b/app/display/gimpmultiwindowstrategy.c
index 5c632ec..2897b9f 100644
--- a/app/display/gimpmultiwindowstrategy.c
+++ b/app/display/gimpmultiwindowstrategy.c
@@ -37,8 +37,7 @@ static void gimp_multi_window_strategy_window_strategy_iface_init (GimpWi
static GtkWidget * gimp_multi_window_strategy_show_dockable_dialog (GimpWindowStrategy
*strategy,
Gimp *gimp,
GimpDialogFactory
*factory,
- GdkScreen
*screen,
- gint
monitor,
+ GdkMonitor
*monitor,
const gchar
*identifiers);
@@ -69,11 +68,10 @@ static GtkWidget *
gimp_multi_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
Gimp *gimp,
GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
const gchar *identifiers)
{
- return gimp_dialog_factory_dialog_raise (factory, screen, monitor,
+ return gimp_dialog_factory_dialog_raise (factory, monitor,
identifiers, -1);
}
diff --git a/app/display/gimpsinglewindowstrategy.c b/app/display/gimpsinglewindowstrategy.c
index 6f3c5e2..06deb62 100644
--- a/app/display/gimpsinglewindowstrategy.c
+++ b/app/display/gimpsinglewindowstrategy.c
@@ -43,8 +43,7 @@ static void gimp_single_window_strategy_window_strategy_iface_init (GimpW
static GtkWidget * gimp_single_window_strategy_show_dockable_dialog (GimpWindowStrategy
*strategy,
Gimp *gimp,
GimpDialogFactory
*factory,
- GdkScreen
*screen,
- gint
monitor,
+ GdkMonitor
*monitor,
const gchar
*identifiers);
@@ -75,8 +74,7 @@ static GtkWidget *
gimp_single_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
Gimp *gimp,
GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
const gchar *identifiers)
{
GList *windows = gimp_get_image_windows (gimp);
@@ -96,9 +94,7 @@ gimp_single_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
GimpDockColumns *columns;
GimpUIManager *ui_manager = gimp_image_window_get_ui_manager (window);
- widget = gimp_dialog_factory_dialog_new (factory,
- screen,
- monitor,
+ widget = gimp_dialog_factory_dialog_new (factory, monitor,
ui_manager,
"gimp-toolbox",
-1 /*view_size*/,
@@ -114,7 +110,7 @@ gimp_single_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
else if (gimp_dialog_factory_find_widget (factory, identifiers))
{
/* if the dialog is already open, simply raise it */
- return gimp_dialog_factory_dialog_raise (factory, screen, monitor,
+ return gimp_dialog_factory_dialog_raise (factory, monitor,
identifiers, -1);
}
else
diff --git a/app/display/gimptooldialog.c b/app/display/gimptooldialog.c
index b8d5232..ea63cba 100644
--- a/app/display/gimptooldialog.c
+++ b/app/display/gimptooldialog.c
@@ -104,8 +104,7 @@ gimp_tool_dialog_dispose (GObject *object)
**/
GtkWidget *
gimp_tool_dialog_new (GimpToolInfo *tool_info,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
const gchar *title,
const gchar *description,
const gchar *icon_name,
@@ -148,7 +147,6 @@ gimp_tool_dialog_new (GimpToolInfo *tool_info,
gimp_dialog_factory_add_foreign (gimp_dialog_factory_get_singleton (),
identifier,
dialog,
- screen,
monitor);
g_free (identifier);
diff --git a/app/display/gimptooldialog.h b/app/display/gimptooldialog.h
index 74c64fe..81df78e 100644
--- a/app/display/gimptooldialog.h
+++ b/app/display/gimptooldialog.h
@@ -43,8 +43,7 @@ struct _GimpToolDialog
GType gimp_tool_dialog_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_tool_dialog_new (GimpToolInfo *tool_info,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
const gchar *title,
const gchar *description,
const gchar *icon_name,
diff --git a/app/display/gimptoolgui.c b/app/display/gimptoolgui.c
index 3fcba0c..f24bfe9 100644
--- a/app/display/gimptoolgui.c
+++ b/app/display/gimptoolgui.c
@@ -90,8 +90,7 @@ static void gimp_tool_gui_dispose (GObject *object);
static void gimp_tool_gui_finalize (GObject *object);
static void gimp_tool_gui_create_dialog (GimpToolGui *gui,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
static void gimp_tool_gui_update_buttons (GimpToolGui *gui);
static void gimp_tool_gui_update_shell (GimpToolGui *gui);
static void gimp_tool_gui_update_viewable (GimpToolGui *gui);
@@ -221,8 +220,7 @@ gimp_tool_gui_new (GimpToolInfo *tool_info,
const gchar *description,
const gchar *icon_name,
const gchar *help_id,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
gboolean overlay,
...)
{
@@ -271,7 +269,7 @@ gimp_tool_gui_new (GimpToolInfo *tool_info,
va_end (args);
- gimp_tool_gui_create_dialog (gui, screen, monitor);
+ gimp_tool_gui_create_dialog (gui, monitor);
return gui;
}
@@ -535,8 +533,7 @@ gimp_tool_gui_hide (GimpToolGui *gui)
void
gimp_tool_gui_set_overlay (GimpToolGui *gui,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
gboolean overlay)
{
GimpToolGuiPrivate *private;
@@ -570,7 +567,7 @@ gimp_tool_gui_set_overlay (GimpToolGui *gui,
private->overlay = overlay;
- gimp_tool_gui_create_dialog (gui, screen, monitor);
+ gimp_tool_gui_create_dialog (gui, monitor);
if (visible)
gimp_tool_gui_show (gui);
@@ -734,8 +731,7 @@ gimp_tool_gui_set_alternative_button_order (GimpToolGui *gui,
static void
gimp_tool_gui_create_dialog (GimpToolGui *gui,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GimpToolGuiPrivate *private = GET_PRIVATE (gui);
GList *list;
@@ -774,7 +770,7 @@ gimp_tool_gui_create_dialog (GimpToolGui *gui,
else
{
private->dialog = gimp_tool_dialog_new (private->tool_info,
- screen, monitor,
+ monitor,
private->title,
private->description,
private->icon_name,
@@ -913,7 +909,6 @@ gimp_tool_gui_dialog_response (GtkWidget *dialog,
{
gimp_tool_gui_set_auto_overlay (gui, FALSE);
gimp_tool_gui_set_overlay (gui,
- gtk_widget_get_screen (dialog),
gimp_widget_get_monitor (dialog),
FALSE);
}
@@ -947,7 +942,6 @@ gimp_tool_gui_canvas_resized (GtkWidget *canvas,
}
gimp_tool_gui_set_overlay (gui,
- gtk_widget_get_screen (private->dialog),
gimp_widget_get_monitor (private->dialog),
overlay);
}
diff --git a/app/display/gimptoolgui.h b/app/display/gimptoolgui.h
index 1de3333..4f098ca 100644
--- a/app/display/gimptoolgui.h
+++ b/app/display/gimptoolgui.h
@@ -57,8 +57,7 @@ GimpToolGui * gimp_tool_gui_new (GimpToolInfo *tool_info,
const gchar *description,
const gchar *icon_name,
const gchar *help_id,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
gboolean overlay,
...) G_GNUC_NULL_TERMINATED;
@@ -84,8 +83,7 @@ void gimp_tool_gui_show (GimpToolGui *gui);
void gimp_tool_gui_hide (GimpToolGui *gui);
void gimp_tool_gui_set_overlay (GimpToolGui *gui,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
gboolean overlay);
gboolean gimp_tool_gui_get_overlay (GimpToolGui *gui);
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 06b097f..c3521e3 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -478,14 +478,13 @@ file_open_with_display (Gimp *gimp,
GimpProgress *progress,
GFile *file,
gboolean as_new,
- GObject *screen,
- gint monitor,
+ GObject *monitor,
GimpPDBStatusType *status,
GError **error)
{
return file_open_with_proc_and_display (gimp, context, progress,
file, file, as_new, NULL,
- screen, monitor,
+ monitor,
status, error);
}
@@ -497,8 +496,7 @@ file_open_with_proc_and_display (Gimp *gimp,
GFile *entered_file,
gboolean as_new,
GimpPlugInProcedure *file_proc,
- GObject *screen,
- gint monitor,
+ GObject *monitor,
GimpPDBStatusType *status,
GError **error)
{
@@ -510,7 +508,7 @@ file_open_with_proc_and_display (Gimp *gimp,
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (G_IS_FILE (file), NULL);
g_return_val_if_fail (G_IS_FILE (entered_file), NULL);
- g_return_val_if_fail (screen == NULL || G_IS_OBJECT (screen), NULL);
+ g_return_val_if_fail (monitor == NULL || G_IS_OBJECT (monitor), NULL);
g_return_val_if_fail (status != NULL, NULL);
image = file_open_image (gimp, context, progress,
@@ -552,7 +550,7 @@ file_open_with_proc_and_display (Gimp *gimp,
}
if (gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0,
- screen, monitor))
+ monitor))
{
/* the display owns the image now */
g_object_unref (image);
@@ -673,8 +671,7 @@ gboolean
file_open_from_command_line (Gimp *gimp,
GFile *file,
gboolean as_new,
- GObject *screen,
- gint monitor)
+ GObject *monitor)
{
GimpImage *image;
@@ -685,7 +682,7 @@ file_open_from_command_line (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
- g_return_val_if_fail (screen == NULL || G_IS_OBJECT (screen), FALSE);
+ g_return_val_if_fail (monitor == NULL || G_IS_OBJECT (monitor), FALSE);
display = gimp_get_empty_display (gimp);
@@ -700,7 +697,7 @@ file_open_from_command_line (Gimp *gimp,
gimp_get_user_context (gimp),
GIMP_PROGRESS (display),
file, as_new,
- screen, monitor,
+ monitor,
&status, &error);
if (image)
diff --git a/app/file/file-open.h b/app/file/file-open.h
index 907168f..f69fc04 100644
--- a/app/file/file-open.h
+++ b/app/file/file-open.h
@@ -49,8 +49,7 @@ GimpImage * file_open_with_display (Gimp *gimp,
GimpProgress *progress,
GFile *file,
gboolean as_new,
- GObject *screen,
- gint monitor,
+ GObject *monitor,
GimpPDBStatusType *status,
GError **error);
@@ -61,8 +60,7 @@ GimpImage * file_open_with_proc_and_display (Gimp *gimp,
GFile *entered_file,
gboolean as_new,
GimpPlugInProcedure *file_proc,
- GObject *screen,
- gint monitor,
+ GObject *monitor,
GimpPDBStatusType *status,
GError **error);
@@ -80,8 +78,7 @@ GList * file_open_layers (Gimp *gimp,
gboolean file_open_from_command_line (Gimp *gimp,
GFile *file,
gboolean as_new,
- GObject *screen,
- gint monitor);
+ GObject *monitor);
#endif /* __FILE_OPEN_H__ */
diff --git a/app/gui/gimpdbusservice.c b/app/gui/gimpdbusservice.c
index b76dfc7..080b167 100644
--- a/app/gui/gimpdbusservice.c
+++ b/app/gui/gimpdbusservice.c
@@ -338,8 +338,8 @@ gimp_dbus_service_process_idle (GimpDBusService *service)
if (data->file)
file_open_from_command_line (service->gimp, data->file, data->as_new,
- NULL, /* FIXME monitor */
- 0 /* FIXME monitor */);
+ NULL /* FIXME monitor */);
+
if (data->command)
{
const gchar *commands[2] = {data->command, 0};
diff --git a/app/gui/gimpuiconfigurer.c b/app/gui/gimpuiconfigurer.c
index 0e8459a..ac5fd53 100644
--- a/app/gui/gimpuiconfigurer.c
+++ b/app/gui/gimpuiconfigurer.c
@@ -331,8 +331,7 @@ gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
GimpDockColumns *dock_columns,
GimpAlignmentType screen_side)
{
- GdkScreen *screen;
- gint monitor;
+ GdkMonitor *monitor;
GdkRectangle monitor_rect;
GList *docks;
GList *iter;
@@ -345,10 +344,9 @@ gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
if (! docks)
return;
- screen = gtk_widget_get_screen (GTK_WIDGET (dock_columns));
monitor = gimp_widget_get_monitor (GTK_WIDGET (dock_columns));
- gdk_screen_get_monitor_workarea (screen, monitor, &monitor_rect);
+ gdk_monitor_get_workarea (monitor, &monitor_rect);
/* Remember the size so we can set the new dock window to the same
* size
@@ -374,7 +372,6 @@ gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
*/
dock_window =
gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- screen,
monitor,
NULL /*ui_manager*/,
(contains_toolbox ?
@@ -449,7 +446,6 @@ gimp_ui_configurer_separate_shells (GimpUIConfigurer *ui_configurer,
new_image_window = gimp_image_window_new (ui_configurer->p->gimp,
NULL,
gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (GTK_WIDGET (source_image_window)),
gimp_widget_get_monitor (GTK_WIDGET (source_image_window)));
/* Move the shell there */
shell = gimp_image_window_get_shell (source_image_window, 1);
diff --git a/app/gui/gui-message.c b/app/gui/gui-message.c
index 8dbffd4..2644f4d 100644
--- a/app/gui/gui-message.c
+++ b/app/gui/gui-message.c
@@ -225,16 +225,13 @@ gui_message_error_console (Gimp *gimp,
if (! dockable)
{
- GdkScreen *screen;
- gint monitor;
-
- monitor = gimp_get_monitor_at_pointer (&screen);
+ GdkMonitor *monitor = gimp_get_monitor_at_pointer ();
dockable =
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (gimp)),
gimp,
gimp_dialog_factory_get_singleton (),
- screen, monitor,
+ monitor,
"gimp-error-console");
}
@@ -455,13 +452,10 @@ gui_message_format (GimpMessageSeverity severity,
static GtkWidget *
global_error_dialog (void)
{
- GdkScreen *screen;
- gint monitor;
-
- monitor = gimp_get_monitor_at_pointer (&screen);
+ GdkMonitor *monitor = gimp_get_monitor_at_pointer ();
return gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- screen, monitor,
+ monitor,
NULL /*ui_manager*/,
"gimp-error-dialog", -1,
FALSE);
@@ -470,14 +464,11 @@ global_error_dialog (void)
static GtkWidget *
global_critical_dialog (void)
{
- GtkWidget *dialog;
- GdkScreen *screen;
- gint monitor;
-
- monitor = gimp_get_monitor_at_pointer (&screen);
+ GdkMonitor *monitor = gimp_get_monitor_at_pointer ();
+ GtkWidget *dialog;
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
- screen, monitor,
+ monitor,
NULL /*ui_manager*/,
"gimp-critical-dialog", -1,
FALSE);
diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c
index e333c3d..3dfeec7 100644
--- a/app/gui/gui-vtable.c
+++ b/app/gui/gui-vtable.c
@@ -100,8 +100,8 @@ static void gui_help (Gimp *gimp,
static const gchar * gui_get_program_class (Gimp *gimp);
static gchar * gui_get_display_name (Gimp *gimp,
gint display_ID,
- GObject **screen,
- gint *monitor);
+ GObject **monitor,
+ gint *monitor_number);
static guint32 gui_get_user_time (Gimp *gimp);
static GFile * gui_get_theme_dir (Gimp *gimp);
static GFile * gui_get_icon_theme_dir (Gimp *gimp);
@@ -115,8 +115,7 @@ static GimpObject * gui_display_create (Gimp *gimp,
GimpImage *image,
GimpUnit unit,
gdouble scale,
- GObject *screen,
- gint monitor);
+ GObject *monitor);
static void gui_display_delete (GimpObject *display);
static void gui_displays_reconnect (Gimp *gimp,
GimpImage *old_image,
@@ -258,40 +257,53 @@ gui_get_program_class (Gimp *gimp)
return gdk_get_program_class ();
}
+static gint
+get_monitor_number (GdkMonitor *monitor)
+{
+ GdkDisplay *display = gdk_monitor_get_display (monitor);
+ gint n_monitors = gdk_display_get_n_monitors (display);
+ gint i;
+
+ for (i = 0; i < n_monitors; i++)
+ if (gdk_display_get_monitor (display, i) == monitor)
+ return i;
+
+ return 0;
+}
+
static gchar *
gui_get_display_name (Gimp *gimp,
gint display_ID,
- GObject **screen,
- gint *monitor)
+ GObject **monitor,
+ gint *monitor_number)
{
- GimpDisplay *display = NULL;
- GdkScreen *my_screen = NULL;
+ GimpDisplay *display = NULL;
+ GdkDisplay *gdk_display;
if (display_ID > 0)
display = gimp_display_get_by_ID (gimp, display_ID);
if (display)
{
- GimpDisplayShell *shell = gimp_display_get_shell (display);
- GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (shell));
+ GimpDisplayShell *shell = gimp_display_get_shell (display);
+
+ gdk_display = gtk_widget_get_display (GTK_WIDGET (shell));
- my_screen = gtk_widget_get_screen (GTK_WIDGET (shell));
- *monitor = gdk_screen_get_monitor_at_window (my_screen, window);
+ *monitor = G_OBJECT (gimp_widget_get_monitor (GTK_WIDGET (shell)));
}
else
{
- *monitor = gui_get_initial_monitor (gimp, &my_screen);
+ *monitor = G_OBJECT (gui_get_initial_monitor (gimp));
- if (*monitor == -1)
- *monitor = gimp_get_monitor_at_pointer (&my_screen);
- }
+ if (! *monitor)
+ *monitor = G_OBJECT (gimp_get_monitor_at_pointer ());
- *screen = G_OBJECT (my_screen);
+ gdk_display = gdk_monitor_get_display (GDK_MONITOR (*monitor));
+ }
- if (my_screen)
- return gdk_screen_make_display_name (my_screen);
+ *monitor_number = get_monitor_number (GDK_MONITOR (*monitor));
- return NULL;
+ return gdk_screen_make_display_name (gdk_display_get_default_screen (gdk_display));
}
static guint32
@@ -378,14 +390,13 @@ gui_display_create (Gimp *gimp,
GimpImage *image,
GimpUnit unit,
gdouble scale,
- GObject *screen,
- gint monitor)
+ GObject *monitor)
{
GimpContext *context = gimp_get_user_context (gimp);
GimpDisplay *display = GIMP_DISPLAY (gui_get_empty_display (gimp));
- if (! screen)
- monitor = gimp_get_monitor_at_pointer ((GdkScreen **) &screen);
+ if (! monitor)
+ monitor = G_OBJECT (gimp_get_monitor_at_pointer ());
if (display)
{
@@ -400,8 +411,7 @@ gui_display_create (Gimp *gimp,
display = gimp_display_new (gimp, image, unit, scale,
image_managers->data,
gimp_dialog_factory_get_singleton (),
- GDK_SCREEN (screen),
- monitor);
+ GDK_MONITOR (monitor));
}
if (gimp_context_get_display (context) == display)
diff --git a/app/gui/gui-vtable.h b/app/gui/gui-vtable.h
index b23f0db..d165101 100644
--- a/app/gui/gui-vtable.h
+++ b/app/gui/gui-vtable.h
@@ -19,13 +19,12 @@
#define __GUI_VTABLE_H__
-void gui_vtable_init (Gimp *gimp);
+void gui_vtable_init (Gimp *gimp);
/* this function lives in gui.c but must only be used from gui-vtable.c;
* also, gui.h can't contain any Gdk types.
*/
-gint gui_get_initial_monitor (Gimp *gimp,
- GdkScreen **screen);
+GdkMonitor * gui_get_initial_monitor (Gimp *gimp);
#endif /* __GUI_VTABLE_H__ */
diff --git a/app/gui/gui.c b/app/gui/gui.c
index a0f126d..47ae2f4 100644
--- a/app/gui/gui.c
+++ b/app/gui/gui.c
@@ -165,8 +165,7 @@ static gboolean gui_check_action_exists (const gchar *accel_path);
static Gimp *the_gui_gimp = NULL;
static GimpUIManager *image_ui_manager = NULL;
static GimpUIConfigurer *ui_configurer = NULL;
-static GdkScreen *initial_screen = NULL;
-static gint initial_monitor = -1;
+static GdkMonitor *initial_monitor = NULL;
/* public functions */
@@ -269,11 +268,11 @@ gui_init (Gimp *gimp,
themes_init (gimp);
- initial_monitor = gimp_get_monitor_at_pointer (&initial_screen);
+ initial_monitor = gimp_get_monitor_at_pointer ();
if (! no_splash)
{
- splash_create (gimp->be_verbose, initial_screen, initial_monitor);
+ splash_create (gimp->be_verbose, initial_monitor);
status_callback = splash_update;
}
@@ -349,14 +348,10 @@ gui_recover (gint n_recoveries)
return recover;
}
-gint
-gui_get_initial_monitor (Gimp *gimp,
- GdkScreen **screen)
+GdkMonitor *
+gui_get_initial_monitor (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
- g_return_val_if_fail (screen != NULL, 0);
-
- *screen = initial_screen;
return initial_monitor;
}
@@ -449,11 +444,10 @@ gui_initialize_after_callback (Gimp *gimp,
if (name)
{
- gchar *display = gdk_get_display ();
+ const gchar *display = gdk_display_get_name (gdk_display_get_default ());
gimp_environ_table_add (gimp->plug_in_manager->environ_table,
name, display, NULL);
- g_free (display);
}
gimp_tools_init (gimp);
@@ -505,9 +499,7 @@ gui_restore_callback (Gimp *gimp,
{
gdouble xres, yres;
- gimp_get_monitor_resolution (initial_screen,
- initial_monitor,
- &xres, &yres);
+ gimp_get_monitor_resolution (initial_monitor, &xres, &yres);
g_object_set (gimp->config,
"monitor-xresolution", xres,
@@ -696,15 +688,12 @@ gui_restore_after_callback (Gimp *gimp,
/* create the empty display */
display = GIMP_DISPLAY (gimp_create_display (gimp, NULL,
GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (initial_screen),
- initial_monitor));
+ G_OBJECT (initial_monitor)));
shell = gimp_display_get_shell (display);
if (gui_config->restore_session)
- session_restore (gimp,
- initial_screen,
- initial_monitor);
+ session_restore (gimp, initial_monitor);
/* move keyboard focus to the display */
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
@@ -715,8 +704,7 @@ gui_restore_after_callback (Gimp *gimp,
gdk_notify_startup_complete ();
/* clear startup monitor variables */
- initial_screen = NULL;
- initial_monitor = -1;
+ initial_monitor = NULL;
}
static gboolean
@@ -730,13 +718,12 @@ gui_exit_callback (Gimp *gimp,
if (! force && gimp_displays_dirty (gimp))
{
- GdkScreen *screen;
- gint monitor;
+ GdkMonitor *monitor;
- monitor = gimp_get_monitor_at_pointer (&screen);
+ monitor = gimp_get_monitor_at_pointer ();
gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
- screen, monitor,
+ monitor,
"gimp-quit-dialog", -1);
return TRUE; /* stop exit for now */
diff --git a/app/gui/session.c b/app/gui/session.c
index 5e98079..948c7aa 100644
--- a/app/gui/session.c
+++ b/app/gui/session.c
@@ -314,15 +314,14 @@ session_exit (Gimp *gimp)
}
void
-session_restore (Gimp *gimp,
- GdkScreen *screen,
- gint monitor)
+session_restore (Gimp *gimp,
+ GdkMonitor *monitor)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
- g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (GDK_IS_MONITOR (monitor));
gimp_dialog_factory_restore (gimp_dialog_factory_get_singleton (),
- screen, monitor);
+ monitor);
/* make sure GimpImageWindow acts upon hide-docks at the right time,
* see bug #678043.
diff --git a/app/gui/session.h b/app/gui/session.h
index 65af7ca..c4b39eb 100644
--- a/app/gui/session.h
+++ b/app/gui/session.h
@@ -19,17 +19,16 @@
#define __SESSION_H__
-void session_init (Gimp *gimp);
-void session_exit (Gimp *gimp);
+void session_init (Gimp *gimp);
+void session_exit (Gimp *gimp);
-void session_restore (Gimp *gimp,
- GdkScreen *screen,
- gint monitor);
-void session_save (Gimp *gimp,
- gboolean always_save);
+void session_restore (Gimp *gimp,
+ GdkMonitor *monitor);
+void session_save (Gimp *gimp,
+ gboolean always_save);
-gboolean session_clear (Gimp *gimp,
- GError **error);
+gboolean session_clear (Gimp *gimp,
+ GError **error);
#endif /* __SESSION_H__ */
diff --git a/app/gui/splash.c b/app/gui/splash.c
index fb6ce98..f1cd394 100644
--- a/app/gui/splash.c
+++ b/app/gui/splash.c
@@ -99,21 +99,23 @@ static void splash_timer_elapsed (void);
/* public functions */
void
-splash_create (gboolean be_verbose,
- GdkScreen *screen,
- gint monitor)
+splash_create (gboolean be_verbose,
+ GdkMonitor *monitor)
{
GtkWidget *frame;
GtkWidget *vbox;
GdkPixbufAnimation *pixbuf;
+ GdkRectangle workarea;
gint max_width;
gint max_height;
g_return_if_fail (splash == NULL);
- g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (GDK_IS_MONITOR (monitor));
- max_width = gdk_screen_get_width (screen) / 2;
- max_height = gdk_screen_get_height (screen) / 2;
+ gdk_monitor_get_workarea (monitor, &workarea);
+
+ max_width = workarea.width / 2;
+ max_height = workarea.height / 2;
pixbuf = splash_image_load (max_width, max_height, be_verbose);
if (! pixbuf)
@@ -127,7 +129,6 @@ splash_create (gboolean be_verbose,
"type-hint", GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
"title", _("GIMP Startup"),
"role", "gimp-startup",
- "screen", screen,
"window-position", GTK_WIN_POS_CENTER,
"resizable", FALSE,
NULL);
@@ -137,9 +138,9 @@ splash_create (gboolean be_verbose,
GINT_TO_POINTER (0));
splash->width = MIN (gdk_pixbuf_animation_get_width (pixbuf),
- gdk_screen_get_width (screen));
+ workarea.width);
splash->height = MIN (gdk_pixbuf_animation_get_height (pixbuf),
- gdk_screen_get_height (screen));
+ workarea.height);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
diff --git a/app/gui/splash.h b/app/gui/splash.h
index 54a9ecb..d140557 100644
--- a/app/gui/splash.h
+++ b/app/gui/splash.h
@@ -20,8 +20,7 @@
void splash_create (gboolean be_verbose,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *mointor);
void splash_destroy (void);
void splash_update (const gchar *label1,
diff --git a/app/pdb/display-cmds.c b/app/pdb/display-cmds.c
index d4d49dd..21673c8 100644
--- a/app/pdb/display-cmds.c
+++ b/app/pdb/display-cmds.c
@@ -78,7 +78,7 @@ display_new_invoker (GimpProcedure *procedure,
{
gimp_image_flush (image);
- display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0, NULL, 0);
+ display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0, NULL);
if (display)
{
diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c
index 680b354..a5a419f 100644
--- a/app/plug-in/gimppluginmanager-call.c
+++ b/app/plug-in/gimppluginmanager-call.c
@@ -173,8 +173,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
GPConfig config;
GPProcRun proc_run;
gint display_ID;
- GObject *screen;
- gint monitor;
+ GObject *monitor;
if (! gimp_plug_in_open (plug_in, GIMP_PLUG_IN_CALL_RUN, FALSE))
{
@@ -217,8 +216,8 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
config.wm_class = (gchar *) gimp_get_program_class (manager->gimp);
config.display_name = gimp_get_display_name (manager->gimp,
display_ID,
- &screen, &monitor);
- config.monitor_number = monitor;
+ &monitor,
+ &config.monitor_number);
config.timestamp = gimp_get_user_time (manager->gimp);
proc_run.name = GIMP_PROCEDURE (procedure)->original_name;
diff --git a/app/tests/gimp-app-test-utils.c b/app/tests/gimp-app-test-utils.c
index a39927f..bb9d756 100644
--- a/app/tests/gimp-app-test-utils.c
+++ b/app/tests/gimp-app-test-utils.c
@@ -150,7 +150,7 @@ gimp_test_utils_create_image (Gimp *gimp,
image,
GIMP_UNIT_PIXEL,
1.0 /*scale*/,
- NULL, 0);
+ NULL);
}
/**
@@ -306,7 +306,7 @@ gimp_test_utils_create_image_from_dialog (Gimp *gimp)
/* Get the GtkWindow of the dialog */
new_image_dialog =
gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
- gdk_screen_get_default (), 0,
+ gdk_display_get_monitor (gdk_display_get_default (), 0),
"gimp-image-new-dialog",
-1 /*view_size*/);
diff --git a/app/tools/gimpcolorpickertool.c b/app/tools/gimpcolorpickertool.c
index 3cabdf6..ad0829d 100644
--- a/app/tools/gimpcolorpickertool.c
+++ b/app/tools/gimpcolorpickertool.c
@@ -342,7 +342,6 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool,
NULL,
_("Color Picker Information"),
NULL, NULL,
- gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
TRUE,
diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c
index 57a48e7..231bd2a 100644
--- a/app/tools/gimpcolortool.c
+++ b/app/tools/gimpcolortool.c
@@ -549,15 +549,13 @@ gimp_color_tool_real_picked (GimpColorTool *color_tool,
case GIMP_COLOR_PICK_MODE_PALETTE:
{
- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (shell));
- gint monitor = gimp_widget_get_monitor (GTK_WIDGET (shell));
- GtkWidget *dockable;
+ GdkMonitor *monitor = gimp_widget_get_monitor (GTK_WIDGET (shell));
+ GtkWidget *dockable;
dockable =
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy
(display->gimp)),
display->gimp,
dialog_factory,
- screen,
monitor,
"gimp-palette-editor");
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index 44d61fc..91a3dde 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -315,7 +315,6 @@ gimp_filter_tool_initialize (GimpTool *tool,
filter_tool->description,
gimp_tool_get_icon_name (tool),
gimp_tool_get_help_id (tool),
- gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
filter_tool->overlay,
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index c98a0a4..655e8b4 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -306,7 +306,6 @@ gimp_foreground_select_tool_initialize (GimpTool *tool,
NULL,
_("Dialog for foreground select"),
NULL, NULL,
- gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
TRUE,
diff --git a/app/tools/gimpgradienttool-editor.c b/app/tools/gimpgradienttool-editor.c
index ab284c9..cba74d0 100644
--- a/app/tools/gimpgradienttool-editor.c
+++ b/app/tools/gimpgradienttool-editor.c
@@ -1847,7 +1847,6 @@ gimp_gradient_tool_editor_update_gui (GimpGradientTool *gradient_tool)
gradient_tool->gui =
gimp_tool_gui_new (GIMP_TOOL (gradient_tool)->tool_info,
NULL, NULL, NULL, NULL,
- gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
TRUE,
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index 76d2240..781e7bd 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -644,7 +644,6 @@ gimp_measure_tool_dialog_new (GimpMeasureTool *measure)
NULL,
_("Measure Distances and Angles"),
NULL, NULL,
- gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
TRUE,
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index 0e76417..fc50d56 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -1300,7 +1300,6 @@ gimp_text_tool_editor_dialog (GimpTextTool *text_tool)
gimp_dialog_factory_add_foreign (dialog_factory,
"gimp-text-tool-dialog",
text_tool->editor_dialog,
- gtk_widget_get_screen (GTK_WIDGET (image_window)),
gimp_widget_get_monitor (GTK_WIDGET (image_window)));
g_signal_connect (text_tool->editor_dialog, "destroy",
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 6673e7e..48a078a 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -1207,7 +1207,6 @@ gimp_transform_tool_dialog (GimpTransformTool *tr_tool)
tr_tool->gui = gimp_tool_gui_new (tool_info,
NULL, NULL, NULL, NULL,
- gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
TRUE,
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index 9e3737b..8e7ec36 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -1161,7 +1161,6 @@ gimp_warp_tool_animate (GimpWarpTool *wt)
widget = GTK_WIDGET (gimp_display_get_shell (tool->display));
gimp_create_display (orig_image->gimp, image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (image);
}
diff --git a/app/widgets/gimpcairo-wilber.c b/app/widgets/gimpcairo-wilber.c
index 3e67685..f269e74 100644
--- a/app/widgets/gimpcairo-wilber.c
+++ b/app/widgets/gimpcairo-wilber.c
@@ -335,6 +335,7 @@ eyes_state_free (EyesState *state)
static gboolean
gimp_cairo_pointer_eyes_timeout (GtkWidget *widget)
{
+ GdkSeat *seat;
EyesState *state;
gdouble t;
gint pointer_x;
@@ -350,8 +351,10 @@ gimp_cairo_pointer_eyes_timeout (GtkWidget *widget)
t = (gdouble) g_get_monotonic_time () / G_TIME_SPAN_SECOND;
- gdk_display_get_pointer (gtk_widget_get_display (widget),
- NULL, &pointer_x, &pointer_y, NULL);
+ seat = gdk_display_get_default_seat (gdk_display_get_default ());
+
+ gdk_device_get_position (gdk_seat_get_pointer (seat),
+ NULL, &pointer_x, &pointer_y);
gtk_widget_get_allocation (widget, &allocation);
diff --git a/app/widgets/gimpcolordialog.c b/app/widgets/gimpcolordialog.c
index 256d9f5..7f10c45 100644
--- a/app/widgets/gimpcolordialog.c
+++ b/app/widgets/gimpcolordialog.c
@@ -268,7 +268,6 @@ gimp_color_dialog_new (GimpViewable *viewable,
{
gimp_dialog_factory_add_foreign (dialog_factory, dialog_identifier,
GTK_WIDGET (dialog),
- gtk_widget_get_screen (parent),
gimp_widget_get_monitor (parent));
}
diff --git a/app/widgets/gimpcontainerpopup.c b/app/widgets/gimpcontainerpopup.c
index fd48ede..fa1bbc0 100644
--- a/app/widgets/gimpcontainerpopup.c
+++ b/app/widgets/gimpcontainerpopup.c
@@ -399,7 +399,6 @@ gimp_container_popup_dialog_clicked (GtkWidget *button,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy
(popup->context->gimp)),
popup->context->gimp,
popup->dialog_factory,
- gtk_widget_get_screen (button),
gimp_widget_get_monitor (button),
popup->dialog_identifier);
g_signal_emit_by_name (popup, "confirm");
diff --git a/app/widgets/gimpcontrollereditor.c b/app/widgets/gimpcontrollereditor.c
index 78b4442..3a82a56 100644
--- a/app/widgets/gimpcontrollereditor.c
+++ b/app/widgets/gimpcontrollereditor.c
@@ -675,7 +675,6 @@ gimp_controller_editor_edit_clicked (GtkWidget *button,
gimp_dialog_factory_add_foreign (gimp_dialog_factory_get_singleton (),
"gimp-controller-action-dialog",
editor->edit_dialog,
- gtk_widget_get_screen (button),
gimp_widget_get_monitor (button));
g_signal_connect (editor->edit_dialog, "response",
diff --git a/app/widgets/gimpcontrollerlist.c b/app/widgets/gimpcontrollerlist.c
index 54b5f07..97d81d1 100644
--- a/app/widgets/gimpcontrollerlist.c
+++ b/app/widgets/gimpcontrollerlist.c
@@ -642,7 +642,6 @@ gimp_controller_list_edit_clicked (GtkWidget *button,
gimp_dialog_factory_add_foreign (gimp_dialog_factory_get_singleton (),
"gimp-controller-editor-dialog",
dialog,
- gtk_widget_get_screen (button),
gimp_widget_get_monitor (button));
g_signal_connect (dialog, "response",
diff --git a/app/widgets/gimpdashboard.c b/app/widgets/gimpdashboard.c
index 07e1d7a..7932b62 100644
--- a/app/widgets/gimpdashboard.c
+++ b/app/widgets/gimpdashboard.c
@@ -1488,9 +1488,8 @@ gimp_dashboard_low_swap_space (GimpDashboard *dashboard)
if (priv->gimp)
{
- GdkScreen *screen;
- gint monitor;
- gint field;
+ GdkMonitor *monitor;
+ gint field;
gtk_expander_set_expanded (priv->groups[GROUP_SWAP].expander, TRUE);
@@ -1508,13 +1507,13 @@ gimp_dashboard_low_swap_space (GimpDashboard *dashboard)
gimp_dashboard_update_groups (dashboard);
- monitor = gimp_get_monitor_at_pointer (&screen);
+ monitor = gimp_get_monitor_at_pointer ();
gimp_window_strategy_show_dockable_dialog (
GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (priv->gimp)),
priv->gimp,
gimp_dialog_factory_get_singleton (),
- screen, monitor,
+ monitor,
"gimp-dashboard");
g_mutex_lock (&priv->mutex);
diff --git a/app/widgets/gimpdevicestatus.c b/app/widgets/gimpdevicestatus.c
index a939b5f..6b56b09 100644
--- a/app/widgets/gimpdevicestatus.c
+++ b/app/widgets/gimpdevicestatus.c
@@ -494,7 +494,6 @@ gimp_device_status_view_clicked (GtkWidget *widget,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (status->gimp)),
status->gimp,
dialog_factory,
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
identifier);
}
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index 1bca90b..7943ac7 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -420,7 +420,7 @@ gimp_dialog_factory_dialog_sane (GimpDialogFactory *factory,
/**
* gimp_dialog_factory_dialog_new_internal:
* @factory:
- * @screen:
+ * @monitor:
* @context:
* @ui_manager:
* @identifier:
@@ -440,8 +440,7 @@ gimp_dialog_factory_dialog_sane (GimpDialogFactory *factory,
**/
static GtkWidget *
gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpContext *context,
GimpUIManager *ui_manager,
const gchar *identifier,
@@ -500,7 +499,6 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
* created in its dock's context.
*/
dock = gimp_dock_with_window_new (factory,
- screen,
monitor,
FALSE /*toolbox*/);
dockbook = gimp_dockbook_new (factory->p->menu_factory);
@@ -514,7 +512,6 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
GimpDockContainer *dock_container;
dock_window = gimp_dialog_factory_dialog_new (factory,
- screen,
monitor,
NULL /*ui_manager*/,
"gimp-toolbox-window",
@@ -621,7 +618,7 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
}
if (dialog)
- gimp_dialog_factory_add_dialog (factory, dialog, screen, monitor);
+ gimp_dialog_factory_add_dialog (factory, dialog, monitor);
}
/* Finally, if we found an existing dialog or created a new one, raise it.
@@ -631,7 +628,8 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
if (gtk_widget_is_toplevel (dialog))
{
- gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+ gtk_window_set_screen (GTK_WINDOW (dialog),
+ gdk_display_get_default_screen (gdk_monitor_get_display (monitor)));
toplevel = dialog;
}
@@ -676,7 +674,7 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
/**
* gimp_dialog_factory_dialog_new:
* @factory: a #GimpDialogFactory
- * @screen: the #GdkScreen the dialog should appear on
+ * @monitor the #GdkMonitor the dialog should appear on
* @ui_manager: A #GimpUIManager, if applicable.
* @identifier: the identifier of the dialog as registered with
* gimp_dialog_factory_register_entry()
@@ -691,19 +689,17 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
**/
GtkWidget *
gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpUIManager *ui_manager,
const gchar *identifier,
gint view_size,
gboolean present)
{
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 (GDK_IS_MONITOR (monitor), NULL);
g_return_val_if_fail (identifier != NULL, NULL);
return gimp_dialog_factory_dialog_new_internal (factory,
- screen,
monitor,
factory->p->context,
ui_manager,
@@ -763,7 +759,7 @@ gimp_dialog_factory_add_session_info (GimpDialogFactory *factory,
/**
* gimp_dialog_factory_dialog_raise:
* @factory: a #GimpDialogFactory
- * @screen: the #GdkScreen the dialog should appear on
+ * @monitor: the #GdkMonitor the dialog should appear on
* @identifiers: a '|' separated list of identifiers of dialogs as
* registered with gimp_dialog_factory_register_entry()
* @view_size: the initial preview size if a dialog needs to be created
@@ -778,8 +774,7 @@ gimp_dialog_factory_add_session_info (GimpDialogFactory *factory,
**/
GtkWidget *
gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
const gchar *identifiers,
gint view_size)
{
@@ -788,7 +783,7 @@ gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
gint i;
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 (GDK_IS_MONITOR (monitor), NULL);
g_return_val_if_fail (identifiers != NULL, NULL);
/* If the identifier is a list, try to find a matching dialog and
@@ -805,7 +800,6 @@ gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
}
dialog = gimp_dialog_factory_dialog_new_internal (factory,
- screen,
monitor,
NULL,
NULL,
@@ -848,8 +842,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)),
- 0,
+ gimp_widget_get_monitor (GTK_WIDGET (dock)),
gimp_dock_get_context (dock),
gimp_dock_get_ui_manager (dock),
identifier,
@@ -862,8 +855,7 @@ gimp_dialog_factory_dockable_new (GimpDialogFactory *factory,
void
gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
GtkWidget *dialog,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GimpDialogFactory *dialog_factory = NULL;
GimpDialogFactoryEntry *entry = NULL;
@@ -873,7 +865,7 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
g_return_if_fail (GTK_IS_WIDGET (dialog));
- g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (GDK_IS_MONITOR (monitor));
if (g_list_find (factory->p->open_dialogs, dialog))
{
@@ -941,7 +933,7 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
gui_config = GIMP_GUI_CONFIG (factory->p->context->gimp->config);
gimp_session_info_apply_geometry (current_info,
- screen, monitor,
+ monitor,
gui_config->restore_monitor);
}
@@ -1011,8 +1003,7 @@ void
gimp_dialog_factory_add_foreign (GimpDialogFactory *factory,
const gchar *identifier,
GtkWidget *dialog,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GimpDialogFactory *dialog_factory;
GimpDialogFactoryEntry *entry;
@@ -1021,7 +1012,7 @@ gimp_dialog_factory_add_foreign (GimpDialogFactory *factory,
g_return_if_fail (identifier != NULL);
g_return_if_fail (GTK_IS_WIDGET (dialog));
g_return_if_fail (gtk_widget_is_toplevel (dialog));
- g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (GDK_IS_MONITOR (monitor));
dialog_factory = gimp_dialog_factory_from_widget (dialog, &entry);
@@ -1050,7 +1041,7 @@ gimp_dialog_factory_add_foreign (GimpDialogFactory *factory,
gimp_dialog_factory_set_widget_data (dialog, factory, entry);
- gimp_dialog_factory_add_dialog (factory, dialog, screen, monitor);
+ gimp_dialog_factory_add_dialog (factory, dialog, monitor);
}
void
@@ -1444,8 +1435,7 @@ gimp_dialog_factory_save (GimpDialogFactory *factory,
void
gimp_dialog_factory_restore (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GList *infos;
@@ -1455,7 +1445,7 @@ gimp_dialog_factory_restore (GimpDialogFactory *factory,
if (gimp_session_info_get_open (info))
{
- gimp_session_info_restore (info, factory, screen, monitor);
+ gimp_session_info_restore (info, factory, monitor);
}
else
{
diff --git a/app/widgets/gimpdialogfactory.h b/app/widgets/gimpdialogfactory.h
index 0d5e9b4..e636163 100644
--- a/app/widgets/gimpdialogfactory.h
+++ b/app/widgets/gimpdialogfactory.h
@@ -138,8 +138,7 @@ GimpSessionInfo * gimp_dialog_factory_find_session_info (GimpDialogFactory
GtkWidget * gimp_dialog_factory_find_widget (GimpDialogFactory *factory,
const gchar *identifiers);
GtkWidget * gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpUIManager *ui_manager,
const gchar *identifier,
gint view_size,
@@ -151,8 +150,7 @@ GList * gimp_dialog_factory_get_session_infos (GimpDialogFactory
void gimp_dialog_factory_add_session_info (GimpDialogFactory *factory,
GimpSessionInfo *info);
GtkWidget * gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
const gchar *identifiers,
gint view_size);
GtkWidget * gimp_dialog_factory_dockable_new (GimpDialogFactory *factory,
@@ -161,21 +159,18 @@ GtkWidget * gimp_dialog_factory_dockable_new (GimpDialogFactory
gint view_size);
void gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
GtkWidget *dialog,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
void gimp_dialog_factory_add_foreign (GimpDialogFactory *factory,
const gchar *identifier,
GtkWidget *dialog,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
void gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
GtkWidget *dialog);
void gimp_dialog_factory_hide_dialog (GtkWidget *dialog);
void gimp_dialog_factory_save (GimpDialogFactory *factory,
GimpConfigWriter *writer);
void gimp_dialog_factory_restore (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
void gimp_dialog_factory_set_state (GimpDialogFactory *factory,
GimpDialogsState state);
GimpDialogsState gimp_dialog_factory_get_state (GimpDialogFactory *factory);
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index f8caa98..0927a1c 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -868,7 +868,6 @@ gimp_dockable_detach (GimpDockable *dockable)
menu_factory = gimp_dialog_factory_get_menu_factory (dialog_factory);
dock = gimp_dock_with_window_new (dialog_factory,
- gtk_widget_get_screen (GTK_WIDGET (dockable)),
gimp_widget_get_monitor (GTK_WIDGET (dockable)),
FALSE /*toolbox*/);
dock_window = gimp_dock_window_from_dock (GIMP_DOCK (dock));
diff --git a/app/widgets/gimpsessioninfo-dock.c b/app/widgets/gimpsessioninfo-dock.c
index e5e8f9a..6788cba 100644
--- a/app/widgets/gimpsessioninfo-dock.c
+++ b/app/widgets/gimpsessioninfo-dock.c
@@ -276,8 +276,7 @@ gimp_session_info_dock_from_widget (GimpDock *dock)
GimpDock *
gimp_session_info_dock_restore (GimpSessionInfoDock *dock_info,
GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpDockContainer *dock_container)
{
gint n_books = 0;
@@ -286,12 +285,10 @@ gimp_session_info_dock_restore (GimpSessionInfoDock *dock_info,
GimpUIManager *ui_manager;
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 (GDK_IS_MONITOR (monitor), NULL);
ui_manager = gimp_dock_container_get_ui_manager (dock_container);
- dock = gimp_dialog_factory_dialog_new (factory,
- screen,
- monitor,
+ dock = gimp_dialog_factory_dialog_new (factory, monitor,
ui_manager,
dock_info->dock_type,
-1 /*view_size*/,
diff --git a/app/widgets/gimpsessioninfo-dock.h b/app/widgets/gimpsessioninfo-dock.h
index 7dee2b0..835df36 100644
--- a/app/widgets/gimpsessioninfo-dock.h
+++ b/app/widgets/gimpsessioninfo-dock.h
@@ -57,8 +57,7 @@ GTokenType gimp_session_info_dock_deserialize (GScanner *
GimpSessionInfoDock * gimp_session_info_dock_from_widget (GimpDock *dock);
GimpDock * gimp_session_info_dock_restore (GimpSessionInfoDock *dock_info,
GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpDockContainer *dock_container);
diff --git a/app/widgets/gimpsessioninfo-private.h b/app/widgets/gimpsessioninfo-private.h
index bf44b98..4ac119b 100644
--- a/app/widgets/gimpsessioninfo-private.h
+++ b/app/widgets/gimpsessioninfo-private.h
@@ -35,11 +35,10 @@ struct _GimpSessionInfoPrivate
gint height;
gboolean right_align;
gboolean bottom_align;
- gint monitor;
+ GdkMonitor *monitor;
/* only valid while restoring and saving the session */
gboolean open;
- gint screen;
/* dialog specific list of GimpSessionInfoAux */
GList *aux_info;
diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c
index 35ba739..fb77704 100644
--- a/app/widgets/gimpsessioninfo.c
+++ b/app/widgets/gimpsessioninfo.c
@@ -63,16 +63,14 @@ enum
SESSION_INFO_GIMP_TOOLBOX
};
-#define DEFAULT_SCREEN -1
-#define DEFAULT_MONITOR -1
+#define DEFAULT_MONITOR NULL
typedef struct
{
GimpSessionInfo *info;
GimpDialogFactory *factory;
- GdkScreen *screen;
- gint monitor;
+ GdkMonitor *monitor;
GtkWidget *dialog;
} GimpRestoreDocksData;
@@ -122,7 +120,6 @@ gimp_session_info_init (GimpSessionInfo *info)
GimpSessionInfoPrivate);
info->p->monitor = DEFAULT_MONITOR;
- info->p->screen = DEFAULT_SCREEN;
}
static void
@@ -157,6 +154,20 @@ gimp_session_info_get_memsize (GimpObject *object,
gui_size);
}
+static gint
+monitor_number (GdkMonitor *monitor)
+{
+ GdkDisplay *display = gdk_monitor_get_display (monitor);
+ gint n_monitors = gdk_display_get_n_monitors (display);
+ gint i;
+
+ for (i = 0; i < n_monitors; i++)
+ if (gdk_display_get_monitor (display, i) == monitor)
+ return i;
+
+ return 0;
+}
+
static gboolean
gimp_session_info_serialize (GimpConfig *config,
GimpConfigWriter *writer,
@@ -195,17 +206,13 @@ gimp_session_info_serialize (GimpConfig *config,
if (info->p->monitor != DEFAULT_MONITOR)
{
gimp_config_writer_open (writer, "monitor");
- gimp_config_writer_printf (writer, "%d", info->p->monitor);
+ gimp_config_writer_printf (writer, "%d", monitor_number (info->p->monitor));
gimp_config_writer_close (writer);
}
if (info->p->open)
{
gimp_config_writer_open (writer, "open-on-exit");
-
- if (info->p->screen != DEFAULT_SCREEN)
- gimp_config_writer_printf (writer, "%d", info->p->screen);
-
gimp_config_writer_close (writer);
}
@@ -293,6 +300,8 @@ gimp_session_info_deserialize (GimpConfig *config,
switch (token)
{
+ gint dummy;
+
case G_TOKEN_LEFT_PAREN:
token = G_TOKEN_SYMBOL;
break;
@@ -342,19 +351,24 @@ gimp_session_info_deserialize (GimpConfig *config,
case SESSION_INFO_MONITOR:
token = G_TOKEN_INT;
- if (! gimp_scanner_parse_int (scanner, &info->p->monitor))
+ if (gimp_scanner_parse_int (scanner, &dummy))
+ {
+ info->p->monitor =
+ gdk_display_get_monitor (gdk_display_get_default (), dummy);
+ }
+ else
goto error;
break;
case SESSION_INFO_OPEN:
info->p->open = TRUE;
- /* the screen number is optional */
+ /* the screen number is optional, and obsolete */
if (g_scanner_peek_next_token (scanner) == G_TOKEN_RIGHT_PAREN)
break;
token = G_TOKEN_INT;
- if (! gimp_scanner_parse_int (scanner, &info->p->screen))
+ if (! gimp_scanner_parse_int (scanner, &dummy))
goto error;
break;
@@ -481,8 +495,7 @@ gimp_session_info_restore_docks (GimpRestoreDocksData *data)
{
GimpSessionInfo *info = data->info;
GimpDialogFactory *factory = data->factory;
- GdkScreen *screen = data->screen;
- gint monitor = data->monitor;
+ GdkMonitor *monitor = data->monitor;
GtkWidget *dialog = data->dialog;
GList *iter;
@@ -500,7 +513,6 @@ gimp_session_info_restore_docks (GimpRestoreDocksData *data)
dock =
GTK_WIDGET (gimp_session_info_dock_restore (dock_info,
factory,
- screen,
monitor,
GIMP_DOCK_CONTAINER (dialog)));
@@ -522,7 +534,7 @@ gimp_session_info_restore_docks (GimpRestoreDocksData *data)
gimp_session_info_clear_info (info);
g_object_unref (dialog);
- g_object_unref (screen);
+ g_object_unref (monitor);
g_object_unref (factory);
g_object_unref (info);
@@ -543,38 +555,23 @@ gimp_session_info_new (void)
void
gimp_session_info_restore (GimpSessionInfo *info,
GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor)
+ GdkMonitor *monitor)
{
GtkWidget *dialog = NULL;
GimpRestoreDocksData *data;
g_return_if_fail (GIMP_IS_SESSION_INFO (info));
g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
- g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (GDK_IS_MONITOR (monitor));
g_object_ref (info);
- if (info->p->screen != DEFAULT_SCREEN)
- {
- GdkDisplay *display;
- GdkScreen *info_screen;
-
- display = gdk_display_get_default ();
- info_screen = gdk_display_get_screen (display, info->p->screen);
-
- if (info_screen)
- screen = info_screen;
- }
-
- info->p->open = FALSE;
- info->p->screen = DEFAULT_SCREEN;
+ info->p->open = FALSE;
if (info->p->factory_entry &&
info->p->factory_entry->restore_func)
{
dialog = info->p->factory_entry->restore_func (factory,
- screen,
monitor,
info);
}
@@ -596,8 +593,7 @@ gimp_session_info_restore (GimpSessionInfo *info,
data = g_slice_new0 (GimpRestoreDocksData);
data->info = g_object_ref (info);
data->factory = g_object_ref (factory);
- data->screen = g_object_ref (screen);
- data->monitor = monitor;
+ data->monitor = g_object_ref (monitor);
data->dialog = dialog ? g_object_ref (dialog) : NULL;
g_idle_add ((GSourceFunc) gimp_session_info_restore_docks, data);
@@ -608,7 +604,7 @@ gimp_session_info_restore (GimpSessionInfo *info,
/**
* gimp_session_info_apply_geometry:
* @info:
- * @screen:
+ * @monitor:
* @current_monitor:
*
* Apply the geometry stored in the session info object to the
@@ -616,42 +612,42 @@ gimp_session_info_restore (GimpSessionInfo *info,
**/
void
gimp_session_info_apply_geometry (GimpSessionInfo *info,
- GdkScreen *screen,
- gint current_monitor,
+ GdkMonitor *current_monitor,
gboolean apply_stored_monitor)
{
- GdkRectangle rect;
- GdkRectangle work_rect;
- gchar geom[32];
- gint monitor;
- gint width;
- gint height;
+ GdkMonitor *monitor;
+ GdkRectangle rect;
+ GdkRectangle work_rect;
+ gchar geom[32];
+ gint width;
+ gint height;
g_return_if_fail (GIMP_IS_SESSION_INFO (info));
g_return_if_fail (GTK_IS_WINDOW (info->p->widget));
- g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (GDK_IS_MONITOR (current_monitor));
monitor = current_monitor;
if (apply_stored_monitor)
{
- gint n_monitors;
+ GdkDisplay *display = gdk_monitor_get_display (current_monitor);
+ gint n_monitors;
- n_monitors = gdk_screen_get_n_monitors (screen);
+ n_monitors = gdk_display_get_n_monitors (display);
- if (info->p->monitor != DEFAULT_MONITOR &&
- info->p->monitor < n_monitors)
+ if (info->p->monitor != DEFAULT_MONITOR &&
+ monitor_number (info->p->monitor) < n_monitors)
{
monitor = info->p->monitor;
}
else
{
- monitor = gdk_screen_get_primary_monitor (screen);
+ monitor = gdk_display_get_primary_monitor (display);
}
}
- gdk_screen_get_monitor_geometry (screen, monitor, &rect);
- gdk_screen_get_monitor_workarea (screen, monitor, &work_rect);
+ gdk_monitor_get_geometry (monitor, &rect);
+ gdk_monitor_get_workarea (monitor, &work_rect);
info->p->x += rect.x;
info->p->y += rect.y;
@@ -732,33 +728,33 @@ void
gimp_session_info_read_geometry (GimpSessionInfo *info,
GdkEventConfigure *cevent)
{
- GdkWindow *window;
- GdkScreen *screen;
+ GdkWindow *window;
+ GdkDisplay *display;
g_return_if_fail (GIMP_IS_SESSION_INFO (info));
g_return_if_fail (GTK_IS_WINDOW (info->p->widget));
- window = gtk_widget_get_window (info->p->widget);
- screen = gtk_widget_get_screen (info->p->widget);
+ window = gtk_widget_get_window (info->p->widget);
+ display = gtk_widget_get_display (info->p->widget);
if (window)
{
- gint x, y;
- gint monitor;
- GdkRectangle geometry;
+ gint x, y;
+ GdkMonitor *monitor;
+ GdkRectangle geometry;
gdk_window_get_root_origin (window, &x, &y);
/* Don't write negative values to the sessionrc, they are
* interpreted as relative to the right, respective bottom edge
- * of the screen.
+ * of the display.
*/
info->p->x = MAX (0, x);
info->p->y = MAX (0, y);
- monitor = gdk_screen_get_monitor_at_point (screen,
- info->p->x, info->p->y);
- gdk_screen_get_monitor_geometry (screen, monitor, &geometry);
+ monitor = gdk_display_get_monitor_at_point (display,
+ info->p->x, info->p->y);
+ gdk_monitor_get_geometry (monitor, &geometry);
/* Always store window coordinates relative to the monitor */
info->p->x -= geometry.x;
@@ -795,7 +791,7 @@ gimp_session_info_read_geometry (GimpSessionInfo *info,
info->p->monitor = DEFAULT_MONITOR;
- if (monitor != gdk_screen_get_primary_monitor (screen))
+ if (monitor != gdk_display_get_primary_monitor (display))
info->p->monitor = monitor;
}
@@ -829,16 +825,6 @@ gimp_session_info_read_geometry (GimpSessionInfo *info,
break;
}
}
-
- info->p->screen = DEFAULT_SCREEN;
-
- if (info->p->open)
- {
- GdkDisplay *display = gtk_widget_get_display (info->p->widget);
-
- if (screen != gdk_display_get_default_screen (display))
- info->p->screen = gdk_screen_get_number (screen);
- }
}
void
diff --git a/app/widgets/gimpsessioninfo.h b/app/widgets/gimpsessioninfo.h
index db5f7e9..483daff 100644
--- a/app/widgets/gimpsessioninfo.h
+++ b/app/widgets/gimpsessioninfo.h
@@ -61,11 +61,9 @@ GimpSessionInfo * gimp_session_info_new (void);
void gimp_session_info_restore (GimpSessionInfo *info,
GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
void gimp_session_info_apply_geometry (GimpSessionInfo *info,
- GdkScreen *screen,
- gint current_monitor,
+ GdkMonitor *current_monitor,
gboolean apply_stored_monitor);
void gimp_session_info_read_geometry (GimpSessionInfo *info,
GdkEventConfigure *cevent);
diff --git a/app/widgets/gimptoolbox-dnd.c b/app/widgets/gimptoolbox-dnd.c
index 1a422c9..1e9c0da 100644
--- a/app/widgets/gimptoolbox-dnd.c
+++ b/app/widgets/gimptoolbox-dnd.c
@@ -160,8 +160,7 @@ gimp_toolbox_drop_uri_list (GtkWidget *widget,
image = file_open_with_display (context->gimp, context, NULL,
file, FALSE,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget),
+ G_OBJECT (gimp_widget_get_monitor (widget)),
&status, &error);
if (! image && status != GIMP_PDB_CANCEL)
@@ -192,8 +191,7 @@ gimp_toolbox_drop_drawable (GtkWidget *widget,
new_image = gimp_image_new_from_drawable (context->gimp,
GIMP_DRAWABLE (viewable));
gimp_create_display (context->gimp, new_image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (new_image);
}
@@ -228,8 +226,7 @@ gimp_toolbox_drop_buffer (GtkWidget *widget,
image = gimp_image_new_from_buffer (context->gimp,
GIMP_BUFFER (viewable));
gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (image);
}
@@ -250,8 +247,7 @@ gimp_toolbox_drop_component (GtkWidget *widget,
new_image = gimp_image_new_from_component (context->gimp,
image, component);
gimp_create_display (new_image->gimp, new_image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (new_image);
}
@@ -271,7 +267,6 @@ gimp_toolbox_drop_pixbuf (GtkWidget *widget,
new_image = gimp_image_new_from_pixbuf (context->gimp, pixbuf,
_("Dropped Buffer"));
gimp_create_display (new_image->gimp, new_image, GIMP_UNIT_PIXEL, 1.0,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget));
+ G_OBJECT (gimp_widget_get_monitor (widget)));
g_object_unref (new_image);
}
diff --git a/app/widgets/gimptoolbox-image-area.c b/app/widgets/gimptoolbox-image-area.c
index 98eec1b..32b2e2f 100644
--- a/app/widgets/gimptoolbox-image-area.c
+++ b/app/widgets/gimptoolbox-image-area.c
@@ -51,7 +51,6 @@ image_preview_clicked (GtkWidget *widget,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (context->gimp)),
context->gimp,
gimp_dock_get_dialog_factory (GIMP_DOCK (toolbox)),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-image-list|gimp-image-grid");
}
diff --git a/app/widgets/gimptoolbox-indicator-area.c b/app/widgets/gimptoolbox-indicator-area.c
index 48b3207..1f92233 100644
--- a/app/widgets/gimptoolbox-indicator-area.c
+++ b/app/widgets/gimptoolbox-indicator-area.c
@@ -59,7 +59,6 @@ brush_preview_clicked (GtkWidget *widget,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (context->gimp)),
context->gimp,
gimp_dock_get_dialog_factory (GIMP_DOCK (toolbox)),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-brush-grid|gimp-brush-list");
}
@@ -86,7 +85,6 @@ pattern_preview_clicked (GtkWidget *widget,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (context->gimp)),
context->gimp,
gimp_dock_get_dialog_factory (GIMP_DOCK (toolbox)),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-pattern-grid|gimp-pattern-list");
}
@@ -113,7 +111,6 @@ gradient_preview_clicked (GtkWidget *widget,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (context->gimp)),
context->gimp,
gimp_dock_get_dialog_factory (GIMP_DOCK (toolbox)),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-gradient-list|gimp-gradient-grid");
}
diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c
index fb6c2e2..dbd09bc 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -762,8 +762,7 @@ toolbox_paste_received (GtkClipboard *clipboard,
image = file_open_with_display (context->gimp, context, NULL,
file, FALSE,
- G_OBJECT (gtk_widget_get_screen (widget)),
- gimp_widget_get_monitor (widget),
+ G_OBJECT (gimp_widget_get_monitor (widget)),
&status, &error);
if (! image && status != GIMP_PDB_CANCEL)
diff --git a/app/widgets/gimptoolpalette.c b/app/widgets/gimptoolpalette.c
index f87dca6..76f0178 100644
--- a/app/widgets/gimptoolpalette.c
+++ b/app/widgets/gimptoolpalette.c
@@ -538,7 +538,6 @@ gimp_tool_palette_tool_button_press (GtkWidget *widget,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy
(context->gimp)),
context->gimp,
gimp_dock_get_dialog_factory (dock),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-tool-options");
}
diff --git a/app/widgets/gimpviewablebox.c b/app/widgets/gimpviewablebox.c
index 856a19a..c680bdd 100644
--- a/app/widgets/gimpviewablebox.c
+++ b/app/widgets/gimpviewablebox.c
@@ -730,7 +730,6 @@ gimp_viewable_box_edit_clicked (GtkWidget *widget,
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy
(button->context->gimp)),
button->context->gimp,
gimp_dialog_factory_get_singleton (),
- gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
editor_id);
}
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index c274d19..077a0dc 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -782,24 +782,23 @@ gimp_get_all_modifiers_mask (void)
* Retrieves the monitor's resolution from GDK.
**/
void
-gimp_get_monitor_resolution (GdkScreen *screen,
- gint monitor,
- gdouble *xres,
- gdouble *yres)
+gimp_get_monitor_resolution (GdkMonitor *monitor,
+ gdouble *xres,
+ gdouble *yres)
{
GdkRectangle size_pixels;
gint width_mm, height_mm;
gdouble x = 0.0;
gdouble y = 0.0;
- g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (GDK_IS_MONITOR (monitor));
g_return_if_fail (xres != NULL);
g_return_if_fail (yres != NULL);
- gdk_screen_get_monitor_geometry (screen, monitor, &size_pixels);
+ gdk_monitor_get_geometry (monitor, &size_pixels);
- width_mm = gdk_screen_get_monitor_width_mm (screen, monitor);
- height_mm = gdk_screen_get_monitor_height_mm (screen, monitor);
+ width_mm = gdk_monitor_get_width_mm (monitor);
+ height_mm = gdk_monitor_get_height_mm (monitor);
/*
* From xdpyinfo.c:
@@ -1381,7 +1380,7 @@ void gimp_widget_blink_cancel (GtkWidget *widget)
/**
* gimp_dock_with_window_new:
* @factory: a #GimpDialogFacotry
- * @screen: the #GdkScreen the dock window should appear on
+ * @monitor: the #GdkMonitor the dock window should appear on
* @toolbox: if %TRUE; gives a "gimp-toolbox-window" with a
* "gimp-toolbox", "gimp-dock-window"+"gimp-dock"
* otherwise
@@ -1390,8 +1389,7 @@ void gimp_widget_blink_cancel (GtkWidget *widget)
**/
GtkWidget *
gimp_dock_with_window_new (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
gboolean toolbox)
{
GtkWidget *dock_window;
@@ -1400,13 +1398,13 @@ gimp_dock_with_window_new (GimpDialogFactory *factory,
GimpUIManager *ui_manager;
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 (GDK_IS_MONITOR (monitor), NULL);
/* Create a dock window to put the dock in. We need to create the
* dock window before the dock because the dock has a dependency to
* the ui manager in the dock window
*/
- dock_window = gimp_dialog_factory_dialog_new (factory, screen, monitor,
+ dock_window = gimp_dialog_factory_dialog_new (factory, monitor,
NULL /*ui_manager*/,
(toolbox ?
"gimp-toolbox-window" :
@@ -1416,9 +1414,7 @@ gimp_dock_with_window_new (GimpDialogFactory *factory,
dock_container = GIMP_DOCK_CONTAINER (dock_window);
ui_manager = gimp_dock_container_get_ui_manager (dock_container);
- dock = gimp_dialog_factory_dialog_new (factory,
- screen,
- monitor,
+ dock = gimp_dialog_factory_dialog_new (factory, monitor,
ui_manager,
(toolbox ?
"gimp-toolbox" :
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index 651db74..32620c6 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -69,8 +69,7 @@ GdkModifierType gimp_get_toggle_behavior_mask (void);
GdkModifierType gimp_get_constrain_behavior_mask (void);
GdkModifierType gimp_get_all_modifiers_mask (void);
-void gimp_get_monitor_resolution (GdkScreen *screen,
- gint monitor,
+void gimp_get_monitor_resolution (GdkMonitor *monitor,
gdouble *xres,
gdouble *yres);
gboolean gimp_get_style_color (GtkWidget *widget,
@@ -98,8 +97,7 @@ void gimp_highlight_widget (GtkWidget *widget
void gimp_widget_blink (GtkWidget *widget);
void gimp_widget_blink_cancel (GtkWidget *widget);
GtkWidget * gimp_dock_with_window_new (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
gboolean toolbox);
GtkWidget * gimp_tools_get_tool_options_gui (GimpToolOptions *tool_options);
void gimp_tools_set_tool_options_gui (GimpToolOptions *tool_options,
diff --git a/app/widgets/gimpwindow.c b/app/widgets/gimpwindow.c
index 67d4a4c..76c8ee5 100644
--- a/app/widgets/gimpwindow.c
+++ b/app/widgets/gimpwindow.c
@@ -46,8 +46,8 @@ enum
struct _GimpWindowPrivate
{
- gint monitor;
- GtkWidget *primary_focus_widget;
+ GdkMonitor *monitor;
+ GtkWidget *primary_focus_widget;
};
@@ -80,10 +80,9 @@ gimp_window_class_init (GimpWindowClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpWindowClass, monitor_changed),
NULL, NULL,
- gimp_marshal_VOID__OBJECT_INT,
- G_TYPE_NONE, 2,
- GDK_TYPE_SCREEN,
- G_TYPE_INT);
+ gimp_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GDK_TYPE_MONITOR);
object_class->dispose = gimp_window_dispose;
@@ -100,8 +99,6 @@ gimp_window_init (GimpWindow *window)
window->private = G_TYPE_INSTANCE_GET_PRIVATE (window,
GIMP_TYPE_WINDOW,
GimpWindowPrivate);
-
- window->private->monitor = -1;
}
static void
@@ -116,16 +113,15 @@ static void
gimp_window_monitor_changed (GtkWidget *widget)
{
GimpWindow *window = GIMP_WINDOW (widget);
- GdkScreen *screen = gtk_widget_get_screen (widget);
+ GdkDisplay *display = gtk_widget_get_display (widget);
GdkWindow *gdk_window = gtk_widget_get_window (widget);
if (gdk_window)
{
- window->private->monitor = gdk_screen_get_monitor_at_window (screen,
- gdk_window);
+ window->private->monitor = gdk_display_get_monitor_at_window (display,
+ gdk_window);
g_signal_emit (widget, window_signals[MONITOR_CHANGED], 0,
- screen,
window->private->monitor);
}
}
@@ -145,7 +141,7 @@ gimp_window_configure_event (GtkWidget *widget,
GdkEventConfigure *cevent)
{
GimpWindow *window = GIMP_WINDOW (widget);
- GdkScreen *screen = gtk_widget_get_screen (widget);
+ GdkDisplay *display = gtk_widget_get_display (widget);
GdkWindow *gdk_window = gtk_widget_get_window (widget);
if (GTK_WIDGET_CLASS (parent_class)->configure_event)
@@ -153,7 +149,7 @@ gimp_window_configure_event (GtkWidget *widget,
if (gdk_window &&
window->private->monitor !=
- gdk_screen_get_monitor_at_window (screen, gdk_window))
+ gdk_display_get_monitor_at_window (display, gdk_window))
{
gimp_window_monitor_changed (widget);
}
diff --git a/app/widgets/gimpwindow.h b/app/widgets/gimpwindow.h
index c526095..f81880d 100644
--- a/app/widgets/gimpwindow.h
+++ b/app/widgets/gimpwindow.h
@@ -44,8 +44,7 @@ struct _GimpWindowClass
GtkWindowClass parent_class;
void (* monitor_changed) (GimpWindow *window,
- GdkScreen *screen,
- gint monitor);
+ GdkMonitor *monitor);
};
diff --git a/app/widgets/gimpwindowstrategy.c b/app/widgets/gimpwindowstrategy.c
index f35ced5..7295cd1 100644
--- a/app/widgets/gimpwindowstrategy.c
+++ b/app/widgets/gimpwindowstrategy.c
@@ -70,8 +70,7 @@ GtkWidget *
gimp_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
Gimp *gimp,
GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
const gchar *identifiers)
{
GimpWindowStrategyInterface *iface;
@@ -84,7 +83,6 @@ gimp_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
return iface->show_dockable_dialog (strategy,
gimp,
factory,
- screen,
monitor,
identifiers);
diff --git a/app/widgets/gimpwindowstrategy.h b/app/widgets/gimpwindowstrategy.h
index 2193453..e86695f 100644
--- a/app/widgets/gimpwindowstrategy.h
+++ b/app/widgets/gimpwindowstrategy.h
@@ -38,8 +38,7 @@ struct _GimpWindowStrategyInterface
GtkWidget * (* show_dockable_dialog) (GimpWindowStrategy *strategy,
Gimp *gimp,
GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
const gchar *identifiers);
};
@@ -48,8 +47,7 @@ GType gimp_window_strategy_interface_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
Gimp *gimp,
GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
const gchar *identifiers);
diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h
index 09a0e51..0350791 100644
--- a/app/widgets/widgets-types.h
+++ b/app/widgets/widgets-types.h
@@ -290,8 +290,7 @@ typedef struct _GimpDialogFactoryEntry GimpDialogFactoryEntry;
/* function types */
typedef GtkWidget * (* GimpDialogRestoreFunc) (GimpDialogFactory *factory,
- GdkScreen *screen,
- gint monitor,
+ GdkMonitor *monitor,
GimpSessionInfo *info);
typedef void (* GimpActionGroupSetupFunc) (GimpActionGroup *group);
typedef void (* GimpActionGroupUpdateFunc) (GimpActionGroup *group,
diff --git a/libgimpwidgets/gimppickbutton-default.c b/libgimpwidgets/gimppickbutton-default.c
index 01be8e3..db5aaba 100644
--- a/libgimpwidgets/gimppickbutton-default.c
+++ b/libgimpwidgets/gimppickbutton-default.c
@@ -204,9 +204,9 @@ gimp_pick_button_pick (GdkScreen *screen,
gint y_root,
GimpPickButton *button)
{
- GimpRGB rgb;
GimpColorProfile *monitor_profile;
- gint monitor;
+ GdkMonitor *monitor;
+ GimpRGB rgb;
#ifdef G_OS_WIN32
@@ -276,8 +276,9 @@ gimp_pick_button_pick (GdkScreen *screen,
#endif
- monitor = gdk_screen_get_monitor_at_point (screen, x_root, y_root);
- monitor_profile = gimp_screen_get_color_profile (screen, monitor);
+ monitor = gdk_display_get_monitor_at_point (gdk_screen_get_display (screen),
+ x_root, y_root);
+ monitor_profile = gimp_monitor_get_color_profile (monitor);
if (monitor_profile)
{
diff --git a/libgimpwidgets/gimpwidgetsutils.c b/libgimpwidgets/gimpwidgetsutils.c
index 32688ef..606c280 100644
--- a/libgimpwidgets/gimpwidgetsutils.c
+++ b/libgimpwidgets/gimpwidgetsutils.c
@@ -359,11 +359,10 @@ gimp_label_set_attributes (GtkLabel *label,
pango_attr_list_unref (attrs);
}
-gint
+GdkMonitor *
gimp_widget_get_monitor (GtkWidget *widget)
{
GdkWindow *window;
- GdkScreen *screen;
GtkAllocation allocation;
gint x, y;
@@ -372,9 +371,7 @@ gimp_widget_get_monitor (GtkWidget *widget)
window = gtk_widget_get_window (widget);
if (! window)
- return gimp_get_monitor_at_pointer (&screen);
-
- screen = gtk_widget_get_screen (widget);
+ return gimp_get_monitor_at_pointer ();
gdk_window_get_origin (window, &x, &y);
gtk_widget_get_allocation (widget, &allocation);
@@ -388,32 +385,31 @@ gimp_widget_get_monitor (GtkWidget *widget)
x += allocation.width / 2;
y += allocation.height / 2;
- return gdk_screen_get_monitor_at_point (screen, x, y);
+ return gdk_display_get_monitor_at_point (gdk_display_get_default (), x, y);
}
-gint
-gimp_get_monitor_at_pointer (GdkScreen **screen)
+GdkMonitor *
+gimp_get_monitor_at_pointer (void)
{
- GdkDeviceManager *device_manager;
- GdkDevice *device;
- gint x, y;
-
- g_return_val_if_fail (screen != NULL, 0);
+ GdkDisplay *display;
+ GdkSeat *seat;
+ gint x, y;
- device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
- device = gdk_device_manager_get_client_pointer (device_manager);
+ display = gdk_display_get_default ();
+ seat = gdk_display_get_default_seat (display);
- gdk_device_get_position (device, screen, &x, &y);
+ gdk_device_get_position (gdk_seat_get_pointer (seat),
+ NULL, &x, &y);
- return gdk_screen_get_monitor_at_point (*screen, x, y);
+ return gdk_display_get_monitor_at_point (display, x, y);
}
typedef void (* MonitorChangedCallback) (GtkWidget *, gpointer);
typedef struct
{
- GtkWidget *widget;
- gint monitor;
+ GtkWidget *widget;
+ GdkMonitor *monitor;
MonitorChangedCallback callback;
gpointer user_data;
@@ -424,7 +420,7 @@ track_monitor_configure_event (GtkWidget *toplevel,
GdkEvent *event,
TrackMonitorData *track_data)
{
- gint monitor = gimp_widget_get_monitor (toplevel);
+ GdkMonitor *monitor = gimp_widget_get_monitor (toplevel);
if (monitor != track_data->monitor)
{
@@ -454,8 +450,8 @@ track_monitor_hierarchy_changed (GtkWidget *widget,
if (GTK_IS_WINDOW (toplevel))
{
- GClosure *closure;
- gint monitor;
+ GClosure *closure;
+ GdkMonitor *monitor;
closure = g_cclosure_new (G_CALLBACK (track_monitor_configure_event),
track_data, NULL);
@@ -525,27 +521,41 @@ gimp_widget_track_monitor (GtkWidget *widget,
track_monitor_hierarchy_changed (widget, NULL, track_data);
}
+static gint
+monitor_number (GdkMonitor *monitor)
+{
+ GdkDisplay *display = gdk_monitor_get_display (monitor);
+ gint n_monitors = gdk_display_get_n_monitors (display);
+ gint i;
+
+ for (i = 0; i < n_monitors; i++)
+ if (gdk_display_get_monitor (display, i) == monitor)
+ return i;
+
+ return 0;
+}
+
/**
- * gimp_screen_get_color_profile:
- * @screen: a #GdkScreen
- * @monitor: the monitor number
+ * gimp_monitor_get_color_profile:
+ * @monitor: a #GdkMonitor
*
- * This function returns the #GimpColorProfile of monitor number @monitor
- * of @screen, or %NULL if there is no profile configured.
+ * This function returns the #GimpColorProfile of @monitor
+ * or %NULL if there is no profile configured.
*
- * Since: 2.10
+ * Since: 3.0
*
* Return value: the monitor's #GimpColorProfile, or %NULL.
**/
GimpColorProfile *
-gimp_screen_get_color_profile (GdkScreen *screen,
- gint monitor)
+gimp_monitor_get_color_profile (GdkMonitor *monitor)
{
+ GdkDisplay *display;
+ GdkScreen *screen;
GimpColorProfile *profile = NULL;
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
- g_return_val_if_fail (monitor >= 0, NULL);
- g_return_val_if_fail (monitor < gdk_screen_get_n_monitors (screen), NULL);
+ g_return_val_if_fail (GDK_IS_MONITOR (monitor), NULL);
+
+ display = gdk_monitor_get_display (monitor);
#if defined GDK_WINDOWING_X11
{
@@ -556,10 +566,13 @@ gimp_screen_get_color_profile (GdkScreen *screen,
guchar *data = NULL;
if (monitor > 0)
- atom_name = g_strdup_printf ("_ICC_PROFILE_%d", monitor);
+ atom_name = g_strdup_printf ("_ICC_PROFILE_%d",
+ monitor_number (monitor));
else
atom_name = g_strdup ("_ICC_PROFILE");
+ screen = gdk_display_get_default_screen (display);
+
if (gdk_property_get (gdk_screen_get_root_window (screen),
gdk_atom_intern (atom_name, FALSE),
GDK_NONE,
@@ -639,23 +652,20 @@ gimp_screen_get_color_profile (GdkScreen *screen,
GimpColorProfile *
gimp_widget_get_color_profile (GtkWidget *widget)
{
- GdkScreen *screen;
- gint monitor;
+ GdkMonitor *monitor;
g_return_val_if_fail (widget == NULL || GTK_IS_WIDGET (widget), NULL);
if (widget)
{
- screen = gtk_widget_get_screen (widget);
monitor = gimp_widget_get_monitor (widget);
}
else
{
- screen = gdk_screen_get_default ();
- monitor = 0;
+ monitor = gdk_display_get_monitor (gdk_display_get_default (), 0);
}
- return gimp_screen_get_color_profile (screen, monitor);
+ return gimp_monitor_get_color_profile (monitor);
}
static GimpColorProfile *
diff --git a/libgimpwidgets/gimpwidgetsutils.h b/libgimpwidgets/gimpwidgetsutils.h
index 231f8c6..e2a7e77 100644
--- a/libgimpwidgets/gimpwidgetsutils.h
+++ b/libgimpwidgets/gimpwidgetsutils.h
@@ -51,15 +51,14 @@ GtkWidget * gimp_grid_attach_aligned (GtkGrid *grid,
void gimp_label_set_attributes (GtkLabel *label,
...);
-gint gimp_widget_get_monitor (GtkWidget *widget);
-gint gimp_get_monitor_at_pointer (GdkScreen **screen);
+GdkMonitor * gimp_widget_get_monitor (GtkWidget *widget);
+GdkMonitor * gimp_get_monitor_at_pointer (void);
void gimp_widget_track_monitor (GtkWidget *widget,
GCallback monitor_changed_callback,
gpointer user_data);
-GimpColorProfile * gimp_screen_get_color_profile (GdkScreen *screen,
- gint monitor);
+GimpColorProfile * gimp_monitor_get_color_profile (GdkMonitor *monitor);
GimpColorProfile * gimp_widget_get_color_profile (GtkWidget *widget);
GimpColorTransform * gimp_widget_get_color_transform (GtkWidget *widget,
diff --git a/pdb/groups/display.pdb b/pdb/groups/display.pdb
index 3ee6124..0c535c0 100644
--- a/pdb/groups/display.pdb
+++ b/pdb/groups/display.pdb
@@ -74,7 +74,7 @@ HELP
{
gimp_image_flush (image);
- display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0, NULL, 0);
+ display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0, NULL);
if (display)
{
diff --git a/plug-ins/screenshot/screenshot-freedesktop.c b/plug-ins/screenshot/screenshot-freedesktop.c
index 1a55596..ac35ce5 100644
--- a/plug-ins/screenshot/screenshot-freedesktop.c
+++ b/plug-ins/screenshot/screenshot-freedesktop.c
@@ -124,7 +124,7 @@ screenshot_freedesktop_dbus_signal (GDBusProxy *proxy,
GimpPDBStatusType
screenshot_freedesktop_shoot (ScreenshotValues *shootvals,
- GdkScreen *screen,
+ GdkMonitor *monitor,
gint32 *image_ID,
GError **error)
{
@@ -183,8 +183,7 @@ screenshot_freedesktop_shoot (ScreenshotValues *shootvals,
* portal screenshots.
* TODO!
*/
- profile = gimp_screen_get_color_profile (screen,
- shootvals->monitor);
+ profile = gimp_monitor_get_color_profile (monitor);
if (profile)
{
gimp_image_set_color_profile (*image_ID, profile);
diff --git a/plug-ins/screenshot/screenshot-freedesktop.h b/plug-ins/screenshot/screenshot-freedesktop.h
index 81e2111..b9df053 100644
--- a/plug-ins/screenshot/screenshot-freedesktop.h
+++ b/plug-ins/screenshot/screenshot-freedesktop.h
@@ -24,7 +24,7 @@ gboolean screenshot_freedesktop_available (void);
ScreenshotCapabilities screenshot_freedesktop_get_capabilities (void);
GimpPDBStatusType screenshot_freedesktop_shoot (ScreenshotValues *shootvals,
- GdkScreen *screen,
+ GdkMonitor *monitor,
gint32 *image_ID,
GError **error);
diff --git a/plug-ins/screenshot/screenshot-gnome-shell.c b/plug-ins/screenshot/screenshot-gnome-shell.c
index 8a0cb4a..9aff1dc 100644
--- a/plug-ins/screenshot/screenshot-gnome-shell.c
+++ b/plug-ins/screenshot/screenshot-gnome-shell.c
@@ -77,7 +77,7 @@ screenshot_gnome_shell_get_capabilities (void)
GimpPDBStatusType
screenshot_gnome_shell_shoot (ScreenshotValues *shootvals,
- GdkScreen *screen,
+ GdkMonitor *monitor,
gint32 *image_ID,
GError **error)
{
@@ -85,7 +85,6 @@ screenshot_gnome_shell_shoot (ScreenshotValues *shootvals,
const gchar *method = NULL;
GVariant *args = NULL;
GVariant *retval;
- gint monitor = shootvals->monitor;
gboolean success;
filename = gimp_temp_name ("png");
@@ -135,9 +134,9 @@ screenshot_gnome_shell_shoot (ScreenshotValues *shootvals,
filename);
monitor =
- gdk_screen_get_monitor_at_point (screen,
- (shootvals->x1 + shootvals->x2) / 2,
- (shootvals->y1 + shootvals->y2) / 2);
+ gdk_display_get_monitor_at_point (gdk_monitor_get_display (monitor),
+ (shootvals->x1 + shootvals->x2) / 2,
+ (shootvals->y1 + shootvals->y2) / 2);
if (shootvals->screenshot_delay > 0)
screenshot_delay (shootvals->screenshot_delay);
@@ -181,7 +180,7 @@ screenshot_gnome_shell_shoot (ScreenshotValues *shootvals,
filename, filename);
gimp_image_set_filename (*image_ID, "screenshot.png");
- profile = gimp_screen_get_color_profile (screen, monitor);
+ profile = gimp_monitor_get_color_profile (monitor);
if (profile)
{
diff --git a/plug-ins/screenshot/screenshot-gnome-shell.h b/plug-ins/screenshot/screenshot-gnome-shell.h
index 6cb1bcc..3e47af5 100644
--- a/plug-ins/screenshot/screenshot-gnome-shell.h
+++ b/plug-ins/screenshot/screenshot-gnome-shell.h
@@ -24,7 +24,7 @@ gboolean screenshot_gnome_shell_available (void);
ScreenshotCapabilities screenshot_gnome_shell_get_capabilities (void);
GimpPDBStatusType screenshot_gnome_shell_shoot (ScreenshotValues *shootvals,
- GdkScreen *screen,
+ GdkMonitor *monitor,
gint32 *image_ID,
GError **error);
diff --git a/plug-ins/screenshot/screenshot-kwin.c b/plug-ins/screenshot/screenshot-kwin.c
index 59ba543..ece7930 100644
--- a/plug-ins/screenshot/screenshot-kwin.c
+++ b/plug-ins/screenshot/screenshot-kwin.c
@@ -82,7 +82,7 @@ screenshot_kwin_get_capabilities (void)
GimpPDBStatusType
screenshot_kwin_shoot (ScreenshotValues *shootvals,
- GdkScreen *screen,
+ GdkMonitor *monitor,
gint32 *image_ID,
GError **error)
{
@@ -90,7 +90,6 @@ screenshot_kwin_shoot (ScreenshotValues *shootvals,
const gchar *method = NULL;
GVariant *args = NULL;
GVariant *retval;
- gint monitor = shootvals->monitor;
gint32 mask;
switch (shootvals->shoot_type)
@@ -178,7 +177,7 @@ screenshot_kwin_shoot (ScreenshotValues *shootvals,
* assume always the monitor 0, which will still work in common
* cases.
*/
- profile = gimp_screen_get_color_profile (screen, monitor);
+ profile = gimp_monitor_get_color_profile (monitor);
if (profile)
{
diff --git a/plug-ins/screenshot/screenshot-kwin.h b/plug-ins/screenshot/screenshot-kwin.h
index bec5c0f..28d87fb 100644
--- a/plug-ins/screenshot/screenshot-kwin.h
+++ b/plug-ins/screenshot/screenshot-kwin.h
@@ -24,7 +24,7 @@ gboolean screenshot_kwin_available (void);
ScreenshotCapabilities screenshot_kwin_get_capabilities (void);
GimpPDBStatusType screenshot_kwin_shoot (ScreenshotValues *shootvals,
- GdkScreen *screen,
+ GdkMonitor *monitor,
gint32 *image_ID,
GError **error);
diff --git a/plug-ins/screenshot/screenshot-win32.h b/plug-ins/screenshot/screenshot-win32.h
index 2e80c0d..db83b44 100644
--- a/plug-ins/screenshot/screenshot-win32.h
+++ b/plug-ins/screenshot/screenshot-win32.h
@@ -34,7 +34,7 @@ gboolean screenshot_win32_available (void);
ScreenshotCapabilities screenshot_win32_get_capabilities (void);
GimpPDBStatusType screenshot_win32_shoot (ScreenshotValues *shootvals,
- GdkScreen *screen,
+ GdkMonitor *monitor,
gint32 *image_ID,
GError **error);
diff --git a/plug-ins/screenshot/screenshot-x11.c b/plug-ins/screenshot/screenshot-x11.c
index 7dafc00..9fd1050 100644
--- a/plug-ins/screenshot/screenshot-x11.c
+++ b/plug-ins/screenshot/screenshot-x11.c
@@ -49,7 +49,7 @@
static guint32 select_window (ScreenshotValues *shootvals,
- GdkScreen *screen);
+ GdkMonitor *monitor);
static gint32 create_image (cairo_surface_t *surface,
cairo_region_t *shape,
const gchar *name);
@@ -59,10 +59,10 @@ static gint32 create_image (cairo_surface_t *surface,
static guint32
select_window (ScreenshotValues *shootvals,
- GdkScreen *screen)
+ GdkMonitor *monitor)
{
- Display *x_dpy = GDK_SCREEN_XDISPLAY (screen);
- gint x_scr = GDK_SCREEN_XNUMBER (screen);
+ Display *x_dpy = GDK_DISPLAY_XDISPLAY (gdk_monitor_get_display (monitor));
+ gint x_scr = 0;
Window x_root = RootWindow (x_dpy, x_scr);
Window x_win = None;
GC x_gc = NULL;
@@ -123,7 +123,7 @@ select_window (ScreenshotValues *shootvals,
&gc_values);
}
- keymap = gdk_keymap_get_for_display (gdk_screen_get_display (screen));
+ keymap = gdk_keymap_get_for_display (gdk_monitor_get_display (monitor));
if (gdk_keymap_get_entries_for_keyval (keymap, GDK_KEY_Escape,
&keys, &num_keys))
@@ -331,8 +331,8 @@ window_get_title (GdkDisplay *display,
}
static cairo_region_t *
-window_get_shape (GdkScreen *screen,
- guint32 window)
+window_get_shape (GdkMonitor *monitor,
+ guint32 window)
{
cairo_region_t *shape = NULL;
@@ -341,7 +341,8 @@ window_get_shape (GdkScreen *screen,
gint rect_count;
gint rect_order;
- rects = XShapeGetRectangles (GDK_SCREEN_XDISPLAY (screen), window,
+ rects = XShapeGetRectangles (GDK_DISPLAY_XDISPLAY (gdk_monitor_get_display (monitor)),
+ window,
ShapeBounding,
&rect_count, &rect_order);
@@ -553,7 +554,7 @@ screenshot_x11_get_capabilities (void)
GimpPDBStatusType
screenshot_x11_shoot (ScreenshotValues *shootvals,
- GdkScreen *screen,
+ GdkMonitor *monitor,
gint32 *image_ID,
GError **error)
{
@@ -568,19 +569,18 @@ screenshot_x11_shoot (ScreenshotValues *shootvals,
gchar *name = NULL;
gint screen_x;
gint screen_y;
- gint monitor = shootvals->monitor;
gint x, y;
/* use default screen if we are running non-interactively */
- if (screen == NULL)
- screen = gdk_screen_get_default ();
+ if (monitor == NULL)
+ monitor = gdk_display_get_monitor (gdk_display_get_default (), 0);
if (shootvals->shoot_type != SHOOT_ROOT && ! shootvals->window_id)
{
if (shootvals->select_delay > 0)
screenshot_delay (shootvals->select_delay);
- shootvals->window_id = select_window (shootvals, screen);
+ shootvals->window_id = select_window (shootvals, monitor);
if (! shootvals->window_id)
return GIMP_PDB_CANCEL;
@@ -589,12 +589,12 @@ screenshot_x11_shoot (ScreenshotValues *shootvals,
if (shootvals->screenshot_delay > 0)
screenshot_delay (shootvals->screenshot_delay);
- display = gdk_screen_get_display (screen);
+ display = gdk_monitor_get_display (monitor);
screen_rect.x = 0;
screen_rect.y = 0;
- screen_rect.width = gdk_screen_get_width (screen);
- screen_rect.height = gdk_screen_get_height (screen);
+ screen_rect.width = gdk_screen_get_width (gdk_display_get_default_screen (display));
+ screen_rect.height = gdk_screen_get_height (gdk_display_get_default_screen (display));
if (shootvals->shoot_type == SHOOT_REGION)
{
@@ -603,15 +603,15 @@ screenshot_x11_shoot (ScreenshotValues *shootvals,
rect.width = ABS (shootvals->x2 - shootvals->x1);
rect.height = ABS (shootvals->y2 - shootvals->y1);
- monitor = gdk_screen_get_monitor_at_point (screen,
- rect.x + rect.width / 2,
- rect.y + rect.height / 2);
+ monitor = gdk_display_get_monitor_at_point (display,
+ rect.x + rect.width / 2,
+ rect.y + rect.height / 2);
}
else
{
if (shootvals->shoot_type == SHOOT_ROOT)
{
- window = gdk_screen_get_root_window (screen);
+ window = gdk_screen_get_root_window (gdk_display_get_default_screen (display));
/* FIXME: figure monitor */
}
@@ -620,7 +620,7 @@ screenshot_x11_shoot (ScreenshotValues *shootvals,
window = gdk_x11_window_foreign_new_for_display (display,
shootvals->window_id);
- monitor = gdk_screen_get_monitor_at_window (screen, window);
+ monitor = gdk_display_get_monitor_at_window (display, window);
}
if (! window)
@@ -640,7 +640,7 @@ screenshot_x11_shoot (ScreenshotValues *shootvals,
if (! gdk_rectangle_intersect (&rect, &screen_rect, &rect))
return GIMP_PDB_EXECUTION_ERROR;
- window = gdk_screen_get_root_window (screen);
+ window = gdk_screen_get_root_window (gdk_display_get_default_screen (display));
gdk_window_get_origin (window, &screen_x, &screen_y);
screenshot = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
@@ -661,7 +661,7 @@ screenshot_x11_shoot (ScreenshotValues *shootvals,
{
name = window_get_title (display, shootvals->window_id);
- shape = window_get_shape (screen, shootvals->window_id);
+ shape = window_get_shape (monitor, shootvals->window_id);
if (shape)
cairo_region_translate (shape, x - rect.x, y - rect.y);
@@ -683,7 +683,7 @@ screenshot_x11_shoot (ScreenshotValues *shootvals,
shootvals->shoot_type == SHOOT_WINDOW) && shootvals->show_cursor)
add_cursor_image (*image_ID, display);
- profile = gimp_screen_get_color_profile (screen, monitor);
+ profile = gimp_monitor_get_color_profile (monitor);
if (profile)
{
diff --git a/plug-ins/screenshot/screenshot-x11.h b/plug-ins/screenshot/screenshot-x11.h
index fd3d0db..3b69fb5 100644
--- a/plug-ins/screenshot/screenshot-x11.h
+++ b/plug-ins/screenshot/screenshot-x11.h
@@ -26,7 +26,7 @@ gboolean screenshot_x11_available (void);
ScreenshotCapabilities screenshot_x11_get_capabilities (void);
GimpPDBStatusType screenshot_x11_shoot (ScreenshotValues *shootvals,
- GdkScreen *screen,
+ GdkMonitor *monitor,
gint32 *image_ID,
GError **error);
diff --git a/plug-ins/screenshot/screenshot.c b/plug-ins/screenshot/screenshot.c
index 1d1f50f..2a3984e 100644
--- a/plug-ins/screenshot/screenshot.c
+++ b/plug-ins/screenshot/screenshot.c
@@ -60,11 +60,11 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
-static GimpPDBStatusType shoot (GdkScreen *screen,
+static GimpPDBStatusType shoot (GdkMonitor *monitor,
gint32 *image_ID,
GError **error);
-static gboolean shoot_dialog (GdkScreen **screen);
+static gboolean shoot_dialog (GdkMonitor **monitor);
static gboolean shoot_quit_timeout (gpointer data);
static gboolean shoot_delay_timeout (gpointer data);
@@ -81,7 +81,6 @@ static ScreenshotValues shootvals =
SHOOT_WINDOW, /* root window */
TRUE, /* include WM decorations */
0, /* window ID */
- 0, /* monitor */
0, /* select delay */
0, /* screenshot delay */
0, /* coords of region dragged out by pointer */
@@ -168,7 +167,7 @@ run (const gchar *name,
static GimpParam values[2];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
- GdkScreen *screen = NULL;
+ GdkMonitor *monitor = NULL;
gint32 image_ID;
GError *error = NULL;
@@ -247,7 +246,7 @@ run (const gchar *name,
}
/* Get information from the dialog */
- if (! shoot_dialog (&screen))
+ if (! shoot_dialog (&monitor))
status = GIMP_PDB_CANCEL;
break;
@@ -299,7 +298,7 @@ run (const gchar *name,
if (status == GIMP_PDB_SUCCESS)
{
- status = shoot (screen, &image_ID, &error);
+ status = shoot (monitor, &image_ID, &error);
}
if (status == GIMP_PDB_SUCCESS)
@@ -343,7 +342,7 @@ run (const gchar *name,
/* Give some sort of feedback that the shot is done */
if (shootvals.select_delay > 0)
{
- gdk_display_beep (gdk_screen_get_display (screen));
+ gdk_display_beep (gdk_monitor_get_display (monitor));
gdk_flush (); /* flush so the beep makes it to the server */
}
}
@@ -368,30 +367,30 @@ run (const gchar *name,
/* The main Screenshot function */
static GimpPDBStatusType
-shoot (GdkScreen *screen,
+shoot (GdkMonitor *monitor,
gint32 *image_ID,
GError **error)
{
#ifdef PLATFORM_OSX
if (backend == SCREENSHOT_BACKEND_OSX)
- return screenshot_osx_shoot (&shootvals, screen, image_ID, error);
+ return screenshot_osx_shoot (&shootvals, monitor, image_ID, error);
#endif
#ifdef G_OS_WIN32
if (backend == SCREENSHOT_BACKEND_WIN32)
- return screenshot_win32_shoot (&shootvals, screen, image_ID, error);
+ return screenshot_win32_shoot (&shootvals, monitor, image_ID, error);
#endif
if (backend == SCREENSHOT_BACKEND_FREEDESKTOP)
- return screenshot_freedesktop_shoot (&shootvals, screen, image_ID, error);
+ return screenshot_freedesktop_shoot (&shootvals, monitor, image_ID, error);
else if (backend == SCREENSHOT_BACKEND_GNOME_SHELL)
- return screenshot_gnome_shell_shoot (&shootvals, screen, image_ID, error);
+ return screenshot_gnome_shell_shoot (&shootvals, monitor, image_ID, error);
else if (backend == SCREENSHOT_BACKEND_KWIN)
- return screenshot_kwin_shoot (&shootvals, screen, image_ID, error);
+ return screenshot_kwin_shoot (&shootvals, monitor, image_ID, error);
#ifdef GDK_WINDOWING_X11
if (backend == SCREENSHOT_BACKEND_X11)
- return screenshot_x11_shoot (&shootvals, screen, image_ID, error);
+ return screenshot_x11_shoot (&shootvals, monitor, image_ID, error);
#endif
return GIMP_PDB_CALLING_ERROR; /* silence compiler */
@@ -458,7 +457,7 @@ shoot_radio_button_toggled (GtkWidget *widget,
}
static gboolean
-shoot_dialog (GdkScreen **screen)
+shoot_dialog (GdkMonitor **monitor)
{
GtkWidget *dialog;
GtkWidget *main_vbox;
@@ -817,7 +816,7 @@ shoot_dialog (GdkScreen **screen)
if (run)
{
/* get the screen on which we are running */
- *screen = gtk_widget_get_screen (dialog);
+ *monitor = gimp_widget_get_monitor (dialog);
}
gtk_widget_destroy (dialog);
diff --git a/plug-ins/screenshot/screenshot.h b/plug-ins/screenshot/screenshot.h
index 3ce07f7..b868264 100644
--- a/plug-ins/screenshot/screenshot.h
+++ b/plug-ins/screenshot/screenshot.h
@@ -62,7 +62,7 @@ typedef struct
ShootType shoot_type;
gboolean decorate;
guint window_id;
- gint monitor;
+ GdkMonitor *monitor;
guint select_delay;
guint screenshot_delay;
gint x1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]