Hello Tamas,
I'm experimenting with the xlib-context and have modified lines 170 and 172 to set maxheight and maxwidth to a large number.
This allows the resulting Xlib window to be resizable.
Before I continue down this path, I'd like to know whether you are open to the idea of expanding xlib-context so that it can play host to an interactive UI, instead of only *presenting* graphics. I'm thinking about creating a mechanism for passing along Xlib events etc. to a code that consumes cl-cairo2.
Joubert
On Thu, Aug 30, 2007 at 10:58:40PM -0400, Joubert Nel wrote:
Hello Tamas,
I'm experimenting with the xlib-context and have modified lines 170 and 172 to set maxheight and maxwidth to a large number.
This allows the resulting Xlib window to be resizable.
Before I continue down this path, I'd like to know whether you are open to the idea of expanding xlib-context so that it can play host to an interactive UI, instead of only *presenting* graphics. I'm thinking about creating a mechanism for passing along Xlib events etc. to a code that consumes cl-cairo2.
Hi Joubert,
Generally, I am happy to accept contributions.
However, I don't really understand what you are doing. Presenting graphics is very simple and can be done with little user interaction, since the flow of data is one way (Lisp application -> pixmap buffer -> X11 display). This allows a particularly simple event model, where I can start the event loops as threads and the "main" application doesn't need to care about them any longer. This suits me fine, the purpose of this context was that I could debug my cairo code while watching stuff happen on screen.
In an application where the GUI is not a sideshow but the main feature, you would have a single event loop that orchestrates everything, including GUI management and whatever background processes you need. Plain vanilla Xlib is not really suitable for that, as it is a pain in the ass to program. That's why people came up with toolkits like Gtk or Qt. I would suggest that you familiarize yourself with the framework of your choice, and then ask on the appropriate mailing list (cairo list is a good place to start).
The only thing to keep in mind is that cl-cairo2 will need an Xlib display, a visual and a drawable to create a surface. Once you have that, you can use all the drawing efunctions and take care of syncing in the event loop. If I recall correctly, I have seen some gtk & cl library which would be suitable, but I can't recall which.
Maybe I can help more if you tell us what it is you are trying to achieve (what kind of application etc). Do you have any prior experience with using any of the X toolkits?
HTH,
Tamas
On Fri, 2007-08-31 at 17:40 +0200, Tamas K Papp wrote:
On Thu, Aug 30, 2007 at 10:58:40PM -0400, Joubert Nel wrote:
Hello Tamas,
I'm experimenting with the xlib-context and have modified lines 170 and 172 to set maxheight and maxwidth to a large number.
This allows the resulting Xlib window to be resizable.
Before I continue down this path, I'd like to know whether you are open to the idea of expanding xlib-context so that it can play host to an interactive UI, instead of only *presenting* graphics. I'm thinking about creating a mechanism for passing along Xlib events etc. to a code that consumes cl-cairo2.
In an application where the GUI is not a sideshow but the main feature, you would have a single event loop that orchestrates everything, including GUI management and whatever background processes you need. Plain vanilla Xlib is not really suitable for that, as it is a pain in the ass to program. That's why people came up with toolkits like Gtk or Qt. I would suggest that you familiarize yourself with the framework of your choice, and then ask on the appropriate mailing list (cairo list is a good place to start).
Yes, perhaps I wasn't explicit enough. I am building a widget toolkit that aims to be smaller in scope yet fundamentally more flexible than either Gtk or Qt. The ideas are taken from the WPF in the .NET Framework 3.0, which I know very well.
In other words, I would need to extend the xlib bits in cl-cairo2 so that my widget toolkit can consume lower-level events that Xlib would pass, e.g. mousedown, resize window, key down, etc.
Maybe I can help more if you tell us what it is you are trying to achieve (what kind of application etc). Do you have any prior experience with using any of the X toolkits?
So, I'm building a widget toolkit that aims to provide the bits I want from the WPF model, because its content model makes it easy for users to build new powerful controls that are composed of other controls and also do data and visual templating.
I have; however, I haven't found anything that has something like the powerful content model that WPF (on Windows - .NET Framework 3.0) does. None of these toolkits' project pages seem to indicate that they're going to move in this direction either.
I guess I'm trying to figure out which lower-level library I want to use for the drawing + low level events in X.
Joubert
On Fri, Aug 31, 2007 at 12:27:44PM -0400, Joubert Nel wrote:
Yes, perhaps I wasn't explicit enough. I am building a widget toolkit that aims to be smaller in scope yet fundamentally more flexible than either Gtk or Qt. The ideas are taken from the WPF in the .NET Framework 3.0, which I know very well.
That's quite a tall order ;-)
In other words, I would need to extend the xlib bits in cl-cairo2 so that my widget toolkit can consume lower-level events that Xlib would pass, e.g. mousedown, resize window, key down, etc.
I think that you are better off rendering to an X11 pixmap directly (without the whole surrounding code) and doing things in your own event loop. The current Xlib context of cl-cairo2 has subtle but annoying bugs that show up under a stress test, I will rewrite the whole thing soon anyway, so I would not recommend extending it.
I guess I'm trying to figure out which lower-level library I want to use for the drawing + low level events in X.
Cairo is great for doing the drawing in quite a sophisticated way. I would suggest that you use cl-cairo2, but instead of just taking the current Xlib context, render into a plain X11 pixmap or a cairo image surface (basically, just a chunk of memory).
HTH,
Tamas
cl-cairo2-devel@common-lisp.net