[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix a few gtk3 deprecation warnings in dialog_mapped()
From: |
Nikolas Nyby |
Subject: |
[PATCH] Fix a few gtk3 deprecation warnings in dialog_mapped() |
Date: |
Sun, 12 May 2024 01:18:08 -0400 |
---
gtkwindows.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/gtkwindows.c b/gtkwindows.c
index 353e594d..2803627d 100644
--- a/gtkwindows.c
+++ b/gtkwindows.c
@@ -104,10 +104,23 @@ dialog_mapped(GtkWidget * window, gpointer UNUSED(data))
{
GdkRectangle monitorrect;
GtkAllocation allocation;
- GdkScreen *screen = gtk_widget_get_screen(window);
gtk_widget_get_allocation(window, &allocation);
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkDisplay *display = gtk_widget_get_display(window);
+ if (!display || gdk_display_get_n_monitors(display) == 1) {
+ monitorrect.x = 0;
+ monitorrect.y = 0;
+ monitorrect.width = gdk_screen_width();
+ monitorrect.height = gdk_screen_height();
+ } else {
+ GdkMonitor *monitor = gdk_display_get_monitor_at_window(display,
+
gtk_widget_get_window(window));
+ gdk_monitor_get_geometry(monitor, &monitorrect);
+ }
+#else
+ GdkScreen *screen = gtk_widget_get_screen(window);
if (!screen || gdk_screen_get_n_monitors(screen) == 1) {
monitorrect.x = 0;
monitorrect.y = 0;
@@ -117,6 +130,7 @@ dialog_mapped(GtkWidget * window, gpointer UNUSED(data))
int monitor = gdk_screen_get_monitor_at_window(screen,
gtk_widget_get_window(window));
gdk_screen_get_monitor_geometry(screen, monitor, &monitorrect);
}
+#endif
if (allocation.width > monitorrect.width || allocation.height >
monitorrect.height) { /* Dialog bigger than window! (just show at top
left) */
gtk_window_move(GTK_WINDOW(window), monitorrect.x, monitorrect.y);
--
2.34.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Fix a few gtk3 deprecation warnings in dialog_mapped(),
Nikolas Nyby <=