gui: normalize clipboard cut selection rectangle (#58756)
authorFriedrich Beckmann <friedrich.beckmann@gmx.de>
Sun, 12 Jul 2020 19:32:28 +0000 (21:32 +0200)
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>
Sun, 12 Jul 2020 19:32:28 +0000 (21:32 +0200)
With this patch the selection rectangle for the clipboard cut
operation is normalize, i.e. it does not matter in which corner
you start the selection.

Closes: https://savannah.gnu.org/bugs/index.php?58756
src/ui/gui/psppire-data-window.c

index 2f31923af286c0517ab5b796beaaa8321198a77e..c43c65d120ee7307fd68fba953b4f8fe83385d03 100644 (file)
@@ -1076,6 +1076,19 @@ on_cut (PsppireDataWindow *dw)
       if (ssw_sheet_try_cut (sheet))
        return;
 
+      if (sel.start_x > sel.end_x)
+       {
+         gint tmp = sel.start_x;
+         sel.start_x = sel.end_x;
+         sel.end_x = tmp;
+       }
+      if (sel.start_y > sel.end_y)
+       {
+         gint tmp = sel.start_y;
+         sel.start_y = sel.end_y;
+         sel.end_y = tmp;
+       }
+         
       GtkClipboard *clip =
        gtk_clipboard_get_for_display (gtk_widget_get_display (GTK_WIDGET (dw)),
                                       GDK_SELECTION_CLIPBOARD);