diff options
Diffstat (limited to 'xine_sxfe_frontend.c')
-rw-r--r-- | xine_sxfe_frontend.c | 70 |
1 files changed, 59 insertions, 11 deletions
diff --git a/xine_sxfe_frontend.c b/xine_sxfe_frontend.c index d6b17cfb..085cedd6 100644 --- a/xine_sxfe_frontend.c +++ b/xine_sxfe_frontend.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_sxfe_frontend.c,v 1.42 2008-05-21 20:06:45 phintuka Exp $ + * $Id: xine_sxfe_frontend.c,v 1.43 2008-06-03 14:24:36 phintuka Exp $ * */ @@ -44,6 +44,9 @@ #ifdef HAVE_XV_FIELD_ORDER # include <X11/extensions/Xvlib.h> #endif +#ifdef HAVE_XINERAMA +# include <X11/extensions/Xinerama.h> +#endif #ifdef boolean # define HAVE_BOOLEAN @@ -128,6 +131,8 @@ typedef struct sxfe_s { #ifdef HAVE_XDPMS BOOL dpms_state; #endif + int xinerama_screen; + int xinerama_x, xinerama_y; /* Atoms */ Atom atom_wm_delete_window; @@ -430,6 +435,49 @@ static void set_cursor(Display *dpy, Window win, const int enable) } } +static void update_xinerama_info(sxfe_t *this) +{ + int screen = this->xinerama_screen; + this->xinerama_x = this->xinerama_y = 0; +#ifdef HAVE_XINERAMA + if(screen >= -1 && XineramaIsActive(this->display)) { + XineramaScreenInfo *screens; + int num_screens; + + screens = XineramaQueryScreens(this->display, &num_screens); + if(screen >= num_screens) + screen = num_screens - 1; + if(screen == -1) { + const int x = this->origxpos + this->origwidth / 2; + const int y = this->origypos + this->origheight / 2; + for(screen = num_screens - 1; screen > 0; screen--) { + const int x0 = screens[screen].x_org; + const int y0 = screens[screen].y_org; + const int x1 = x0 + screens[screen].width; + const int y1 = y0 + screens[screen].height; + if(x0 <= x && x <= x1 && y0 <= y && y <= y1) + break; + } + } + if (screen < 0) + screen = 0; + this->xinerama_x = screens[screen].x_org; + this->xinerama_y = screens[screen].y_org; + this->width = screens[screen].width; + this->height = screens[screen].height; + + XFree(screens); + } +#endif +} + +static void update_screen_size(sxfe_t *this) +{ + this->width = DisplayWidth(this->display, this->screen); + this->height = DisplayHeight(this->display, this->screen); + update_xinerama_info(this); +} + #ifdef HAVE_XRENDER Xrender_Surf * xrender_surf_new(Display *dpy, Drawable draw, Visual *vis, int w, int h, int alpha) { @@ -852,6 +900,7 @@ static int sxfe_display_open(frontend_t *this_gen, int width, int height, int fu this->overscan = 0; this->fullscreen_state_forced = 0; strn0cpy(this->modeline, modeline ? : "", sizeof(this->modeline)); + this->xinerama_screen = -1; /* * init x11 stuff @@ -903,10 +952,8 @@ static int sxfe_display_open(frontend_t *this_gen, int width, int height, int fu this->completion_event = -1; } - if(fullscreen) { - this->width = DisplayWidth(this->display, this->screen); - this->height = DisplayHeight(this->display, this->screen); - } + if(fullscreen) + update_screen_size(this); if(this->window_id > 0) { LOGMSG("sxfe_diaplay_open(): Using X11 window %d for output", this->window_id); @@ -920,8 +967,9 @@ static int sxfe_display_open(frontend_t *this_gen, int width, int height, int fu this->width, this->height, 1, 0, 0); this->window[1] = XCreateSimpleWindow(this->display, XDefaultRootWindow(this->display), - 0, 0, (DisplayWidth(this->display, this->screen)), - (DisplayHeight(this->display, this->screen)), 0, 0, 0); + this->xinerama_x, this->xinerama_y, + this->width, this->height, + 0, 0, 0); } hint.flags = USSize | USPosition | PPosition | PSize; @@ -1072,10 +1120,8 @@ static int sxfe_display_config(frontend_t *this_gen, (void*) this->window[0]); } - if(fullscreen) { - this->width = DisplayWidth(this->display, this->screen); - this->height = DisplayHeight(this->display, this->screen); - } + if(fullscreen) + update_screen_size(this); if(fullscreen != this->fullscreen) { Window tmp_win; @@ -1096,6 +1142,8 @@ static int sxfe_display_config(frontend_t *this_gen, set_above(this, this->stay_above); } else { set_fullscreen_props(this); + XResizeWindow(this->display, this->window[1], this->width, this->height); + XMoveWindow(this->display, this->window[1], this->xinerama_x, this->xinerama_y); } XSync(this->display, False); XTranslateCoordinates(this->display, this->window[this->fullscreen ? 1 : 0], |