diff options
Diffstat (limited to '')
-rw-r--r-- | graphics/darktable/files/patch-git-0cc770a2e21ced661c5363c5733eb13ac7433748 | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/graphics/darktable/files/patch-git-0cc770a2e21ced661c5363c5733eb13ac7433748 b/graphics/darktable/files/patch-git-0cc770a2e21ced661c5363c5733eb13ac7433748 deleted file mode 100644 index 4127a55bb2ba..000000000000 --- a/graphics/darktable/files/patch-git-0cc770a2e21ced661c5363c5733eb13ac7433748 +++ /dev/null @@ -1,85 +0,0 @@ -From 0cc770a2e21ced661c5363c5733eb13ac7433748 Mon Sep 17 00:00:00 2001 -From: Martin Straeten <39386816+MStraeten@users.noreply.github.com> -Date: Fri, 27 Jun 2025 17:06:45 +0200 -Subject: [PATCH] reset window placement if last position is out of available - display space (#18988) - -* reset window if position is out of display space - -on initialisation darktable moves the window to the last position even thats outside of the available displays. - -_valid_window_placement checks for an overlay with an existing display - -dt_gui_gtk_load_config() resets position to default if there's no overlap - -* 24 pixel as a border - -a border of 24 pixels is used to define the effective area that must be overlapped from the last window position to avoid a reset of position - -* stile fixes - -one parameter per line -several const additions ---- - src/gui/gtk.c | 41 ++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 40 insertions(+), 1 deletion(-) - -diff --git a/src/gui/gtk.c b/src/gui/gtk.c -index 671d87345850..a620dcb42332 100644 ---- src/gui/gtk.c -+++ b/src/gui/gtk.c -@@ -773,6 +773,42 @@ static gboolean _scrollbar_changed(GtkWidget *widget, - return TRUE; - } - -+gboolean _valid_window_placement( const gint saved_x, -+ const gint saved_y, -+ const gint window_width, -+ const gint window_height, -+ const gint border) -+{ -+ GdkDisplay *display = gdk_display_get_default(); -+ const gint n_monitors = gdk_display_get_n_monitors(display); -+ -+ // check each monitor -+ for(gint i = 0; i < n_monitors; i++) -+ { -+ GdkMonitor *monitor = gdk_display_get_monitor(display, i); -+ GdkRectangle geometry; -+ gdk_monitor_get_geometry(monitor, &geometry); -+ -+ // Calculate effective area excluding border -+ const gint eff_x = geometry.x + border; -+ const gint eff_y = geometry.y + border; -+ const gint eff_width = geometry.width - (2 * border); -+ const gint eff_height = geometry.height - (2 * border); -+ -+ if(eff_width <= 0 || eff_height <= 0) continue; -+ -+ // Check overlap -+ const gboolean x_overlap = (saved_x < eff_x + eff_width) && (saved_x + window_width > eff_x); -+ const gboolean y_overlap = (saved_y < eff_y + eff_height) && (saved_y + window_height > eff_y); -+ -+ if(x_overlap && y_overlap) -+ { -+ return TRUE; -+ } -+ } -+ return FALSE; -+} -+ - int dt_gui_gtk_load_config() - { - dt_pthread_mutex_lock(&darktable.gui->mutex); -@@ -784,7 +820,10 @@ int dt_gui_gtk_load_config() - const gint y = MAX(0, dt_conf_get_int("ui_last/window_y")); - - gtk_window_resize(GTK_WINDOW(widget), width, height); -- gtk_window_move(GTK_WINDOW(widget), x, y); -+ if(_valid_window_placement(x, y, width, height, 24)) -+ gtk_window_move(GTK_WINDOW(widget), x, y); -+ else -+ gtk_window_move(GTK_WINDOW(widget), 0, 0); - const gboolean fullscreen = dt_conf_get_bool("ui_last/fullscreen"); - - if(fullscreen) |