[nautilus/wip/antoniof/gnome-42: 45/72] Revert "window: Drop GdkScreen parameter from ::new()"
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gnome-42: 45/72] Revert "window: Drop GdkScreen parameter from ::new()"
- Date: Fri, 11 Feb 2022 19:28:01 +0000 (UTC)
commit 581342cc645db6d6056c820e03e5d12ed73d0e39
Author: António Fernandes <antoniof gnome org>
Date: Fri Feb 11 19:01:54 2022 +0000
Revert "window: Drop GdkScreen parameter from ::new()"
This reverts commit d625b9b254a62ae2593844829b586c307f9ebd24.
src/nautilus-application.c | 21 ++++++++++-----------
src/nautilus-application.h | 3 ++-
src/nautilus-gtk4-helpers.c | 17 -----------------
src/nautilus-gtk4-helpers.h | 6 ------
src/nautilus-window.c | 8 ++++----
src/nautilus-window.h | 2 +-
6 files changed, 17 insertions(+), 40 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 348dae188..89a26615f 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -66,7 +66,6 @@
#include "nautilus-view.h"
#include "nautilus-window-slot.h"
#include "nautilus-window.h"
-#include "nautilus-gtk4-helpers.h"
typedef struct
{
@@ -241,7 +240,8 @@ menu_provider_init_callback (void)
}
NautilusWindow *
-nautilus_application_create_window (NautilusApplication *self)
+nautilus_application_create_window (NautilusApplication *self,
+ GdkScreen *screen)
{
NautilusWindow *window;
gboolean maximized;
@@ -252,7 +252,7 @@ nautilus_application_create_window (NautilusApplication *self)
g_return_val_if_fail (NAUTILUS_IS_APPLICATION (self), NULL);
nautilus_profile_start (NULL);
- window = nautilus_window_new ();
+ window = nautilus_window_new (screen);
maximized = g_settings_get_boolean
(nautilus_window_state, NAUTILUS_WINDOW_STATE_MAXIMIZED);
@@ -369,7 +369,7 @@ real_open_location_full (NautilusApplication *self,
GFile *old_location = NULL;
char *old_uri, *new_uri;
gboolean use_same;
- GdkDisplay *display;
+ GdkScreen *screen;
use_same = TRUE;
/* FIXME: We are having problems on getting the current focused window with
@@ -441,13 +441,12 @@ real_open_location_full (NautilusApplication *self,
}
else
{
- display = active_window != NULL ?
- gtk_root_get_display (GTK_ROOT (active_window)) :
- gdk_display_get_default ();
+ screen = active_window != NULL ?
+ gtk_window_get_screen (GTK_WINDOW (active_window)) :
+ gdk_screen_get_default ();
- target_window = nautilus_application_create_window (self);
+ target_window = nautilus_application_create_window (self, screen);
/* Whatever the caller says, the slot won't be the same */
- gtk_window_set_display (GTK_WINDOW (target_window), display);
target_slot = NULL;
}
@@ -466,7 +465,7 @@ open_window (NautilusApplication *self,
NautilusWindow *window;
nautilus_profile_start (NULL);
- window = nautilus_application_create_window (self);
+ window = nautilus_application_create_window (self, gdk_screen_get_default ());
if (location != NULL)
{
@@ -507,7 +506,7 @@ nautilus_application_open_location (NautilusApplication *self,
if (!slot)
{
- window = nautilus_application_create_window (self);
+ window = nautilus_application_create_window (self, gdk_screen_get_default ());
}
else
{
diff --git a/src/nautilus-application.h b/src/nautilus-application.h
index 76d741a50..cbef12312 100644
--- a/src/nautilus-application.h
+++ b/src/nautilus-application.h
@@ -43,7 +43,8 @@ struct _NautilusApplicationClass {
NautilusApplication * nautilus_application_new (void);
-NautilusWindow * nautilus_application_create_window (NautilusApplication *application);
+NautilusWindow * nautilus_application_create_window (NautilusApplication *application,
+ GdkScreen *screen);
void nautilus_application_set_accelerator (GApplication *app,
const gchar *action_name,
diff --git a/src/nautilus-gtk4-helpers.c b/src/nautilus-gtk4-helpers.c
index a4c5ac679..21e72d87b 100644
--- a/src/nautilus-gtk4-helpers.c
+++ b/src/nautilus-gtk4-helpers.c
@@ -123,20 +123,3 @@ gtk_widget_get_first_child (GtkWidget *widget)
return NULL;
}
-
-GdkDisplay *
-gtk_root_get_display (GtkRoot *root)
-{
- g_assert (GTK_IS_WINDOW (root));
-
- return gdk_screen_get_display (gtk_window_get_screen (GTK_WINDOW (root)));
-}
-
-void
-gtk_window_set_display (GtkWindow *window,
- GdkDisplay *display)
-{
- g_assert (GTK_IS_WINDOW (window));
-
- gtk_window_set_screen (window, gdk_display_get_default_screen (display));
-}
diff --git a/src/nautilus-gtk4-helpers.h b/src/nautilus-gtk4-helpers.h
index 9ffacc1e1..9621bcfa7 100644
--- a/src/nautilus-gtk4-helpers.h
+++ b/src/nautilus-gtk4-helpers.h
@@ -33,11 +33,5 @@ void gtk_check_button_set_active (GtkCheckButton *button,
gboolean gtk_check_button_get_active (GtkCheckButton *button);
GtkWidget *gtk_widget_get_first_child (GtkWidget *widget);
-#define GTK_ROOT(root) ((GtkRoot *) GTK_WINDOW (root))
-typedef GtkWindow GtkRoot;
-GdkDisplay *gtk_root_get_display (GtkRoot *root);
-void gtk_window_set_display (GtkWindow *window,
- GdkDisplay *display);
-
#endif
G_END_DECLS
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 2a8ac417b..162537dca 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -2002,9 +2002,8 @@ notebook_create_window_cb (GtkNotebook *notebook,
}
app = NAUTILUS_APPLICATION (g_application_get_default ());
- new_window = nautilus_application_create_window (app);
- gtk_window_set_display (GTK_WINDOW (new_window),
- gtk_widget_get_display (GTK_WIDGET (notebook)));
+ new_window = nautilus_application_create_window
+ (app, gtk_widget_get_screen (GTK_WIDGET (notebook)));
slot = NAUTILUS_WINDOW_SLOT (page);
g_object_set_data (G_OBJECT (slot), "dnd-window-slot",
@@ -2850,10 +2849,11 @@ nautilus_window_class_init (NautilusWindowClass *class)
}
NautilusWindow *
-nautilus_window_new (void)
+nautilus_window_new (GdkScreen *screen)
{
return g_object_new (NAUTILUS_TYPE_WINDOW,
"icon-name", APPLICATION_ID,
+ "screen", screen,
NULL);
}
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index af38441f1..dfb810ae5 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -57,7 +57,7 @@ typedef void (* NautilusWindowHandleExported) (NautilusWindow *window,
#define NAUTILUS_WINDOW_DEFAULT_WIDTH 890
#define NAUTILUS_WINDOW_DEFAULT_HEIGHT 550
-NautilusWindow * nautilus_window_new (void);
+NautilusWindow * nautilus_window_new (GdkScreen *screen);
void nautilus_window_close (NautilusWindow *window);
void nautilus_window_open_location_full (NautilusWindow *window,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]