summaryrefslogtreecommitdiffstats
path: root/libvo/x11_common.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-06-27 10:26:13 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-06-27 10:26:13 +0000
commitf131aafff160e816a3c5904d664561ffe9f32058 (patch)
tree31eb8b5970484238c36a7ca3d2cad288785879a3 /libvo/x11_common.c
parentb4be37acaf5d725d0c81508907fef9733acab444 (diff)
downloadmpv-f131aafff160e816a3c5904d664561ffe9f32058.tar.bz2
mpv-f131aafff160e816a3c5904d664561ffe9f32058.tar.xz
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23675 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/x11_common.c')
-rw-r--r--libvo/x11_common.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index a7ddc9da18..c316c7af3f 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -1265,6 +1265,62 @@ Window vo_x11_create_smooth_window(Display * mDisplay, Window mRoot,
return ret_win;
}
+/**
+ * \brief create and setup a window suitable for display
+ * \param vis Visual to use for creating the window
+ * \param x x position of window
+ * \param y y position of window
+ * \param width width of window
+ * \param height height of window
+ * \param flags flags for window creation.
+ * Only VOFLAG_FULLSCREEN is supported so far.
+ * \param col_map Colourmap for window
+ * \param classname name to use for the classhint
+ * \param title title for the window
+ *
+ * This also does the grunt-work like setting Window Manager hints etc.
+ * If vo_window is already set it just moves and resizes it.
+ */
+void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y,
+ unsigned int width, unsigned int height, int flags,
+ Colormap col_map,
+ const char *classname, const char *title)
+{
+ if (vo_window == None) {
+ XSizeHints hint;
+ XEvent xev;
+ vo_fs = 0;
+ vo_dwidth = width;
+ vo_dheight = height;
+ vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vis->visual,
+ x, y, width, height, vis->depth, col_map);
+ vo_x11_classhint(mDisplay, vo_window, classname);
+ XStoreName(mDisplay, vo_window, title);
+ vo_hidecursor(mDisplay, vo_window);
+ XSelectInput(mDisplay, vo_window, StructureNotifyMask);
+ hint.x = x; hint.y = y;
+ hint.width = width; hint.height = height;
+ hint.flags = PPosition | PSize;
+ XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint);
+ vo_x11_sizehint(x, y, width, height, 0);
+ // map window
+ XMapWindow(mDisplay, vo_window);
+ XClearWindow(mDisplay, vo_window);
+ // wait for map
+ do {
+ XNextEvent(mDisplay, &xev);
+ } while (xev.type != MapNotify || xev.xmap.event != vo_window);
+ XSelectInput(mDisplay, vo_window, NoEventMask);
+ XSync(mDisplay, False);
+ vo_x11_selectinput_witherr(mDisplay, vo_window,
+ StructureNotifyMask | KeyPressMask | PointerMotionMask |
+ ButtonPressMask | ButtonReleaseMask | ExposureMask);
+ }
+ if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+ vo_x11_nofs_sizepos(vo_dx, vo_dy, width, height);
+ if (!!vo_fs != !!(flags & VOFLAG_FULLSCREEN))
+ vo_x11_fullscreen();
+}
void vo_x11_clearwindow_part(Display * mDisplay, Window vo_window,
int img_width, int img_height, int use_fs)