From c6a1bafda333d15e7b5559cc085200a3c930a13c Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sat, 13 Nov 2004 17:18:15 +0000 Subject: xinimin updates to properly quit on stream end CVS patchset: 7121 CVS date: 2004/11/13 17:18:15 --- doc/hackersguide/library.sgml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/doc/hackersguide/library.sgml b/doc/hackersguide/library.sgml index 69570fcc3..07aaf3cc0 100644 --- a/doc/hackersguide/library.sgml +++ b/doc/hackersguide/library.sgml @@ -69,7 +69,7 @@ */ /* - * compile-command: "gcc -Wall -O2 `xine-config --cflags` `xine-config --libs` -lX11 -lm -o xinimin xinimin.c" + * compile-command: "gcc -Wall -O2 `xine-config --cflags` `xine-config --libs` -L/usr/X11R6/lib -lX11 -lm -o xinimin xinimin.c" */ #include <stdio.h> @@ -112,6 +112,9 @@ static double pixel_aspect; static int running = 1; +#define INPUT_MOTION (ExposureMask | ButtonPressMask | KeyPressMask | \ + ButtonMotionMask | StructureNotifyMask | \ + PropertyChangeMask | PointerMotionMask) /* this will be called by xine, if it wants to know the target size of a frame */ static void dest_size_cb(void *data, int video_width, int video_height, double video_pixel_aspect, @@ -210,13 +213,9 @@ int main(int argc, char **argv) { 0, 0, (DisplayWidth(display, screen)), (DisplayHeight(display, screen)), 0, 0, 0); - XSelectInput(display, window[0], (ExposureMask | ButtonPressMask | KeyPressMask | - ButtonMotionMask | StructureNotifyMask | - PropertyChangeMask | PointerMotionMask)); + XSelectInput(display, window[0], INPUT_MOTION); - XSelectInput(display, window[1], (ExposureMask | ButtonPressMask | KeyPressMask | - ButtonMotionMask | StructureNotifyMask | - PropertyChangeMask | PointerMotionMask)); + XSelectInput(display, window[1], INPUT_MOTION); XA_NO_BORDER = XInternAtom(display, "_MOTIF_WM_HINTS", False); mwmhints.flags = MWM_HINTS_DECORATIONS; @@ -262,9 +261,17 @@ int main(int argc, char **argv) { } while (running) { - XEvent xevent; + XEvent xevent; + int got_event; + + xine_usec_sleep(20000); + + XLockDisplay(display); + got_event = XCheckMaskEvent(display, INPUT_MOTION, &xevent); + XUnlockDisplay(display); - XNextEvent(display, &xevent); + if( !got_event ) + continue; switch(xevent.type) { -- cgit v1.2.3