Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Issues #17

Closed
ktb92677 opened this issue Oct 5, 2015 · 9 comments
Closed

Issues #17

ktb92677 opened this issue Oct 5, 2015 · 9 comments

Comments

@ktb92677
Copy link

ktb92677 commented Oct 5, 2015

Hey! Thanks as always for fixing these issues so quickly. I've got a few more for you.

  1. On lines 4574 and 4575 looks like you are doing the following:

scroll.w = scroll.w;
scroll.x = scroll.x;

Were you trying to do something else?

  1. Doesn't demo.c need the following lines appended to the top?

define LEN(a) (sizeof(a)/sizeof(a)[0])

define UNUSED(a) ((void)(a))

include <stdarg.h>

include "zahnrad.h"

void clipboard_set(const char text){UNUSED(text);}
zr_bool clipboard_is_filled(void){return zr_false;}
const char
clipboard_get(void) {return NULL;}

I've found it doesn't compile without this (at least on Windows).

  1. Scroll bar is a little bit glitchy. It only scrolls up and down when the mouse is exactly over it. There should be a bit of wiggle room. I'd suggest the following logic:

bool flag = false;
if (mouse.clicked_on_Scrollbar()) { flag = true; }
if (flag && mouse.unclicked) { flag = false; }

if (flag) {
//scroll scroll bar distance mouse has moved in the y direction regardless of x
scrollbar.scroll(mouse.prev_x - mouse.curr_x);
}

  1. Backspace doesn't seem to work right (at least on the windows demo). When I click backspace (on demo.c, also important to note here that I did do a bunch of "ctrl" operations before I noticed the issue) it adds characters to the input box.

Anyways thanks for reading and I look forward to an update!

@vurtun
Copy link
Owner

vurtun commented Oct 5, 2015

Hey,
1.) Unused variables
These previously had more zero check logic to it but it was moved higher up in the function so they are left overs and I removed them.
2.) Helper macros
Yeah stupid mistake, I copied each macro into each platform instead of placing them in the demo.c file. Should be fixed now
3.) Scrollbars
Up to this point I never had problems with scrolling but I can take a look at it tomorrow.
4.) Backspace
Which platform do you use for input? SDL, or directly over win32 or other, that would at least narrow done the problem, since at the moment I have no idea why that is. Will probably have to check that out tomorrow as well.

@ktb92677
Copy link
Author

ktb92677 commented Oct 5, 2015

I've literally just copied and pasted your win32 example into the MinGW compiler. in reference to number 4.

@vurtun
Copy link
Owner

vurtun commented Oct 5, 2015

Ah OK, that makes sense I just saw that I forgot to update win32 input handling to this library version. So it shouldn't be to much trouble to fix the problem.

@ktb92677
Copy link
Author

ktb92677 commented Oct 5, 2015

Oh cool! Do you think you could quickly show me what the fix is before you push it live?

@vurtun
Copy link
Owner

vurtun commented Oct 6, 2015

OK I fixed the backspace and key behavior. The problem was that I checked the wrong parameter in win32's MSG struct in the key function. I checked msg->lParam but should have checked
msg->wParam. In addition the check inside the text function was wrong I used && instead of ||. So just some stupid mistakes.

@ktb92677
Copy link
Author

ktb92677 commented Oct 7, 2015

I can confirm everything is working now!

Have you looked into the scroll bar issue?

@vurtun
Copy link
Owner

vurtun commented Oct 8, 2015

I looked at the scrollbar problem and things got a little bit more complicated. The reason why the scrollbar behaves like it does is because I don't want to store another flag with each scrollbar. Since each window and more importantly subwindows (popups, groups, shelfs ...) would all need another variable that needs to be stored by the user. This is generally a problem with dragging in my library which would have to be based on permanent dragging state. But in general up to this point I never had problems with scrolling, especially since you can still scroll by mouse (at least in windows).

In general there are some more cases in this library with this kind of problem for example text that spans over the editbox bounds uses frames instead of scrolling to move to the left and a few other smaller cases which are hard to handle since everything can change and almost no state is stored.

There would be a solution to fix and get all this and other things that bother me with this library right but it would require to rewrite everything (2-4kLoc) except the base (buffer, commands, vertex buffer, font handling, editbuffer). In general I would have no problem doing exactly that but I would have to totally rewrite and change the API, a lot of really hard to get right parts of the library like window and all subwindow handling and explore and iterate a lot. While even all that would not really bother me the fact that I worked on it for 7-10 month does, at least at the moment I just want to fix bugs that come up and learn and explore other things. I will probably come back in the future and fork this library and try to do all that but at the moment I am just tired of all these complete rewrites.

@vurtun vurtun closed this as completed Oct 8, 2015
@dumblob
Copy link
Contributor

dumblob commented Oct 8, 2015

at the moment I am just tired of all these complete rewrites.

That's completely understandable. You did a great job! Thanks a lot!

I'll try to promote Zahnrad everywhere, where possible, because I see a great opportunity in the future (be it Zahnrad, or rather the new fork with the mentioned issues solved).

@vurtun vurtun reopened this Nov 10, 2015
@vurtun
Copy link
Owner

vurtun commented Nov 10, 2015

Scroll bar is a little bit glitchy. It only scrolls up and down when the mouse is exactly over it. There should be a bit of wiggle room.

OK I found a solution (more like a hack) to fix the the scrollbar behavior. I use the input structure to update the clicked position with the cursor movement which works nicely and as so far no downside the user input behavior. Biggest downside is of course that I have to remove const correctness for the input struct inside the context/window but I think it is worth it.

@vurtun vurtun closed this as completed Nov 10, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants