gabrielzschmitz / Tomato.C

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

I'm not able to see the notebook or to add a note/task #40

Closed CarlosCraveiro closed 5 months ago

CarlosCraveiro commented 5 months ago

I'm using NixOS, and I have built the application by running the following

git clone https://github.com/gabrielzschmitz/Tomato.C.git
cd Tomato.C
nix develop
nix build
nix run

When I try to add a note I don't see the "cute notebook", only getting what appears to be a white cursor...however, when I try to add a note, sometimes I can type something, sometimes I get a segmentation fault.

Screenshot-2024-03-23_17-34-03 Screenshot-2024-03-23_17-34-49

MeowRosya commented 5 months ago

You may not be able to see because the color of the ascii charactrers in the notebook matches the color of the background. I faced the same problem and it was solved by changing the color of background.

gabrielzschmitz commented 5 months ago

Yeah, not sure about the segmentation fault. But the black in black print should be resolved now! Try git pulling the project and reinstalling.

Try fixing it first, than I will take a look at the notepad problem.

CarlosCraveiro commented 5 months ago

Now the notepad works! Screenshot-2024-03-23_21-27-36

CarlosCraveiro commented 5 months ago

However, as for seg-faults. Apparently, they occur when I accidentally end up changing the Pomodoro, like skipping steps or pausing it when I'm inside the notebook.

gabrielzschmitz commented 5 months ago

Should be fixed! I've really just forgot to block the skip input out of pomodoro... Added mouse support to the skip icon too, you can just click it now!

CarlosCraveiro commented 5 months ago

Apparently it's working now. However, I noticed that I'm also getting segmentation faults inside the Pomodoro screen. Either by pressing 's' to skip or using the mouse. I also think that smoke should be comming out of the coffee...

Skip_bug_click

gabrielzschmitz commented 5 months ago

Don't have any idea about it yet...

gabrielzschmitz commented 5 months ago

Try this patch at input.c:

--- input.c 2024-03-24 10:56:42.455462772 -0300
+++ input.c 2024-03-24 10:56:49.376571068 -0300
@@ -361,7 +361,7 @@

       case CTRLS:
       case 's':
-        if (app->currentMode >= 1 && app->currentMode <= 3) app->timer = 0;
+        if (app->currentMode >= 1 && app->currentMode <= 3) app->timer = 2;
         break;

       case ESC:
@@ -867,7 +867,7 @@
   if (app->currentMode >= 1 && app->currentMode <= 3) {
     if (event.y == (app->middley - 7) && (app->middlex - 10) >= event.x &&
         event.x >= (app->middlex - 11)) {
-      if (event.bstate & BUTTON1_PRESSED) app->timer = 0;
+      if (event.bstate & BUTTON1_PRESSED) app->timer = 2;
     }
   }
 }

Copy this code to a patch.diff file in the repository directory and just run the patch command:

patch input.c < patch.diff

Than, you just need to recompile the app to take effect:

sudo make clean install

Does this help?

CarlosCraveiro commented 5 months ago

Apparently the problem was an uninitialized variable app->machineFrame.