Add draw.h, basic draw function (text)
This commit is contained in:
parent
05aafde11a
commit
4fc5f0a9c2
34
wmfs2/src/draw.h
Executable file
34
wmfs2/src/draw.h
Executable file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* wmfs2 by Martin Duquesnoy <xorg62@gmail.com> { for(i = 2011; i < 2111; ++i) ©(i); }
|
||||
* For license, see COPYING.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DRAW_H
|
||||
#define DRAW_H
|
||||
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "wmfs.h"
|
||||
|
||||
#define TEXTY(w) ((W->font.height - W->font.de) + ((w - W->font.height) >> 1))
|
||||
|
||||
static inline void
|
||||
draw_text(Drawable d, int x, int y, Color fg, const char *str)
|
||||
{
|
||||
XSetForeground(W->dpy, W->gc, fg);
|
||||
XmbDrawString(W->dpy, d, W->font.fontset, W->gc, x, y, str, strlen(str));
|
||||
}
|
||||
|
||||
static inline unsigned short
|
||||
draw_textw(const char *str)
|
||||
{
|
||||
XRectangle r;
|
||||
|
||||
XmbTextExtents(W->font.fontset, str, strlen(str), NULL, &r);
|
||||
|
||||
return r.width;
|
||||
}
|
||||
|
||||
#endif /* DRAW_H */
|
||||
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "event.h"
|
||||
#include "ewmh.h"
|
||||
#include "util.h"
|
||||
#include "wmfs.h"
|
||||
#include "client.h"
|
||||
@ -149,7 +150,7 @@ event_propertynotify(XEvent *e)
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
if(ev->atom == XA_WM_NAME /* || ev->atom == _NET_WM_NAME */)
|
||||
if(ev->atom == XA_WM_NAME || ev->atom == W->net_atom[net_wm_name])
|
||||
client_get_name(c);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "wmfs.h"
|
||||
#include "draw.h"
|
||||
#include "infobar.h"
|
||||
#include "barwin.h"
|
||||
#include "util.h"
|
||||
@ -49,6 +50,8 @@ infobar_init(void)
|
||||
void
|
||||
infobar_refresh(Infobar *i)
|
||||
{
|
||||
draw_text(i->bar->dr, 1, TEXTY(INFOBAR_DEF_W), 0x005500, "WMFS2");
|
||||
|
||||
barwin_refresh(i->bar);
|
||||
}
|
||||
|
||||
|
||||
@ -73,9 +73,6 @@ screen_init(void)
|
||||
s = screen_new(&g, 0);
|
||||
tag_screen(s, tag_new(s, "tag"));
|
||||
}
|
||||
|
||||
SLIST_FOREACH(s, &W->h.screen, next)
|
||||
printf("%d: %d %d %d %d\n", s->id, s->geo.x, s->geo.y, s->geo.w, s->geo.h);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user