Origin: upstream, other, *
Description: Applied patches. See Vcs-* headers in debian/control.

--- xine-ui-0.99.6.orig/doc/man/en/xine-remote.1
+++ xine-ui-0.99.6/doc/man/en/xine-remote.1
@@ -3,7 +3,7 @@
 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
 .\" other parms are allowed: see man(7), man(1)
 .\""
-.TH XINE-REMOTE 1x 2002-04-16 "The xine project"
+.TH XINE-REMOTE 1 2002-04-16 "The xine project"
 .SH NAME
 xine-remote \- a small tool to connect xine remote control server.
 .SH SYNOPSIS
--- xine-ui-0.99.6.orig/doc/man/es/xine-remote.1
+++ xine-ui-0.99.6/doc/man/es/xine-remote.1
@@ -5,7 +5,7 @@
 .\" 
 .\" CER: Traduccin revisada 2008-03-4 - codificacin latin1
 .\"
-.TH "XINE-REMOTE" "1x" "2002-04-16" "El proyecto xine" ""
+.TH "XINE-REMOTE" "1" "2002-04-16" "El proyecto xine" ""
 .SH "NOMBRE"
 xine\-remote \- una pequea herramienta para conectar el servidor de control remoto de xine.
 .SH "SINOPSIS"
--- xine-ui-0.99.6.orig/doc/man/pl/xine-remote.1
+++ xine-ui-0.99.6/doc/man/pl/xine-remote.1
@@ -3,7 +3,7 @@
 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
 .\" other parms are allowed: see man(7), man(1)
 .\""
-.TH XINE-REMOTE 1x 2002-04-16 "Projekt xine"
+.TH XINE-REMOTE 1 2002-04-16 "Projekt xine"
 .SH NAZWA
 xine-remote \- mae narzdzie do czenia si z serwerem zdalnej kontroli xine.
 .SH SKADNIA
--- xine-ui-0.99.6.orig/doc/man/de/xine-remote.1
+++ xine-ui-0.99.6/doc/man/de/xine-remote.1
@@ -3,7 +3,7 @@
 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
 .\" other parms are allowed: see man(7), man(1)
 .\""
-.TH "XINE-REMOTE" 1x "30. April 2002" "Das xine Projekt"
+.TH "XINE-REMOTE" 1 "30. April 2002" "Das xine Projekt"
 .SH NAME
 xine-remote \- Ein kleines Programm um xine fernzusteuern.
 
--- xine-ui-0.99.6.orig/misc/desktops/xine.desktop
+++ xine-ui-0.99.6/misc/desktops/xine.desktop
@@ -2,7 +2,7 @@
 Encoding=UTF-8
 Name=xine
 Comment=Video Player
-Exec=xine
+Exec=xine %U
 MimeType=video/mpeg;video/quicktime;video/x-msvideo;video/x-anim;audio/x-mp3;audio/x-mp2;
 Icon=xine
 Terminal=false
--- xine-ui-0.99.6.orig/src/xitk/event.c
+++ xine-ui-0.99.6/src/xitk/event.c
@@ -135,9 +135,6 @@ static void skip_by_chapter_cb(void *dat
   gGui->skip_by_chapter = cfg->num_value;
   panel_update_nextprev_tips();
 }
