[gnome-builder/wip/slaf/colorpicker] gstyle-palette-widget: fix dnd drop in empty area



commit 02df33f2c87ee6997b67cae0ceb0f158b4e7ec8e
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Thu Jul 14 16:18:07 2016 +0200

    gstyle-palette-widget: fix dnd drop in empty area
    
    When dropping a color swatch in the empty area of
    a palette (in swatch mode/flow box), we append
    the swatch to the list's end.

 contrib/gstyle/gstyle-palette-widget.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/contrib/gstyle/gstyle-palette-widget.c b/contrib/gstyle/gstyle-palette-widget.c
index 8f7742a..5451c65 100644
--- a/contrib/gstyle/gstyle-palette-widget.c
+++ b/contrib/gstyle/gstyle-palette-widget.c
@@ -270,7 +270,12 @@ dnd_highlight_set_from_cursor (GstylePaletteWidget *self,
 
   g_assert (GSTYLE_IS_PALETTE_WIDGET (self));
 
-  if (x != -1 && y != -1 && dnd_get_index_from_cursor (self, x, y, &info))
+  if (x == -1 || y == -1)
+    {
+      highlight = FALSE;
+      info.index = -1;
+    }
+  else if (dnd_get_index_from_cursor (self, x, y, &info))
     {
       gtk_widget_get_allocation (GTK_WIDGET (info.child), &alloc);
       if (self->view_mode == GSTYLE_PALETTE_WIDGET_VIEW_MODE_LIST)
@@ -303,8 +308,8 @@ dnd_highlight_set_from_cursor (GstylePaletteWidget *self,
     }
   else
     {
-      highlight = FALSE;
-      info.index = -1;
+      info.index = gstyle_palette_get_len (self->selected_palette);
+      highlight = TRUE;
     }
 
   if (self->dnd_draw_highlight != highlight || self->dnd_child_index != info.index)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]