]> www.fi.muni.cz Git - evince.git/commitdiff
[dualscreen] monitor switching
authorLukas Bezdicka <255993@mail.muni.cz>
Mon, 11 Apr 2011 09:48:13 +0000 (11:48 +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-window.c

index 04d67d15cfb9cf9391fa7998aa5be26373080d9f..83ef7c71fb7079d2dd17f2ec1f44863e1de648ac 100644 (file)
 #include "ev-sidebar-thumbnails.h"
 
 struct _EvDSCWindowPrivate {
-       GtkWidget *main_box;
-       GtkWidget *menubar;
-       GtkWidget *sidebar;
-       GtkWidget *notesview;
+       GtkWidget       *main_box;
+       GtkWidget       *menubar;
+       GtkWidget       *sidebar;
+       GtkWidget       *notesview;
        EvDocumentModel *model;
-       EvDocument * notesdocument;
+       EvDocumentModel *notes_model;
+       EvDocument      *presentation_document;
+       EvDocument      *notes_document;
 
+       GtkWidget       *presentation_window;
+       GtkWidget *overview_scrolled_window;
        GtkWidget *notesview_scrolled_window;
-       GtkWidget *presentation_window;
 
        EvViewPresentation *presentation_view;
-       EvDocument * presentation_document;
-       gint moveback_monitor;
+       gint            moveback_monitor;
 };
 
 #define EV_DSCWINDOW_GET_PRIVATE(object) \
@@ -58,7 +60,6 @@ struct _EvDSCWindowPrivate {
 #define PAGE_CACHE_SIZE 52428800 /* 50MB */
 #define SIDEBAR_DEFAULT_SIZE    132
 
-/*static gpointer parent_class = NULL;*/
 
 G_DEFINE_TYPE (EvDSCWindow, ev_dscwindow, GTK_TYPE_WINDOW)
 
@@ -69,37 +70,33 @@ G_DEFINE_TYPE (EvDSCWindow, ev_dscwindow, GTK_TYPE_WINDOW)
  * @self: EvDSCWindow
  **/
 static gboolean
-ev_dscwindow_switch_monitors (GtkWidget *widget, EvDSCWindow *self)
+ev_dscwindow_switch_monitors (GtkWidget *widget, EvDSCWindow *ev_dscwindow)
 {
-/*
-+      if (!EV_IS_DSCWINDOW (self))
-+              return FALSE;
-+
-+      EvDSCWindowPrivate *priv = EV_DSCWINDOW_GET_PRIVATE (self);
-+
-+      gint num_monitors = get_num_monitors (GTK_WINDOW (self));
-+
-+      if (num_monitors == 2) {
-+              GtkWindow * presentation_window = GTK_WINDOW (priv->presentation_window);
-+              GdkScreen * screen = gtk_window_get_screen (presentation_window);
-+
-+              gint monitor_1 = gdk_screen_get_monitor_at_window (screen,
-+                      GTK_WIDGET (presentation_window)->window);
-+
-+              gint monitor_2 = (monitor_1 + 1) % 2;
-+
-+              GdkRectangle coords;
-+              gdk_screen_get_monitor_geometry (screen, monitor_2, &coords);
-+              ev_window_stop_presentation (priv->presentation_window);
-+              gtk_window_move (presentation_window, coords.x, coords.y);
-+              ev_window_run_presentation (priv->presentation_window);
-+              priv->moveback_monitor = monitor_1;
-+
-+              gdk_screen_get_monitor_geometry (screen, monitor_1, &coords);
-+              gtk_window_unmaximize (GTK_WINDOW (self));
-+              gtk_window_move (GTK_WINDOW (self), coords.x, coords.y);
-+              gtk_window_maximize (GTK_WINDOW (self));
-+      }*/
+
+       if (!EV_IS_DSCWINDOW (ev_dscwindow))
+               return FALSE;
+
+       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 monitor_1 = gdk_screen_get_monitor_at_window (screen,
+                       gtk_widget_get_window (GTK_WIDGET (presentation_window)));
+
+               gint monitor_2 = (monitor_1 + 1) % 2;
+
+               GdkRectangle coords;
+               gdk_screen_get_monitor_geometry (screen, monitor_2, &coords);
+               gtk_window_move (presentation_window, coords.x, coords.y);
+               ev_dscwindow->priv->moveback_monitor = monitor_1;
+
+               gdk_screen_get_monitor_geometry (screen, monitor_1, &coords);
+               gtk_window_unmaximize (GTK_WINDOW (ev_dscwindow));
+               gtk_window_move (GTK_WINDOW (ev_dscwindow), coords.x, coords.y);
+               gtk_window_maximize (GTK_WINDOW (ev_dscwindow));
+       }
        return TRUE;
 }
 
@@ -279,7 +276,7 @@ ev_dscwindow_init (EvDSCWindow *ev_dscwindow)
 {
        ev_dscwindow->priv = EV_DSCWINDOW_GET_PRIVATE (ev_dscwindow);
        ev_dscwindow->priv->moveback_monitor = -1;
-       ev_dscwindow->priv->notesdocument = NULL;
+       ev_dscwindow->priv->notes_document = NULL;
 
        gtk_window_set_title (GTK_WINDOW (ev_dscwindow), _("Presentation Control"));
 
@@ -299,11 +296,7 @@ ev_dscwindow_init (EvDSCWindow *ev_dscwindow)
 
        GtkWidget *sidebar_widget;
        sidebar_widget = ev_sidebar_thumbnails_new ();
-       /*g_signal_connect (sidebar_widget,
-                         "notify::main-widget",
-                         G_CALLBACK (sidebar_page_main_widget_update_cb),
-                         ev_window);
-       sidebar_page_main_widget_update_cb (G_OBJECT (sidebar_widget), NULL, ev_window);*/
+
        gtk_widget_show (sidebar_widget);
        ev_sidebar_add_page (EV_SIDEBAR (ev_dscwindow->priv->sidebar),
                             sidebar_widget);
index 5acc5422bd41b0842f7849b06849925209a8e64a..a9e03e6ebd1382aaf9cc75828edcf9ae85c1438c 100644 (file)
@@ -4052,14 +4052,15 @@ ev_window_run_presentation (EvWindow *window)
 
        if (window->priv->metadata && !ev_window_is_empty (window))
                ev_metadata_set_boolean (window->priv->metadata, "presentation", TRUE);
-       //if ( get_num_monitors(GTK_WINDOW(window)) > 1) {
 
-       EvDSCWindow *control = ev_dscwindow_get_control();
-       ev_dscwindow_set_presentation   (control, window,
+       if ( get_num_monitors(GTK_WINDOW(window)) > 1) {
+               EvDSCWindow *control = ev_dscwindow_get_control();
+
+               ev_dscwindow_set_presentation   (control, window,
                                         window->priv->document,
                                         EV_VIEW_PRESENTATION(window->priv->presentation_view));
-       gtk_window_present (GTK_WINDOW (control));
-       //}
+               gtk_window_present (GTK_WINDOW (control));
+       }
 }
 
 void