Some little fixes for bapt’s patch, use predict_text_width, support UTF8, pre-render workspace names

This commit is contained in:
Michael Stapelberg
2009-07-28 13:55:09 +02:00
parent ddcb11baba
commit e6198ad6c8
7 changed files with 115 additions and 46 deletions

View File

@ -165,9 +165,12 @@ struct Workspace {
/** Number of this workspace, starting from 0 */
int num;
/** Name of the workspave */
/** Name of the workspace (in UCS-2) */
char *name;
/** Length of the workspaces name (in glyphs) */
int name_len;
/** x, y, width, height */
Rect rect;

27
include/workspace.h Normal file
View File

@ -0,0 +1,27 @@
/*
* vim:ts=8:expandtab
*
* i3 - an improved dynamic tiling window manager
*
* © 2009 Michael Stapelberg and contributors
*
* See file LICENSE for license information.
*
*/
#include <xcb/xcb.h>
#include "data.h"
#ifndef _WORKSPACE_H
#define _WORKSPACE_H
/**
* Sets the name (or just its number) for the given workspace. This has to
* be called for every workspace as the rendering function
* (render_internal_bar) relies on workspace->name and workspace->name_len
* being ready-to-use.
*
*/
void workspace_set_name(Workspace *ws, const char *name);
#endif

View File

@ -157,7 +157,7 @@ void cached_pixmap_prepare(xcb_connection_t *conn, struct Cached_Pixmap *pixmap)
* real length (amount of glyphs) using the given font.
*
*/
int predict_text_width(xcb_connection_t *conn, char *font_pattern, char *text,
int predict_text_width(xcb_connection_t *conn, const char *font_pattern, char *text,
int length);
#endif