updated on Thu Jan 26 12:02:26 UTC 2012
[aur-mirror.git] / tvtime_patched / tvtime-1.0.2-xscreensaver-fix.patch
blob49dcf59b0e25d01520e1b869cc809cc208638c73
1 Based on the patch in
2 http://sourceforge.net/tracker/?func=detail&aid=2683274&group_id=64301&atid=506989
3 --- tvtime-1.0.2.orig/configure.ac
4 +++ tvtime-1.0.2/configure.ac
5 @@ -118,10 +118,10 @@ if test x"$no_x" != x"yes"; then
6 X11_LIBS="$X11_LIBS -lXinerama"],,
7 [$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext])
9 - dnl check for XTest
10 - AC_CHECK_LIB([Xtst],[XTestFakeKeyEvent],
11 - [AC_DEFINE([HAVE_XTESTEXTENSION],,[XTest support])
12 - X11_LIBS="$X11_LIBS -lXtst"],,
13 + dnl check for XSs
14 + AC_CHECK_LIB([Xss],[XScreenSaverSuspend],
15 + [AC_DEFINE([HAVE_XSSEXTENSION],,[XSs support])
16 + X11_LIBS="$X11_LIBS -lXss"],,
17 [$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext])
19 dnl check for Xvidmode
20 --- tvtime-1.0.2.orig/src/xcommon.c 2005-08-14 19:36:52.000000000 +0200
21 +++ tvtime-1.0.2/src/xcommon.c 2009-05-31 18:44:18.861410600 +0200
22 @@ -45,8 +45,8 @@
23 #include <X11/keysym.h>
24 #include <X11/cursorfont.h>
25 #include <X11/extensions/XShm.h>
26 -#ifdef HAVE_XTESTEXTENSION
27 -#include <X11/extensions/XTest.h>
28 +#ifdef HAVE_XSSEXTENSION
29 +#include <X11/extensions/scrnsaver.h>
30 #endif
32 #include "xfullscreen.h"
33 @@ -67,7 +67,7 @@ static Window wm_window;
34 static Window fs_window;
35 static Window output_window;
36 static GC gc;
37 -static int have_xtest;
38 +static int have_xss;
39 static int output_width, output_height;
40 static int output_aspect;
41 static int output_on_root;
42 @@ -107,10 +107,6 @@ static Atom wm_delete_window;
43 static Atom xawtv_station;
44 static Atom xawtv_remote;
46 -#ifdef HAVE_XTESTEXTENSION
47 -static KeyCode kc_shift_l; /* Fake key to send. */
48 -#endif
50 static area_t video_area;
51 static area_t window_area;
52 static area_t scale_area;
53 @@ -248,12 +244,12 @@ static void x11_wait_mapped( Display *dp
54 } while ( (event.type != MapNotify) || (event.xmap.event != win) );
57 -static int have_xtestextention( void )
58 +static int have_xssextention( void )
60 -#ifdef HAVE_XTESTEXTENSION
61 - int dummy1, dummy2, dummy3, dummy4;
62 +#ifdef HAVE_XSSEXTENSION
63 + int dummy1, dummy2;
65 - return (XTestQueryExtension( display, &dummy1, &dummy2, &dummy3, &dummy4 ) == True);
66 + return (XScreenSaverQueryExtension( display, &dummy1, &dummy2 ) == True);
67 #endif
68 return 0;
70 @@ -843,7 +839,7 @@ int xcommon_open_display( const char *us
71 output_aspect = aspect;
72 output_height = 576;
74 - have_xtest = 0;
75 + have_xss = 0;
76 output_on_root = 0;
77 has_ewmh_state_fullscreen = 0;
78 has_ewmh_state_above = 0;
79 @@ -927,13 +923,16 @@ int xcommon_open_display( const char *us
80 xfullscreen_print_summary( xf );
83 -#ifdef HAVE_XTESTEXTENSION
84 - kc_shift_l = XKeysymToKeycode( display, XK_Shift_L );
85 -#endif
86 - have_xtest = have_xtestextention();
87 - if( have_xtest && xcommon_verbose ) {
88 - fprintf( stderr, "xcommon: Have XTest, will use it to ping the screensaver.\n" );
89 + have_xss = have_xssextention();
90 + if( have_xss && xcommon_verbose ) {
91 + fprintf( stderr, "xcommon: Have XSS, will use it to disable the screensaver.\n" );
92 + }
94 +#ifdef HAVE_XSSEXTENSION
95 + if ( have_xss ) {
96 + XScreenSaverSuspend( display, True );
98 +#endif
100 /* Initially, get the best width for our height. */
101 output_width = xv_get_width_for_height( output_height );
102 @@ -1112,15 +1111,7 @@ void xcommon_ping_screensaver( void )
103 gettimeofday( &curtime, 0 );
104 if( timediff( &curtime, &last_ping_time ) > SCREENSAVER_PING_TIME ) {
105 last_ping_time = curtime;
106 -#ifdef HAVE_XTESTEXTENSION
107 - if( have_xtest ) {
108 - XTestFakeKeyEvent( display, kc_shift_l, True, CurrentTime );
109 - XTestFakeKeyEvent( display, kc_shift_l, False, CurrentTime );
110 - } else
111 -#endif
113 - XResetScreenSaver( display );
115 + XResetScreenSaver( display );
119 @@ -1715,6 +1706,11 @@ void xcommon_poll_events( input_t *in )
121 void xcommon_close_display( void )
123 +#ifdef HAVE_XSSEXTENSION
124 + if ( have_xss ) {
125 + XScreenSaverSuspend( display, False );
127 +#endif
128 XDestroyWindow( display, output_window );
129 XDestroyWindow( display, wm_window );
130 XDestroyWindow( display, fs_window );