-static void ssaver_timeout_cb(void *data, xine_cfg_entry_t *cfg) {
-  gGui->ssaver_timeout = cfg->num_value;
-}
 
 static void visual_anim_cb(void *data, xine_cfg_entry_t *cfg) {
   
@@ -1614,14 +1611,6 @@ void gui_init (int nfiles, char *filenam
 					 snapshot_loc_cb,
 					 CONFIG_NO_DATA);
   
-  gGui->ssaver_timeout =
-    xine_config_register_num (__xineui_global_xine_instance, "gui.screensaver_timeout", 10,
-			      _("Screensaver reset interval (s)"),
-			      _("Time, in seconds, between two faked events to keep a screensaver quiet, 0 to disable."),
-			      CONFIG_LEVEL_ADV,
-			      ssaver_timeout_cb,
-			      CONFIG_NO_DATA);
-  
   gGui->skip_by_chapter = 
     xine_config_register_bool (__xineui_global_xine_instance, "gui.skip_by_chapter", 1,
 			       _("Chapter hopping"),
--- xine-ui-0.99.6.orig/src/xitk/panel.c
+++ xine-ui-0.99.6/src/xitk/panel.c
@@ -356,7 +356,6 @@ void panel_update_runtime_display(void)
  * Update slider thread.
  */
 static void *slider_loop(void *dummy) {
-  int screensaver_timer = 0;
   int status, speed;
   int pos, secs;
   int i = 0;
@@ -441,20 +440,7 @@ static void *slider_loop(void *dummy) {
 	else
 	  video_window_set_mrl((char *)gGui->mmk.mrl);
 	
-	if(!xitk_is_window_iconified(gGui->video_display, gGui->video_window)) {
-	  
-	  if(gGui->ssaver_timeout) {
-	    
-	    if(!(i % 2))
-	      screensaver_timer++;
-	    
-	    if(screensaver_timer >= gGui->ssaver_timeout) {
-	      screensaver_timer = 0;
-	      video_window_reset_ssaver();
-	      
-	    }
-	  }  
-	}
+       video_window_suspend_ssaver(!xitk_is_window_iconified(gGui->video_display, gGui->video_window));
 
 	if(gGui->logo_mode == 0) {
 	  
@@ -494,6 +480,8 @@ static void *slider_loop(void *dummy) {
 	    stream_infos_update_infos();
 
 	}
+      } else {
+       video_window_suspend_ssaver(0);
       }
     }
     
--- xine-ui-0.99.6.orig/src/xitk/videowin.h
+++ xine-ui-0.99.6/src/xitk/videowin.h
@@ -81,6 +81,7 @@ void video_window_get_mag (float *xmag,
 void video_window_update_logo(void);
 void video_window_change_skins(int);
 
+void video_window_suspend_ssaver(int do_suspend);
 void video_window_reset_ssaver(void);
 
 void video_window_get_frame_size(int *w, int *h);
--- xine-ui-0.99.6.orig/src/xitk/videowin.c
+++ xine-ui-0.99.6/src/xitk/videowin.c
@@ -1087,6 +1087,9 @@ static void video_window_adapt_size (voi
 
   /* The old window should be destroyed now */
   if(old_video_window != None) {
+    /* Screensaver control is tied to our window id */
+    video_window_suspend_ssaver(0);
+
     XDestroyWindow(gGui->video_display, old_video_window);
      
     if(gGui->cursor_grabbed)
@@ -2261,69 +2264,34 @@ static void video_window_handle_event (X
 
 }
 
-void video_window_reset_ssaver(void) {
+void video_window_suspend_ssaver(int do_suspend) {
+  static int was_suspended;
 
-  if(gGui->ssaver_enabled && (xitk_get_last_keypressed_time() >= (long int) gGui->ssaver_timeout)) {
+  do_suspend = do_suspend && gGui->ssaver_enabled;
 
-#ifdef HAVE_XTESTEXTENSION
-    if(gVw.have_xtest == True) {
-      
-      gVw.fake_key_cur++;
-      
-      if(gVw.fake_key_cur >= 2)
-	gVw.fake_key_cur = 0;
-
-      XLockDisplay(gGui->video_display);
-      XTestFakeKeyEvent(gGui->video_display, gVw.fake_keys[gVw.fake_key_cur], True, CurrentTime);
-      XTestFakeKeyEvent(gGui->video_display, gVw.fake_keys[gVw.fake_key_cur], False, CurrentTime);
-      XSync(gGui->video_display, False);
-      XUnlockDisplay(gGui->video_display);
+  if(was_suspended != do_suspend) {
+    if(fork() == 0) {
+      char window_id[30];
+      char *args[] = { "xdg-screensaver", NULL, window_id, NULL };
+      int fd;
+
+      for(fd = 3; fd < 256; fd++)
+	close(fd);
+
+      args[1] = do_suspend ? "suspend" : "resume";
+      sprintf(window_id, "%lu", (unsigned long)gGui->video_window);
+      execvp(args[0], args);
+      _exit(0);
     }
-    else 
-#endif
-    {
-      /* Reset the gnome screensaver. Look up the command in PATH only once to save time, */
-      /* assuming its location and permission will not change during run time of xine-ui. */
-      {
-	static char *const gssaver_args[] = { "gnome-screensaver-command", "--poke", NULL };
-	static char *gssaver_path   = NULL;
-
-	if(!gssaver_path) {
-	  char *path = getenv("PATH");
-
-	  if(!path)
-	    path = "/usr/local/bin:/usr/bin";
-	  do {
-	    char *p, *pbuf;
-	    int   plen;
-
-	    for(p = path; *path && *path != ':'; path++)
-	      ;
-	    if(p == path)
-	      plen = 1, p = ".";
-	    else
-	      plen = path - p;
-	    asprintf(&pbuf, "%.*s/%s", plen, p, gssaver_args[0]);
-	    if ( access(pbuf, X_OK) ) {
-	      free(pbuf);
-	      gssaver_path = "";
-	    } else
-	      gssaver_path = pbuf;
-	  } while(!gssaver_path[0] && *path++);
-	}
-	if(gssaver_path[0] && (fork() == 0)) {
-	  execv(gssaver_path, gssaver_args);
-	  exit(0);
-	}
-      }
 
-      XLockDisplay(gGui->video_display);
-      XResetScreenSaver(gGui->video_display);
-      XUnlockDisplay(gGui->video_display);
-    }
+    was_suspended = do_suspend;
   }
 }
 
+void video_window_reset_ssaver(void) {
+  video_window_suspend_ssaver(1);
+}
+
 void video_window_get_frame_size(int *w, int *h) {
   if(w)
     *w = gVw.frame_width;
--- xine-ui-0.99.6.orig/src/xitk/main.c
+++ xine-ui-0.99.6/src/xitk/main.c
@@ -1383,6 +1383,8 @@ int main(int argc, char *argv[]) {
   if (sigprocmask (SIG_BLOCK,  &vo_mask, NULL))
     fprintf (stderr, "sigprocmask() failed.\n");
 
+  signal(SIGCHLD, SIG_IGN);
+
   gGui = (gGui_t *) calloc(1, sizeof(gGui_t));
   
   gGui->stream                 = NULL;
--- xine-ui-0.99.6.orig/src/xitk/common.h
+++ xine-ui-0.99.6/src/xitk/common.h
@@ -331,7 +331,6 @@ typedef struct {
   int                       use_root_window;
 
   int                       ssaver_enabled;
-  int                       ssaver_timeout;
 
   int                       skip_by_chapter;
 
--- xine-ui-0.99.6.orig/src/xitk/Imlib-light/misc.c
+++ xine-ui-0.99.6/src/xitk/Imlib-light/misc.c
@@ -12,6 +12,8 @@
 #include <X11/extensions/XShm.h>
 #endif
 
+#include <xine/xineutils.h>
+
 #ifdef __EMX__
 extern const char *__XOS2RedirRoot(const char *);
 #endif
--- /dev/null
+++ xine-ui-0.99.6/src/common/getsubopt.c
@@ -0,0 +1,91 @@
+/* Parse comma separate list into words.
+   Copyright (C) 1996-2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+/* This function doesn't exist on most systems (this replacement is
+   lifted from the libc sources. */
+#if !defined HAVE___STRCHRNUL && !defined _LIBC
+static char * __strchrnul (const char *s, int c);
+static char * __strchrnul (const char *s, int c)
+{
+  char *result = strchr (s, c);
+  if (result == NULL)
+    result = strchr (s, '\0');
+  return result;
+}
+# endif
+
+/* Parse comma separated suboption from *OPTIONP and match against
+   strings in TOKENS.  If found return index and set *VALUEP to
+   optional value introduced by an equal sign.  If the suboption is
+   not part of TOKENS return in *VALUEP beginning of unknown
+   suboption.  On exit *OPTIONP is set to the beginning of the next
+   token or at the terminating NUL character.  */
+int
+getsubopt (optionp, tokens, valuep)
+     char **optionp;
+     char *const *tokens;
+     char **valuep;
+{
+  char *endp, *vstart;
+  int cnt;
+
+  if (**optionp == '\0')
+    return -1;
+
+  /* Find end of next token.  */
+  endp = __strchrnul (*optionp, ',');
+
+  /* Find start of value.  */
+  vstart = memchr (*optionp, '=', endp - *optionp);
+  if (vstart == NULL)
+    vstart = endp;
+
+  /* Try to match the characters between *OPTIONP and VSTART against
+     one of the TOKENS.  */
+  for (cnt = 0; tokens[cnt] != NULL; ++cnt)
+    if (memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0
+	&& tokens[cnt][vstart - *optionp] == '\0')
+      {
+	/* We found the current option in TOKENS.  */
+	*valuep = vstart != endp ? vstart + 1 : NULL;
+
+	if (*endp != '\0')
+	  *endp++ = '\0';
+	*optionp = endp;
+
+	return cnt;
+      }
+
+  /* The current suboption does not match any option.  */
+  *valuep = *optionp;
+
+  if (*endp != '\0')
+    *endp++ = '\0';
+  *optionp = endp;
+
+  return -1;
+}
