diff options
author | Gary Wong <gtw@gnu.org> | 2014-05-08 14:26:29 -0600 |
---|---|---|
committer | Gary Wong <gtw@gnu.org> | 2014-05-08 15:49:08 -0600 |
commit | 1b7e97261d90c83b64869a4b0dee0368d81dba4b (patch) | |
tree | a6832014430d23b543f3cfdcc53960d01d5cd4e0 | |
parent | 64524725acf86cd9c239146dad52c09496f32fcd (diff) |
Add support for XCB cursor library.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | decorate-render.c | 27 | ||||
-rw-r--r-- | gwm.h | 2 | ||||
-rw-r--r-- | menu.c | 1 |
5 files changed, 39 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2014-05-08 Gary Wong <gtw@gnu.org> + + * decorate-render.c (decorate_compat_init) [USE_CURSOR]: Load + cursors via xcb_cursor_load_cursor (to honour cursor themes + where available). + 2012-02-01 Gary Wong <gtw@gnu.org> * decorate-render.c (decorate_render_init): Specify property size diff --git a/configure.ac b/configure.ac index e6903f2..dee8f12 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,7 @@ PKG_PROG_PKG_CONFIG # Checks for libraries: AC_ARG_WITH(composite,[ --with-composite use the X Composite extension.]) +AC_ARG_WITH(cursor, [ --with-cursor use the XCB cursor library.]) AC_ARG_WITH(damage, [ --with-damage use the X DAMAGE extension.]) AC_ARG_WITH(randr, [ --with-randr use the X RANDR extension.]) AC_ARG_WITH(render, [ --with-render use the X RENDER extension.]) @@ -62,6 +63,7 @@ AC_ARG_WITH(shape, [ --with-shape use the X SHAPE extension.]) AC_ARG_WITH(xfixes, [ --with-xfixes use the XFIXES extension.]) AH_TEMPLATE(USE_COMPOSITE,[Use the X Composite extension.]) +AH_TEMPLATE(USE_CURSOR,[Use the XCB cursor library.]) AH_TEMPLATE(USE_DAMAGE,[Use the X DAMAGE extension.]) AH_TEMPLATE(USE_RANDR,[Use the X RANDR extension.]) AH_TEMPLATE(USE_RENDER,[Use the X RENDER extension.]) @@ -72,6 +74,7 @@ GWM_MANDATORY_PACKAGE(xcb) GWM_OPTIONAL_PACKAGE(fontconfig) GWM_OPTIONAL_PACKAGE(freetype2) GWM_OPTIONAL_PACKAGE(xcb-composite, composite) +GWM_OPTIONAL_PACKAGE(xcb-cursor, cursor) GWM_OPTIONAL_PACKAGE(xcb-damage, damage) GWM_OPTIONAL_PACKAGE(xcb-randr, randr) GWM_OPTIONAL_PACKAGE(xcb-render, render, fontconfig freetype2) diff --git a/decorate-render.c b/decorate-render.c index 75f1a12..9a7de40 100644 --- a/decorate-render.c +++ b/decorate-render.c @@ -33,6 +33,9 @@ #include <string.h> #include <xcb/render.h> #include <xcb/xcb.h> +#if USE_CURSOR +#include <xcb/xcb_cursor.h> +#endif #include "gwm.h" @@ -1036,6 +1039,29 @@ static void handle_get_default_map( unsigned int sequence, void *reply, static INIT void decorate_compat_init( void ) { int i; +#if USE_CURSOR + xcb_cursor_context_t *cc; + static INITD const char *const cursor_names[ NUM_CURSORS ] = { + "top_left_corner", /* CURSOR_TL */ + "top_side", /* CURSOR_T */ + "top_right_corner", /* CURSOR_TR */ + "left_side", /* CURSOR_L */ + "fleur", /* CURSOR_C */ + "right_side", /* CURSOR_R */ + "bottom_left_corner", /* CURSOR_BL */ + "bottom_side", /* CURSOR_B */ + "bottom_right_corner", /* CURSOR_BR */ + "left_ptr", /* CURSOR_ARROW */ + "pirate" /* CURSOR_DESTROY */ + }; + + xcb_cursor_context_new( c, screens[ 0 ], &cc ); + + for( i = 0; i < NUM_CURSORS; i++ ) + cursors[ i ] = xcb_cursor_load_cursor( cc, cursor_names[ i ] ); + + xcb_cursor_context_free( cc ); +#else const char *cursor_font_name = "cursor"; xcb_font_t cursor_font; static INITD const int cursor_glyphs[ NUM_CURSORS ] = { @@ -1062,6 +1088,7 @@ static INIT void decorate_compat_init( void ) { 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF ); } xcb_close_font( c, cursor_font ); +#endif /* Retrieve any RGB_DEFAULT_MAP properties on the roots. */ for( i = 0; i < num_screens; i++ ) { @@ -219,6 +219,8 @@ enum gwm_cursor { CURSOR_DESTROY, NUM_CURSORS }; +/* FIXME these should really be indexed by (screen,cursor), not just by + cursor -- screens might be different resolutions, for instance. */ extern xcb_cursor_t cursors[ NUM_CURSORS ]; union callback_param { @@ -24,6 +24,7 @@ #include <config.h> #include <assert.h> +#include <limits.h> #include <stdlib.h> #include <string.h> #include <xcb/xcb.h> |