On Wed, Mar 28, 2018 at 08:03:37PM -0300, Héctor Monacci wrote:
> 2018-03-28 5:54 GMT-03:00 Markus Teich
> >> Thank you Markus! Sure I can wait!
> >
> >
> > Cool, please resend the fixed patch.
> >
>
> Here it goes. I hope it is OK!
>
> From 37637d82867278bad5593db9a2687bc95c1bdb13 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?H=C3=A9ctor=20M=2E=20Monacci?= <hector.monacci_AT_gmail.com>
> Date: Sun, 18 Mar 2018 09:04:23 -0300
> Subject: [PATCH] Add toggle fullscreen shortcut: f
>
> ---
> README.md | 12 ++++++------
> config.def.h | 1 +
> sent.c | 21 ++++++++++++++++++---
> 3 files changed, 25 insertions(+), 9 deletions(-)
>
> diff --git a/README.md b/README.md
> index c1e9385..4e93d26 100644
> --- a/README.md
> +++ b/README.md
> _AT_@ -20,7 +20,7 @@ To get a little demo, just type
>
> make && ./sent example
>
> -You can navigate with the arrow keys and quit with `q`.
> +You can navigate with the arrow keys, toggle fullscreen with `f`, and
> quit with `q`.
>
>
> Usage
> _AT_@ -33,21 +33,21 @@ 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
> - Xft
> - farbfeld
> -
> +
> 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?
>
>
> diff --git a/config.def.h b/config.def.h
> index 60eb376..5dc7d2b 100644
> --- a/config.def.h
> +++ b/config.def.h
> _AT_@ -46,6 +46,7 @@ static Shortcut shortcuts[] = {
> { XK_Prior, advance, {.i = -1} },
> { XK_n, advance, {.i = +1} },
> { XK_p, advance, {.i = -1} },
> + { XK_f, fullscr_togg, {0} },
> { XK_r, reload, {0} },
> };
>
> diff --git a/sent.c b/sent.c
> index c50a572..5b0b6cc 100644
> --- a/sent.c
> +++ b/sent.c
> _AT_@ -97,13 +97,14 @@ static void cleanup(int slidesonly);
> static void reload(const Arg *arg);
> static void load(FILE *fp);
> static void advance(const Arg *arg);
> +static void fullscr_togg();
> static void quit(const Arg *arg);
> static void resize(int width, int height);
> static void run();
> static void usage();
> static void xdraw();
> static void xhints();
> -static void xinit();
> +static void xinit(Bool fs);
> static void xloadfonts();
>
> static void bpress(XEvent *);
> _AT_@ -475,6 +476,16 @@ advance(const Arg *arg)
> }
> }
>
> +void
> +fullscr_togg()
> +{
> + static Bool toggle;
> + toggle = !toggle;
> + XDestroyWindow(xw.dpy, xw.win);
> + XSync(xw.dpy, False);
> + xinit(toggle);
> +}
> +
Can you rename this as I mentioned before? To togglefullscreen() or so?
> void
> quit(const Arg *arg)
> {
> _AT_@ -560,7 +571,7 @@ xhints()
> }
>
> void
> -xinit()
> +xinit(Bool fs)
> {
> XTextProperty prop;
> unsigned int i;
> _AT_@ -580,6 +591,10 @@ xinit()
> InputOutput, xw.vis, CWBitGravity | CWEventMask,
> &xw.attrs);
>
> + Atom wm_state = XInternAtom(xw.dpy, "_NET_WM_STATE", True);
> + Atom wm_fullscreen = XInternAtom(xw.dpy, "_NET_WM_STATE_FULLSCREEN", True);
> + XChangeProperty(xw.dpy, xw.win, wm_state, XA_ATOM, 32,
> PropModeReplace, (unsigned char *)&wm_fullscreen, fs);
> +
> xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
> xw.netwmname = XInternAtom(xw.dpy, "_NET_WM_NAME", False);
> XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1);
> _AT_@ -698,7 +713,7 @@ main(int argc, char *argv[])
> load(fp);
> fclose(fp);
>
> - xinit();
> + xinit(False);
> run();
>
> cleanup(0);
> --
> 2.16.2
>
Can you also add the fullscreen hotkey to the man page documentation in
sent.1?
--
Kind regards,
Hiltjo
Received on Thu Mar 29 2018 - 10:05:27 CEST