forked from speedie/spmenu
move image size stuff to a separate function we can call on demand
This commit is contained in:
parent
345a8467e5
commit
6a83ac707e
20
libs/arg.c
20
libs/arg.c
|
@ -305,25 +305,7 @@ setimgsize(const Arg *arg)
|
|||
return;
|
||||
#endif
|
||||
|
||||
/* this makes sure we cannot scale down the image too much */
|
||||
if ((!image && imageheight + arg->i < imageheight) || hideimage) return;
|
||||
|
||||
cleanupimage();
|
||||
|
||||
imageheight += arg->i;
|
||||
imagewidth += arg->i;
|
||||
|
||||
drawimage();
|
||||
|
||||
if (!image) {
|
||||
imageheight -= arg->i;
|
||||
imagewidth -= arg->i;
|
||||
return;
|
||||
} else {
|
||||
drawimage();
|
||||
}
|
||||
|
||||
drawmenu();
|
||||
setimagesize(imagewidth + arg->i, imageheight + arg->i);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
32
libs/img.c
32
libs/img.c
|
@ -1,3 +1,35 @@
|
|||
void
|
||||
setimagesize(int width, int height)
|
||||
{
|
||||
#if !USEIMAGE
|
||||
return;
|
||||
#endif
|
||||
|
||||
int oih = 0;
|
||||
int oiw = 0;
|
||||
|
||||
/* this makes sure we cannot scale down the image too much */
|
||||
if ((!image && height < imageheight) || (!image && width < imagewidth) || hideimage) return;
|
||||
|
||||
cleanupimage();
|
||||
|
||||
oih = imageheight;
|
||||
oiw = imagewidth;
|
||||
|
||||
imageheight = height;
|
||||
imagewidth = width;
|
||||
|
||||
drawimage();
|
||||
|
||||
if (!image) {
|
||||
imageheight = oih;
|
||||
imagewidth = oiw;
|
||||
return;
|
||||
}
|
||||
|
||||
drawmenu();
|
||||
}
|
||||
|
||||
void
|
||||
flipimage(void)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <Imlib2.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
static void setimagesize(int width, int height);
|
||||
static void setimageopts(void);
|
||||
static void cleanupimage(void);
|
||||
static void drawimage(void);
|
||||
|
|
Loading…
Reference in a new issue