[Toxine-cvs] CVS: toxine/src/plugins vo_x11.c,1.22,1.23
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2003-05-22 20:50:39
|
Update of /cvsroot/toxine/toxine/src/plugins In directory sc8-pr-cvs1:/tmp/cvs-serv17186/src/plugins Modified Files: vo_x11.c Log Message: Made it compile with gcc 3.2.2, without warnings. Made it compile with OrT. Get rid of Shm completion event. Index: vo_x11.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_x11.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- vo_x11.c 21 Jan 2003 16:53:39 -0000 1.22 +++ vo_x11.c 22 May 2003 20:50:34 -0000 1.23 @@ -29,6 +29,8 @@ #include <sys/types.h> #include <signal.h> #include <time.h> +#include <sys/select.h> +#include <sys/stat.h> #include <X11/Xlib.h> #include <X11/Xatom.h> @@ -88,7 +90,6 @@ int screen; XColor black, white; - int completion_event; Visual *visual; Colormap colormap; int depth; @@ -126,7 +127,7 @@ /* * Config callback. */ -static void change_fake_rate_cb(void *data, xine_cfg_entry_t *cfg) { +static void change_fake_rate_cb(void *data, _cfg_entry_t *cfg) { x11_private_t *private = (x11_private_t *)data; private->fake_rate = cfg->num_value; @@ -543,14 +544,6 @@ private->wm_hint->initial_state = NormalState; private->wm_hint->flags = InputHint | StateHint; - /* - * completion event - */ - if(XShmQueryExtension(private->display) == True) - private->completion_event = XShmGetEventBase(private->display) + ShmCompletion; - else - private->completion_event = -1; - private->x11_drawable[private->fullscreen].video_width = 720; private->x11_drawable[private->fullscreen].video_height = 576; @@ -951,15 +944,14 @@ } - if((xev->type == private->completion_event) - && tox->video.port && (tox->xine_state & XINE_STREAM)) - xine_gui_send_vo_data(tox->stream, XINE_GUI_SEND_COMPLETION_EVENT, (void *)xev); - } /* * */ +static Bool is_not_completion(Display *display, XEvent *event, XPointer arg) { + return True; +} static void *event_loop(void *data) { toxine_t *tox = (toxine_t *) data; toxine_vo_plugin_t *vop = (toxine_vo_plugin_t *) tox->video.cur_plugin; @@ -969,8 +961,31 @@ pthread_detach(pthread_self()); while(tox->video.running) { - XNextEvent(private->display, &myevent); - video_window_handle_event(&myevent, tox) ; + Bool got_xevent; + struct timeval tv; + fd_set r; + + FD_ZERO(&r); + FD_SET(ConnectionNumber(private->display), &r); + + tv.tv_sec = 0; + tv.tv_usec = 33000; + + select(ConnectionNumber(private->display) + 1, &r, 0, 0, &tv); + + XLockDisplay(private->display); + got_xevent = XCheckIfEvent(private->display, &myevent, is_not_completion, (XPointer) NULL); + XUnlockDisplay(private->display); + + /* While event isn't completion */ + while(got_xevent == True) { + video_window_handle_event(&myevent, tox); + + XLockDisplay(private->display); + got_xevent = XCheckIfEvent(private->display, &myevent, is_not_completion, (XPointer) NULL); + XUnlockDisplay(private->display); + + } } pthread_exit(NULL); |