]> www.fi.muni.cz Git - evince.git/blobdiff - libview/ev-annotation-window.c
shell: Add bookmarks menu to add and show internal bookmarks
[evince.git] / libview / ev-annotation-window.c
index 749d1a012ad53d7132bca109a2769ea10660bfd3..61002e2e61a85803fd6623b480c74bf0376a73b2 100644 (file)
@@ -139,10 +139,6 @@ ev_annotation_window_set_color (EvAnnotationWindow *window,
 
        gcolor = *color;
 
-       /* Allocate these colors */
-       gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (window)),
-                                 &gcolor, FALSE, TRUE);
-
        /* Apply colors to style */
        rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (window));
        rc_style->base[GTK_STATE_NORMAL] = gcolor;
@@ -332,6 +328,7 @@ ev_annotation_window_init (EvAnnotationWindow *window)
        gtk_widget_show (swindow);
 
        /* Resize bar */
+       gtk_window_set_has_resize_grip (GTK_WINDOW(window), FALSE);
        hbox = gtk_hbox_new (FALSE, 0);
 
        window->resize_sw = gtk_event_box_new ();
@@ -454,8 +451,8 @@ ev_annotation_window_button_press_event (GtkWidget      *widget,
 
        if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
                window->in_move = TRUE;
-               window->x = event->x;
-               window->y = event->y;
+               window->x = event->x_root - event->x;
+               window->y = event->y_root - event->y;
                gtk_window_begin_move_drag (GTK_WINDOW (widget),
                                            event->button,
                                            event->x_root,
@@ -489,8 +486,12 @@ ev_annotation_window_focus_in_event (GtkWidget     *widget,
        EvAnnotationWindow *window = EV_ANNOTATION_WINDOW (widget);
 
        if (window->in_move) {
-               window->orig_x = window->x;
-               window->orig_y = window->y;
+               if (window->orig_x != window->x || window->orig_y != window->y) {
+                       window->orig_x = window->x;
+                       window->orig_y = window->y;
+                       g_signal_emit (window, signals[MOVED], 0, window->x, window->y);
+               }
+               window->in_move = FALSE;
        }
 
        return FALSE;
@@ -502,12 +503,6 @@ ev_annotation_window_focus_out_event (GtkWidget     *widget,
 {
        EvAnnotationWindow *window = EV_ANNOTATION_WINDOW (widget);
 
-       if (window->in_move &&
-           (window->orig_x != window->x || window->orig_y != window->y)) {
-               window->in_move = FALSE;
-               g_signal_emit (window, signals[MOVED], 0, window->x, window->y);
-       }
-
        ev_annotation_window_sync_contents (window);
 
        return FALSE;