all repos — fluxbox @ babce4da5ece32f9d9d9c160761391e4b31d556b

custom fork of the fluxbox windowmanager

see misc.cc log
fluxgen fluxgen
commit

babce4da5ece32f9d9d9c160761391e4b31d556b

parent

c5fdccd430ec5f5624c51e173e45e332401deec8

1 files changed, 57 insertions(+), 16 deletions(-)

jump to
M src/misc.hhsrc/misc.hh

@@ -19,42 +19,83 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. +#ifndef _MISC_HH_ +#define _MISC_HH_ + #ifdef HAVE_CONFIG_H # include "config.h" #endif //HAVE_CONFIG_H #include <X11/Xlib.h> -#include "Theme.hh" -#ifndef _MISC_HH_ -#define _MISC_HH_ +class Misc +{ +public: + typedef struct FFont + { + enum FontJustify {LEFT=0, RIGHT, CENTER}; + + XFontSet set; + XFontSetExtents *set_extents; + XFontStruct *fontstruct; + FontJustify justify; + } Font; + +static char *strdup(const char *); -// ---- start code stealing ----- +static void DrawString(Display *display, Window w, GC gc, Misc::Font *font, + unsigned int text_w, unsigned int size_w, + unsigned int bevel_w, char *text); // ---------------------------------------------------------------------- // xvertext, Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma) // ---------------------------------------------------------------------- -#define XV_NOFONT 1 // no such font on X server -#define XV_NOMEM 2 // couldn't do malloc -#define XV_NOXIMAGE 3 // couldn't create an XImage + /* *** The font structures *** */ + + struct BitmapStruct { + int bit_w; + int bit_h; + + Pixmap bm; + }; + + struct XRotCharStruct { + int ascent; + int descent; + int lbearing; + int rbearing; + int width; -unsigned int XRotTextWidth(XRotFontStruct *rotfont, char *str, int len); -void XRotDrawString(Display *dpy, XRotFontStruct *rotfont, Drawable drawable, - GC gc, int x, int y, char *str, int len); + BitmapStruct glyph; + }; -//int xv_errno; //TODO: ? + struct XRotFontStruct { + int dir; + int height; + int max_ascent; + int max_descent; + int max_char; + int min_char; + char *name; -// --- stop code stealing --- + XFontStruct *xfontstruct; -void DrawString(Display *display, Window w, GC gc, FFont *font, - unsigned int text_w, unsigned int size_w, - unsigned int bevel_w, char *text); + Misc::XRotCharStruct per_char[95]; + }; +static unsigned int XRotTextWidth(Misc::XRotFontStruct *rotfont, char *str, int len); +static void XRotDrawString(Display *dpy, Misc::XRotFontStruct *rotfont, Drawable drawable, + GC gc, int x, int y, char *str, int len); -void DrawRotString(Display *display, Window w, GC gc, XRotFontStruct *font, +static void DrawRotString(Display *display, Window w, GC gc, Misc::XRotFontStruct *font, unsigned int align, unsigned int text_w, unsigned int size_w, unsigned int size_h, unsigned int bevel_w, char *text); + +static Misc::XRotFontStruct *Misc::XRotLoadFont(Display *dpy, char *fontname, float angle); +static void Misc::XRotUnloadFont(Display *dpy, Misc::XRotFontStruct *rotfont); + +}; #endif //_MISC_HH_