xcolor: Rename to color
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
2c52bc7001
commit
0e819f2328
14
color.c
14
color.c
|
@ -78,15 +78,15 @@ color_parse(const char *colstr, ssize_t len,
|
||||||
/** Send a request to initialize a X color.
|
/** Send a request to initialize a X color.
|
||||||
* If you are only interested in the rgba values and don't need the color's
|
* If you are only interested in the rgba values and don't need the color's
|
||||||
* pixel value, you should use color_init_unchecked() instead.
|
* pixel value, you should use color_init_unchecked() instead.
|
||||||
* \param color xcolor_t struct to store color into.
|
* \param color color_t struct to store color into.
|
||||||
* \param colstr Color specification.
|
* \param colstr Color specification.
|
||||||
* \param len The length of colstr (which still MUST be NULL terminated).
|
* \param len The length of colstr (which still MUST be NULL terminated).
|
||||||
* \return request informations.
|
* \return request informations.
|
||||||
*/
|
*/
|
||||||
xcolor_init_request_t
|
color_init_request_t
|
||||||
xcolor_init_unchecked(xcolor_t *color, const char *colstr, ssize_t len)
|
color_init_unchecked(color_t *color, const char *colstr, ssize_t len)
|
||||||
{
|
{
|
||||||
xcolor_init_request_t req;
|
color_init_request_t req;
|
||||||
uint8_t red, green, blue, alpha;
|
uint8_t red, green, blue, alpha;
|
||||||
|
|
||||||
p_clear(&req, 1);
|
p_clear(&req, 1);
|
||||||
|
@ -123,11 +123,11 @@ xcolor_init_unchecked(xcolor_t *color, const char *colstr, ssize_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialize a X color.
|
/** Initialize a X color.
|
||||||
* \param req xcolor_init request.
|
* \param req color_init request.
|
||||||
* \return True if color allocation was successful.
|
* \return True if color allocation was successful.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
xcolor_init_reply(xcolor_init_request_t req)
|
color_init_reply(color_init_request_t req)
|
||||||
{
|
{
|
||||||
if(req.has_error)
|
if(req.has_error)
|
||||||
return false;
|
return false;
|
||||||
|
@ -157,7 +157,7 @@ xcolor_init_reply(xcolor_init_request_t req)
|
||||||
* \return The number of elements pushed on stack.
|
* \return The number of elements pushed on stack.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
luaA_pushxcolor(lua_State *L, const xcolor_t c)
|
luaA_pushcolor(lua_State *L, const color_t c)
|
||||||
{
|
{
|
||||||
uint8_t r = (unsigned) c.red * 0xff / 0xffff;
|
uint8_t r = (unsigned) c.red * 0xff / 0xffff;
|
||||||
uint8_t g = (unsigned) c.green * 0xff / 0xffff;
|
uint8_t g = (unsigned) c.green * 0xff / 0xffff;
|
||||||
|
|
12
color.h
12
color.h
|
@ -35,21 +35,21 @@ typedef struct
|
||||||
uint16_t blue;
|
uint16_t blue;
|
||||||
uint16_t alpha;
|
uint16_t alpha;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
} xcolor_t;
|
} color_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
xcb_alloc_color_cookie_t cookie_hexa;
|
xcb_alloc_color_cookie_t cookie_hexa;
|
||||||
uint16_t alpha;
|
uint16_t alpha;
|
||||||
xcolor_t *color;
|
color_t *color;
|
||||||
bool has_error;
|
bool has_error;
|
||||||
const char *colstr;
|
const char *colstr;
|
||||||
} xcolor_init_request_t;
|
} color_init_request_t;
|
||||||
|
|
||||||
xcolor_init_request_t xcolor_init_unchecked(xcolor_t *, const char *, ssize_t);
|
color_init_request_t color_init_unchecked(color_t *, const char *, ssize_t);
|
||||||
bool xcolor_init_reply(xcolor_init_request_t);
|
bool color_init_reply(color_init_request_t);
|
||||||
|
|
||||||
int luaA_pushxcolor(lua_State *, const xcolor_t);
|
int luaA_pushcolor(lua_State *, const color_t);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ luaA_window_set_border_color(lua_State *L, window_t *window)
|
||||||
const char *color_name = luaL_checklstring(L, -1, &len);
|
const char *color_name = luaL_checklstring(L, -1, &len);
|
||||||
|
|
||||||
if(color_name &&
|
if(color_name &&
|
||||||
xcolor_init_reply(xcolor_init_unchecked(&window->border_color, color_name, len)))
|
color_init_reply(color_init_unchecked(&window->border_color, color_name, len)))
|
||||||
{
|
{
|
||||||
xwindow_set_border_color(window_get(window), &window->border_color);
|
xwindow_set_border_color(window_get(window), &window->border_color);
|
||||||
luaA_object_emit_signal(L, -3, "property::border_color", 0);
|
luaA_object_emit_signal(L, -3, "property::border_color", 0);
|
||||||
|
@ -342,7 +342,7 @@ luaA_window_set_border_width(lua_State *L, window_t *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(window, window_t, window, lua_pushnumber)
|
LUA_OBJECT_EXPORT_PROPERTY(window, window_t, window, lua_pushnumber)
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(window, window_t, border_color, luaA_pushxcolor)
|
LUA_OBJECT_EXPORT_PROPERTY(window, window_t, border_color, luaA_pushcolor)
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(window, window_t, border_width, lua_pushnumber)
|
LUA_OBJECT_EXPORT_PROPERTY(window, window_t, border_width, lua_pushnumber)
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -64,7 +64,7 @@ typedef enum
|
||||||
/** Button bindings */ \
|
/** Button bindings */ \
|
||||||
button_array_t buttons; \
|
button_array_t buttons; \
|
||||||
/** Border color */ \
|
/** Border color */ \
|
||||||
xcolor_t border_color; \
|
color_t border_color; \
|
||||||
/** Border width */ \
|
/** Border width */ \
|
||||||
uint16_t border_width; \
|
uint16_t border_width; \
|
||||||
/** The window type */ \
|
/** The window type */ \
|
||||||
|
|
|
@ -250,7 +250,7 @@ xwindow_set_cursor(xcb_window_t w, xcb_cursor_t c)
|
||||||
* \param color The color.
|
* \param color The color.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xwindow_set_border_color(xcb_window_t w, xcolor_t *color)
|
xwindow_set_border_color(xcb_window_t w, color_t *color)
|
||||||
{
|
{
|
||||||
if(w)
|
if(w)
|
||||||
xcb_change_window_attributes(globalconf.connection, w, XCB_CW_BORDER_PIXEL, &color->pixel);
|
xcb_change_window_attributes(globalconf.connection, w, XCB_CW_BORDER_PIXEL, &color->pixel);
|
||||||
|
|
|
@ -37,7 +37,7 @@ void xwindow_set_opacity(xcb_window_t, double);
|
||||||
void xwindow_grabkeys(xcb_window_t, key_array_t *);
|
void xwindow_grabkeys(xcb_window_t, key_array_t *);
|
||||||
void xwindow_takefocus(xcb_window_t);
|
void xwindow_takefocus(xcb_window_t);
|
||||||
void xwindow_set_cursor(xcb_window_t, xcb_cursor_t);
|
void xwindow_set_cursor(xcb_window_t, xcb_cursor_t);
|
||||||
void xwindow_set_border_color(xcb_window_t, xcolor_t *);
|
void xwindow_set_border_color(xcb_window_t, color_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
Loading…
Reference in New Issue