aboutsummaryrefslogtreecommitdiffstats
path: root/src/drw/drw.h
diff options
context:
space:
mode:
authorphilw <dscr@duck.com>2025-04-15 01:41:05 +0200
committerphilw <dscr@duck.com>2025-04-15 01:41:05 +0200
commit8146021a2ea4130cfb0d2bf846b451ec538b1bb6 (patch)
tree3a946ef5ee4769bf4eae89b4e77858cc67b8060b /src/drw/drw.h
parent515b7f3b4f048b29325e3e38f0f4a2ef898e8daa (diff)
downloaddwm-8146021a2ea4130cfb0d2bf846b451ec538b1bb6.tar.gz
dwm-8146021a2ea4130cfb0d2bf846b451ec538b1bb6.zip
Refactor the project
Refactored core logic to improve readability and maintainability. Documented the 'transient.c' file to provide clear explanations of its purpose and functions. Updated the 'util.c' file with necessary comments and improvements to existing code. Documented the 'util.h' header file to clarify function prototypes and usage. This update should improve the overall code quality and make it easier for future development. Signed-off-by: philw <dscr@duck.com>
Diffstat (limited to '')
-rw-r--r--src/drw/drw.h (renamed from drw.h)50
1 files changed, 28 insertions, 22 deletions
diff --git a/drw.h b/src/drw/drw.h
index 6471431..e645d43 100644
--- a/drw.h
+++ b/src/drw/drw.h
@@ -1,42 +1,45 @@
1/* See LICENSE file for copyright and license details. */ 1/* See LICENSE file for copyright and license details. */
2 2
3typedef struct { 3typedef struct {
4 Cursor cursor; 4 Cursor cursor;
5} Cur; 5} Cur;
6 6
7typedef struct Fnt { 7typedef struct Fnt {
8 Display *dpy; 8 Display *dpy;
9 unsigned int h; 9 unsigned int h;
10 XftFont *xfont; 10 XftFont *xfont;
11 FcPattern *pattern; 11 FcPattern *pattern;
12 struct Fnt *next; 12 struct Fnt *next;
13} Fnt; 13} Fnt;
14 14
15enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */ 15enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */
16typedef XftColor Clr; 16typedef XftColor Clr;
17 17
18typedef struct { 18typedef struct {
19 unsigned int w, h; 19 unsigned int w, h;
20 Display *dpy; 20 Display *dpy;
21 int screen; 21 int screen;
22 Window root; 22 Window root;
23 Drawable drawable; 23 Drawable drawable;
24 GC gc; 24 GC gc;
25 Clr *scheme; 25 Clr *scheme;
26 Fnt *fonts; 26 Fnt *fonts;
27} Drw; 27} Drw;
28 28
29/* Drawable abstraction */ 29/* Drawable abstraction */
30Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); 30Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w,
31 unsigned int h);
31void drw_resize(Drw *drw, unsigned int w, unsigned int h); 32void drw_resize(Drw *drw, unsigned int w, unsigned int h);
32void drw_free(Drw *drw); 33void drw_free(Drw *drw);
33 34
34/* Fnt abstraction */ 35/* Fnt abstraction */
35Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); 36Fnt *drw_fontset_create(Drw *drw, const char *fonts[], size_t fontcount);
36void drw_fontset_free(Fnt* set); 37void drw_fontset_free(Fnt *set);
37unsigned int drw_fontset_getwidth(Drw *drw, const char *text); 38unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
38unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n); 39unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text,
39void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); 40 unsigned int n);
41void drw_font_getexts(Fnt *font, const char *text, unsigned int len,
42 unsigned int *w, unsigned int *h);
40 43
41/* Colorscheme abstraction */ 44/* Colorscheme abstraction */
42void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); 45void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
@@ -51,8 +54,11 @@ void drw_setfontset(Drw *drw, Fnt *set);
51void drw_setscheme(Drw *drw, Clr *scm); 54void drw_setscheme(Drw *drw, Clr *scm);
52 55
53/* Drawing functions */ 56/* Drawing functions */
54void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); 57void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h,
55int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); 58 int filled, int invert);
59int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h,
60 unsigned int lpad, const char *text, int invert);
56 61
57/* Map functions */ 62/* Map functions */
58void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); 63void drw_map(Drw *drw, Window win, int x, int y, unsigned int w,
64 unsigned int h);