FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

duit pre-release for dmd 1.00
Goto page Previous  1, 2
 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
Auria



Joined: 29 May 2006
Posts: 44

PostPosted: Fri Jan 12, 2007 1:53 pm    Post subject: Reply with quote

Actually the page you pointed out is the *native* version of GTK for mac. It's yet unusable

However, it is, as of now, possible to run GTK for mac via X11, a "fake" X server for mac, and it works all correctly.

as far as i know you can compile just like on linux, with 'pkg-config'. If a build system was built, it probably could work not too hard. (right now it doesn't seem to work - is it me or are there no install instructions? anyway setup refuses to execute on mac, maybe it can't run on PPC?)
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Fri Jan 12, 2007 3:44 pm    Post subject: Reply with quote

Auria wrote:
...
anyway setup refuses to execute on mac, maybe it can't run on PPC?)

At the very least you need to recompile it.

and setup (the new installer) isn't finished yet - I think it's fine for Linux
but it fails on the second step on windows (compiling the tests).

I shouldn't have replaced the zip and tar yet, to many automatisms...

This will be a developers release anyway.

Ant
Back to top
View user's profile Send private message
hauptmech



Joined: 14 Jan 2007
Posts: 20
Location: Wellington, NZ

PostPosted: Wed Jan 17, 2007 2:00 am    Post subject: re: compd Reply with quote

I just pulled down the svn of duit...

It would be helpful to mention in duit README that installing the dool (compd) project is a prerequisite. Being new to all this I had never heard of it and finding it through google was not straightforward.

