diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2008-11-17 20:50:23 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2008-11-17 20:50:23 +0200 |
commit | 1715c2a33632b333f8e8e581ef23ea5fe0234edd (patch) | |
tree | f2f9ddca0f4940edd845d71a5bfd74c8a09ba633 /libvo | |
parent | e46ce9c0ac88cdc3b4604c249576cfde0c5c4946 (diff) | |
parent | 409bb1c5daba69aac788ce5065d05b8ea8441cfd (diff) | |
download | mpv-1715c2a33632b333f8e8e581ef23ea5fe0234edd.tar.bz2 mpv-1715c2a33632b333f8e8e581ef23ea5fe0234edd.tar.xz |
Merge svn changes up to r27949
Conflicts:
common.mak
libvo/vo_xv.c
libvo/x11_common.c
libvo/x11_common.h
stream/cache2.c
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/gl_common.c | 8 | ||||
-rw-r--r-- | libvo/vo_dxr3.c | 3 | ||||
-rw-r--r-- | libvo/vo_gl.c | 17 | ||||
-rw-r--r-- | libvo/vo_gl2.c | 3 | ||||
-rw-r--r-- | libvo/vo_png.c | 4 | ||||
-rw-r--r-- | libvo/vo_x11.c | 106 | ||||
-rw-r--r-- | libvo/vo_xmga.c | 3 | ||||
-rw-r--r-- | libvo/vo_xover.c | 2 | ||||
-rw-r--r-- | libvo/vo_xv.c | 65 | ||||
-rw-r--r-- | libvo/vo_xvidix.c | 3 | ||||
-rw-r--r-- | libvo/vo_xvmc.c | 30 | ||||
-rw-r--r-- | libvo/w32_common.c | 16 | ||||
-rw-r--r-- | libvo/x11_common.c | 82 | ||||
-rw-r--r-- | libvo/x11_common.h | 18 |
14 files changed, 104 insertions, 256 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 65592932e6..cd75bdb706 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1608,13 +1608,7 @@ int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win) // set new values vo_window = win; - { - Window root; - int tmp; - unsigned utmp; - XGetGeometry(mDisplay, vo_window, &root, &tmp, &tmp, - (unsigned *)&vo_dwidth, (unsigned *)&vo_dheight, &utmp, &utmp); - } + vo_x11_update_geometry(); if (!keep_context) { void *(*getProcAddress)(const GLubyte *); const char *(*glXExtStr)(Display *, int); diff --git a/libvo/vo_dxr3.c b/libvo/vo_dxr3.c index 69038ae0eb..3fa0ed9c6d 100644 --- a/libvo/vo_dxr3.c +++ b/libvo/vo_dxr3.c @@ -540,9 +540,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_OVERLAY); overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_RECTANGLE); } - - if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); - #endif return 0; diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index dedbac75cc..cfd908b615 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -170,6 +170,7 @@ static void texSize(int w, int h, int *texw, int *texh) { while (*texh < h) *texh *= 2; } + if (ati_hack) *texw = (*texw + 511) & ~511; } //! maximum size of custom fragment program @@ -689,12 +690,8 @@ static uint32_t get_image(mp_image_t *mpi) { } if (mpi->flags & MP_IMGFLAG_READABLE) return VO_FALSE; if (ati_hack) { - int s = 1; - // for unexplainable reasons, with width < 512 chroma tends to be messed up - // (after ca. 2/3 the previous line repeats all over) - if (mpi->width < 512) return VO_FALSE; - while (s < mpi->width) s *= 2; - mpi->width = s; + mpi->width = texture_width; + mpi->height = texture_height; } if (!gl_buffer) GenBuffers(1, &gl_buffer); @@ -734,6 +731,8 @@ static uint32_t draw_image(mp_image_t *mpi) { int stride[3]; unsigned char *planes[3]; mp_image_t mpi2 = *mpi; + int w = mpi->w, h = mpi->h; + if (ati_hack) { w = texture_width; h = texture_height; } if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) goto skip_upload; mpi2.flags = 0; mpi2.type = MP_IMGTYPE_TEMP; @@ -763,14 +762,14 @@ static uint32_t draw_image(mp_image_t *mpi) { slice = 0; // always "upload" full texture } glUploadTex(gl_target, gl_format, gl_type, planes[0], stride[0], - mpi->x, mpi->y, mpi->w, mpi->h, slice); + mpi->x, mpi->y, w, h, slice); if (mpi->imgfmt == IMGFMT_YV12) { ActiveTexture(GL_TEXTURE1); glUploadTex(gl_target, gl_format, gl_type, planes[1], stride[1], - mpi->x / 2, mpi->y / 2, mpi->w / 2, mpi->h / 2, slice); + mpi->x / 2, mpi->y / 2, w / 2, h / 2, slice); ActiveTexture(GL_TEXTURE2); glUploadTex(gl_target, gl_format, gl_type, planes[2], stride[2], - mpi->x / 2, mpi->y / 2, mpi->w / 2, mpi->h / 2, slice); + mpi->x / 2, mpi->y / 2, w / 2, h / 2, slice); ActiveTexture(GL_TEXTURE0); } if (mpi->flags & MP_IMGFLAG_DIRECT) diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index b2c7e49d25..d957337540 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -670,9 +670,6 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin if (initGl(vo_dwidth, vo_dheight) == -1) return -1; -#ifndef GL_WIN32 - if (vo_ontop) vo_x11_setlayer(mDisplay,vo_window, vo_ontop); -#endif return 0; } diff --git a/libvo/vo_png.c b/libvo/vo_png.c index 3c5f109aa2..ac0e99587e 100644 --- a/libvo/vo_png.c +++ b/libvo/vo_png.c @@ -191,8 +191,8 @@ static int query_format(uint32_t format) { switch(format){ - case IMGFMT_RGB|24: - case IMGFMT_BGR|24: + case IMGFMT_RGB24: + case IMGFMT_BGR24: return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_ACCEPT_STRIDE; } return 0; diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c index 18861e1266..3c8d672734 100644 --- a/libvo/vo_x11.c +++ b/libvo/vo_x11.c @@ -304,7 +304,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, { // int screen; int fullscreen = 0; - int vm = 0; // int interval, prefer_blank, allow_exp, nothing; unsigned int fg, bg; @@ -315,15 +314,14 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, const struct fmt2Xfmtentry_s *fmte = fmt2Xfmt; #ifdef CONFIG_XF86VM - unsigned int modeline_width, modeline_height; - static uint32_t vm_width; - static uint32_t vm_height; + int vm = 0; #endif vo_mouse_autohide = 1; old_vo_dwidth = -1; old_vo_dheight = -1; + int_pause = 0; if (!title) title = "MPlayer X11 (XImage/Shm) render"; @@ -333,13 +331,14 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, if (flags & (VOFLAG_FULLSCREEN|VOFLAG_MODESWITCHING)) fullscreen = 1; +#ifdef CONFIG_XF86VM if (flags & VOFLAG_MODESWITCHING) vm = 1; +#endif if (flags & VOFLAG_FLIPPING) Flip_Flag = 1; zoomFlag = flags & VOFLAG_SWSCALE; - int_pause = 0; // if(!fullscreen) zoomFlag=1; //it makes no sense to avoid zooming on windowd mode //printf( "w: %d h: %d\n\n",vo_dwidth,vo_dheight ); @@ -375,21 +374,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, #ifdef CONFIG_XF86VM if (vm) { - if ((d_width == 0) && (d_height == 0)) - { - vm_width = image_width; - vm_height = image_height; - } else - { - vm_width = d_width; - vm_height = d_height; - } - vo_vm_switch(vm_width, vm_height, &modeline_width, - &modeline_height); - vo_dx = (vo_screenwidth - modeline_width) / 2; - vo_dy = (vo_screenheight - modeline_height) / 2; - vo_dwidth = modeline_width; - vo_dheight = modeline_height; + vo_vm_switch(); } #endif bg = WhitePixel(mDisplay, mScreen); @@ -415,7 +400,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, vo_window = WinID ? ((Window) WinID) : mRootWin; if (WinID) { - int border; XUnmapWindow(mDisplay, vo_window); XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); @@ -428,27 +412,20 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, ButtonReleaseMask | ExposureMask); XMapWindow(mDisplay, vo_window); - XGetGeometry(mDisplay, vo_window, &mRootWin, - &vo_dx, &vo_dy, &vo_dwidth, &vo_dheight, - &border, &depth); + depth = vo_x11_update_geometry(); } else XSelectInput(mDisplay, vo_window, ExposureMask); } else { - vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, + vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight, flags, theCmap, "x11", title); } + if (vo_gc != None) + XFreeGC(mDisplay, vo_gc); + vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv); XSync(mDisplay, False); - vo_x11_selectinput_witherr(mDisplay, vo_window, - StructureNotifyMask | KeyPressMask | - PropertyChangeMask | ExposureMask | - ((WinID == - 0) ? 0 : (ButtonPressMask | - ButtonReleaseMask | - PointerMotionMask))); - #ifdef CONFIG_XF86VM if (vm) { @@ -462,10 +439,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, #endif } - if (vo_gc != None) - XFreeGC(mDisplay, vo_gc); - vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv); - if (myximage) { freeMyXImage(); @@ -473,12 +446,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, } getMyXImage(); - if (!WinID) - { - vo_dwidth = vo_screenwidth; - vo_dheight = vo_screenheight; - } - while (fmte->mpfmt) { int depth = IMGFMT_RGB_DEPTH(fmte->mpfmt); /* bits_per_pixel in X seems to be set to 16 for 15 bit formats @@ -540,30 +507,31 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, dst_width = width; //printf( "X11 bpp: %d color mask: R:%lX G:%lX B:%lX\n",bpp,myximage->red_mask,myximage->green_mask,myximage->blue_mask ); - if (vo_ontop) - vo_x11_setlayer(mDisplay, vo_window, vo_ontop); - return 0; } static void Display_Image(XImage * myximage, uint8_t * ImageData) { + int x = (vo_dwidth - dst_width) / 2; + int y = (vo_dheight - myximage->height) / 2; + if (WinID == 0) { + x = vo_dx; + y = vo_dy; + } myximage->data += out_offset; #ifdef HAVE_SHM if (Shmem_Flag) { XShmPutImage(mDisplay, vo_window, vo_gc, myximage, 0, 0, - (vo_dwidth - dst_width) / 2, - (vo_dheight - myximage->height) / 2, dst_width, + x, y, dst_width, myximage->height, True); } else #endif { XPutImage(mDisplay, vo_window, vo_gc, myximage, 0, 0, - (vo_dwidth - dst_width) / 2, - (vo_dheight - myximage->height) / 2, dst_width, + x, y, dst_width, myximage->height); } myximage->data -= out_offset; @@ -637,27 +605,7 @@ static int draw_slice(uint8_t * src[], int stride[], int w, int h, static int draw_frame(uint8_t * src[]) { -#if 0 - int stride[3] = { 0, 0, 0 }; - - if (in_format == IMGFMT_YUY2) - stride[0] = srcW * 2; - else if (in_format == IMGFMT_BGR8) - stride[0] = srcW; - else if (in_format == IMGFMT_BGR15) - stride[0] = srcW * 2; - else if (in_format == IMGFMT_BGR16) - stride[0] = srcW * 2; - else if (in_format == IMGFMT_BGR24) - stride[0] = srcW * 3; - else if (in_format == IMGFMT_BGR32) - stride[0] = srcW * 4; - - return draw_slice(src, stride, srcW, srcH, 0, 0); -#else - mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_X11_DrawFrameCalled); - return -1; -#endif + return VO_ERROR; } static uint32_t get_image(mp_image_t * mpi) @@ -729,7 +677,7 @@ static void uninit(void) freeMyXImage(); #ifdef CONFIG_XF86VM - vo_vm_close(mDisplay); + vo_vm_close(); #endif zoomFlag = 0; @@ -761,10 +709,14 @@ static int control(uint32_t request, void *data) return int_pause = 0; case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t *) data)); - case VOCTRL_GUISUPPORT: - return VO_TRUE; case VOCTRL_GET_IMAGE: return get_image(data); + case VOCTRL_GUISUPPORT: + return VO_TRUE; + case VOCTRL_FULLSCREEN: + vo_x11_fullscreen(); + vo_x11_clearwindow(mDisplay, vo_window); + return VO_TRUE; case VOCTRL_SET_EQUALIZER: { struct voctrl_set_equalizer_args *args = data; @@ -778,12 +730,6 @@ static int control(uint32_t request, void *data) case VOCTRL_ONTOP: vo_x11_ontop(); return VO_TRUE; - case VOCTRL_FULLSCREEN: - { - vo_x11_fullscreen(); - vo_x11_clearwindow(mDisplay, vo_window); - } - return VO_TRUE; case VOCTRL_UPDATE_SCREENINFO: update_xinerama_info(); return VO_TRUE; diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c index 0a91b57415..96d400866b 100644 --- a/libvo/vo_xmga.c +++ b/libvo/vo_xmga.c @@ -248,9 +248,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, set_window(); // set up mga_vid_config.dest_width etc - if (vo_ontop) - vo_x11_setlayer(mDisplay, vo_window, vo_ontop); - XSync(mDisplay, False); ioctl(f, MGA_VID_ON, 0); diff --git a/libvo/vo_xover.c b/libvo/vo_xover.c index 38a3a585e6..3feb5d8da7 100644 --- a/libvo/vo_xover.c +++ b/libvo/vo_xover.c @@ -188,8 +188,6 @@ static void set_window(int force_update) XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth, (vo_fs ? drwHeight - 1 : drwHeight)); - if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); - /* flush, update drawable */ XFlush(mDisplay); diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 6dfd8a8cf4..51afa2a693 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -181,7 +181,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, { struct MPOpts *opts = vo->opts; struct vo_x11_state *x11 = vo->x11; - XSizeHints hint; XVisualInfo vinfo; XGCValues xgcv; XSetWindowAttributes xswa; @@ -223,44 +222,18 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, #ifdef CONFIG_GUI if (use_gui) - guiGetEvent(guiSetShVideo, 0); // let the GUI to setup/resize our window + guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window else #endif { - hint.x = vo->dx; - hint.y = vo->dy; - hint.width = d_width; - hint.height = d_height; #ifdef CONFIG_XF86VM - unsigned int modeline_width, modeline_height; - uint32_t vm_width; - uint32_t vm_height; int vm = flags & VOFLAG_MODESWITCHING; if (vm) { - if ((d_width == 0) && (d_height == 0)) - { - vm_width = ctx->image_width; - vm_height = ctx->image_height; - } else - { - vm_width = d_width; - vm_height = d_height; - } - vo_vm_switch(vo, vm_width, vm_height, &modeline_width, - &modeline_height); + vo_vm_switch(vo); ctx->mode_switched = 1; - hint.x = (opts->vo_screenwidth - modeline_width) / 2; - hint.y = (opts->vo_screenheight - modeline_height) / 2; - hint.width = modeline_width; - hint.height = modeline_height; - aspect_save_screenres(vo, modeline_width, modeline_height); - } else -#warning This "else" makes no sense + } #endif - hint.flags = PPosition | PSize /* | PBaseSize */ ; - hint.base_width = hint.width; - hint.base_height = hint.height; XGetWindowAttributes(x11->display, DefaultRootWindow(x11->display), &attribs); depth = attribs.depth; @@ -293,18 +266,13 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, ButtonReleaseMask | ExposureMask); XMapWindow(x11->display, x11->window); - Window mRoot; - uint32_t drwBorderWidth, drwDepth; - XGetGeometry(x11->display, x11->window, &mRoot, - &ctx->drwX, &ctx->drwY, &vo->dwidth, &vo->dheight, - &drwBorderWidth, &drwDepth); - if (vo->dwidth <= 0) vo->dwidth = d_width; - if (vo->dheight <= 0) vo->dheight = d_height; + vo_x11_update_geometry(vo); aspect_save_prescale(vo, vo->dwidth, vo->dheight); - } + } else + XSelectInput(x11->display, x11->window, ExposureMask); } else { - vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, d_width, d_height, + vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, vo->dwidth, vo->dheight, flags, CopyFromParent, "xv", title); XChangeWindowAttributes(x11->display, x11->window, xswamask, &xswa); } @@ -360,10 +328,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, ctx->current_buf = 0; ctx->current_ip_buf = 0; -#if 0 - set_gamma_correction(); -#endif - aspect(vo, &vo->dwidth, &vo->dheight, A_NOZOOM); if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1; calc_drwXY(vo, &ctx->drwX, &ctx->drwY); @@ -378,9 +342,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", ctx->drwX, ctx->drwY, vo->dwidth, vo->dheight); - if (opts->vo_ontop) - vo_x11_setlayer(vo, x11->window, opts->vo_ontop); - return 0; } @@ -480,16 +441,7 @@ static void check_events(struct vo *vo) int e = vo_x11_check_events(vo); if (e & VO_EVENT_RESIZE) - { - Window mRoot; - uint32_t drwBorderWidth, drwDepth; - XGetGeometry(x11->display, x11->window, &mRoot, &ctx->drwX, &ctx->drwY, - &vo->dwidth, &vo->dheight, &drwBorderWidth, &drwDepth); - mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", ctx->drwX, - ctx->drwY, vo->dwidth, vo->dheight); - calc_drwXY(vo, &ctx->drwX, &ctx->drwY); - } if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) { @@ -577,8 +529,7 @@ static int draw_slice(struct vo *vo, uint8_t * image[], int stride[], int w, static int draw_frame(struct vo *vo, uint8_t * src[]) { - mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_XV_DrawFrameCalled); - return -1; + return VO_ERROR; } static uint32_t draw_image(struct vo *vo, mp_image_t * mpi) diff --git a/libvo/vo_xvidix.c b/libvo/vo_xvidix.c index 04c8bea4b7..27c9eb0bce 100644 --- a/libvo/vo_xvidix.c +++ b/libvo/vo_xvidix.c @@ -340,9 +340,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, panscan_calc(); - if (vo_ontop) - vo_x11_setlayer(mDisplay, vo_window, vo_ontop); - return 0; } diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index dbf5483434..4eba5b2fcb 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -454,7 +454,6 @@ int i,mode_id,rez; int numblocks,blocks_per_macroblock;//bpmb we have 6,8,12 //from vo_xv -XSizeHints hint; XVisualInfo vinfo; XGCValues xgcv; XSetWindowAttributes xswa; @@ -463,9 +462,6 @@ unsigned long xswamask; int depth; #ifdef CONFIG_XF86VM int vm=0; -unsigned int modeline_width, modeline_height; -static uint32_t vm_width; -static uint32_t vm_height; #endif //end of vo_xv @@ -649,28 +645,13 @@ skip_surface_allocation: else #endif { - hint.x = vo_dx; - hint.y = vo_dy; - hint.width = d_width; - hint.height = d_height; #ifdef CONFIG_XF86VM if ( vm ) { - if ((d_width==0) && (d_height==0)) - { vm_width=image_width; vm_height=image_height; } - else - { vm_width=d_width; vm_height=d_height; } - vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height); - hint.x=(vo_screenwidth-modeline_width)/2; - hint.y=(vo_screenheight-modeline_height)/2; - hint.width=modeline_width; - hint.height=modeline_height; - aspect_save_screenres(modeline_width,modeline_height); + vo_vm_switch(); } else #endif - hint.flags = PPosition | PSize /* | PBaseSize */; - hint.base_width = hint.width; hint.base_height = hint.height; XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); depth=attribs.depth; if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24; @@ -726,8 +707,6 @@ skip_surface_allocation: mp_msg(MSGT_VO,MSGL_V, "[xvmc] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); - if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); - //end vo_xv /* store image dimesions for displaying */ @@ -1085,11 +1064,6 @@ int e=vo_x11_check_events(mDisplay); { e |= VO_EVENT_EXPOSE; - XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&vo_dwidth,&vo_dheight, - &drwBorderWidth,&drwDepth ); - mp_msg(MSGT_VO,MSGL_V, "[xvmc] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY, - vo_dwidth,vo_dheight ); - calc_drwXY(&drwX, &drwY); } if ( e & VO_EVENT_EXPOSE ) @@ -1152,7 +1126,7 @@ static void uninit(void){ xvmc_free(); //from vo_xv #ifdef CONFIG_XF86VM - vo_vm_close(mDisplay); + vo_vm_close(); #endif vo_x11_uninit(); } diff --git a/libvo/w32_common.c b/libvo/w32_common.c index 1346f50a7f..ff5312af6a 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -46,8 +46,6 @@ static BOOL (WINAPI* myEnumDisplayMonitors)(HDC, LPCRECT, MONITORENUMPROC, LPARA static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { RECT r; POINT p; - if (WinID < 0 || message == WM_PAINT || message == WM_ERASEBKGND || - message == WM_SIZE) { switch (message) { case WM_ERASEBKGND: // no need to erase background seperately return 1; @@ -150,19 +148,6 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l break; } } - } else switch (message) { - case WM_MOUSEMOVE: - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_LBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_MBUTTONDBLCLK: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - case WM_RBUTTONDBLCLK: - SendNotifyMessage(WinID, message, wParam, lParam); - } return DefWindowProc(hWnd, message, wParam, lParam); } @@ -397,6 +382,7 @@ int vo_w32_init(void) { vo_window = CreateWindowEx(WS_EX_NOPARENTNOTIFY, classname, classname, WS_CHILD | WS_VISIBLE, 0, 0, vo_dwidth, vo_dheight, WinID, 0, hInstance, 0); + EnableWindow(vo_window, 0); } else vo_window = CreateWindowEx(0, classname, classname, vo_border ? (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP, diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 674f5d3af9..5557704c6c 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -3,6 +3,7 @@ #include <stdlib.h> #include <math.h> #include <inttypes.h> +#include <limits.h> #include "config.h" #include "options.h" @@ -1008,25 +1009,7 @@ int vo_x11_check_events(struct vo *vo) // if (vo_fs && Event.xconfigure.width != opts->vo_screenwidth && Event.xconfigure.height != opts->vo_screenheight) break; if (x11->window == None) break; - vo->dwidth = Event.xconfigure.width; - vo->dheight = Event.xconfigure.height; -#if 0 - /* when resizing, x and y are zero :( */ - vo->dx = Event.xconfigure.x; - vo->dy = Event.xconfigure.y; -#else - { - Window root; - int foo; - Window win; - - XGetGeometry(display, x11->window, &root, &foo, &foo, - &foo /*width */ , &foo /*height */ , &foo, - &foo); - XTranslateCoordinates(display, x11->window, root, 0, 0, - &vo->dx, &vo->dy, &win); - } -#endif + vo_x11_update_geometry(vo); ret |= VO_EVENT_RESIZE; break; case KeyPress: @@ -1479,6 +1462,27 @@ static int vo_x11_get_fs_type(int supported) return type; } +/** + * \brief update vo->dx, vo->dy, vo->dwidth and vo->dheight with current values of vo->x11->window + * \return returns current color depth of vo->x11->window + */ +int vo_x11_update_geometry(struct vo *vo) +{ + struct vo_x11_state *x11 = vo->x11; + unsigned depth, w, h; + int dummy_int; + Window dummy_win; + XGetGeometry(x11->display, x11->window, &dummy_win, &dummy_int, &dummy_int, + &w, &h, &dummy_int, &depth); + if (w <= INT_MAX && h <= INT_MAX) { + vo->dwidth = w; + vo->dheight = h; + } + XTranslateCoordinates(x11->display, x11->window, x11->rootwin, 0, 0, + &vo->dx, &vo->dy, &dummy_win); + return depth <= INT_MAX ? depth : 0; +} + void vo_x11_fullscreen(struct vo *vo) { struct MPOpts *opts = vo->opts; @@ -1731,8 +1735,7 @@ void vo_x11_selectinput_witherr(Display * display, Window w, } #ifdef CONFIG_XF86VM -void vo_vm_switch(struct vo *vo, uint32_t X, uint32_t Y, int *modeline_width, - int *modeline_height) +void vo_vm_switch(struct vo *vo) { struct vo_x11_state *x11 = vo->x11; struct MPOpts *opts = vo->opts; @@ -1740,6 +1743,8 @@ void vo_vm_switch(struct vo *vo, uint32_t X, uint32_t Y, int *modeline_width, int vm_event, vm_error; int vm_ver, vm_rev; int i, j, have_vm = 0; + int X = vo->dwidth, Y = vo->dheight; + int modeline_width, modeline_height; int modecount; @@ -1749,9 +1754,10 @@ void vo_vm_switch(struct vo *vo, uint32_t X, uint32_t Y, int *modeline_width, mp_msg(MSGT_VO, MSGL_V, "XF86VidMode extension v%i.%i\n", vm_ver, vm_rev); have_vm = 1; - } else + } else { mp_msg(MSGT_VO, MSGL_WARN, "XF86VidMode extension not available.\n"); + } if (have_vm) { @@ -1759,28 +1765,35 @@ void vo_vm_switch(struct vo *vo, uint32_t X, uint32_t Y, int *modeline_width, XF86VidModeGetAllModeLines(mDisplay, x11->screen, &modecount, &vidmodes); j = 0; - *modeline_width = vidmodes[0]->hdisplay; - *modeline_height = vidmodes[0]->vdisplay; + modeline_width = vidmodes[0]->hdisplay; + modeline_height = vidmodes[0]->vdisplay; for (i = 1; i < modecount; i++) if ((vidmodes[i]->hdisplay >= X) && (vidmodes[i]->vdisplay >= Y)) - if ((vidmodes[i]->hdisplay <= *modeline_width) - && (vidmodes[i]->vdisplay <= *modeline_height)) + if ((vidmodes[i]->hdisplay <= modeline_width) + && (vidmodes[i]->vdisplay <= modeline_height)) { - *modeline_width = vidmodes[i]->hdisplay; - *modeline_height = vidmodes[i]->vdisplay; + modeline_width = vidmodes[i]->hdisplay; + modeline_height = vidmodes[i]->vdisplay; j = i; } mp_msg(MSGT_VO, MSGL_INFO, MSGTR_SelectedVideoMode, - *modeline_width, *modeline_height, X, Y); + modeline_width, modeline_height, X, Y); XF86VidModeLockModeSwitch(mDisplay, x11->screen, 0); XF86VidModeSwitchToMode(mDisplay, x11->screen, vidmodes[j]); XF86VidModeSwitchToMode(mDisplay, x11->screen, vidmodes[j]); - X = (opts->vo_screenwidth - *modeline_width) / 2; - Y = (opts->vo_screenheight - *modeline_height) / 2; + + // FIXME: all this is more of a hack than proper solution + X = (opts->vo_screenwidth - modeline_width) / 2; + Y = (opts->vo_screenheight - modeline_height) / 2; XF86VidModeSetViewPort(mDisplay, x11->screen, X, Y); + vo->dx = X; + vo->dy = Y; + vo->dwidth = modeline_width; + vo->dheight = modeline_height; + aspect_save_screenres(vo, modeline_width, modeline_height); } } @@ -1795,9 +1808,6 @@ void vo_vm_close(struct vo *vo) #endif { int i, modecount; - int screen; - - screen = DefaultScreen(dpy); free(vidmodes); vidmodes = NULL; @@ -1813,8 +1823,8 @@ void vo_vm_close(struct vo *vo) break; } - XF86VidModeSwitchToMode(dpy, screen, vidmodes[i]); - XF86VidModeSwitchToMode(dpy, screen, vidmodes[i]); + XF86VidModeSwitchToMode(dpy, vo->x11->screen, vidmodes[i]); + XF86VidModeSwitchToMode(dpy, vo->x11->screen, vidmodes[i]); free(vidmodes); vidmodes = NULL; } diff --git a/libvo/x11_common.h b/libvo/x11_common.h index 70f1231a7d..e145c5b5a0 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -94,18 +94,19 @@ extern int mLocalDisplay; struct vo_x11_state *vo_x11_init_state(void); int vo_init(struct vo *vo); void vo_uninit(struct vo_x11_state *x11); -extern void vo_x11_decoration(struct vo *vo, int d ); +void vo_x11_decoration(struct vo *vo, int d ); void vo_x11_classhint(struct vo *vo, Window window, char *name); void vo_x11_sizehint(struct vo *vo, int x, int y, int width, int height, int max); int vo_x11_check_events(struct vo *vo); -extern void vo_x11_selectinput_witherr(Display *display, Window w, long event_mask); +void vo_x11_selectinput_witherr(Display *display, Window w, long event_mask); void vo_x11_fullscreen(struct vo *vo); +int vo_x11_update_geometry(struct vo *vo); void vo_x11_setlayer(struct vo *vo, Window vo_window, int layer); void vo_x11_uninit(struct vo *vo); Colormap vo_x11_create_colormap(struct vo *vo, XVisualInfo *vinfo); uint32_t vo_x11_set_equalizer(struct vo *vo, char *name, int value); -extern uint32_t vo_x11_get_equalizer(char *name, int *value); -extern void fstype_help(void); +uint32_t vo_x11_get_equalizer(char *name, int *value); +void fstype_help(void); void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, unsigned int width, unsigned int height, in |