From d20d3b04fcc53fc9b45f7279812d84af4e124159 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 4 Aug 2011 20:00:18 -0500
Subject: xine-ui: Bump to latest. ref #647

---
 abs/extra/xine-ui/ChangeLog                        |  27 ---
 abs/extra/xine-ui/PKGBUILD                         |  32 ++--
 .../xine-ui/xine-ui-0.99.6-1-i686-build.log.1      |   2 -
 abs/extra/xine-ui/xine-ui-xdg.diff                 | 206 +++++++++++++++++++++
 abs/extra/xine-ui/xine-ui.install                  |   1 +
 5 files changed, 224 insertions(+), 44 deletions(-)
 delete mode 100644 abs/extra/xine-ui/ChangeLog
 delete mode 100644 abs/extra/xine-ui/xine-ui-0.99.6-1-i686-build.log.1
 create mode 100644 abs/extra/xine-ui/xine-ui-xdg.diff

diff --git a/abs/extra/xine-ui/ChangeLog b/abs/extra/xine-ui/ChangeLog
deleted file mode 100644
index bfb45aa..0000000
--- a/abs/extra/xine-ui/ChangeLog
+++ /dev/null
@@ -1,27 +0,0 @@
-2010-03-23  Eric Belanger  <eric@archlinux.org>
-
-	* xine-ui 0.99.6-1
-	* Upstream update
-	* Cleaned up depends
-	* Removed optdepends
-	* Replaced lirc makedepends by lirc-utils
-	* Added shared-mime-info depends
-
-2010-01-19  Eric Belanger  <eric@archlinux.org>
-
-	* xine-ui 0.99.5-6
-	* Rebuilt for libpng 1.4 and libjpeg 8
-	* Added install scriptlet to update icon cache
-
-2009-06-18  Eric Belanger  <eric@archlinux.org>
-
-	* xine-ui 0.99.5-5
-	* Rebuilt against readline 6.0.00
-
-2008-08-19  Eric Belanger  <eric@archlinux.org>
-
-	* xine-ui 0.99.5-4
-	* Added xine and xine-remote binaries (missing in 0.99.5-3)
-	* Added missing libxt makedepends
-	* Replaced .install file by an optdepends
-	* Added ChangeLog
diff --git a/abs/extra/xine-ui/PKGBUILD b/abs/extra/xine-ui/PKGBUILD
index 4c5471f..59ae0cb 100644
--- a/abs/extra/xine-ui/PKGBUILD
+++ b/abs/extra/xine-ui/PKGBUILD
@@ -1,41 +1,43 @@
-# $Id: PKGBUILD 77076 2010-04-10 16:09:26Z andrea $
-# Maintainer: Eric Belanger <eric@archlinux.org>
+# $Id$
+# Maintainer: Eric Bélanger <eric@archlinux.org>
 
 pkgname=xine-ui
 pkgver=0.99.6
-pkgrel=1
+pkgrel=2
 pkgdesc="A free video player for Unix"
 arch=('i686' 'x86_64')
 license=('GPL')
 url="http://www.xine-project.org"
 depends=('xine-lib' 'curl' 'libxtst' 'libxinerama' 'libxv' 'libpng' 'libxft'
 	'libxxf86vm' 'readline' 'xdg-utils' 'shared-mime-info' 'hicolor-icon-theme'
-	'lirc-utils')
+	'desktop-file-utils' 'lirc-utils')
 makedepends=('libxt')
 options=('!emptydirs' '!strip')
-install=${pkgname}.install
+install=xine-ui.install
 source=(http://downloads.sourceforge.net/xine/${pkgname}-${pkgver}.tar.xz
-	lirc-check-a89347673097.patch lirc-makefile-a68dd15ff7ae.patch fix_lirc.diff)
+	lirc-check-a89347673097.patch lirc-makefile-a68dd15ff7ae.patch 
+        fix_lirc.diff xine-ui-xdg.diff)
 md5sums=('d468b4e7fe39ff19888261e1da9be914'
          '4f06f63f5fd55b08a648e5d63f881898'
          '9f5acaf14f3945aa2ce428631d09cd47'
-         '0174bd096756b9c6f47e9b8b5ff6e145')
+         '0174bd096756b9c6f47e9b8b5ff6e145'
+         '5972b4061acf3b553760de9ae2178d38')
 
 build() {
   cd "${srcdir}/${pkgname}-${pkgver}"
-  patch -p1 < "${srcdir}/lirc-check-a89347673097.patch" || return 1
-  patch -p1 < "${srcdir}/lirc-makefile-a68dd15ff7ae.patch" || return 1
-  patch -p1 < "${srcdir}/fix_lirc.diff" || return 1
-  autoconf || return 1
-
+  patch -p1 < "${srcdir}/lirc-check-a89347673097.patch"
+  patch -p1 < "${srcdir}/lirc-makefile-a68dd15ff7ae.patch"
+  patch -p1 < "${srcdir}/fix_lirc.diff"
+  patch -p1 < "${srcdir}/xine-ui-xdg.diff"
+  autoconf
   ./configure --prefix=/usr --mandir=/usr/share/man \
-    --with-x --enable-lirc --without-aalib --enable-debug || return 1
-  make || return 1
+    --with-x --enable-lirc --without-aalib --enable-debug
+  make
 }
 
 package() {
   cd "${srcdir}/${pkgname}-${pkgver}"
-  make DESTDIR="${pkgdir}" install || return 1
+  make DESTDIR="${pkgdir}" install
   install -d "${pkgdir}/usr/share/applications"
   mv "${pkgdir}/usr/share/xine/desktop/xine.desktop" "${pkgdir}/usr/share/applications"
 }
diff --git a/abs/extra/xine-ui/xine-ui-0.99.6-1-i686-build.log.1 b/abs/extra/xine-ui/xine-ui-0.99.6-1-i686-build.log.1
deleted file mode 100644
index d1d33d7..0000000
--- a/abs/extra/xine-ui/xine-ui-0.99.6-1-i686-build.log.1
+++ /dev/null
@@ -1,2 +0,0 @@
-/data/linhes_pkgbuild/abs/extra/xine-ui/PKGBUILD: line 25: cd: /data/linhes_pkgbuild/abs/extra/xine-ui/src/xine-ui-0.99.6: No such file or directory
-[1m    Aborting...(B[m
diff --git a/abs/extra/xine-ui/xine-ui-xdg.diff b/abs/extra/xine-ui/xine-ui-xdg.diff
new file mode 100644
index 0000000..959d674
--- /dev/null
+++ b/abs/extra/xine-ui/xine-ui-xdg.diff
@@ -0,0 +1,206 @@
+--- xine-ui-0.99.6.orig/src/xitk/common.h
++++ xine-ui-0.99.6/src/xitk/common.h
+@@ -331,6 +331,5 @@ typedef struct {
+   int                       use_root_window;
+ 
+   int                       ssaver_enabled;
+-  int                       ssaver_timeout;
+ 
+   int                       skip_by_chapter;
+--- 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/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.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/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/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"),
+
+
+
+
+ 
diff --git a/abs/extra/xine-ui/xine-ui.install b/abs/extra/xine-ui/xine-ui.install
index 8afc566..3b3aff7 100644
--- a/abs/extra/xine-ui/xine-ui.install
+++ b/abs/extra/xine-ui/xine-ui.install
@@ -1,6 +1,7 @@
 post_install() {
   xdg-icon-resource forceupdate --theme hicolor &> /dev/null
   update-mime-database usr/share/mime &> /dev/null
+  update-desktop-database -q
 }
 
 post_upgrade() {
-- 
cgit v0.12

