]> www.fi.muni.cz Git - evince.git/commitdiff
[dualscreen] presentation wrapper and window placement
authorLukáš Bezdička <255993@mail.muni.cz>
Tue, 5 Apr 2011 18:36:58 +0000 (20:36 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 Jun 2011 11:09:21 +0000 (13:09 +0200)
shell/ev-dualscreen.c
shell/ev-dualscreen.h
shell/ev-window.c

index 4df456cc3575527dd41c10995a1f2e8e175783ca..3a0beaea8aac23f9e5e51bb592a569f25117650e 100644 (file)
@@ -158,6 +158,55 @@ ev_dscwindow_get_control (void)
 
        return control;
 }
+/*TODO: Fix me!*/
+static void
+ev_dscwindow_window_placement (EvDSCWindow *ev_dscwindow)
+{
+       gint num_monitors = get_num_monitors (GTK_WINDOW (ev_dscwindow));
+       if (num_monitors == 2) {
+               GtkWindow * presentation_window = GTK_WINDOW (ev_dscwindow->priv->presentation_window);
+               GdkScreen * screen = gtk_window_get_screen (presentation_window);
+
+               gint work_monitor = gdk_screen_get_monitor_at_window (screen,
+                       GTK_WIDGET (presentation_window)->window);
+
+               gint presentation_monitor = (work_monitor + 1) % 2;
+
+               GdkRectangle coords;
+               gdk_screen_get_monitor_geometry (screen, presentation_monitor,
+                       &coords);
+
+               gtk_window_move (presentation_window, coords.x, coords.y);
+               ev_window_run_presentation (ev_dscwindow->priv->presentation_window);
+               ev_dscwindow->priv->moveback_monitor = work_monitor;
+
+               gtk_window_maximize (GTK_WINDOW (ev_dscwindow));
+       }
+}
+
+
+/**
+ * ev_dscwindow_set_presentation: Set presentation document
+ * @presentation_window: Main window we can reuse for presentation
+ **/
+void
+ev_dscwindow_set_presentation (EvDSCWindow *ev_dscwindow,
+       EvWindow *presentation_window)
+{
+       if (!EV_IS_WINDOW (presentation_window))
+               return;
+
+       ev_dscwindow->priv->presentation_window = presentation_window;
+       ev_dscwindow->priv->presentation_document = document;
+
+       ev_document_model_set_document(ev_dscwindow->priv->model,
+               presentation_window->priv->document);
+/*     ev_view_set_document (EV_VIEW (priv->notesview),
+               priv->presentation_document);
+       ev_dscwindow_window_placement (self);
+       ev_dscwindow_handle_resized (NULL, NULL, self);
+       */
+}
 
 /**
  * ev_dscwindow_end: Stop presentation mode.
@@ -169,8 +218,6 @@ ev_dscwindow_end (GtkWidget *widget, GdkEvent *event)
        return TRUE;
 }
 
-
-
 /**
 * ev_dscwindow_init: Initialize multihead presentation
 *
index c884f58932341502d28afb7140cc2fc173ea54b0..4c884324c39587079a0640851a7302c28af3723e 100644 (file)
@@ -50,10 +50,9 @@ struct _EvDSCWindowClass {
 
 GType          ev_dscwindow_get_type   (void);
 GtkWidget      *ev_dscwindow_new (void);
-/*void         ev_dscwindow_set_presentation (EvDSCWindow * self,
-                                          EvWindow *presentation_window,
-                                          EvDocument *document);
-EvDSCWindow*    ev_dscwindow_get_control (void);*/
+void           ev_dscwindow_set_presentation (EvDSCWindow * self,
+                                               EvWindow *presentation_window);
+/*EvDSCWindow*    ev_dscwindow_get_control (void);*/
 
 G_END_DECLS
 
index f0593b2373f53a7a6f51f121dfb879b7689776b6..b7cf4442457105ae55526b442cc5ba896337baca 100644 (file)
@@ -4000,7 +4000,17 @@ ev_window_view_presentation_focus_out (EvWindow *window)
 }
 
 static void
-ev_window_run_presentation_wrapper(){
+ev_window_run_presentation_wrapper ()
+{
+       if ( get_num_monitors(GTK_WINDOW(window) > 1) {
+               EvWindow *presentation_window = window;
+               EvDSCWindow *control = ev_dscwindow_get_control();
+
+               ev_dscwindow_set_presentation (control, presentation_window);
+               gtk_window_present (GTK_WINDOW (control));
+       } else
+               ev_window_stop_presentation (window);
+
 }
 static void
 ev_window_stop_presentation_wrapper(){