diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-23 15:06:30 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-23 17:53:12 +0200 |
commit | 658467304c40676dfd8a5d117f3b1866de40b959 (patch) | |
tree | 26d3e0d210faabfcfc85aa02916941cd2c2ab99d /libreofficekit | |
parent | ac1130130b50c6e047629e4387f8bbabe4241494 (diff) |
gtktiledviewer: let findbar have the focus when it's visible
1) Give its GtkEntry focus after pressing the button to show the
findbar, so one can immediately can begin typing.
2) Only forward keypresses to LOK if the findbar is not visible, so it's
not necessary to stop editing to be able to search.
Change-Id: I5c9487739a550e34c66f39b12469392028bb7e3d
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index fc309ed8caf1..4b5f1c580fbc 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -124,7 +124,17 @@ void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) gtk_widget_hide(pFindbar); } else + { gtk_widget_show_all(pFindbar); + gtk_widget_grab_focus(pFindbarEntry); + } +} + +/// Handles the key-press-event of the window. +static void signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData) +{ + if (!gtk_widget_get_visible(pFindbar)) + lok_docview_post_key(pWidget, pEvent, pData); } /// Searches for the next or previous text of pFindbarEntry. @@ -415,8 +425,8 @@ int main( int argc, char* argv[] ) g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); // Input handling. - g_signal_connect(pWindow, "key-press-event", G_CALLBACK(lok_docview_post_key), pDocView); - g_signal_connect(pWindow, "key-release-event", G_CALLBACK(lok_docview_post_key), pDocView); + g_signal_connect(pWindow, "key-press-event", G_CALLBACK(signalKey), pDocView); + g_signal_connect(pWindow, "key-release-event", G_CALLBACK(signalKey), pDocView); gtk_container_add( GTK_CONTAINER(pVBox), pDocView ); |