little style fixes, add vim modeline

This commit is contained in:
Michael Stapelberg 2010-11-28 13:02:29 +01:00
parent 69fc6449dc
commit d60e8c56dc
2 changed files with 10 additions and 8 deletions

View File

@ -1,3 +1,6 @@
/*
* vim:ts=4:sw=4:expandtab
*/
#ifndef _XCURSOR_CURSOR_H #ifndef _XCURSOR_CURSOR_H
#define _XCURSOR_CURSOR_H #define _XCURSOR_CURSOR_H

View File

@ -1,3 +1,6 @@
/*
* vim:ts=4:sw=4:expandtab
*/
#include <assert.h> #include <assert.h>
#include <X11/Xcursor/Xcursor.h> #include <X11/Xcursor/Xcursor.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
@ -14,29 +17,25 @@ static const int xcb_cursors[XCURSOR_CURSOR_MAX] = {
XCB_CURSOR_SB_V_DOUBLE_ARROW XCB_CURSOR_SB_V_DOUBLE_ARROW
}; };
static Cursor load_cursor(const char *name, int font) static Cursor load_cursor(const char *name, int font) {
{
Cursor c = XcursorLibraryLoadCursor(xlibdpy, name); Cursor c = XcursorLibraryLoadCursor(xlibdpy, name);
if (c == None) if (c == None)
c = XCreateFontCursor(xlibdpy, font); c = XCreateFontCursor(xlibdpy, font);
return c; return c;
} }
void xcursor_load_cursors() void xcursor_load_cursors() {
{
cursors[XCURSOR_CURSOR_POINTER] = load_cursor("left_ptr", XC_left_ptr); cursors[XCURSOR_CURSOR_POINTER] = load_cursor("left_ptr", XC_left_ptr);
cursors[XCURSOR_CURSOR_RESIZE_HORIZONTAL] = load_cursor("sb_h_double_arrow", XC_sb_h_double_arrow); cursors[XCURSOR_CURSOR_RESIZE_HORIZONTAL] = load_cursor("sb_h_double_arrow", XC_sb_h_double_arrow);
cursors[XCURSOR_CURSOR_RESIZE_VERTICAL] = load_cursor("sb_v_double_arrow", XC_sb_v_double_arrow); cursors[XCURSOR_CURSOR_RESIZE_VERTICAL] = load_cursor("sb_v_double_arrow", XC_sb_v_double_arrow);
} }
Cursor xcursor_get_cursor(enum xcursor_cursor_t c) Cursor xcursor_get_cursor(enum xcursor_cursor_t c) {
{
assert(c >= 0 && c < XCURSOR_CURSOR_MAX); assert(c >= 0 && c < XCURSOR_CURSOR_MAX);
return cursors[c]; return cursors[c];
} }
int xcursor_get_xcb_cursor(enum xcursor_cursor_t c) int xcursor_get_xcb_cursor(enum xcursor_cursor_t c) {
{
assert(c >= 0 && c < XCURSOR_CURSOR_MAX); assert(c >= 0 && c < XCURSOR_CURSOR_MAX);
return xcb_cursors[c]; return xcb_cursors[c];
} }