From a5c5711a5b97f23fdadc0e00875c7757be6ae622 Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 29 Nov 2012 03:54:46 +0000 Subject: x_setupscreen -> screen_init; no functional change. --- screen.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'screen.c') diff --git a/screen.c b/screen.c index 85bcb13..bc37105 100644 --- a/screen.c +++ b/screen.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: screen.c,v 1.37 2012/11/09 03:52:02 okan Exp $ + * $OpenBSD: screen.c,v 1.38 2012/11/29 03:54:46 okan Exp $ */ #include @@ -32,6 +32,60 @@ static void screen_init_xinerama(struct screen_ctx *); +void +screen_init(struct screen_ctx *sc, u_int which) +{ + Window *wins, w0, w1; + XWindowAttributes winattr; + XSetWindowAttributes rootattr; + u_int nwins, i; + + sc->which = which; + sc->rootwin = RootWindow(X_Dpy, sc->which); + + xu_ewmh_net_supported(sc); + xu_ewmh_net_supported_wm_check(sc); + + conf_gap(&Conf, sc); + + screen_update_geometry(sc); + + conf_color(&Conf, sc); + + group_init(sc); + conf_font(&Conf, sc); + + TAILQ_INIT(&sc->mruq); + + menu_init(sc); + + rootattr.cursor = Cursor_normal; + rootattr.event_mask = CHILDMASK|PropertyChangeMask|EnterWindowMask| + LeaveWindowMask|ColormapChangeMask|BUTTONMASK; + + XChangeWindowAttributes(X_Dpy, sc->rootwin, + CWEventMask|CWCursor, &rootattr); + + /* Deal with existing clients. */ + XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins); + + for (i = 0; i < nwins; i++) { + XGetWindowAttributes(X_Dpy, wins[i], &winattr); + if (winattr.override_redirect || + winattr.map_state != IsViewable) + continue; + (void)client_new(wins[i], sc, winattr.map_state != IsUnmapped); + } + XFree(wins); + + screen_updatestackingorder(sc); + + if (HasRandr) + XRRSelectInput(X_Dpy, sc->rootwin, RRScreenChangeNotifyMask); + + XSync(X_Dpy, False); +} + struct screen_ctx * screen_fromroot(Window rootwin) { -- cgit v1.2.3-2-gb3c3