sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 601005df27e3d5fc5c7d55d0d9b23c4a8e512232
parent 0ba9c9ce89f6eb9d138ee2e33f16c7999c725b66
Author: Alex Kozadaev <akozadaev at yahoo com>
Date:   Tue, 17 Nov 2015 14:02:20 +0000

[sent] add toggle-mouse-cursor patch

Diffstat:
Rtools.suckless.org/sent.md -> tools.suckless.org/sent/index.md | 0
Atools.suckless.org/sent/patches/index.md | 29+++++++++++++++++++++++++++++
Atools.suckless.org/sent/patches/toggle-mouse-cursor.diff | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atools.suckless.org/sent/patches/toggle_cursor.md | 18++++++++++++++++++
4 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/tools.suckless.org/sent.md b/tools.suckless.org/sent/index.md diff --git a/tools.suckless.org/sent/patches/index.md b/tools.suckless.org/sent/patches/index.md @@ -0,0 +1,29 @@ +Patches +======= + +diff generation +--------------- +For git users: + + cd dmenu-directory + git diff > dmenu-X.Y-yourpatchname.diff + +For tarballs: + + cd modified-dmenu-directory/.. + diff -up original-dmenu-directory modified-dmenu-directory > dmenu-X.Y-yourpatchname.diff + +where `X.Y` is a dmenu tag name or version number. + + +patch application +----------------- +For git users: + + cd dmenu-directory + git apply path/to/patch.diff + +For tarballs: + + cd dmenu-directory + patch -p1 < path/to/patch.diff diff --git a/tools.suckless.org/sent/patches/toggle-mouse-cursor.diff b/tools.suckless.org/sent/patches/toggle-mouse-cursor.diff @@ -0,0 +1,61 @@ +diff --git a/config.def.h b/config.def.h +index 6ecc267..96acbe1 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -39,4 +39,5 @@ static Shortcut shortcuts[] = { + { XK_Up, advance, {.i = -1} }, + { XK_Next, advance, {.i = +1} }, + { XK_Prior, advance, {.i = -1} }, ++ { XK_x, toggle_cursor, {0} }, + }; +diff --git a/sent.c b/sent.c +index 4e2e810..a14c49b 100644 +--- a/sent.c ++++ b/sent.c +@@ -13,6 +13,7 @@ + #include <X11/Xlib.h> + #include <X11/Xutil.h> + #include <X11/Xft/Xft.h> ++#include <X11/cursorfont.h> + + #include "arg.h" + #include "drw.h" +@@ -92,6 +93,7 @@ static void eprintf(const char *, ...); + static void die(const char *, ...); + static void load(FILE *fp); + static void advance(const Arg *arg); ++static void toggle_cursor(const Arg *arg); + static void quit(const Arg *arg); + static void resize(int width, int height); + static void run(); +@@ -476,6 +478,30 @@ void advance(const Arg *arg) + } + } + ++void toggle_cursor(const Arg *arg) ++{ ++ Cursor cursor; ++ XColor color; ++ Pixmap bitmapNoData; ++ char noData[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; ++ static int cursor_visible = 1; ++ ++ memset(&color, 0, sizeof(color)); ++ ++ ++ if (cursor_visible) { ++ bitmapNoData = XCreateBitmapFromData(xw.dpy, xw.win, noData, 8, 8); ++ cursor = XCreatePixmapCursor(xw.dpy, bitmapNoData, ++ bitmapNoData, &color, &color, 0, 0); ++ XFreePixmap(xw.dpy, bitmapNoData); ++ } else { ++ cursor = XCreateFontCursor(xw.dpy, XC_left_ptr); ++ } ++ XDefineCursor(xw.dpy, xw.win, cursor); ++ XFreeCursor(xw.dpy, cursor); ++ cursor_visible ^= 1; ++} ++ + void quit(const Arg *arg) + { + running = 0; diff --git a/tools.suckless.org/sent/patches/toggle_cursor.md b/tools.suckless.org/sent/patches/toggle_cursor.md @@ -0,0 +1,18 @@ +Toggle Mouse Cursor +=================== + +Description +----------- + +The patch introduces a shortcut that toggles the mouse cursor. +Enjoy! + +Download +-------- + +* [toggle-mouse-cursor.diff](toggle-mouse-cursor.diff) (1623) (20151117) + +Author +------ + +* Alex Kozadaev (snobb)