mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-16 07:47:22 +01:00
Added initial support for Xlib cursor themes -- for branch 3.4
The same patch, only for branch 3.4 (there is a bunch of differences from master) Signed-off-by: Tumin Alexander <iamtakingiteasy@eientei.org> Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
dd7d3ed6a1
commit
08ca70c00d
8 changed files with 23 additions and 22 deletions
12
awesome.c
12
awesome.c
|
@ -33,6 +33,8 @@
|
|||
#include <xcb/xinerama.h>
|
||||
#include <xcb/xtest.h>
|
||||
|
||||
#include <X11/Xlib-xcb.h>
|
||||
|
||||
#include "awesome.h"
|
||||
#include "spawn.h"
|
||||
#include "client.h"
|
||||
|
@ -373,7 +375,15 @@ main(int argc, char **argv)
|
|||
sigaction(SIGSEGV, &sa, 0);
|
||||
|
||||
/* X stuff */
|
||||
globalconf.connection = xcb_connect(NULL, &globalconf.default_screen);
|
||||
globalconf.display = XOpenDisplay(NULL);
|
||||
if (globalconf.display == NULL)
|
||||
fatal("cannot open display");
|
||||
|
||||
globalconf.default_screen = XDefaultScreen(globalconf.display);
|
||||
|
||||
globalconf.connection = XGetXCBConnection(globalconf.display);
|
||||
|
||||
/* Double checking then everything is OK. */
|
||||
if(xcb_connection_has_error(globalconf.connection))
|
||||
fatal("cannot open display");
|
||||
|
||||
|
|
|
@ -133,6 +133,7 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED
|
|||
glib-2.0
|
||||
cairo
|
||||
x11
|
||||
xcursor
|
||||
pango>=1.19.3
|
||||
pangocairo>=1.19.3
|
||||
xcb-randr
|
||||
|
|
|
@ -137,25 +137,12 @@ xcursor_font_tostr(uint16_t c)
|
|||
* \return Allocated cursor font.
|
||||
*/
|
||||
xcb_cursor_t
|
||||
xcursor_new(xcb_connection_t *conn, uint16_t cursor_font)
|
||||
xcursor_new(Display *conn, uint16_t cursor_font)
|
||||
{
|
||||
static xcb_font_t font = XCB_NONE;
|
||||
static xcb_cursor_t xcursor[countof(xcursor_font)];
|
||||
|
||||
/* Get the font for the cursor */
|
||||
if(!font)
|
||||
{
|
||||
font = xcb_generate_id(conn);
|
||||
xcb_open_font(conn, font, sizeof(CURSORFONT) - 1, CURSORFONT);
|
||||
}
|
||||
|
||||
if(!xcursor[cursor_font])
|
||||
{
|
||||
xcursor[cursor_font] = xcb_generate_id(conn);
|
||||
xcb_create_glyph_cursor(conn, xcursor[cursor_font], font, font,
|
||||
cursor_font, cursor_font + 1,
|
||||
0, 0, 0,
|
||||
65535, 65535, 65535);
|
||||
if (!xcursor[cursor_font]) {
|
||||
xcursor[cursor_font] = XcursorLibraryLoadCursor(conn, xcursor_font_tostr(cursor_font));
|
||||
}
|
||||
|
||||
return xcursor[cursor_font];
|
||||
|
|
|
@ -23,11 +23,12 @@
|
|||
#define AWESOME_COMMON_XCURSORS_H
|
||||
|
||||
#include <X11/cursorfont.h>
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
uint16_t xcursor_font_fromstr(const char *);
|
||||
const char * xcursor_font_tostr(uint16_t);
|
||||
xcb_cursor_t xcursor_new(xcb_connection_t *, uint16_t);
|
||||
xcb_cursor_t xcursor_new(Display *, uint16_t);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||
|
|
|
@ -52,6 +52,8 @@ ARRAY_TYPE(wibox_t *, wibox)
|
|||
/** Main configuration structure */
|
||||
typedef struct
|
||||
{
|
||||
/** Xlib Display ref [for Xcursors] */
|
||||
Display * display;
|
||||
/** Connection ref */
|
||||
xcb_connection_t *connection;
|
||||
/** Default screen number */
|
||||
|
|
|
@ -106,7 +106,7 @@ luaA_mousegrabber_run(lua_State *L)
|
|||
|
||||
if(cfont)
|
||||
{
|
||||
xcb_cursor_t cursor = xcursor_new(globalconf.connection, cfont);
|
||||
xcb_cursor_t cursor = xcursor_new(globalconf.display, cfont);
|
||||
|
||||
luaA_registerfct(L, 1, &globalconf.mousegrabber);
|
||||
|
||||
|
|
2
root.c
2
root.c
|
@ -229,7 +229,7 @@ luaA_root_cursor(lua_State *L)
|
|||
|
||||
if(cursor_font)
|
||||
{
|
||||
uint32_t change_win_vals[] = { xcursor_new(globalconf.connection, cursor_font) };
|
||||
uint32_t change_win_vals[] = { xcursor_new(globalconf.display, cursor_font) };
|
||||
|
||||
for(int screen_nbr = 0;
|
||||
screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
|
|
4
wibox.c
4
wibox.c
|
@ -799,7 +799,7 @@ wibox_attach(lua_State *L, int udx, screen_t *s)
|
|||
wibox_init(wibox, phys_screen);
|
||||
|
||||
window_set_cursor(wibox->window,
|
||||
xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox->cursor)));
|
||||
xcursor_new(globalconf.display, xcursor_font_fromstr(wibox->cursor)));
|
||||
|
||||
if(wibox->opacity != -1)
|
||||
window_opacity_set(wibox->window, wibox->opacity);
|
||||
|
@ -1316,7 +1316,7 @@ luaA_wibox_set_cursor(lua_State *L, wibox_t *wibox)
|
|||
uint16_t cursor_font = xcursor_font_fromstr(buf);
|
||||
if(cursor_font)
|
||||
{
|
||||
xcb_cursor_t cursor = xcursor_new(globalconf.connection, cursor_font);
|
||||
xcb_cursor_t cursor = xcursor_new(globalconf.display, cursor_font);
|
||||
p_delete(&wibox->cursor);
|
||||
wibox->cursor = a_strdup(buf);
|
||||
window_set_cursor(wibox->window, cursor);
|
||||
|
|
Loading…
Reference in a new issue