|
|
d6c6b3 |
From 91ac78bc587eb2ac931136c9da9609b142410209 Mon Sep 17 00:00:00 2001
|
|
|
d6c6b3 |
From: Giselle Reis <gisellemnr@src.gnome.org>
|
|
|
d6c6b3 |
Date: Wed, 29 Jul 2015 22:19:36 +0200
|
|
|
d6c6b3 |
Subject: Selecting text from annotation notes
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
Clicking and dragging the mouse inside an
|
|
|
d6c6b3 |
annotation note should select the text. Clicking
|
|
|
d6c6b3 |
and dragging the mouse on the title bar should
|
|
|
d6c6b3 |
move the window.
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
This commit fixes
|
|
|
d6c6b3 |
https://bugzilla.gnome.org/show_bug.cgi?id=749727
|
|
|
d6c6b3 |
---
|
|
|
d6c6b3 |
libview/ev-annotation-window.c | 55 ++++++++++++++++++++++++------------------
|
|
|
d6c6b3 |
1 file changed, 32 insertions(+), 23 deletions(-)
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c
|
|
|
d6c6b3 |
index ee002ce..9d66ec9 100644
|
|
|
d6c6b3 |
--- a/libview/ev-annotation-window.c
|
|
|
d6c6b3 |
+++ b/libview/ev-annotation-window.c
|
|
|
d6c6b3 |
@@ -275,12 +275,34 @@ ev_annotation_window_close (EvAnnotationWindow *window)
|
|
|
d6c6b3 |
g_signal_emit (window, signals[CLOSED], 0);
|
|
|
d6c6b3 |
}
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
+static gboolean
|
|
|
d6c6b3 |
+ev_annotation_window_button_press_event (GtkWidget *widget,
|
|
|
d6c6b3 |
+ GdkEventButton *event)
|
|
|
d6c6b3 |
+{
|
|
|
d6c6b3 |
+ EvAnnotationWindow *window = EV_ANNOTATION_WINDOW (widget);
|
|
|
d6c6b3 |
+
|
|
|
d6c6b3 |
+ if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
|
|
|
d6c6b3 |
+ window->in_move = TRUE;
|
|
|
d6c6b3 |
+ window->x = event->x_root - event->x;
|
|
|
d6c6b3 |
+ window->y = event->y_root - event->y;
|
|
|
d6c6b3 |
+ gtk_window_begin_move_drag (GTK_WINDOW (widget),
|
|
|
d6c6b3 |
+ event->button,
|
|
|
d6c6b3 |
+ event->x_root,
|
|
|
d6c6b3 |
+ event->y_root,
|
|
|
d6c6b3 |
+ event->time);
|
|
|
d6c6b3 |
+ return TRUE;
|
|
|
d6c6b3 |
+ }
|
|
|
d6c6b3 |
+
|
|
|
d6c6b3 |
+ return FALSE;
|
|
|
d6c6b3 |
+}
|
|
|
d6c6b3 |
+
|
|
|
d6c6b3 |
static void
|
|
|
d6c6b3 |
ev_annotation_window_init (EvAnnotationWindow *window)
|
|
|
d6c6b3 |
{
|
|
|
d6c6b3 |
GtkWidget *vbox, *hbox;
|
|
|
d6c6b3 |
GtkWidget *icon;
|
|
|
d6c6b3 |
GtkWidget *swindow;
|
|
|
d6c6b3 |
+ GtkWidget *header;
|
|
|
d6c6b3 |
GtkIconTheme *icon_theme;
|
|
|
d6c6b3 |
GdkPixbuf *pixbuf;
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
@@ -297,10 +319,19 @@ ev_annotation_window_init (EvAnnotationWindow *window)
|
|
|
d6c6b3 |
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
|
|
|
d6c6b3 |
gtk_widget_show (icon);
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
+ header = gtk_event_box_new ();
|
|
|
d6c6b3 |
+ gtk_widget_add_events (header, GDK_BUTTON_PRESS_MASK);
|
|
|
d6c6b3 |
+ g_signal_connect_swapped (header, "button-press-event",
|
|
|
d6c6b3 |
+ G_CALLBACK (ev_annotation_window_button_press_event),
|
|
|
d6c6b3 |
+ window);
|
|
|
d6c6b3 |
+
|
|
|
d6c6b3 |
window->title = gtk_label_new (NULL);
|
|
|
d6c6b3 |
- gtk_box_pack_start (GTK_BOX (hbox), window->title, TRUE, TRUE, 0);
|
|
|
d6c6b3 |
+ gtk_container_add (GTK_CONTAINER (header), window->title);
|
|
|
d6c6b3 |
gtk_widget_show (window->title);
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
+ gtk_box_pack_start (GTK_BOX (hbox), header, TRUE, TRUE, 0);
|
|
|
d6c6b3 |
+ gtk_widget_show (header);
|
|
|
d6c6b3 |
+
|
|
|
d6c6b3 |
window->close_button = gtk_button_new ();
|
|
|
d6c6b3 |
gtk_button_set_relief (GTK_BUTTON (window->close_button), GTK_RELIEF_NONE);
|
|
|
d6c6b3 |
gtk_container_set_border_width (GTK_CONTAINER (window->close_button), 0);
|
|
|
d6c6b3 |
@@ -461,27 +492,6 @@ ev_annotation_window_constructor (GType type,
|
|
|
d6c6b3 |
}
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
static gboolean
|
|
|
d6c6b3 |
-ev_annotation_window_button_press_event (GtkWidget *widget,
|
|
|
d6c6b3 |
- GdkEventButton *event)
|
|
|
d6c6b3 |
-{
|
|
|
d6c6b3 |
- EvAnnotationWindow *window = EV_ANNOTATION_WINDOW (widget);
|
|
|
d6c6b3 |
-
|
|
|
d6c6b3 |
- if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
|
|
|
d6c6b3 |
- window->in_move = TRUE;
|
|
|
d6c6b3 |
- window->x = event->x_root - event->x;
|
|
|
d6c6b3 |
- window->y = event->y_root - event->y;
|
|
|
d6c6b3 |
- gtk_window_begin_move_drag (GTK_WINDOW (widget),
|
|
|
d6c6b3 |
- event->button,
|
|
|
d6c6b3 |
- event->x_root,
|
|
|
d6c6b3 |
- event->y_root,
|
|
|
d6c6b3 |
- event->time);
|
|
|
d6c6b3 |
- return TRUE;
|
|
|
d6c6b3 |
- }
|
|
|
d6c6b3 |
-
|
|
|
d6c6b3 |
- return FALSE;
|
|
|
d6c6b3 |
-}
|
|
|
d6c6b3 |
-
|
|
|
d6c6b3 |
-static gboolean
|
|
|
d6c6b3 |
ev_annotation_window_configure_event (GtkWidget *widget,
|
|
|
d6c6b3 |
GdkEventConfigure *event)
|
|
|
d6c6b3 |
{
|
|
|
d6c6b3 |
@@ -539,7 +549,6 @@ ev_annotation_window_class_init (EvAnnotationWindowClass *klass)
|
|
|
d6c6b3 |
g_object_class->set_property = ev_annotation_window_set_property;
|
|
|
d6c6b3 |
g_object_class->dispose = ev_annotation_window_dispose;
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
- gtk_widget_class->button_press_event = ev_annotation_window_button_press_event;
|
|
|
d6c6b3 |
gtk_widget_class->configure_event = ev_annotation_window_configure_event;
|
|
|
d6c6b3 |
gtk_widget_class->focus_in_event = ev_annotation_window_focus_in_event;
|
|
|
d6c6b3 |
gtk_widget_class->focus_out_event = ev_annotation_window_focus_out_event;
|
|
|
d6c6b3 |
--
|
|
|
d6c6b3 |
cgit v0.12
|
|
|
d6c6b3 |
|