...
 
Commits (3)
......@@ -95,6 +95,39 @@ wsmbox_create(struct workspace *ws, struct wsmap *wsm)
return wb;
}
struct wsmbox *
wsmbox_create_ng(void)
{
struct config const *config = config_get();
struct wsmbox *box;
XSetWindowAttributes wa;
int unsigned w, h, bw;
box = malloc(sizeof(struct wsmbox));
if (!box)
die("Could not allocate %zu bytes for workspace map box structure: %s",
sizeof(struct wsmbox), strerror(errno));
box->workspace = NULL;
box->pos = (struct position) { 0, 0 };
box->type = WSMBOX_UNFOCUSED;
w = config->wsmbox.size.width;
h = config->wsmbox.size.height;
bw = config->wsmbox.border.width;
/* X window */
box->pixmap = XCreatePixmap(x11.dpy, x11.root, w, h, x11.sd);
box->window = XCreateWindow(x11.dpy, x11.root, 0, 0, w, h, bw,
(int signed) x11.sd, CopyFromParent,
DefaultVisual(x11.dpy, x11.screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask,
&wa);
update(box);
return box;
}
void
wsmbox_destroy(struct wsmbox *wb)
{
......@@ -146,13 +179,22 @@ wsmbox_set_type(struct wsmbox *wb, enum wsmbox_type type)
update(wb);
}
void
wsmbox_set_workspace(struct wsmbox *wb, struct workspace *ws)
{
wb->workspace = ws;
update(wb);
}
void
wsmbox_show(struct wsmbox *wb, bool show)
{
if (show)
if (show) {
wsmbox_render(wb);
XMapRaised(x11.dpy, wb->window);
else
} else {
XUnmapWindow(x11.dpy, wb->window);
}
}
void
......
......@@ -19,12 +19,14 @@ struct wsmbox {
#include <stdbool.h>
struct wsmbox *wsmbox_create(struct workspace *ws, struct wsmap *map);
struct wsmbox *wsmbox_create_ng(void);
void wsmbox_destroy(struct wsmbox *wb);
bool wsmbox_manages_workspace(struct wsmbox *wb, struct workspace *ws);
void wsmbox_move(struct wsmbox *wb, struct position pos);
void wsmbox_render(struct wsmbox *wb);
void wsmbox_set_position(struct wsmbox *wb, struct position pos);
void wsmbox_set_type(struct wsmbox *wb, enum wsmbox_type type);
void wsmbox_set_workspace(struct wsmbox *wb, struct workspace *ws);
void wsmbox_show(struct wsmbox *wb, bool show);
void wsmbox_update(struct wsmbox *wb, struct wsmap *map);
......