gabrielzschmitz / Tomato.C

A pomodoro timer written in pure C.
GNU General Public License v3.0
315 stars 19 forks source link

Compilation issues with mpv and ncurses #29

Closed szchenshixi closed 11 months ago

szchenshixi commented 11 months ago

I love the cool design with cute interfaces and animation. This would surely add some fun to my poor server board.

However, I ran into some problems compiling the project in my environment. It seems that the tomato.c file is hard-coded to <mpv/mpv.h>, which means it won't compile without having mpv installed. Even when I disabled the mpv-related variables in config.h, it still wouldn't work. I guess static variables aren't checked during compilation, so that makes sense.

The same thing happened for <ncurses.h>. My system does have ncurses installed, but it might be too old to include the BUTTON5_PRESSED macro that's needed at input.c:690.

I think it would be helpful if you could include a few system macros that allow disabling external libraries like mpv and ncurses. But anyway thanks and keep up with the great work!

gabrielzschmitz commented 11 months ago

Sure, I can remove the mpv depedencie. But the ncurses need to be hardcoded!

gabrielzschmitz commented 11 months ago

Try it now! You'll need to comment the MPVTOGGLE at config.mk and toggle off the SOUND and the NOISE from config.h This way the only requirement is ncurses.

szchenshixi commented 11 months ago

Cool! It worked like a charm after I did what you said to disable the mpv. For the ncurses compatibility, I tweaked input.c a bit at around line 675 to make the compiler happy with my old version. This totally works for me since I do not use the sound function anyway.

// input.c:675
if((app->printVolume == 1) && (event.bstate & BUTTON3_PRESSED))          // <--- was BUTTON5_PRESSED
    controlVolumeNoise(app, 1, '-');
else if((app->printVolume == 1) && (event.bstate & BUTTON4_PRESSED))
    controlVolumeNoise(app, 1, '+');
if((app->printVolume == 2) && (event.bstate & BUTTON3_PRESSED))          // <--- was BUTTON5_PRESSED
    controlVolumeNoise(app, 2, '-');
else if((app->printVolume == 2) && (event.bstate & BUTTON4_PRESSED))
    controlVolumeNoise(app, 2, '+');
if((app->printVolume == 3) && (event.bstate & BUTTON3_PRESSED))          // <--- was BUTTON5_PRESSED
    controlVolumeNoise(app, 3, '-');
else if((app->printVolume == 3) && (event.bstate & BUTTON4_PRESSED))
    controlVolumeNoise(app, 3, '+');
if((app->printVolume == 4) && (event.bstate & BUTTON3_PRESSED))          // <--- was BUTTON5_PRESSED
    controlVolumeNoise(app, 4, '-');
else if((app->printVolume == 4) && (event.bstate & BUTTON4_PRESSED))
    controlVolumeNoise(app, 4, '+');

Here attaches a working snapshot of the program. Great work! image

szchenshixi commented 11 months ago

Sorry for posting the wrong image with a glitch icon at the left-top corner. I got it fixed by modifying the config.h file with the line from static const char * ICONS = "nerdicons"; to static const char * ICONS = "iconson";, although it is weird enough the icon did not show up since I do have a Nerd Font. Anyway, I like this interface: image