summaryrefslogtreecommitdiff
path: root/gtk/gtklistitemwidget.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-12-21 19:07:11 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-06-03 13:32:57 -0400
commita0f04bdcf368cd789de0407b181bd7c394e642e5 (patch)
tree35d44ca4beaa81817b00b4d0d0d135c53d7087d1 /gtk/gtklistitemwidget.c
parent28f6e2727635497b21ff098aeb7f88ab0404965e (diff)
downloadgtk+-a0f04bdcf368cd789de0407b181bd7c394e642e5.tar.gz
listbase: Add rubberband selection
Implement the typical rubberband selection, including autoscroll. This is only useful with multiselection, and not very compatible with single-click-activate. Therefore, it is not enabled by default, and needs to be turned on explicitly.
Diffstat (limited to 'gtk/gtklistitemwidget.c')
-rw-r--r--gtk/gtklistitemwidget.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gtk/gtklistitemwidget.c b/gtk/gtklistitemwidget.c
index 2e6078d704..84e51a166c 100644
--- a/gtk/gtklistitemwidget.c
+++ b/gtk/gtklistitemwidget.c
@@ -29,6 +29,7 @@
#include "gtkintl.h"
#include "gtklistitemfactoryprivate.h"
#include "gtklistitemprivate.h"
+#include "gtklistbaseprivate.h"
#include "gtkmain.h"
#include "gtkselectionmodel.h"
#include "gtkwidget.h"
@@ -309,6 +310,8 @@ gtk_list_item_widget_click_gesture_pressed (GtkGestureClick *gesture,
{
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
GtkWidget *widget = GTK_WIDGET (self);
+ GtkWidget * parent = gtk_widget_get_parent (widget);
+ gboolean rubberband;
if (priv->list_item && !priv->list_item->selectable && !priv->list_item->activatable)
{
@@ -316,7 +319,12 @@ gtk_list_item_widget_click_gesture_pressed (GtkGestureClick *gesture,
return;
}
- if (!priv->list_item || priv->list_item->selectable)
+ if (GTK_IS_LIST_BASE (parent))
+ rubberband = gtk_list_base_get_enable_rubberband (GTK_LIST_BASE (parent));
+ else
+ rubberband = FALSE;
+
+ if (!rubberband && (!priv->list_item || priv->list_item->selectable))
{
GdkModifierType state;
GdkEvent *event;