Mercurial > mplayer.hg
comparison libvo/x11_common.c @ 23655:00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
consistent by introducing a new function that handles most of the
ugly things. Changes of behaviour with some vos is unavoidable, bug reports
welcome.
author | reimar |
---|---|
date | Wed, 27 Jun 2007 10:26:13 +0000 |
parents | 0999b3eb3ed4 |
children | 3ab096c77b9e |
comparison
equal
deleted
inserted
replaced
23654:c80995bd18b9 | 23655:00aa61cde84a |
---|---|
1263 XSetForeground(mDisplay, f_gc, 0); | 1263 XSetForeground(mDisplay, f_gc, 0); |
1264 | 1264 |
1265 return ret_win; | 1265 return ret_win; |
1266 } | 1266 } |
1267 | 1267 |
1268 /** | |
1269 * \brief create and setup a window suitable for display | |
1270 * \param vis Visual to use for creating the window | |
1271 * \param x x position of window | |
1272 * \param y y position of window | |
1273 * \param width width of window | |
1274 * \param height height of window | |
1275 * \param flags flags for window creation. | |
1276 * Only VOFLAG_FULLSCREEN is supported so far. | |
1277 * \param col_map Colourmap for window | |
1278 * \param classname name to use for the classhint | |
1279 * \param title title for the window | |
1280 * | |
1281 * This also does the grunt-work like setting Window Manager hints etc. | |
1282 * If vo_window is already set it just moves and resizes it. | |
1283 */ | |
1284 void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y, | |
1285 unsigned int width, unsigned int height, int flags, | |
1286 Colormap col_map, | |
1287 const char *classname, const char *title) | |
1288 { | |
1289 if (vo_window == None) { | |
1290 XSizeHints hint; | |
1291 XEvent xev; | |
1292 vo_fs = 0; | |
1293 vo_dwidth = width; | |
1294 vo_dheight = height; | |
1295 vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vis->visual, | |
1296 x, y, width, height, vis->depth, col_map); | |
1297 vo_x11_classhint(mDisplay, vo_window, classname); | |
1298 XStoreName(mDisplay, vo_window, title); | |
1299 vo_hidecursor(mDisplay, vo_window); | |
1300 XSelectInput(mDisplay, vo_window, StructureNotifyMask); | |
1301 hint.x = x; hint.y = y; | |
1302 hint.width = width; hint.height = height; | |
1303 hint.flags = PPosition | PSize; | |
1304 XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint); | |
1305 vo_x11_sizehint(x, y, width, height, 0); | |
1306 // map window | |
1307 XMapWindow(mDisplay, vo_window); | |
1308 XClearWindow(mDisplay, vo_window); | |
1309 // wait for map | |
1310 do { | |
1311 XNextEvent(mDisplay, &xev); | |
1312 } while (xev.type != MapNotify || xev.xmap.event != vo_window); | |
1313 XSelectInput(mDisplay, vo_window, NoEventMask); | |
1314 XSync(mDisplay, False); | |
1315 vo_x11_selectinput_witherr(mDisplay, vo_window, | |
1316 StructureNotifyMask | KeyPressMask | PointerMotionMask | | |
1317 ButtonPressMask | ButtonReleaseMask | ExposureMask); | |
1318 } | |
1319 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); | |
1320 vo_x11_nofs_sizepos(vo_dx, vo_dy, width, height); | |
1321 if (!!vo_fs != !!(flags & VOFLAG_FULLSCREEN)) | |
1322 vo_x11_fullscreen(); | |
1323 } | |
1268 | 1324 |
1269 void vo_x11_clearwindow_part(Display * mDisplay, Window vo_window, | 1325 void vo_x11_clearwindow_part(Display * mDisplay, Window vo_window, |
1270 int img_width, int img_height, int use_fs) | 1326 int img_width, int img_height, int use_fs) |
1271 { | 1327 { |
1272 int u_dheight, u_dwidth, left_ov, left_ov2; | 1328 int u_dheight, u_dwidth, left_ov, left_ov2; |