-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gtk v0.1.0 refactoring updates #36
Conversation
Thanks for doing this. We might even decide to make Gtk the default. But, making a copy of a whole bunch of code is not going to work (only a few lines of it are even different). |
Also, while I'm not sure I'd push for identical GUI APIs implemented with both Tk and Gtk as alternate backends, it shouldn't be necessary to use things like |
I realized that too Jeff (both the file copying, and the button constants issues). I could also point out that the only changes I needed to make were to code where you were still breaking the abstraction and assigning / calling functions directly to members of the Tk types. I was delaying this pull request because of these issues, but realized that I may not have much time to make updates in the next few weeks, so figured I can at least make this much available. I was hoping we can discuss this in realtime (perhaps the upcoming IRC sprint). I think they can have nearly identical GUI API's (except for layout). |
Yes, let's do that. It'd be nice to settle on high-level APIs at least for the simple stuff. In this case, assigning to e.g. |
bump. Can this be merged now? |
Yes, if the changes to canvas3d.jl are removed. Having code that checks everywhere whether we are using tk or gtk is insane. The development of that code will be all but stopped by having to do everything twice. We might use GTK as a backend, but we aren't going to use its API, which is designed for C. Notice how my part of the Tk bindings (Tk/src/tkwidget.jl) does not really expose the Tk API. For example you don't write |
I'm starting a related discussion here: JuliaGraphics/Tk.jl#35 |
@JeffBezanson bump. |
Ok, that's fair. We should sync up the meanings of these. My I propose the following:
I will make these changes in Tk.jl and Winston/src/tk.jl, and you can make them in canvas3d.jl, then I will merge this. |
I use redraw in the same way, but I think the name is correct. I propose the following:
optional:
|
If we have |
Ah, OK. That is something quite different. If we want to say that the user is responsible for not calling draw() until after the configure callback is called, (as I think we have now) that is seems fine. It's just a question of whether we want to have immediate drawing (buffered), or callback (immediate) drawing available. |
My thinking is based on the fact that only the toolkit knows when the window resizes and so must push that info to you, but only you know when something has changed that requires a redraw. I don't believe the gui toolkit ever needs to request an application-level redraw (i.e. rerendering geometry), since it can refresh screen areas out of its backing store. |
Yes, the callback style is only advantageous if we want to allow unbuffered (high-speed?) writes. |
I don't consider unbuffered drawing useful at all, but we could still support it by providing a way to tell the window to store a snapshot in its backing store at an appropriate time. |
I seems that nearly all graphics libraries are written to provide this. But I agree that that speed (and perhaps more importantly, memory) of modern computers has probably made it mostly unnecessary.
Yes, lets do this. It is much more clear.
I'm not sure this distinction is meaningful, when both the drawing code and the mouse handlers are provided by the user. It probably makes the most sense for draw to end with a call to reveal. I think it is enough to say that the user may call draw on the backing store anytime after the configure callback has been fired (and must do so in the configure callback at minimum). |
Ok. It's not terrible for the |
ok, that makes sense. on the other hand, only the drawing code would know if the call to reveal is necessary (or if only a part has been updated). are you just figuring that is an unnecessary optimization? |
Yes, I consider that an unnecessary optimization. There also might be other ways to get it, such as returning a bounding box of the changed region, so higher level code can aggregate and act on them. You also might be drawing many things, and it would clearly be wrong for all of them to call reveal. |
Gtk v0.1.0 refactoring updates
This updates the Winston Gtk backend code to work against Gtk v0.1.0 (previous code worked against v0.0.0) and it provides a port of the canvas3d demo to Gtk.