From 9deafe68c85296370e809547949c7e66ee0694ef Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 6 Oct 2010 20:08:24 +0200 Subject: [PATCH] Font: Remove, oopango took over the job Signed-off-by: Uli Schlachter --- CMakeLists.txt | 1 - awesome.c | 3 -- awesomeConfig.cmake | 2 -- font.c | 78 --------------------------------------------- font.h | 37 --------------------- globalconf.h | 3 -- luaa.c | 33 +------------------ spawn.c | 2 +- 8 files changed, 2 insertions(+), 157 deletions(-) delete mode 100644 font.c delete mode 100644 font.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e5d87524..fe80df56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,6 @@ set(AWE_SRCS ${SOURCE_DIR}/draw.c ${SOURCE_DIR}/event.c ${SOURCE_DIR}/ewmh.c - ${SOURCE_DIR}/font.c ${SOURCE_DIR}/keygrabber.c ${SOURCE_DIR}/keyresolv.c ${SOURCE_DIR}/luaa.c diff --git a/awesome.c b/awesome.c index 35747f90..5695b8a1 100644 --- a/awesome.c +++ b/awesome.c @@ -483,9 +483,6 @@ main(int argc, char **argv) /* init screens information */ screen_scan(); - /* init default font */ - globalconf.font = font_new("sans 8"); - xutil_lock_mask_get(globalconf.connection, xmapping_cookie, globalconf.keysyms, &globalconf.numlockmask, &globalconf.shiftlockmask, &globalconf.capslockmask, diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 969a29d5..0bea2041 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -134,8 +134,6 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED glib-2.0 cairo x11 - pango>=1.19.3 - pangocairo>=1.19.3 oocairo oopango xcb-randr diff --git a/font.c b/font.c deleted file mode 100644 index 33608758..00000000 --- a/font.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * font.c - font functions - * - * Copyright © 2007-2009 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include -#include - -#include "font.h" -#include "screen.h" -#include "globalconf.h" -#include "common/xutil.h" - -/** Create a new Pango font. - * \param fontname Pango fontname (e.g. [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]). - * \return A new font. - */ -font_t * -font_new(const char *fontname) -{ - cairo_surface_t *surface; - cairo_t *cr; - PangoLayout *layout; - font_t *font = p_new(font_t, 1); - - /* Create a dummy cairo surface, cairo context and pango layout in - * order to get font informations */ - surface = cairo_xcb_surface_create(globalconf.connection, - globalconf.default_screen, - globalconf.visual, 1, 1); - - cr = cairo_create(surface); - layout = pango_cairo_create_layout(cr); - - /* Get the font description used to set text on a PangoLayout */ - font->desc = pango_font_description_from_string(fontname); - pango_layout_set_font_description(layout, font->desc); - - /* Get height */ - pango_layout_get_pixel_size(layout, NULL, &font->height); - - g_object_unref(layout); - cairo_destroy(cr); - cairo_surface_destroy(surface); - - return font; -} - -/** Delete a font. - * \param font Font to delete. - */ -void -font_delete(font_t **font) -{ - if(*font) - { - pango_font_description_free((*font)->desc); - p_delete(font); - } -} - -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/font.h b/font.h deleted file mode 100644 index 31e1559c..00000000 --- a/font.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * font.h - font functions header - * - * Copyright © 2009 Julien Danjou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef AWESOME_FONT_H -#define AWESOME_FONT_H - -#include - -typedef struct -{ - PangoFontDescription *desc; - int height; -} font_t; - -font_t *font_new(const char *); -void font_delete(font_t **); - -#endif -// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/globalconf.h b/globalconf.h index 0e7522c9..cd993f44 100644 --- a/globalconf.h +++ b/globalconf.h @@ -32,7 +32,6 @@ #include "objects/key.h" #include "color.h" -#include "font.h" #include "common/xembed.h" typedef struct drawin_t drawin_t; @@ -75,8 +74,6 @@ typedef struct client_array_t stack; /** Lua VM state */ lua_State *L; - /** Default font */ - font_t *font; /** The event loop */ struct ev_loop *loop; /** The key grabber function */ diff --git a/luaa.c b/luaa.c index 0a3d182a..75cd6a4a 100644 --- a/luaa.c +++ b/luaa.c @@ -390,15 +390,7 @@ luaA_awesome_index(lua_State *L) const char *buf = luaL_checkstring(L, 2); - if(a_strcmp(buf, "font") == 0) - { - char *font = pango_font_description_to_string(globalconf.font->desc); - lua_pushstring(L, font); - g_free(font); - } - else if(a_strcmp(buf, "font_height") == 0) - lua_pushnumber(L, globalconf.font->height); - else if(a_strcmp(buf, "conffile") == 0) + if(a_strcmp(buf, "conffile") == 0) lua_pushstring(L, conffile); else if(a_strcmp(buf, "version") == 0) lua_pushliteral(L, AWESOME_VERSION); @@ -410,28 +402,6 @@ luaA_awesome_index(lua_State *L) return 1; } -/** Newindex function for the awesome global table. - * \param L The Lua VM state. - * \return The number of elements pushed on stack. - */ -static int -luaA_awesome_newindex(lua_State *L) -{ - if(luaA_usemetatable(L, 1, 2)) - return 1; - - const char *buf = luaL_checkstring(L, 2); - - if(a_strcmp(buf, "font") == 0) - { - const char *newfont = luaL_checkstring(L, 3); - font_delete(&globalconf.font); - globalconf.font = font_new(newfont); - } - - return 0; -} - /** Add a global signal. * \param L The Lua VM state. * \return The number of elements pushed on stack. @@ -532,7 +502,6 @@ luaA_init(xdgHandle* xdg) { "emit_signal", luaA_awesome_emit_signal }, { "systray", luaA_systray }, { "__index", luaA_awesome_index }, - { "__newindex", luaA_awesome_newindex }, { NULL, NULL } }; diff --git a/spawn.c b/spawn.c index 8f6a1491..62be784a 100644 --- a/spawn.c +++ b/spawn.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include "spawn.h" #include "screen.h"