Remove fullscreen functionality
The fullscreen functionality is kind of cool, but adds a lot of code and as commit history has shown, plenty of bugs and extra required testing. I may reimplement this later in a less bad manner. Note that the fullscreen behavior can be achieved by simply increasing image size to the max. spmenu will let you do that. Fixes issue #9
This commit is contained in:
parent
748db7eed1
commit
dfc4fe038c
|
@ -771,7 +771,6 @@ These are the default keybinds. You can generate these yourself from a
|
||||||
| 0 | Shift | 1 | setimggaps | -100 |
|
| 0 | Shift | 1 | setimggaps | -100 |
|
||||||
| 0 | Shift | 2 | setimggaps | +100 |
|
| 0 | Shift | 2 | setimggaps | +100 |
|
||||||
| 0 | 0 | t | toggleimg | 0 |
|
| 0 | 0 | t | toggleimg | 0 |
|
||||||
| 0 | 0 | f | togglefullimg | 0 |
|
|
||||||
| 0 | 0 | p | paste | 2 |
|
| 0 | 0 | p | paste | 2 |
|
||||||
| 0 | 0 | q | flipimg | 1 |
|
| 0 | 0 | q | flipimg | 1 |
|
||||||
| 0 | 0 | w | flipimg | 0 |
|
| 0 | 0 | w | flipimg | 0 |
|
||||||
|
|
|
@ -312,7 +312,6 @@ spmenu = {
|
||||||
{ mode = 0; modifier = "Shift"; key = "!"; function = "setimggaps"; argument = "-100"; }, // Shift+1: Decrease image gaps by 100
|
{ mode = 0; modifier = "Shift"; key = "!"; function = "setimggaps"; argument = "-100"; }, // Shift+1: Decrease image gaps by 100
|
||||||
{ mode = 0; modifier = "Shift"; key = "@"; function = "setimggaps"; argument = "+100"; }, // Shift+2: Increase image gaps by 100
|
{ mode = 0; modifier = "Shift"; key = "@"; function = "setimggaps"; argument = "+100"; }, // Shift+2: Increase image gaps by 100
|
||||||
{ mode = 0; modifier = "None"; key = "t"; function = "toggleimg"; argument = "0"; }, // t: Toggle image
|
{ mode = 0; modifier = "None"; key = "t"; function = "toggleimg"; argument = "0"; }, // t: Toggle image
|
||||||
{ mode = 0; modifier = "None"; key = "f"; function = "togglefullimg"; argument = "0"; }, // f: Toggle image full screen mode
|
|
||||||
{ mode = 0; modifier = "None"; key = "q"; function = "flipimg"; argument = "1"; }, // q: Flip image horizontally
|
{ mode = 0; modifier = "None"; key = "q"; function = "flipimg"; argument = "1"; }, // q: Flip image horizontally
|
||||||
{ mode = 0; modifier = "None"; key = "w"; function = "flipimg"; argument = "0"; }, // w: Flip image vertically
|
{ mode = 0; modifier = "None"; key = "w"; function = "flipimg"; argument = "0"; }, // w: Flip image vertically
|
||||||
{ mode = 0; modifier = "None"; key = "k"; function = "moveup"; argument = "0"; }, // k: Move up 1 item
|
{ mode = 0; modifier = "None"; key = "k"; function = "moveup"; argument = "0"; }, // k: Move up 1 item
|
||||||
|
|
26
libs/arg.c
26
libs/arg.c
|
@ -426,28 +426,6 @@ void toggleimg(Arg *arg) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void togglefullimg(Arg *arg) {
|
|
||||||
#if USEIMAGE
|
|
||||||
if (hideimage || !image) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fullscreen = !fullscreen;
|
|
||||||
|
|
||||||
if (fullscreen) {
|
|
||||||
img.imagewidth = sp.mw;
|
|
||||||
img.imageheight = sp.mh;
|
|
||||||
img.imagegaps = 0;
|
|
||||||
} else {
|
|
||||||
img.imagewidth = imagewidth;
|
|
||||||
img.imageheight = imageheight;
|
|
||||||
img.imagegaps = imagegaps;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawmenu();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void defaultimg(Arg *arg) {
|
void defaultimg(Arg *arg) {
|
||||||
#if USEIMAGE
|
#if USEIMAGE
|
||||||
|
|
||||||
|
@ -462,7 +440,7 @@ void defaultimg(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setlines(Arg *arg) {
|
void setlines(Arg *arg) {
|
||||||
if (fullscreen || !overridelines) return;
|
if (!overridelines) return;
|
||||||
|
|
||||||
lines += arg->i;
|
lines += arg->i;
|
||||||
|
|
||||||
|
@ -480,7 +458,7 @@ void setlines(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setcolumns(Arg *arg) {
|
void setcolumns(Arg *arg) {
|
||||||
if (fullscreen || !overridecolumns) return;
|
if (!overridecolumns) return;
|
||||||
|
|
||||||
columns += arg->i;
|
columns += arg->i;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ static void quit(Arg *arg);
|
||||||
static void complete(Arg *arg);
|
static void complete(Arg *arg);
|
||||||
static void setimgsize(Arg *arg);
|
static void setimgsize(Arg *arg);
|
||||||
static void toggleimg(Arg *arg);
|
static void toggleimg(Arg *arg);
|
||||||
static void togglefullimg(Arg *arg);
|
|
||||||
static void defaultimg(Arg *arg);
|
static void defaultimg(Arg *arg);
|
||||||
static void flipimg(Arg *arg);
|
static void flipimg(Arg *arg);
|
||||||
static void setimgpos(Arg *arg);
|
static void setimgpos(Arg *arg);
|
||||||
|
|
|
@ -376,7 +376,6 @@ static FuncList fl[] = {
|
||||||
{ "setimgsize", setimgsize },
|
{ "setimgsize", setimgsize },
|
||||||
{ "setimgsize", setimgsize },
|
{ "setimgsize", setimgsize },
|
||||||
{ "toggleimg", toggleimg },
|
{ "toggleimg", toggleimg },
|
||||||
{ "togglefullimg", togglefullimg },
|
|
||||||
{ "defaultimg", defaultimg },
|
{ "defaultimg", defaultimg },
|
||||||
{ "flipimg", flipimg },
|
{ "flipimg", flipimg },
|
||||||
{ "setimgpos", setimgpos },
|
{ "setimgpos", setimgpos },
|
||||||
|
|
13
libs/draw.c
13
libs/draw.c
|
@ -582,6 +582,7 @@ void drawmenu_layer(void) {
|
||||||
int x = 0, y = 0, w = 0;
|
int x = 0, y = 0, w = 0;
|
||||||
sp.plw = hidepowerline ? 0 : draw->font->h / 2 + 1; // powerline size
|
sp.plw = hidepowerline ? 0 : draw->font->h / 2 + 1; // powerline size
|
||||||
|
|
||||||
|
|
||||||
// draw menu first using menu scheme
|
// draw menu first using menu scheme
|
||||||
draw_rect(draw, 0, 0, sp.mw, sp.mh, 1, 1, col_menu, col_menu, alpha_menu, alpha_menu);
|
draw_rect(draw, 0, 0, sp.mw, sp.mh, 1, 1, col_menu, col_menu, alpha_menu, alpha_menu);
|
||||||
|
|
||||||
|
@ -613,32 +614,32 @@ void drawmenu_layer(void) {
|
||||||
y -= sp.bh;
|
y -= sp.bh;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hideprompt && !fullscreen) {
|
if (!hideprompt) {
|
||||||
w = sp.promptw;
|
w = sp.promptw;
|
||||||
x = drawprompt(x, y, w);
|
x = drawprompt(x, y, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hideinput && !fullscreen) {
|
if (!hideinput) {
|
||||||
w = (lines > 0 || !matches) ? sp.mw - x : sp.inputw;
|
w = (lines > 0 || !matches) ? sp.mw - x : sp.inputw;
|
||||||
x = drawinput(x, y, w);
|
x = drawinput(x, y, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hidemode && !fullscreen) modew = pango_mode ? TEXTWM(tx.modetext) : TEXTW(tx.modetext);
|
if (!hidemode) modew = pango_mode ? TEXTWM(tx.modetext) : TEXTW(tx.modetext);
|
||||||
|
|
||||||
// draw the items, this function also calls drawrarrow() and drawlarrow()
|
// draw the items, this function also calls drawrarrow() and drawlarrow()
|
||||||
if (!hideitem) drawitem(x, y, w);
|
if (!hideitem) drawitem(x, y, w);
|
||||||
|
|
||||||
if (!hidematchcount && !fullscreen) {
|
if (!hidematchcount) {
|
||||||
w = numberw;
|
w = numberw;
|
||||||
drawnumber(sp.mw - numberw - modew - capsw - 2 * sp.sp - 2 * borderwidth - menumarginh, y, w);
|
drawnumber(sp.mw - numberw - modew - capsw - 2 * sp.sp - 2 * borderwidth - menumarginh, y, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hidemode && !fullscreen) {
|
if (!hidemode) {
|
||||||
w = modew;
|
w = modew;
|
||||||
drawmode(sp.mw - modew - capsw - 2 * sp.sp - 2 * borderwidth - menumarginh, y, w);
|
drawmode(sp.mw - modew - capsw - 2 * sp.sp - 2 * borderwidth - menumarginh, y, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hidecaps && !fullscreen) {
|
if (!hidecaps) {
|
||||||
w = capsw;
|
w = capsw;
|
||||||
drawcaps(sp.mw - capsw - 2 * sp.sp - 2 * borderwidth - menumarginh, y, w);
|
drawcaps(sp.mw - capsw - 2 * sp.sp - 2 * borderwidth - menumarginh, y, w);
|
||||||
}
|
}
|
||||||
|
|
36
libs/img.c
36
libs/img.c
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#if USEIMAGE
|
#if USEIMAGE
|
||||||
void setimagesize(int width, int height) {
|
void setimagesize(int width, int height) {
|
||||||
if (!image || fullscreen || hideimage || height < 5 || width < 5 || width > sp.mw) {
|
if (!image || hideimage || height < 5 || width < 5 || width > sp.mw) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,10 +38,6 @@ void drawimage(void) {
|
||||||
int width = 0, height = 0;
|
int width = 0, height = 0;
|
||||||
char *limg = NULL;
|
char *limg = NULL;
|
||||||
|
|
||||||
if (fullscreen && !image) {
|
|
||||||
togglefullimg(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!lines || !columns || hideimage) return;
|
if (!lines || !columns || hideimage) return;
|
||||||
|
|
||||||
// load image cache
|
// load image cache
|
||||||
|
@ -53,13 +49,6 @@ void drawimage(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!image) {
|
if (!image) {
|
||||||
if (fullscreen) {
|
|
||||||
fullscreen = 0;
|
|
||||||
img.imagewidth = imagewidth;
|
|
||||||
img.imageheight = imageheight;
|
|
||||||
img.imagegaps = imagegaps;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,24 +72,11 @@ void drawimage(void) {
|
||||||
wta += menumarginv;
|
wta += menumarginv;
|
||||||
|
|
||||||
if (sp.mh != sp.bh + height + leftmargin * 2 - wtr && imageresize) { // menu height cannot be smaller than image height
|
if (sp.mh != sp.bh + height + leftmargin * 2 - wtr && imageresize) { // menu height cannot be smaller than image height
|
||||||
resizetoimageheight(imlib_image_get_height() - (fullscreen ? 2 * menumarginv : 0));
|
resizetoimageheight(imlib_image_get_height());
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_set_img(draw, imlib_image_get_data(), width, height);
|
draw_set_img(draw, imlib_image_get_data(), width, height);
|
||||||
|
|
||||||
if (fullscreen) {
|
|
||||||
xta = wta = leftmargin = 0;
|
|
||||||
draw_img(draw, (img.imagewidth - width) / 2, 0);
|
|
||||||
|
|
||||||
if (sel) {
|
|
||||||
limg = sel->image;
|
|
||||||
} else {
|
|
||||||
limg = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// render image on X11
|
// render image on X11
|
||||||
if (!imageposition) { // top mode = 0
|
if (!imageposition) { // top mode = 0
|
||||||
if (height > width)
|
if (height > width)
|
||||||
|
@ -365,10 +341,6 @@ void resizetoimageheight_x11(int imageheight) {
|
||||||
|
|
||||||
if (lines * sp.bh < imageheight + imagegaps * 2) {
|
if (lines * sp.bh < imageheight + imagegaps * 2) {
|
||||||
lines = (imageheight + imagegaps * 2) / sp.bh;
|
lines = (imageheight + imagegaps * 2) / sp.bh;
|
||||||
|
|
||||||
if (fullscreen) {
|
|
||||||
lines = imageheight / sp.bh - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_mh();
|
get_mh();
|
||||||
|
@ -464,10 +436,6 @@ void resizetoimageheight_wl(int imageheight) {
|
||||||
|
|
||||||
if (lines * sp.bh < imageheight + imagegaps * 2) {
|
if (lines * sp.bh < imageheight + imagegaps * 2) {
|
||||||
lines = (imageheight + imagegaps * 2) / sp.bh;
|
lines = (imageheight + imagegaps * 2) / sp.bh;
|
||||||
|
|
||||||
if (fullscreen) {
|
|
||||||
lines = imageheight / sp.bh - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_mh();
|
get_mh();
|
||||||
|
|
|
@ -49,7 +49,6 @@ static Key keys[] = {
|
||||||
{ 0, Shift, XK_1, setimggaps, {.i = -100 } },
|
{ 0, Shift, XK_1, setimggaps, {.i = -100 } },
|
||||||
{ 0, Shift, XK_2, setimggaps, {.i = +100 } },
|
{ 0, Shift, XK_2, setimggaps, {.i = +100 } },
|
||||||
{ 0, 0, XK_t, toggleimg, {0} },
|
{ 0, 0, XK_t, toggleimg, {0} },
|
||||||
{ 0, 0, XK_f, togglefullimg, {0} },
|
|
||||||
{ 0, 0, XK_p, paste, {.i = 2 } },
|
{ 0, 0, XK_p, paste, {.i = 2 } },
|
||||||
{ 0, 0, XK_q, flipimg, {.i = 1 } },
|
{ 0, 0, XK_q, flipimg, {.i = 1 } },
|
||||||
{ 0, 0, XK_w, flipimg, {.i = 0 } },
|
{ 0, 0, XK_w, flipimg, {.i = 0 } },
|
||||||
|
@ -125,7 +124,6 @@ static WlKey wl_keys[] = {
|
||||||
{ 0, WL_Shift, XKB_KEY_1, setimggaps, {.i = -100 } },
|
{ 0, WL_Shift, XKB_KEY_1, setimggaps, {.i = -100 } },
|
||||||
{ 0, WL_Shift, XKB_KEY_2, setimggaps, {.i = +100 } },
|
{ 0, WL_Shift, XKB_KEY_2, setimggaps, {.i = +100 } },
|
||||||
{ 0, WL_None, XKB_KEY_t, toggleimg, {0} },
|
{ 0, WL_None, XKB_KEY_t, toggleimg, {0} },
|
||||||
{ 0, WL_None, XKB_KEY_f, togglefullimg, {0} },
|
|
||||||
{ 0, WL_None, XKB_KEY_p, paste, {.i = 2 } },
|
{ 0, WL_None, XKB_KEY_p, paste, {.i = 2 } },
|
||||||
{ 0, WL_None, XKB_KEY_q, flipimg, {.i = 1 } },
|
{ 0, WL_None, XKB_KEY_q, flipimg, {.i = 1 } },
|
||||||
{ 0, WL_None, XKB_KEY_w, flipimg, {.i = 0 } },
|
{ 0, WL_None, XKB_KEY_w, flipimg, {.i = 0 } },
|
||||||
|
|
19
spmenu.1
19
spmenu.1
|
@ -1220,17 +1220,6 @@ T{
|
||||||
T}@T{
|
T}@T{
|
||||||
0
|
0
|
||||||
T}@T{
|
T}@T{
|
||||||
f
|
|
||||||
T}@T{
|
|
||||||
togglefullimg
|
|
||||||
T}@T{
|
|
||||||
0
|
|
||||||
T}
|
|
||||||
T{
|
|
||||||
0
|
|
||||||
T}@T{
|
|
||||||
0
|
|
||||||
T}@T{
|
|
||||||
p
|
p
|
||||||
T}@T{
|
T}@T{
|
||||||
paste
|
paste
|
||||||
|
@ -1240,9 +1229,9 @@ T}
|
||||||
T{
|
T{
|
||||||
0
|
0
|
||||||
T}@T{
|
T}@T{
|
||||||
Shift
|
0
|
||||||
T}@T{
|
T}@T{
|
||||||
h
|
q
|
||||||
T}@T{
|
T}@T{
|
||||||
flipimg
|
flipimg
|
||||||
T}@T{
|
T}@T{
|
||||||
|
@ -1251,9 +1240,9 @@ T}
|
||||||
T{
|
T{
|
||||||
0
|
0
|
||||||
T}@T{
|
T}@T{
|
||||||
Shift
|
0
|
||||||
T}@T{
|
T}@T{
|
||||||
v
|
w
|
||||||
T}@T{
|
T}@T{
|
||||||
flipimg
|
flipimg
|
||||||
T}@T{
|
T}@T{
|
||||||
|
|
1
spmenu.c
1
spmenu.c
|
@ -203,7 +203,6 @@ static int *sel_index = NULL;
|
||||||
static unsigned int sel_size = 0;
|
static unsigned int sel_size = 0;
|
||||||
static int protocol_override = 0;
|
static int protocol_override = 0;
|
||||||
static int itemn = 0;
|
static int itemn = 0;
|
||||||
static int fullscreen = 0;
|
|
||||||
|
|
||||||
#if USERTL
|
#if USERTL
|
||||||
static int isrtl = 1;
|
static int isrtl = 1;
|
||||||
|
|
Loading…
Reference in a new issue