merge in Xinerama screen query; no functional change.

This commit is contained in:
okan 2013-01-02 18:11:23 +00:00
parent ce8ef02ed2
commit 6e5dda99a6

View File

@ -30,8 +30,6 @@
#include "calmwm.h" #include "calmwm.h"
static void screen_init_xinerama(struct screen_ctx *);
void void
screen_init(struct screen_ctx *sc, u_int which) screen_init(struct screen_ctx *sc, u_int which)
{ {
@ -124,25 +122,6 @@ screen_updatestackingorder(struct screen_ctx *sc)
XFree(wins); XFree(wins);
} }
/*
* If we're using RandR then we'll redo this whenever the screen
* changes since a CTRC may have been added or removed
*/
void
screen_init_xinerama(struct screen_ctx *sc)
{
XineramaScreenInfo *info = NULL;
int no = 0;
if (XineramaIsActive(X_Dpy))
info = XineramaQueryScreens(X_Dpy, &no);
if (sc->xinerama != NULL)
XFree(sc->xinerama);
sc->xinerama = info;
sc->xinerama_no = no;
}
/* /*
* Find which xinerama screen the coordinates (x,y) is on. * Find which xinerama screen the coordinates (x,y) is on.
*/ */
@ -175,6 +154,9 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y)
void void
screen_update_geometry(struct screen_ctx *sc) screen_update_geometry(struct screen_ctx *sc)
{ {
XineramaScreenInfo *info = NULL;
int info_no = 0;
sc->view.x = 0; sc->view.x = 0;
sc->view.y = 0; sc->view.y = 0;
sc->view.w = DisplayWidth(X_Dpy, sc->which); sc->view.w = DisplayWidth(X_Dpy, sc->which);
@ -185,7 +167,13 @@ screen_update_geometry(struct screen_ctx *sc)
sc->work.w = sc->view.w - (sc->gap.left + sc->gap.right); sc->work.w = sc->view.w - (sc->gap.left + sc->gap.right);
sc->work.h = sc->view.h - (sc->gap.top + sc->gap.bottom); sc->work.h = sc->view.h - (sc->gap.top + sc->gap.bottom);
screen_init_xinerama(sc); /* RandR event may have a CTRC added or removed. */
if (XineramaIsActive(X_Dpy))
info = XineramaQueryScreens(X_Dpy, &info_no);
if (sc->xinerama != NULL)
XFree(sc->xinerama);
sc->xinerama = info;
sc->xinerama_no = info_no;
xu_ewmh_net_desktop_geometry(sc); xu_ewmh_net_desktop_geometry(sc);
xu_ewmh_net_workarea(sc); xu_ewmh_net_workarea(sc);