]> www.fi.muni.cz Git - evince.git/commitdiff
Fix ps backend in multihead systems.
authorCarlos Garcia Campos <carlosgc@gnome.org>
Thu, 14 Dec 2006 16:23:06 +0000 (16:23 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Thu, 14 Dec 2006 16:23:06 +0000 (16:23 +0000)
2006-12-14  Carlos Garcia Campos  <carlosgc@gnome.org>
* configure.ac:
* ps/ps-document.c: (start_interpreter), (ps_document_next_page):
Fix ps backend in multihead systems.

ChangeLog
configure.ac
ps/ps-document.c

index 31adf50325e4ca18bdc06d7f482cd71e8961ee12..969c9b77aefb8c3c770e4296f8c12695521673f2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-12-14  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * configure.ac:
+       * ps/ps-document.c: (start_interpreter), (ps_document_next_page):
+
+       Fix ps backend in multihead systems.
+
 2006-12-14  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * ps/ps-document.c: (setup_page), (ps_document_get_page_size):
index 304219975be03d923d589d1aa2af04a4d23764e1..2e431cf9b2bb614b4fd020c5936a76d1caffed93 100644 (file)
@@ -55,6 +55,9 @@ PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0)
 PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED libglade-2.0)
 PKG_CHECK_MODULES(SHELL_CORE, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gnome-vfs-2.0 libglade-2.0 gconf-2.0 gnome-keyring-1 >= $KEYRING_REQUIRED)
 
+BACKEND_CFLAGS="$BACKEND_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
+AC_SUBST(BACKEND_CFLAGS)
+
 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`  
 AC_SUBST(GLIB_GENMARSHAL)
 
@@ -130,7 +133,7 @@ if test "x$enable_dbus" = "xyes" ; then
        AC_DEFINE_UNQUOTED(DBUS_VERSION, $DBUS_VERSION, [DBUS version.])
 fi
 
-SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS"
+SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
 SHELL_LIBS="$SHELL_CORE_LIBS $DBUS_LIBS -lz"
 AC_SUBST(SHELL_CFLAGS)
 AC_SUBST(SHELL_LIBS)
index cd120aaa3e52afa5f56ea5745a63725ff6bbd640..1500b7b4a9c806d131126c5c9a900d8a36f77c78 100644 (file)
@@ -610,6 +610,7 @@ start_interpreter (PSDocument *gs)
 
        char *argv[NUM_ARGS], *dir, *gv_env, *gs_path;
        char **gs_args, **alpha_args = NULL;
+       char **gv_env_vars = NULL;
        int argc = 0, i;
 
        LOG ("Start the interpreter");
@@ -665,9 +666,10 @@ start_interpreter (PSDocument *gs)
                return -1;
        }
 
-       gv_env = g_strdup_printf ("GHOSTVIEW=%ld %ld",
+       gv_env = g_strdup_printf ("GHOSTVIEW=%ld %ld;DISPLAY=%s",
                                  gdk_x11_drawable_get_xid (gs->pstarget),
-                                 gdk_x11_drawable_get_xid (gs->bpixmap));
+                                 gdk_x11_drawable_get_xid (gs->bpixmap),
+                                 gdk_display_get_name (gdk_drawable_get_display (gs->pstarget)));
        LOG ("Launching ghostview with env %s", gv_env);
 
        gs->interpreter_pid = fork ();
@@ -703,7 +705,11 @@ start_interpreter (PSDocument *gs)
                                }
                        }
 
-                       putenv(gv_env);
+                       gv_env_vars = g_strsplit (gv_env, ";", -1);
+                       g_free (gv_env);
+                       for (i = 0; gv_env_vars[i]; i++) {
+                               putenv (gv_env_vars[i]);
+                       }
 
                        /* change to directory where the input file is. This helps
                         * with postscript-files which include other files using
@@ -717,8 +723,8 @@ start_interpreter (PSDocument *gs)
                        /* Notify error */
                        g_critical ("Unable to execute [%s]\n", argv[0]);
                        g_strfreev (gs_args);
-                       g_free (gv_env);
                        g_strfreev (alpha_args);
+                       g_strfreev (gv_env_vars);
                        _exit (1);
                        break;
                default:                     /* parent */
@@ -976,7 +982,10 @@ document_load (PSDocument *gs, const gchar *fname)
 static gboolean
 ps_document_next_page (PSDocument *gs)
 {
-       XEvent event;
+       XEvent      event;
+       GdkScreen  *screen;
+       GdkDisplay *display;
+       Display    *dpy;
 
        LOG ("Make ghostscript render next page");
 
@@ -986,14 +995,20 @@ ps_document_next_page (PSDocument *gs)
 
        gs->busy = TRUE;
 
+       screen = gtk_window_get_screen (GTK_WINDOW (gs->target_window));
+       display = gdk_screen_get_display (screen);
+       dpy = gdk_x11_display_get_xdisplay (display);
+
        event.xclient.type = ClientMessage;
-       event.xclient.display = gdk_display;
+       event.xclient.display = dpy;
        event.xclient.window = gs->message_window;
-       event.xclient.message_type = gdk_x11_atom_to_xatom(gs_class->next_atom);
+       event.xclient.message_type =
+               gdk_x11_atom_to_xatom_for_display (display,
+                                                  gs_class->next_atom);
        event.xclient.format = 32;
 
        gdk_error_trap_push ();
-       XSendEvent (gdk_display, gs->message_window, FALSE, 0, &event);
+       XSendEvent (dpy, gs->message_window, FALSE, 0, &event);
        gdk_flush ();
        gdk_error_trap_pop ();