Improve DRM function "drw_create"

This commit is contained in:
Alex Kotov 2021-12-04 22:01:58 +05:00
parent 5a70ec3d1e
commit 7d6ca8f856
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 7 additions and 8 deletions

View file

@ -63,16 +63,16 @@ utf8decode(const char *c, long *u, size_t clen)
}
Drw *
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
drw_create(Display *dpy, int screen, Window root, const struct Sizes sizes)
{
Drw *drw = ecalloc(1, sizeof(Drw));
drw->dpy = dpy;
drw->screen = screen;
drw->root = root;
drw->w = w;
drw->h = h;
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
drw->w = sizes.w;
drw->h = sizes.h;
drw->drawable = XCreatePixmap(dpy, root, sizes.w, sizes.h, DefaultDepth(dpy, screen));
drw->gc = XCreateGC(dpy, root, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);

View file

@ -1,4 +1,4 @@
/* See LICENSE file for copyright and license details. */
#include "state.h"
typedef struct {
Cursor cursor;
@ -27,7 +27,7 @@ typedef struct {
} Drw;
/* Drawable abstraction */
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
Drw *drw_create(Display *dpy, int screen, Window win, struct Sizes sizes);
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);

View file

@ -283,8 +283,7 @@ int dwm_main(const char *const new_program_title)
xbase->x_display,
xbase->x_screen,
xbase->x_root,
xbase->screen_sizes.w,
xbase->screen_sizes.h
xbase->screen_sizes
);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))