From 952ec178f06165512a42a4a8136c328b7d60529e Mon Sep 17 00:00:00 2001 From: Scoopta Date: Thu, 27 Aug 2020 19:18:42 -0700 Subject: [PATCH] Fixed key_submit not properly working with multi-action entires --- .hgignore | 1 + src/wofi.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.hgignore b/.hgignore index 83dacc7..7d2c722 100644 --- a/.hgignore +++ b/.hgignore @@ -5,3 +5,4 @@ ^build$ ^debug$ ^Debug$ +^noasan$ diff --git a/src/wofi.c b/src/wofi.c index 24f0d94..6cb1d4f 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -1291,9 +1291,19 @@ static gboolean key_press(GtkWidget* widget, GdkEvent* event, gpointer data) { GList* children = gtk_flow_box_get_selected_children(GTK_FLOW_BOX(inner_box)); if(gtk_widget_has_focus(entry)) { g_signal_emit_by_name(entry, "activate", entry, NULL); - } else if(gtk_widget_has_focus(inner_box) || (children->data != NULL && gtk_widget_has_focus(children->data))) { - if(children->data != NULL) { - g_signal_emit_by_name(children->data, "activate", children->data, NULL); + } else if(gtk_widget_has_focus(inner_box) || children->data != NULL) { + gpointer obj = children->data; + + if(obj != NULL) { + GtkWidget* exp = gtk_bin_get_child(GTK_BIN(obj)); + if(GTK_IS_EXPANDER(exp)) { + GtkWidget* box = gtk_bin_get_child(GTK_BIN(exp)); + GtkListBoxRow* row = gtk_list_box_get_selected_row(GTK_LIST_BOX(box)); + if(row != NULL) { + obj = row; + } + } + g_signal_emit_by_name(obj, "activate", obj, NULL); } } g_list_free(children);