mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding bidi patch ref. #285
This commit is contained in:
parent
2e496ed931
commit
4b20c92b4c
@ -19,6 +19,7 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
2022-08-02 - Added the bidi patch
|
||||||
|
|
||||||
2022-07-05 - Added the tagpreview patch
|
2022-07-05 - Added the tagpreview patch
|
||||||
|
|
||||||
@ -287,6 +288,9 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
|
|||||||
- [bartabgroups](https://dwm.suckless.org/patches/bartabgroups/)
|
- [bartabgroups](https://dwm.suckless.org/patches/bartabgroups/)
|
||||||
- turns the titlebar area into a mfact-respecting tab-bar showing each client's title
|
- turns the titlebar area into a mfact-respecting tab-bar showing each client's title
|
||||||
|
|
||||||
|
- [bidi](https://dwm.suckless.org/patches/bidi/)
|
||||||
|
- adds proper support for Right-To-Left (RTL) languages (such as Farsi, Arabic or Hebrew)
|
||||||
|
|
||||||
- [center](https://dwm.suckless.org/patches/center/)
|
- [center](https://dwm.suckless.org/patches/center/)
|
||||||
- adds an iscentered rule to automatically center clients on the current monitor
|
- adds an iscentered rule to automatically center clients on the current monitor
|
||||||
|
|
||||||
|
@ -51,9 +51,13 @@ FREETYPEINC = /usr/include/freetype2
|
|||||||
# This is needed for the winicon and tagpreview patches / BAR_WINICON_PATCH / BAR_TAGPREVIEW_PATCH
|
# This is needed for the winicon and tagpreview patches / BAR_WINICON_PATCH / BAR_TAGPREVIEW_PATCH
|
||||||
#IMLIB2LIBS = -lImlib2
|
#IMLIB2LIBS = -lImlib2
|
||||||
|
|
||||||
|
# Uncomment for the bidi patch
|
||||||
|
#BDINC = -I/usr/include/fribidi
|
||||||
|
#BDLIBS = -lfribidi
|
||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I${X11INC} -I${FREETYPEINC} ${YAJLINC} ${PANGOINC}
|
INCS = -I${X11INC} -I${FREETYPEINC} ${YAJLINC} ${PANGOINC} ${BDINC}
|
||||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XRENDER} ${MPDCLIENT} ${XEXTLIB} ${XCBLIBS} ${KVMLIB} ${PANGOLIB} ${YAJLLIBS} ${IMLIB2LIBS}
|
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XRENDER} ${MPDCLIENT} ${XEXTLIB} ${XCBLIBS} ${KVMLIB} ${PANGOLIB} ${YAJLLIBS} ${IMLIB2LIBS} $(BDLIBS)
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||||
|
46
drw.c
46
drw.c
@ -9,6 +9,30 @@
|
|||||||
#include "drw.h"
|
#include "drw.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#if BIDI_PATCH
|
||||||
|
#include <fribidi.h>
|
||||||
|
|
||||||
|
static char fribidi_text[BUFSIZ] = "";
|
||||||
|
|
||||||
|
static void
|
||||||
|
apply_fribidi(const char *str)
|
||||||
|
{
|
||||||
|
FriBidiStrIndex len = strlen(str);
|
||||||
|
FriBidiChar logical[BUFSIZ];
|
||||||
|
FriBidiChar visual[BUFSIZ];
|
||||||
|
FriBidiParType base = FRIBIDI_PAR_ON;
|
||||||
|
FriBidiCharSet charset;
|
||||||
|
|
||||||
|
fribidi_text[0] = 0;
|
||||||
|
if (len > 0) {
|
||||||
|
charset = fribidi_parse_charset("UTF-8");
|
||||||
|
len = fribidi_charset_to_unicode(charset, str, len, logical);
|
||||||
|
fribidi_log2vis(logical, len, &base, visual, NULL, NULL, NULL);
|
||||||
|
len = fribidi_unicode_to_charset(charset, visual, len, fribidi_text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !BAR_PANGO_PATCH
|
#if !BAR_PANGO_PATCH
|
||||||
#define UTF_INVALID 0xFFFD
|
#define UTF_INVALID 0xFFFD
|
||||||
#define UTF_SIZ 4
|
#define UTF_SIZ 4
|
||||||
@ -394,10 +418,15 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
|
|||||||
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
|
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BAR_PANGO_PATCH
|
#if BIDI_PATCH
|
||||||
|
int
|
||||||
|
_drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
|
||||||
|
#else
|
||||||
int
|
int
|
||||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
|
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
|
||||||
|
#endif // BIDI_PATCH
|
||||||
{
|
{
|
||||||
|
#if BAR_PANGO_PATCH
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int ty;
|
int ty;
|
||||||
unsigned int ew;
|
unsigned int ew;
|
||||||
@ -458,11 +487,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||||||
XftDrawDestroy(d);
|
XftDrawDestroy(d);
|
||||||
|
|
||||||
return x + (render ? w : 0);
|
return x + (render ? w : 0);
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
int
|
|
||||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool ignored)
|
|
||||||
{
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int ty;
|
int ty;
|
||||||
unsigned int ew;
|
unsigned int ew;
|
||||||
@ -593,8 +618,17 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||||||
XftDrawDestroy(d);
|
XftDrawDestroy(d);
|
||||||
|
|
||||||
return x + (render ? w : 0);
|
return x + (render ? w : 0);
|
||||||
}
|
|
||||||
#endif // BAR_PANGO_PATCH
|
#endif // BAR_PANGO_PATCH
|
||||||
|
}
|
||||||
|
|
||||||
|
#if BIDI_PATCH
|
||||||
|
int
|
||||||
|
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
|
||||||
|
{
|
||||||
|
apply_fribidi(text);
|
||||||
|
return _drw_text(drw, x, y, w, h, lpad, fribidi_text, invert, markup);
|
||||||
|
}
|
||||||
|
#endif // BIDI_PATCH
|
||||||
|
|
||||||
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
|
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
|
||||||
void
|
void
|
||||||
|
@ -490,6 +490,18 @@
|
|||||||
*/
|
*/
|
||||||
#define AUTORESIZE_PATCH 0
|
#define AUTORESIZE_PATCH 0
|
||||||
|
|
||||||
|
/* This patch adds proper support for Right-To-Left languages. (such as Farsi, Arabic or Hebrew).
|
||||||
|
*
|
||||||
|
* You need to uncomment the corresponding lines in config.mk to use the -lfribidi library
|
||||||
|
* when including this patch.
|
||||||
|
*
|
||||||
|
* This patch depends on the following additional library:
|
||||||
|
* - fribidi
|
||||||
|
*
|
||||||
|
* https://dwm.suckless.org/patches/bidi/
|
||||||
|
*/
|
||||||
|
#define BIDI_PATCH 0
|
||||||
|
|
||||||
/* This patch adds an iscentered rule to automatically center clients on the current monitor.
|
/* This patch adds an iscentered rule to automatically center clients on the current monitor.
|
||||||
* This patch takes precedence over centeredwindowname, alwayscenter and fancybar patches.
|
* This patch takes precedence over centeredwindowname, alwayscenter and fancybar patches.
|
||||||
* https://dwm.suckless.org/patches/center/
|
* https://dwm.suckless.org/patches/center/
|
||||||
|
Loading…
Reference in New Issue
Block a user