]> git.pld-linux.org Git - packages/elinks.git/commitdiff
- previously when the master session of ELinks was run on a console
authorwitekfl <witekfl@pld-linux.org>
Sun, 16 Mar 2008 21:05:08 +0000 (21:05 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  and slave session on X11, the mailcap handler for console was choosen
  on a X11 terminal. The patch fixes this bug.

Changed files:
    elinks-mailcap_DISPLAY.patch -> 1.1

elinks-mailcap_DISPLAY.patch [new file with mode: 0644]

diff --git a/elinks-mailcap_DISPLAY.patch b/elinks-mailcap_DISPLAY.patch
new file mode 100644 (file)
index 0000000..fc0197b
--- /dev/null
@@ -0,0 +1,106 @@
+bug 638: Save, set and restore the DISPLAY environment variable.
+
+Thanks to this trick the appropriate handler is executed,
+even in a mixed (X11, framebuffer) environment.
+
+---
+commit 65a3518a912d6cc6aa38cee4a4142299d7a25cc7
+tree 47b6a1c4af22420fef498ac26dd0955e79428024
+parent 81f8ee1fa2b94ef40460eb4a42710e1ed9e22c98
+author Witold Filipczyk <witekfl@poczta.onet.pl> Sun, 16 Mar 2008 16:29:32 +0100
+committer Witold Filipczyk <nobody@nowhere> Sun, 16 Mar 2008 16:29:32 +0100
+
+ configure.in               |    1 +
+ src/mime/backend/mailcap.c |   58 +++++++++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 58 insertions(+), 1 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 0a867ae..5cfeaa9 100644
+--- a/configure.in
++++ b/configure.in
+@@ -307,6 +307,7 @@ AC_CHECK_FUNCS(gettimeofday clock_gettime)
+ AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
+ AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
++AC_CHECK_FUNCS(unsetenv)
+ AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
+ AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
+diff --git a/src/mime/backend/mailcap.c b/src/mime/backend/mailcap.c
+index 76ea78b..70e270d 100644
+--- a/src/mime/backend/mailcap.c
++++ b/src/mime/backend/mailcap.c
+@@ -646,8 +646,57 @@ get_mailcap_entry(unsigned char *type)
+       return entry;
+ }
++#if defined(HAVE_SETENV) || defined(HAVE_PUTENV)
++/* restore == 0 set DISPLAY
++ * restore == 1 restore DISPLAY
++ */
++static void
++set_display(int xwin, int restore)
++{
++      static unsigned char *display = NULL;
++
++      if (!restore) {
++              display = getenv("DISPLAY");
++              if (display) display = stracpy(display);
++              if (xwin) {
++#ifdef HAVE_SETENV
++                      setenv("DISPLAY", ":0", 1);
++#else
++                      putenv("DISPLAY=:0");
++#endif
++              } else {
++#ifdef HAVE_UNSETENV
++                      unsetenv("DISPLAY");
++#else
++                      putenv("DISPLAY");
++#endif
++              }
++      } else { /* restore DISPLAY */
++              if (display) {
++#ifdef HAVE_SETENV
++                      setenv("DISPLAY", display, 1);
++#else
++                      {
++                              static unsigned char DISPLAY[1024] = { 'D','I','S','P','L','A','Y','=' };
++
++                              strncpy(DISPLAY + 8, display, 1023 - 8);
++                              putenv(DISPLAY);
++                      }
++#endif
++                      mem_free(display);
++              } else {
++#ifdef HAVE_UNSETENV
++                      unsetenv("DISPLAY");
++#else
++                      putenv("DISPLAY");
++#endif
++              }
++      }
++}
++#endif
++
+ static struct mime_handler *
+-get_mime_handler_mailcap(unsigned char *type, int options)
++get_mime_handler_mailcap(unsigned char *type, int xwin)
+ {
+       struct mailcap_entry *entry;
+       struct mime_handler *handler;
+@@ -658,7 +707,14 @@ get_mime_handler_mailcap(unsigned char *type, int options)
+           || (!mailcap_map && !init_mailcap_map()))
+               return NULL;
++#if defined(HAVE_SETENV) || defined(HAVE_PUTENV)
++      set_display(xwin, 0);
++#endif
+       entry = get_mailcap_entry(type);
++
++#if defined(HAVE_SETENV) || defined(HAVE_PUTENV)
++      set_display(xwin, 1);
++#endif
+       if (!entry) return NULL;
+       program = format_command(entry->command, type, entry->copiousoutput);
This page took 0.754567 seconds and 4 git commands to generate.