[wiki] [sites] [sent] add toggle-mouse-cursor patch || Alex Kozadaev

From: <git_AT_suckless.org>
Date: Tue, 17 Nov 2015 15:01:06 +0100

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

    [sent] add toggle-mouse-cursor patch

diff --git a/tools.suckless.org/sent.md b/tools.suckless.org/sent.md
deleted file mode 100644
index 31779f2..0000000
--- a/tools.suckless.org/sent.md
+++ /dev/null
_AT_@ -1,85 +0,0 @@
-sent
-====
-
-Simple plaintext presentation tool.
-
-->[![Screenshot of sent](sent-bullets-s.png)](sent-bullets.png)<-
-
-sent does not need latex, libreoffice or any other fancy file format, it uses
-plaintext files and png images. Every paragraph represents a slide in the
-presentation. Especially for presentations using the [Takahashi
-method](https://en.wikipedia.org/wiki/Takahashi_method) this is very nice and
-allows you to write down the presentation for a quick lightning talk within a
-few minutes.
-
-The presentation is displayed in a simple X11 window colored black on white for
-maximum contrast even if the sun shines directly onto the projected image. The
-content of each slide is automatically scaled to fit the window so you don't
-have to worry about alignment. Instead you can really concentrate on the
-content.
-
-Demo
-----
-
-To get a little demo, just type
-
- make && ./sent example
-
-You can navigate with the arrow keys and quit with `q`.
-
-(Non-)Features
---------------
-
-* A presentation is just a simple text file
-* Each paragraph represents one slide
-* Content is automatically scaled to fit the screen
-* UTF-8 is supported
-* PNG images can be displayed (no text on the same slide)
-* Just around 1000 lines of C.
-* No different font styles (bold, italic, underline)
-* No fancy layout options (different font sizes, different colors, …)
-* No animations
-* No support for automatic layouting paragraphs
-* Slides with exuberant amount of lines or characters produce rendering glitches
- intentionally to prevent you from holding bad presentations
-
-Usage
------
-
-Edit config.h to fit your needs then build again.
-
- sent FILE1 [FILE2 ...]
-
-If one FILE equals `-`, stdin will be read. Produce image slides by prepending a
-`_AT_` in front of the filename as a single paragraph. Lines starting with `#` will
-be ignored. A `\` at the beginning of the line escapes `_AT_` and `#`. A
-presentation file could look like this:
-
- sent
-
- _AT_nyan.png
-
- depends on
- - Xlib
- - libpng
-
- sent FILENAME
- one slide per paragraph
- # This is a comment and will not be part of the presentation
- \# This and the next line start with backslashes
-
- \_AT_FILE.png
-
- thanks / questions?
-
-Development
------------
-
-You can [browse](http://git.suckless.org/sent) its source code repository
-or get a copy using the following command:
-
- git clone http://git.suckless.org/sent
-
-Download
---------
-* [sent-0.1](http://dl.suckless.org/tools/sent-0.1.tar.gz) (20151111)
diff --git a/tools.suckless.org/sent/index.md b/tools.suckless.org/sent/index.md
new file mode 100644
index 0000000..31779f2
--- /dev/null
+++ b/tools.suckless.org/sent/index.md
_AT_@ -0,0 +1,85 @@
+sent
+====
+
+Simple plaintext presentation tool.
+
+->[![Screenshot of sent](sent-bullets-s.png)](sent-bullets.png)<-
+
+sent does not need latex, libreoffice or any other fancy file format, it uses
+plaintext files and png images. Every paragraph represents a slide in the
+presentation. Especially for presentations using the [Takahashi
+method](https://en.wikipedia.org/wiki/Takahashi_method) this is very nice and
+allows you to write down the presentation for a quick lightning talk within a
+few minutes.
+
+The presentation is displayed in a simple X11 window colored black on white for
+maximum contrast even if the sun shines directly onto the projected image. The
+content of each slide is automatically scaled to fit the window so you don't
+have to worry about alignment. Instead you can really concentrate on the
+content.
+
+Demo
+----
+
+To get a little demo, just type
+
+ make && ./sent example
+
+You can navigate with the arrow keys and quit with `q`.
+
+(Non-)Features
+--------------
+
+* A presentation is just a simple text file
+* Each paragraph represents one slide
+* Content is automatically scaled to fit the screen
+* UTF-8 is supported
+* PNG images can be displayed (no text on the same slide)
+* Just around 1000 lines of C.
+* No different font styles (bold, italic, underline)
+* No fancy layout options (different font sizes, different colors, …)
+* No animations
+* No support for automatic layouting paragraphs
+* Slides with exuberant amount of lines or characters produce rendering glitches
+ intentionally to prevent you from holding bad presentations
+
+Usage
+-----
+
+Edit config.h to fit your needs then build again.
+
+ sent FILE1 [FILE2 ...]
+
+If one FILE equals `-`, stdin will be read. Produce image slides by prepending a
+`_AT_` in front of the filename as a single paragraph. Lines starting with `#` will
+be ignored. A `\` at the beginning of the line escapes `_AT_` and `#`. A
+presentation file could look like this:
+
+ sent
+
+ _AT_nyan.png
+
+ depends on
+ - Xlib
+ - libpng
+
+ sent FILENAME
+ one slide per paragraph
+ # This is a comment and will not be part of the presentation
+ \# This and the next line start with backslashes
+
+ \_AT_FILE.png
+
+ thanks / questions?
+
+Development
+-----------
+
+You can [browse](http://git.suckless.org/sent) its source code repository
+or get a copy using the following command:
+
+ git clone http://git.suckless.org/sent
+
+Download
+--------
+* [sent-0.1](http://dl.suckless.org/tools/sent-0.1.tar.gz) (20151111)
diff --git a/tools.suckless.org/sent/patches/index.md b/tools.suckless.org/sent/patches/index.md
new file mode 100644
index 0000000..efa7efa
--- /dev/null
+++ b/tools.suckless.org/sent/patches/index.md
_AT_@ -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
new file mode 100644
index 0000000..b166346
--- /dev/null
+++ b/tools.suckless.org/sent/patches/toggle-mouse-cursor.diff
_AT_@ -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
+_AT_@ -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
+_AT_@ -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"
+_AT_@ -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();
+_AT_@ -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
new file mode 100644
index 0000000..b820ff0
--- /dev/null
+++ b/tools.suckless.org/sent/patches/toggle_cursor.md
_AT_@ -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)
Received on Tue Nov 17 2015 - 15:01:06 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 17 2015 - 15:12:11 CET