Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gtk gtk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,603
    • Issues 1,603
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 220
    • Merge requests 220
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • gtkgtk
  • Issues
  • #5541
Closed
Open
Issue created Jan 22, 2023 by Andy Russell@euclioContributor

GtkListWidgetItem can intercept click gestures

Steps to reproduce

  1. Apply the following patch to the Application Launcher demo:
diff --git a/demos/gtk-demo/listview_applauncher.c b/demos/gtk-demo/listview_applauncher.c
index 3194e05e21..d9d09ae2c0 100644
--- a/demos/gtk-demo/listview_applauncher.c
+++ b/demos/gtk-demo/listview_applauncher.c
@@ -38,6 +38,16 @@ create_application_list (void)
   return G_LIST_MODEL (store);
 }
 
+static void
+pressed (GtkGestureClick *gesture,
+         int              n_press,
+         double           x,
+         double           y,
+         GtkWidget       *box)
+{
+  printf("pressed!\n");
+}
+
 /* This is the function we use for setting up new listitems to display.
  * We add just an GtkImage and a GtkLabel here to display the application's
  * icon and name, as this is just a simple demo.
@@ -49,6 +59,7 @@ setup_listitem_cb (GtkListItemFactory *factory,
   GtkWidget *box;
   GtkWidget *image;
   GtkWidget *label;
+  GtkGesture *gesture;
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
   image = gtk_image_new ();
@@ -57,6 +68,12 @@ setup_listitem_cb (GtkListItemFactory *factory,
   label = gtk_label_new ("");
   gtk_box_append (GTK_BOX (box), label);
   gtk_list_item_set_child (list_item, box);
+
+  gesture = gtk_gesture_click_new();
+  gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 3);
+  gtk_widget_add_controller(box, GTK_EVENT_CONTROLLER(gesture));
+
+  g_signal_connect(gesture, "pressed", G_CALLBACK(pressed), box);
 }
 
 /* Here we need to prepare the listitem for displaying its item. We get the
  1. Launch the demo.
  2. Position the mouse precisely on the edge of one of the list items. Observe that the item is highlighted while hovered. Press right-click. The handler will not be triggered.

Current behavior

Right click gestures can be swallowed by the GtkListWidgetItems that contain widgets with a handler.

Expected outcome

I would expect the handler to be triggered, especially because the item is highlighted.

Version information

GTK version: 4.8.3 Arch Linux

Additional information

N/A

Assignee
Assign to
Time tracking