X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-dualscreen.c;h=7f60546556e797cb8d7af1695654529064ab4b02;hb=ffc1f12a9dd407c4924960276a018ec785c3740b;hp=4df456cc3575527dd41c10995a1f2e8e175783ca;hpb=d3f9bc975c0b9219b1f6659570e0693a2cfd84e9;p=evince.git diff --git a/shell/ev-dualscreen.c b/shell/ev-dualscreen.c index 4df456cc..7f605465 100644 --- a/shell/ev-dualscreen.c +++ b/shell/ev-dualscreen.c @@ -27,6 +27,7 @@ #include "ev-dualscreen.h" #include "ev-window.h" #include "ev-view.h" +#include "ev-utils.h" struct _EvDSCWindowPrivate { GtkWidget *main_box; @@ -159,6 +160,56 @@ 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_get_window (GTK_WIDGET (presentation_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, EvDocument *document) +{ + 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, + document); +/* ev_view_set_document (EV_VIEW (priv->notesview), + priv->presentation_document);*/ + ev_dscwindow_window_placement (ev_dscwindow); + /*ev_dscwindow_handle_resized (NULL, NULL, self); + */ +} + /** * ev_dscwindow_end: Stop presentation mode. */ @@ -169,8 +220,6 @@ ev_dscwindow_end (GtkWidget *widget, GdkEvent *event) return TRUE; } - - /** * ev_dscwindow_init: Initialize multihead presentation * @@ -252,7 +301,7 @@ ev_dscwindow_init (EvDSCWindow *ev_dscwindow) + } + + gtk_paned_set_position (GTK_PANED (h), 400); -+ gtk_widget_show_all (h); + gtk_widget_show_all (h); + gtk_container_add (GTK_CONTAINER (self), h); + + /* fallback if we have >2 monitors (see window placement) */