[Toxine-cvs] CVS: toxine/src/plugins vo_x11.c,1.27,1.28
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2004-04-12 12:49:26
|
Update of /cvsroot/toxine/toxine/src/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11273 Modified Files: vo_x11.c Log Message: permit resizing Index: vo_x11.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_x11.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- vo_x11.c 11 Apr 2004 13:29:39 -0000 1.27 +++ vo_x11.c 12 Apr 2004 12:35:38 -0000 1.28 @@ -105,6 +105,9 @@ pthread_t timed_thread; + int frame_width; + int frame_height; + pthread_mutex_t mutex; } x11_private_t; @@ -398,23 +401,21 @@ *dest_x = 0; *dest_y = 0; - if(!private->fullscreen) { - - if(((video_width > 0) && (video_height > 0)) && - ((video_width != private->x11_drawable[private->fullscreen].video_width) || - (video_height != private->x11_drawable[private->fullscreen].video_height))) { - + if((private->frame_width == -1) && (private->frame_height == -1)) { + private->x11_drawable[private->fullscreen].video_width = video_width; + private->x11_drawable[private->fullscreen].video_height = video_height; + if(!private->fullscreen) { XLockDisplay(private->display); XResizeWindow(private->display, private->x11_drawable[private->fullscreen].video_window, - video_width, video_height); - XFlush(private->display); + private->x11_drawable[private->fullscreen].video_width, + private->x11_drawable[private->fullscreen].video_height); XUnlockDisplay(private->display); } - - private->x11_drawable[private->fullscreen].video_width = video_width; - private->x11_drawable[private->fullscreen].video_height = video_height; } - + + private->frame_width = video_width; + private->frame_height = video_height; + *dest_width = private->x11_drawable[private->fullscreen].video_width; *dest_height = private->x11_drawable[private->fullscreen].video_height; @@ -552,7 +553,9 @@ private->x11_drawable[private->fullscreen].video_width = 720; private->x11_drawable[private->fullscreen].video_height = 576; - + private->frame_width = -1; + private->frame_height = -1; + /* Setup windowed window */ hint.x = 0; hint.y = 0; @@ -804,6 +807,22 @@ XUnlockDisplay(private->display); switch (ksym) { + /* 1:1 */ + case XK_1: + case XK_KP_1: + pthread_mutex_lock(&private->mutex); + private->x11_drawable[0].video_width = private->frame_width; + private->x11_drawable[0].video_height = private->frame_height; + if(!private->fullscreen) { + XLockDisplay(private->display); + XResizeWindow(private->display, private->x11_drawable[private->fullscreen].video_window, + private->x11_drawable[private->fullscreen].video_width, + private->x11_drawable[private->fullscreen].video_height); + XUnlockDisplay(private->display); + } + pthread_mutex_unlock(&private->mutex); + break; + /* Fullscreen toggle */ case XK_f: case XK_F: @@ -927,11 +946,22 @@ pthread_mutex_lock(&private->mutex); if(xev->xany.window == private->x11_drawable[private->fullscreen].video_window) { + XConfigureEvent *cev = (XConfigureEvent *) xev; - translate_coords(private->display, - private->x11_drawable[private->fullscreen].video_window, - &private->x11_drawable[private->fullscreen].x, - &private->x11_drawable[private->fullscreen].y); + private->x11_drawable[private->fullscreen].video_width = cev->width; + private->x11_drawable[private->fullscreen].video_height = cev->height; + + if((cev->x == 0) && (cev->y == 0)) { + translate_coords(private->display, + private->x11_drawable[private->fullscreen].video_window, + &private->x11_drawable[private->fullscreen].x, + &private->x11_drawable[private->fullscreen].y); + } + else { + private->x11_drawable[private->fullscreen].x = cev->x; + private->x11_drawable[private->fullscreen].y = cev->y; + } + #if 0 printf("CONFIGURE X %d, Y %d ** w %d, h %d ** 0x%lx\n", private->x11_drawable[private->fullscreen].x, |