Discussion:
[dev] [st] scrollback-mouse patch is broken on 0.8
Devin Neal
2018-09-06 20:18:26 UTC
Permalink
There appears to be a problem with one of the patches to enable mouse
scrolling at https://st.suckless.org/patches/scrollback/.
git checkout 0.8
HEAD is now at 8ab6290 LICENSE: fix a few years
curl https://st.suckless.org/patches/scrollback/st-scrollback-0.8.diff | git apply
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8818 0 8818 0 0 7708 0 --:--:-- 0:00:01 --:--:-- 7708
make
st build options:
CFLAGS = -I/usr/X11R6/include -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/freetype2
-I/usr/include/libpng16 -DVERSION="0.8" -D_XOPEN_SOURCE=600 -O
LDFLAGS = -L/usr/X11R6/lib -lm -lrt -lX11 -lutil -lXft -lfontconfig
-lfreetype -lfreetype
CC = c99
cp config.def.h config.h
c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig`
`pkg-config --cflags freetype2` -DVERSION=\"0.8\" -D_XOPEN_SOURCE=600
-O -c st.c
c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig`
`pkg-config --cflags freetype2` -DVERSION=\"0.8\" -D_XOPEN_SOURCE=600
-O -c x.c
c99 -o st st.o x.o -L/usr/X11R6/lib -lm -lrt -lX11 -lutil -lXft
`pkg-config --libs fontconfig` `pkg-config --libs freetype2`
curl https://st.suckless.org/patches/scrollback/st-scrollback-mouse-0.8.diff | git apply
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1813 0 1813 0 0 1892 0 --:--:-- --:--:-- --:--:-- 1890
make
st build options:
CFLAGS = -I/usr/X11R6/include -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/freetype2
-I/usr/include/libpng16 -DVERSION="0.8" -D_XOPEN_SOURCE=600 -O
LDFLAGS = -L/usr/X11R6/lib -lm -lrt -lX11 -lutil -lXft -lfontconfig
-lfreetype -lfreetype
CC = c99
c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig`
`pkg-config --cflags freetype2` -DVERSION=\"0.8\" -D_XOPEN_SOURCE=600
-O -c st.c
c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig`
`pkg-config --cflags freetype2` -DVERSION=\"0.8\" -D_XOPEN_SOURCE=600
-O -c x.c
In file included from x.c:20:0:
x.c: In function ‘bpress’:
st.h:12:25: error: invalid application of ‘sizeof’ to incomplete type
‘MouseKey[] {aka struct <anonymous>[]}’
#define LEN(a) (sizeof(a) / sizeof(a)[0])
^
x.c:428:32: note: in expansion of macro ‘LEN’
for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) {
^~~
Makefile:22: recipe for target 'x.o' failed
make: *** [x.o] Error 1
It seems that this patch is incorrect, though I'm not discounting the
possibility that I've done something wrong.
Daniel Tameling
2018-09-07 15:08:17 UTC
Permalink
Post by Devin Neal
There appears to be a problem with one of the patches to enable mouse
scrolling at https://st.suckless.org/patches/scrollback/.
It seems that this patch is incorrect, though I'm not discounting the
possibility that I've done something wrong.
Hi Devin,

you need to apply the normal scrollback patch before the mouse one.
Then it works.

--
Best,
Daniel
Devin Neal
2018-09-07 17:10:44 UTC
Permalink
Post by Daniel Tameling
you need to apply the normal scrollback patch before the mouse one.
Then it works.
Sorry if it wasn't clear from my previous post, but I applied the
normal scrollback patch before the mouse one when I encountered the
problem.
Daniel Tameling
2018-09-07 18:40:45 UTC
Permalink
Post by Devin Neal
Post by Daniel Tameling
you need to apply the normal scrollback patch before the mouse one.
Then it works.
Sorry if it wasn't clear from my previous post, but I applied the
normal scrollback patch before the mouse one when I encountered the
problem.
Sorry, didn't read your first mail carefully.
The thing is that it always worked for me without any problem.

But now I managed to reproduce it. Have you built st before applying
the patch? That creates a config.h from config.def.h, which is then
used during subsequent builds. The patches change only config.def.h,
and if there is already an existing config.h, you get the error you
described. You either have to transfer the changes to config.h, or if
you didn't customize this file yet, you can simply delete it and build
st again.
--
Best,
Daniel
Devin Neal
2018-09-07 23:13:48 UTC
Permalink
if there is already an existing config.h, you get the error you described.
It turns out that this error occurred precisely because I ran make
(which created a config.h file) in between applying the two patches.
I think this error is subtle and frustrating enough that it deserves
an entry in the notes section of the page. Is there a specific person
to contact about this?
Daniel Tameling
2018-09-08 09:28:22 UTC
Permalink
Post by Devin Neal
if there is already an existing config.h, you get the error you described.
It turns out that this error occurred precisely because I ran make
(which created a config.h file) in between applying the two patches.
I think this error is subtle and frustrating enough that it deserves
an entry in the notes section of the page. Is there a specific person
to contact about this?
You can suggest an edit yourself:
https://suckless.org/wiki/
--
Best,
Daniel
Devin Neal
2018-09-08 23:25:55 UTC
Permalink
Post by Daniel Tameling
https://suckless.org/wiki/
Noted, thanks for all your help.

Platon Ryzhikov
2018-09-08 07:55:08 UTC
Permalink
As long as i remember my experience in using scrollback patches, you need to swap some code (functions and definitions) between st.c and x.c
Post by Devin Neal
There appears to be a problem with one of the patches to enable mouse
scrolling at https://st.suckless.org/patches/scrollback/.
 git checkout 0.8
HEAD is now at 8ab6290 LICENSE: fix a few years
 curl https://st.suckless.org/patches/scrollback/st-scrollback-0.8.diff | git apply
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 8818 0 8818 0 0 7708 0 --:--:-- 0:00:01 --:--:-- 7708
 make
CFLAGS = -I/usr/X11R6/include -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/freetype2
-I/usr/include/libpng16 -DVERSION="0.8" -D_XOPEN_SOURCE=600 -O
LDFLAGS = -L/usr/X11R6/lib -lm -lrt -lX11 -lutil -lXft -lfontconfig
-lfreetype -lfreetype
CC = c99
cp config.def.h config.h
c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig`
`pkg-config --cflags freetype2` -DVERSION=\"0.8\" -D_XOPEN_SOURCE=600
-O -c st.c
c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig`
`pkg-config --cflags freetype2` -DVERSION=\"0.8\" -D_XOPEN_SOURCE=600
-O -c x.c
c99 -o st st.o x.o -L/usr/X11R6/lib -lm -lrt -lX11 -lutil -lXft
`pkg-config --libs fontconfig` `pkg-config --libs freetype2`
 curl https://st.suckless.org/patches/scrollback/st-scrollback-mouse-0.8.diff | git apply
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 1813 0 1813 0 0 1892 0 --:--:-- --:--:-- --:--:-- 1890
 make
CFLAGS = -I/usr/X11R6/include -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/freetype2
-I/usr/include/libpng16 -DVERSION="0.8" -D_XOPEN_SOURCE=600 -O
LDFLAGS = -L/usr/X11R6/lib -lm -lrt -lX11 -lutil -lXft -lfontconfig
-lfreetype -lfreetype
CC = c99
c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig`
`pkg-config --cflags freetype2` -DVERSION=\"0.8\" -D_XOPEN_SOURCE=600
-O -c st.c
c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig`
`pkg-config --cflags freetype2` -DVERSION=\"0.8\" -D_XOPEN_SOURCE=600
-O -c x.c
st.h:12:25: error: invalid application of ‘sizeof’ to incomplete type
‘MouseKey[] {aka struct <anonymous>[]}’
 #define LEN(a) (sizeof(a) / sizeof(a)[0])
                         ^
x.c:428:32: note: in expansion of macro ‘LEN’
  for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) {
                                ^~~
Makefile:22: recipe for target 'x.o' failed
make: *** [x.o] Error 1
It seems that this patch is incorrect, though I'm not discounting the
possibility that I've done something wrong.
Loading...