]> uap-core.de Git - mizunara.git/commitdiff
fix point2item detecting out of bounds columns
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Sat, 1 Feb 2025 20:52:54 +0000 (21:52 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Sat, 1 Feb 2025 20:52:54 +0000 (21:52 +0100)
mizunara/gtk-filesview.c

index dfac4ea96e178d614c550d069829a3fe32515135..a2e56b23d6c7c9bec3a1f31ed55f3f4e51b7ce27 100644 (file)
@@ -171,7 +171,7 @@ static int point2item(MzFilesView *view, int x, int y, int *out_col, int *out_ro
         row = -1;
     }
     
-    if(col >= 0 && row >= 0) {
+    if(col >= 0 && row >= 0 && col < items_per_line) {
         *out_col = col;
         *out_row = row;
         if(index) {
@@ -501,7 +501,7 @@ static void drag_begin_cb(
     if(point2item(view, start_x, start_y, &col, &row, &item_index)) {
         if(view->numsections > 0 && item_index < cxListSize(view->sections[0].section.files)) {
             FileInfo *file = cxListAt(view->sections[0].section.files, item_index);
-            printf("drag file[%d]: %s\n", view->items[item_index].isselected, file->name);
+            printf("%d x %d  drag file[%d]: %s\n", col, row, view->items[item_index].isselected, file->name);
             view->drag_file = file;
             view->drag_item = TRUE;
             if(view->items[item_index].isselected) {