mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-20 03:51:18 +00:00
Add creation functions for certain cairo structures.
This commit is contained in:
parent
4652e834b1
commit
8bd41caa51
13
doc/docs.xml
13
doc/docs.xml
@ -208,10 +208,10 @@
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Lua API</title>
|
||||
<para>Conky features a Lua Programming API, and also ships with
|
||||
some Lua bindings for some useful libraries. Conky defines
|
||||
certain global functions and variables which can be accessed
|
||||
from Lua code running in Conky.
|
||||
<para>Conky features a Lua Programming API, and also ships with Lua
|
||||
bindings for some useful libraries. Conky defines certain global
|
||||
functions and variables which can be accessed from Lua code running
|
||||
in Conky.
|
||||
</para>
|
||||
<para>To use Lua Conky, you first need to make sure you have a version of Conky
|
||||
with Lua support enabled (``conky -v'' will report this). Scripts
|
||||
@ -228,6 +228,11 @@
|
||||
At this time, the Lua API should not be considered stable and may
|
||||
change drastically from one release to another as it matures.
|
||||
</para>
|
||||
<para>
|
||||
NOTE: In order to accommodate certain features in the cairo
|
||||
library's API, Conky will export a few additional functions for the
|
||||
creation of certain structures. These are documented below.
|
||||
</para>
|
||||
&lua;
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
|
39
doc/lua.xml
39
doc/lua.xml
@ -186,4 +186,43 @@
|
||||
configuration file.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>
|
||||
<option>cairo_text_extents_t:create()</option>
|
||||
</command>
|
||||
<option>function</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Call this function to return a new cairo_text_extents_t structure. A creation function for this structure is not provided by the cairo API. After calling this, you should use tolua.takeownership() on the return value to ensure ownership is passed properly.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>
|
||||
<option>cairo_font_extents_t:create()</option>
|
||||
</command>
|
||||
<option>function</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Call this function to return a new cairo_font_extents_t structure. A creation function for this structure is not provided by the cairo API. After calling this, you should use tolua.takeownership() on the return value to ensure ownership is passed properly.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>
|
||||
<option>cairo_matrix_t:create()</option>
|
||||
</command>
|
||||
<option>function</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Call this function to return a new cairo_matrix_t structure. A creation function for this structure is not provided by the cairo API. After calling this, you should use tolua.takeownership() on the return value to ensure ownership is passed properly.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
@ -20,37 +20,44 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
libcairo_la_SOURCES = libcairo.c
|
||||
libimlib2_la_SOURCES = libimlib2.c
|
||||
|
||||
if BUILD_LUA
|
||||
|
||||
if BUILD_LUA_CAIRO
|
||||
|
||||
libcairo = libcairo.la
|
||||
libcairo_built_sources = libcairo.c
|
||||
|
||||
libcairo_la_CFLAGS = $(cairo_CFLAGS) $(cairo_xlib_CFLAGS) $(tolua_CFLAGS)
|
||||
libcairo_la_LIBADD = $(cairo_LIBS) $(cairo_xlib_LIBS) $(tolua_LIBS)
|
||||
libcairo = libcairo.la
|
||||
|
||||
libcairo.c: cairo.pkg
|
||||
${toluapp} -n cairo -o $@ $(srcdir)/cairo.pkg
|
||||
|
||||
libcairo_la_CFLAGS = $(cairo_CFLAGS) $(cairo_xlib_CFLAGS) $(tolua_CFLAGS)
|
||||
libcairo_la_LIBADD = $(cairo_LIBS) $(cairo_xlib_LIBS) $(tolua_LIBS)
|
||||
libcairo_la_SOURCES = cairo.pkg libcairo-helper.h libcairo.c
|
||||
|
||||
endif # BUILD_LUA_CAIRO
|
||||
|
||||
if BUILD_LUA_IMLIB2
|
||||
|
||||
libimlib2 = libimlib2.la
|
||||
libimlib2_built_sources = libimlib2.c
|
||||
|
||||
libimlib2_la_CFLAGS = $(Imlib2_CFLAGS) $(tolua_CFLAGS)
|
||||
libimlib2_la_LIBADD = $(Imlib2_LIBS) $(tolua_LIBS)
|
||||
libimlib2 = libimlib2.la
|
||||
|
||||
libimlib2.c: imlib2.pkg
|
||||
${toluapp} -n imlib2 -o $@ $(srcdir)/imlib2.pkg
|
||||
|
||||
libimlib2_la_CFLAGS = $(Imlib2_CFLAGS) $(tolua_CFLAGS)
|
||||
libimlib2_la_LIBADD = $(Imlib2_LIBS) $(tolua_LIBS)
|
||||
libimlib2_la_SOURCES = imlib2.pkg libimlib2.c
|
||||
|
||||
endif # BUILD_LUA_IMLIB2
|
||||
|
||||
pkglib_LTLIBRARIES = $(libcairo) $(libimlib2)
|
||||
|
||||
endif # BUILD_LUA
|
||||
|
||||
EXTRA_DIST = libcairo-helper.h
|
||||
BUILT_SOURCES = $(cairo_built_sources) $(imlib2_built_sources)
|
||||
|
||||
# vi:set ts=4 sw=4 noet ai nocindent syntax=automake:
|
||||
|
@ -3,6 +3,7 @@ $#include <cairo-deprecated.h>
|
||||
$#include <cairo.h>
|
||||
$#include <cairo-xlib.h>
|
||||
$#include <X11/Xlib.h>
|
||||
$#include "libcairo-helper.h"
|
||||
/*
|
||||
* This code was mostly copied from cairo.h and cairo-xlib.h with comments
|
||||
* removed. The licence noticed below is present for the sake of clarity.
|
||||
@ -59,6 +60,7 @@ typedef struct _cairo_matrix {
|
||||
double yy;
|
||||
double x0;
|
||||
double y0;
|
||||
static tolua_outside cairo_matrix_t* create_cairo_matrix_t @ create();
|
||||
} cairo_matrix_t;
|
||||
typedef int cairo_bool_t;
|
||||
|
||||
@ -375,6 +377,7 @@ typedef struct {
|
||||
double height;
|
||||
double x_advance;
|
||||
double y_advance;
|
||||
static tolua_outside cairo_text_extents_t* create_cairo_text_extents_t @ create();
|
||||
} cairo_text_extents_t;
|
||||
|
||||
typedef struct {
|
||||
@ -383,6 +386,7 @@ typedef struct {
|
||||
double height;
|
||||
double max_x_advance;
|
||||
double max_y_advance;
|
||||
static tolua_outside cairo_font_extents_t* create_cairo_font_extents_t @ create();
|
||||
} cairo_font_extents_t;
|
||||
|
||||
typedef enum _cairo_font_slant {
|
||||
|
42
lua/libcairo-helper.h
Normal file
42
lua/libcairo-helper.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
||||
*
|
||||
* Conky, a system monitor, based on torsmo
|
||||
*
|
||||
* Please see COPYING for details
|
||||
*
|
||||
* Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
|
||||
* (see AUTHORS)
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LIBCAIRO_HELPER_H_
|
||||
#define _LIBCAIRO_HELPER_H_
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
cairo_text_extents_t *create_cairo_text_extents_t(void) {
|
||||
return calloc(1, sizeof(cairo_text_extents_t));
|
||||
}
|
||||
|
||||
cairo_font_extents_t *create_cairo_font_extents_t(void) {
|
||||
return calloc(1, sizeof(cairo_font_extents_t));
|
||||
}
|
||||
|
||||
cairo_matrix_t *create_cairo_matrix_t(void) {
|
||||
return calloc(1, sizeof(cairo_matrix_t));
|
||||
}
|
||||
|
||||
#endif /* _LIBCAIRO_HELPER_H_ */
|
Loading…
Reference in New Issue
Block a user