diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-31 00:37:27 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-31 00:37:27 +0000 |
commit | b583968115e269ae112ca4ccb6af161ae017fe82 (patch) | |
tree | 2991331fd75db2bbece54738586bf8875c897271 /libvo | |
parent | dad7081d3f7a6133a09ef9069140cdf9d1d205cc (diff) | |
download | mpv-b583968115e269ae112ca4ccb6af161ae017fe82.tar.bz2 mpv-b583968115e269ae112ca4ccb6af161ae017fe82.tar.xz |
common -vm code, patch by Santi BĂ©jar <tiarda@yahoo.es>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4426 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/x11_common.c | 66 | ||||
-rw-r--r-- | libvo/x11_common.h | 5 |
2 files changed, 71 insertions, 0 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 0147d48a5f..58710a6398 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -25,6 +25,10 @@ #include <X11/extensions/Xinerama.h> #endif +#ifdef HAVE_XF86VM +#include <X11/extensions/xf86vmode.h> +#endif + /* * If SCAN_VISUALS is defined, vo_init() scans all available TrueColor * visuals for the 'best' visual for MPlayer video display. Note that @@ -54,6 +58,10 @@ int xinerama_x = 0; int xinerama_y = 0; #endif +#ifdef HAVE_XF86VM +XF86VidModeModeInfo **vidmodes=NULL; +#endif + void vo_hidecursor ( Display *disp , Window win ) { Cursor no_ptr; @@ -498,4 +506,62 @@ void vo_x11_xinerama_move(Display *dsp, Window w) } #endif +#ifdef HAVE_XF86VM +void vo_vm_switch(uint32_t X, uint32_t Y, int* modeline_width, int* modeline_height) +{ + unsigned int vm_event, vm_error; + unsigned int vm_ver, vm_rev; + int i,j,have_vm=0; + + int modecount; + + if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) { + XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev); + printf("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); + have_vm=1; + } else + printf("XF86VidMode Extenstion not available.\n"); + + if (have_vm) { + if (vidmodes==NULL) + XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes); + j=0; + *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) ) + { + *modeline_width=vidmodes[i]->hdisplay; + *modeline_height=vidmodes[i]->vdisplay; + j=i; + } + + printf("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",*modeline_width, *modeline_height, X, Y); + XF86VidModeLockModeSwitch(mDisplay,mScreen,0); + XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]); + XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]); + X=(vo_screenwidth-*modeline_width)/2; + Y=(vo_screenheight-*modeline_height)/2; + XF86VidModeSetViewPort(mDisplay,mScreen,X,Y); + } +} + +void vo_vm_close(Display *dpy) +{ + #ifdef HAVE_NEW_GUI + if ((vidmodes!=NULL)&&( vo_window == None ) ) + #else + if (vidmodes!=NULL) + #endif + { + int screen; screen=DefaultScreen( dpy ); + XF86VidModeSwitchToMode(dpy,screen,vidmodes[0]); + XF86VidModeSwitchToMode(dpy,screen,vidmodes[0]); + free(vidmodes); + } +} +#endif + #endif diff --git a/libvo/x11_common.h b/libvo/x11_common.h index 3ad800c3d1..9c42d01b22 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -41,3 +41,8 @@ void saver_on( Display * ); #ifdef HAVE_XINERAMA void vo_x11_xinerama_move(Display *dsp, Window w); #endif + +#ifdef HAVE_XF86VM +void vo_vm_switch(uint32_t, uint32_t, int*, int*); +void vo_vm_close(Display*); +#endif |