From 432e8ff4a568b1040cae43df4aa6a602c86c6162 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 21 Apr 2008 01:50:19 +0300 Subject: Move vo_depthonscreen to x11 struct --- libvo/video_out.c | 1 - libvo/video_out.h | 1 - libvo/x11_common.c | 22 +++++++++++----------- libvo/x11_common.h | 2 ++ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libvo/video_out.c b/libvo/video_out.c index 179384fd33..7e3781020b 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -31,7 +31,6 @@ int xinerama_x; int xinerama_y; // currect resolution/bpp on screen: (should be autodetected by vo_init()) -int vo_depthonscreen=0; int vo_screenwidth=0; int vo_screenheight=0; diff --git a/libvo/video_out.h b/libvo/video_out.h index 70dd3612d8..1604bd233b 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -246,7 +246,6 @@ extern int xinerama_x; extern int xinerama_y; // correct resolution/bpp on screen: (should be autodetected by vo_init()) -extern int vo_depthonscreen; extern int vo_screenwidth; extern int vo_screenheight; diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 989d45ce5f..8d144ea960 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -427,7 +427,7 @@ int vo_init(struct vo *vo) if (vo_rootwin) WinID = 0; // use root window - if (vo_depthonscreen) + if (x11->depthonscreen) { saver_off(x11->display); return 1; // already called @@ -490,7 +490,7 @@ int vo_init(struct vo *vo) mXImage = XGetImage(x11->display, mRootWin, 0, 0, 1, 1, AllPlanes, ZPixmap); - vo_depthonscreen = depth; // display depth on screen + x11->depthonscreen = depth; // display depth on screen // get bits/pixel from XImage structure: if (mXImage == NULL) @@ -500,15 +500,15 @@ int vo_init(struct vo *vo) { /* * for the depth==24 case, the XImage structures might use - * 24 or 32 bits of data per pixel. The global variable - * vo_depthonscreen stores the amount of data per pixel in the + * 24 or 32 bits of data per pixel. The x11->depthonscreen + * field stores the amount of data per pixel in the * XImage structure! * * Maybe we should rename vo_depthonscreen to (or add) vo_bpp? */ bpp = mXImage->bits_per_pixel; - if ((vo_depthonscreen + 7) / 8 != (bpp + 7) / 8) - vo_depthonscreen = bpp; // by A'rpi + if ((x11->depthonscreen + 7) / 8 != (bpp + 7) / 8) + x11->depthonscreen = bpp; // by A'rpi mask = mXImage->red_mask | mXImage->green_mask | mXImage->blue_mask; mp_msg(MSGT_VO, MSGL_V, @@ -516,12 +516,12 @@ int vo_init(struct vo *vo) mXImage->red_mask, mXImage->green_mask, mXImage->blue_mask); XDestroyImage(mXImage); } - if (((vo_depthonscreen + 7) / 8) == 2) + if (((x11->depthonscreen + 7) / 8) == 2) { if (mask == 0x7FFF) - vo_depthonscreen = 15; + x11->depthonscreen = 15; else if (mask == 0xFFFF) - vo_depthonscreen = 16; + x11->depthonscreen = 16; } // XCloseDisplay( mDisplay ); /* slightly improved local display detection AST */ @@ -535,7 +535,7 @@ int vo_init(struct vo *vo) mLocalDisplay = 0; mp_msg(MSGT_VO, MSGL_V, "vo: X11 running at %dx%d with depth %d and %d bpp (\"%s\" => %s display)\n", - vo_screenwidth, vo_screenheight, depth, vo_depthonscreen, + vo_screenwidth, vo_screenheight, depth, x11->depthonscreen, dispName, mLocalDisplay ? "local" : "remote"); vo_wm_type = vo_wm_detect(vo); @@ -560,7 +560,7 @@ void vo_uninit(struct vo_x11_state *x11) mp_msg(MSGT_VO, MSGL_V, "vo: uninit ...\n"); XSetErrorHandler(NULL); XCloseDisplay(x11->display); - vo_depthonscreen = 0; + x11->depthonscreen = 0; x11->display = NULL; } diff --git a/libvo/x11_common.h b/libvo/x11_common.h index 931c9ec233..3cae10714f 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -8,6 +8,7 @@ struct vo; struct vo_x11_state { Display *display; + int depthonscreen; }; #ifdef X11_FULLSCREEN @@ -143,6 +144,7 @@ int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return) #define vo_x11_clearwindow_part(display, ...) vo_x11_clearwindow_part(global_vo, __VA_ARGS__) #define mDisplay global_vo->x11->display +#define vo_depthonscreen global_vo->x11->depthonscreen #endif #endif /* MPLAYER_X11_COMMON_H */ -- cgit v1.2.3