Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-bidi-restricted-20230512-e81f17d.diff - sites - public wiki contents of suc…
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-bidi-restricted-20230512-e81f17d.diff (3178B)
---
1 From f22071dcfa3cd01d4fee25ea6fe3441780a11387 Mon Sep 17 00:00:00 2001
2 From: mortezadadgar <[email protected]>
3 Date: Thu, 11 May 2023 16:24:49 +0330
4 Subject: [PATCH]: Added restricted version of support for RTL
5 languages
6
7 Only applied fribi where is needed the title
8 also improved the code quality based on suckless guidelines.
9 ---
10 config.mk | 8 ++++++--
11 dwm.c | 21 ++++++++++++++++++++-
12 2 files changed, 26 insertions(+), 3 deletions(-)
13
14 diff --git a/config.mk b/config.mk
15 index 681e059..1dd9bb5 100644
16 --- a/config.mk
17 +++ b/config.mk
18 @@ -10,6 +10,8 @@ MANPREFIX = ${PREFIX}/share/man
19 X11INC = /usr/X11R6/include
20 X11LIB = /usr/X11R6/lib
21
22 +BDINC = /usr/include/fribidi
23 +
24 # Xinerama, comment if you don't want it
25 XINERAMALIBS = -lXinerama
26 XINERAMAFLAGS = -DXINERAMA
27 @@ -21,9 +23,11 @@ FREETYPEINC = /usr/include/freetype2
28 #FREETYPEINC = ${X11INC}/freetype2
29 #MANPREFIX = ${PREFIX}/man
30
31 +BDLIBS = -lfribidi
32 +
33 # includes and libs
34 -INCS = -I${X11INC} -I${FREETYPEINC}
35 -LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
36 +INCS = -I${X11INC} -I${FREETYPEINC} -I$(BDINC)
37 +LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} $(BDLIBS)
38
39 # flags
40 CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSI…
41 diff --git a/dwm.c b/dwm.c
42 index 2f4cad9..5df8bdb 100644
43 --- a/dwm.c
44 +++ b/dwm.c
45 @@ -21,6 +21,7 @@
46 * To understand everything else, start reading main().
47 */
48 #include <errno.h>
49 +#include <fribidi.h>
50 #include <locale.h>
51 #include <signal.h>
52 #include <stdarg.h>
53 @@ -168,6 +169,7 @@ typedef struct {
54 } Rule;
55
56 /* function declarations */
57 +static void apply_fribidi(char *str);
58 static void applyrules(Client *c);
59 static int applysizehints(Client *c, int *x, int *y, int *w, int *h, in…
60 static void arrange(Monitor *m);
61 @@ -267,6 +269,7 @@ static void zoom(const Arg *arg);
62 /* variables */
63 static const char broken[] = "broken";
64 static char stext[256];
65 +static char fribidi_text[256];
66 static int screen;
67 static int sw, sh; /* X display screen geometry width, height…
68 static int bh; /* bar height */
69 @@ -312,6 +315,21 @@ struct Pertag {
70 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
71
72 /* function implementations */
73 +void
74 +apply_fribidi(char *str)
75 +{
76 + FriBidiStrIndex len = strlen(str);
77 + FriBidiChar logical[256];
78 + FriBidiChar visual[256];
79 + FriBidiParType base = FRIBIDI_PAR_ON;
80 + FriBidiCharSet charset;
81 +
82 + charset = fribidi_parse_charset("UTF-8");
83 + len = fribidi_charset_to_unicode(charset, str, len, logical);
84 + fribidi_log2vis(logical, len, &base, visual, NULL, NULL, NULL);
85 + fribidi_unicode_to_charset(charset, visual, len, fribidi_text);
86 +}
87 +
88 void
89 applyrules(Client *c)
90 {
91 @@ -808,7 +826,8 @@ drawbar(Monitor *m)
92 if ((w = m->ww - tw - x) > bh) {
93 if (m->sel) {
94 drw_setscheme(drw, scheme[m == selmon ? SchemeS…
95 - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->n…
96 + apply_fribidi(m->sel->name);
97 + drw_text(drw, x, 0, w, bh, lrpad / 2, fribidi_t…
98 if (m->sel->isfloating)
99 drw_rect(drw, x + boxs, boxs, boxw, box…
100 } else {
101 --
102 2.39.3
103
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.