From 2deca77fa75334948d869a25fc29112bbdb477ed Mon Sep 17 00:00:00 2001 From: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> Date: Thu, 27 Jun 2019 10:04:05 -0400 Subject: [PATCH] currentcallview: fix DTMF focus - current_call_view now receives mouse click to grab focus - remove useless search box in conversationsview Change-Id: I8bf9e94fda1e2387b1dda7eecedf957b6d9fc09a --- src/conversationsview.cpp | 2 ++ src/currentcallview.cpp | 8 ++++++++ src/currentcallview.h | 1 + src/ringmainwindow.cpp | 15 +++++++++++++++ 4 files changed, 26 insertions(+) diff --git a/src/conversationsview.cpp b/src/conversationsview.cpp index 7cffdafa..856ce28a 100644 --- a/src/conversationsview.cpp +++ b/src/conversationsview.cpp @@ -563,6 +563,8 @@ build_conversations_view(ConversationsView *self) gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(model)); + gtk_tree_view_set_enable_search(GTK_TREE_VIEW(self), false); + // ringId method column auto area = gtk_cell_area_box_new(); auto column = gtk_tree_view_column_new_with_area(area); diff --git a/src/currentcallview.cpp b/src/currentcallview.cpp index 9f223b55..01ce17b9 100644 --- a/src/currentcallview.cpp +++ b/src/currentcallview.cpp @@ -1294,3 +1294,11 @@ current_call_view_new(WebKitChatContainer* chat_widget, priv->cpp->setup(chat_widget, accountInfo, conversation, avModel); return GTK_WIDGET(self); } + +void +current_call_view_handup_focus(GtkWidget *current_call_view) +{ + auto* priv = CURRENT_CALL_VIEW_GET_PRIVATE(current_call_view); + gtk_widget_set_can_focus (priv->button_hangup, true); + gtk_widget_grab_focus(priv->button_hangup); +} diff --git a/src/currentcallview.h b/src/currentcallview.h index 53475612..58568412 100644 --- a/src/currentcallview.h +++ b/src/currentcallview.h @@ -58,5 +58,6 @@ GtkWidget *current_call_view_new (WebKitChatContainer* view, lrc::api::conversation::Info current_call_view_get_conversation(CurrentCallView*); GtkWidget *current_call_view_get_chat_view(CurrentCallView*); void current_call_view_show_chat(CurrentCallView*); +void current_call_view_handup_focus(GtkWidget *current_call_view); G_END_DECLS diff --git a/src/ringmainwindow.cpp b/src/ringmainwindow.cpp index 0d63bd37..26bfe49a 100644 --- a/src/ringmainwindow.cpp +++ b/src/ringmainwindow.cpp @@ -604,6 +604,15 @@ on_search_entry_key_released(G_GNUC_UNUSED GtkEntry* search_entry, GdkEventKey* return GDK_EVENT_PROPAGATE; } +static gboolean +on_current_call_clicked(GtkWidget *widget, G_GNUC_UNUSED GdkEventButton *event) +{ + // once mouse is clicked, grab the focus + gtk_widget_set_can_focus (widget, true); + gtk_widget_grab_focus(widget); + return GDK_EVENT_PROPAGATE; +} + static gboolean on_dtmf_pressed(RingMainWindow* self, GdkEventKey* event, gpointer user_data) { @@ -1347,6 +1356,11 @@ CppImpl::changeView(GType type, lrc::api::conversation::Info conversation) conversations_view_select_conversation( CONVERSATIONS_VIEW(widgets->treeview_conversations), conversation.uid); + + // grab focus for handup button for current call view + if (g_type_is_a(CURRENT_CALL_VIEW_TYPE, type)){ + current_call_view_handup_focus(new_view); + } } GtkWidget* @@ -1388,6 +1402,7 @@ CppImpl::displayCurrentCallView(lrc::api::conversation::Info conversation, bool g_signal_connect_swapped(new_view, "video-double-clicked", G_CALLBACK(on_video_double_clicked), self); + g_signal_connect(new_view, "button-press-event", G_CALLBACK(on_current_call_clicked), nullptr); return new_view; } -- GitLab