[gtk+/wip/matthiasc/touch-selection: 2/6] Never show handles and popover at the same time
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/touch-selection: 2/6] Never show handles and popover at the same time
- Date: Sun, 7 Jun 2015 17:01:13 +0000 (UTC)
commit 95330519d128cef2789e994406682f6ee0393159
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 7 12:12:43 2015 -0400
Never show handles and popover at the same time
Hide the handles when the popover appears, and brind them back
when it disappears. This will need revisiting if we start using
the popover for mouse interaction as well, where we may not
want handles to show up.
gtk/gtktextview.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 803acc3..99ad656 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -9139,6 +9139,31 @@ gtk_text_view_get_selection_rect (GtkTextView *text_view,
}
static void
+show_or_hide_handles (GtkWidget *popover,
+ GParamSpec *pspec,
+ GtkTextView *text_view)
+{
+ gboolean visible;
+ GtkTextHandle *handle;
+ GtkTextHandleMode mode;
+
+ visible = gtk_widget_get_visible (popover);
+
+ handle = text_view->priv->text_handle;
+ mode = _gtk_text_handle_get_mode (handle);
+
+ if (mode == GTK_TEXT_HANDLE_MODE_CURSOR)
+ {
+ _gtk_text_handle_set_visible (text_view->priv->text_handle, GTK_TEXT_HANDLE_POSITION_CURSOR, !visible);
+ }
+ else if (mode == GTK_TEXT_HANDLE_MODE_SELECTION)
+ {
+ _gtk_text_handle_set_visible (text_view->priv->text_handle, GTK_TEXT_HANDLE_POSITION_SELECTION_START,
!visible);
+ _gtk_text_handle_set_visible (text_view->priv->text_handle, GTK_TEXT_HANDLE_POSITION_SELECTION_END,
!visible);
+ }
+}
+
+static void
activate_bubble_cb (GtkWidget *item,
GtkTextView *text_view)
{
@@ -9211,6 +9236,8 @@ bubble_targets_received (GtkClipboard *clipboard,
GTK_STYLE_CLASS_TOUCH_SELECTION);
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM);
gtk_popover_set_modal (GTK_POPOVER (priv->selection_bubble), FALSE);
+ g_signal_connect (priv->selection_bubble, "notify::visible",
+ G_CALLBACK (show_or_hide_handles), text_view);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
g_object_set (box, "margin", 10, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]