@@ -280,12 +280,34 @@ ev_annotation_window_close (EvAnnotationWindow *window)
280
280
g_signal_emit (window , signals [CLOSED ], 0 );
281
281
}
282
282
283
+ static gboolean
284
+ ev_annotation_window_button_press_event (GtkWidget * widget ,
285
+ GdkEventButton * event )
286
+ {
287
+ EvAnnotationWindow * window = EV_ANNOTATION_WINDOW (widget );
288
+
289
+ if (event -> type == GDK_BUTTON_PRESS && event -> button == 1 ) {
290
+ window -> in_move = TRUE;
291
+ window -> x = event -> x_root - event -> x ;
292
+ window -> y = event -> y_root - event -> y ;
293
+ gtk_window_begin_move_drag (GTK_WINDOW (widget ),
294
+ event -> button ,
295
+ event -> x_root ,
296
+ event -> y_root ,
297
+ event -> time );
298
+ return TRUE;
299
+ }
300
+
301
+ return FALSE;
302
+ }
303
+
283
304
static void
284
305
ev_annotation_window_init (EvAnnotationWindow * window )
285
306
{
286
307
GtkWidget * vbox , * hbox ;
287
308
GtkWidget * icon ;
288
309
GtkWidget * swindow ;
310
+ GtkWidget * header ;
289
311
GtkIconTheme * icon_theme ;
290
312
GdkPixbuf * pixbuf ;
291
313
@@ -302,10 +324,19 @@ ev_annotation_window_init (EvAnnotationWindow *window)
302
324
gtk_box_pack_start (GTK_BOX (hbox ), icon , FALSE, FALSE, 0 );
303
325
gtk_widget_show (icon );
304
326
327
+ header = gtk_event_box_new ();
328
+ gtk_widget_add_events (header , GDK_BUTTON_PRESS_MASK );
329
+ g_signal_connect_swapped (header , "button-press-event" ,
330
+ G_CALLBACK (ev_annotation_window_button_press_event ),
331
+ window );
332
+
305
333
window -> title = gtk_label_new (NULL );
306
- gtk_box_pack_start ( GTK_BOX ( hbox ), window -> title , TRUE, TRUE, 0 );
334
+ gtk_container_add ( GTK_CONTAINER ( header ), window -> title );
307
335
gtk_widget_show (window -> title );
308
336
337
+ gtk_box_pack_start (GTK_BOX (hbox ), header , TRUE, TRUE, 0 );
338
+ gtk_widget_show (header );
339
+
309
340
window -> close_button = gtk_button_new ();
310
341
gtk_button_set_relief (GTK_BUTTON (window -> close_button ), GTK_RELIEF_NONE );
311
342
gtk_container_set_border_width (GTK_CONTAINER (window -> close_button ), 0 );
@@ -464,27 +495,6 @@ ev_annotation_window_constructor (GType type,
464
495
return object ;
465
496
}
466
497
467
- static gboolean
468
- ev_annotation_window_button_press_event (GtkWidget * widget ,
469
- GdkEventButton * event )
470
- {
471
- EvAnnotationWindow * window = EV_ANNOTATION_WINDOW (widget );
472
-
473
- if (event -> type == GDK_BUTTON_PRESS && event -> button == 1 ) {
474
- window -> in_move = TRUE;
475
- window -> x = event -> x_root - event -> x ;
476
- window -> y = event -> y_root - event -> y ;
477
- gtk_window_begin_move_drag (GTK_WINDOW (widget ),
478
- event -> button ,
479
- event -> x_root ,
480
- event -> y_root ,
481
- event -> time );
482
- return TRUE;
483
- }
484
-
485
- return FALSE;
486
- }
487
-
488
498
static gboolean
489
499
ev_annotation_window_configure_event (GtkWidget * widget ,
490
500
GdkEventConfigure * event )
@@ -543,7 +553,6 @@ ev_annotation_window_class_init (EvAnnotationWindowClass *klass)
543
553
g_object_class -> set_property = ev_annotation_window_set_property ;
544
554
g_object_class -> dispose = ev_annotation_window_dispose ;
545
555
546
- gtk_widget_class -> button_press_event = ev_annotation_window_button_press_event ;
547
556
gtk_widget_class -> configure_event = ev_annotation_window_configure_event ;
548
557
gtk_widget_class -> focus_in_event = ev_annotation_window_focus_in_event ;
549
558
gtk_widget_class -> focus_out_event = ev_annotation_window_focus_out_event ;
0 commit comments