(and oddly enough didn't notice the INSTALL file until after I posted this...)
_________________
-hauptmech
Back to top
View user's profile Send private message
kaarna



Joined: 03 Apr 2006
Posts: 92
Location: Finland

PostPosted: Sat Jan 20, 2007 6:43 pm    Post subject: Cairo isn't working yet... Reply with quote

I've just been testing the new version for the past week, and the first thing I noticed, was that Cairo is not yet usable because of those couple of functions missing. Here's a short tutorial on how it could be done to make it work. I didn't have time to go through the APIlookup.txt files, so again I hand edited some files to make it work.

If anyone of you real Duit developers could take a look here, and add these changes (or similar changes) to the Duit svn version. That would be much appreciated, as every time I get a new version, I have to make these changes by hand. (And I guess I should be able to do it automatically by keeping a local copy of the Duit svn, and merging the changes everytime I checkout Duit, but I haven't had the time to learn svn yet.)


1. I've created a new file called /src/gdk/GdkCairo.d.

Here's the contents of that file without comments:
Code:

module gdk.GdkCairo;
private import gdk.gdktypes;
private import lib.gdk;
private import cairoLib.cairoLibtypes;
private import cairoLib.Cairo;
private import gdk.Drawable;

public class GdkCairo
{
   public static Cairo createFromDrawable(Drawable drawable)
   {
      // cairo_t* gdk_cairo_create (GdkDrawable *drawable);
      return new Cairo( gdk_cairo_create((drawable is null) ? null : drawable.getDrawableStruct()) );
   }
}

As you can see, we need a way to make a new cairo context from a drawable.
This function could as well be just:
Code:

public static Cairo create(Drawable drawable)...

if you'd prefer a simpler function name.

2. /src/build/duit.d approximately line 180 add:
Code:

private import gdk.GdkCairo;


3. /src/cairo/cairoLibtypes.d line 35 comment out or replace the line with
the Drawable like this:
Code:

   //private alias void* Drawable; //the old thing.
   public import gdk.Drawable; //our new thing.


4. /src/gtk/Widget.d line 193 add a new function:
Code:

   Window getWindow()
   {
      //GtkWidget* wid = cast(GtkWidget*)getStruct();
      //return new Window( cast(GdkWindow*) wid.window );
      int* pt =cast(int*)getStruct();
      pt += 52/4;
      return new Window(cast(GdkWindow*)(*pt));
   }


5. /src/lib/gdk.d line 656 add a few lines:
Code:

   //gdk.GdkCairo
   cairo_t*  function(GdkDrawable *drawable)gdk_cairo_create;

and /src/lib/gdk.d (that same file) line 1189 (end of the list):
Code:

   { "gdk_cairo_create", cast(void**)& gdk_cairo_create},


That's it!

I'll try to post some examples and a working build of Duit with Cairo, on my website, when I'll get the time.

Otherwise, I've had no problems with the new version of Duit.
Back to top
View user's profile Send private message AIM Address MSN Messenger
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Sat Jan 20, 2007 11:26 pm    Post subject: Re: Cairo isn't working yet... Reply with quote

satelliittipupu wrote:
...Cairo is not yet usable because of those couple of functions missing. Here's a short tutorial on how it could be done to make it work....

Otherwise, I've had no problems with the new version of Duit.

Thank you!
added it to APILookupCairo

except the getWindow()
do you need it?
is it the same as getDrawable() ?

Ant
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Sat Jan 20, 2007 11:44 pm    Post subject: Re: Cairo isn't working yet... Reply with quote

Ant wrote:
satelliittipupu wrote:
...Cairo is not yet usable because of those couple of functions missing. Here's a short tutorial on how it could be done to make it work....

Otherwise, I've had no problems with the new version of Duit.

Thank you!
added it to APILookupCairo

except the getWindow()
do you need it?
is it the same as getDrawable() ?

Ant


OK, I added the getWindow.

also added your cairo clock demo to the demos/cairo - it's perfect.
I'm gonna add it to the DuitTests

Ant
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Sun Jan 21, 2007 12:00 am    Post subject: Re: Cairo isn't working yet... Reply with quote

Ant wrote:

I'm gonna add it to the DuitTests

Ant


I added it and now I notice it takes 10? of my CPU when maximized and visible.
Is that expected?
takes 45? if I change the timeout to 250 (from 1000).
can we do anything about it? changing the backend? how?

(Pentium D 820 - 10? of one of the cores)

Ant
Back to top
View user's profile Send private message
kaarna



Joined: 03 Apr 2006
Posts: 92
Location: Finland

PostPosted: Sun Jan 21, 2007 8:28 am    Post subject: Re: Cairo isn't working yet... Reply with quote

Ant wrote:

I added it and now I notice it takes 10? of my CPU when maximized and visible.
Is that expected?
takes 45? if I change the timeout to 250 (from 1000).
can we do anything about it? changing the backend? how?

(Pentium D 820 - 10? of one of the cores)
Ant


Hmm. I'm not an expert on Cairo (yet), but it must have something to do with the timeout??? I have my own app which doesn't have a timeout for rendering, and I only render the parts that have changed and it doesn't take almost any resources when it's idle. So I guess that would only be a problem with some continuos movement.

Cairo is said to be slow, and they are working on the performance (I've heard they are going to have a new tessellator which is a lot faster, and that should make drawing with the default backend a lot faster).

But it is possible to change the drawing backend to glitz, which will draw with OpenGL, and it's alot faster. But it only works on some newer versions of Cairo. Here's a tutorial on how to make glitz work in C: http://cairographics.org/OpenGL
Look for "Something with a bit more glitz". But I haven't gotten that working yet, as I don't know how to update the cairolibs to the newer versions on my Ubuntu 6.06. I'm going to update my whole Ubuntu to Feisty Fawn as soon as the final version is released.

And regarding the question about do we need getWindow(): Yes I think it's needed. The cairo clock example uses it for telling the window which part has to be redrawn (using the invalidateRect() function).

One more thing I noticed today was that Cairo.setSource(cairo_pattern_t*) takes only cairo_pattern_t* and not Pattern objects as it's argument. This means that it's impossible to draw gradients at the moment. (If getStruct() was public, it would be possible, but not clean offcourse). So propably almost all of the occurrences of "cairo_pattern_t*" in Cairo.d should be replaced with "Pattern", but I haven't tested that yet...

I'll test some more in the coming months. As I'm working on my own app.
Back to top
View user's profile Send private message AIM Address MSN Messenger
kaarna



Joined: 03 Apr 2006
Posts: 92
Location: Finland

PostPosted: Sun Jan 21, 2007 8:40 am    Post subject: Reply with quote

I just noticed that there's a getPatternStruct() that is public, and it allows me to make it work for now.
Back to top
View user's profile Send private message AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group