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

Converting from DUI to Duit
Goto page Previous  1, 2
 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
h3r3tic



Joined: 30 Mar 2004
Posts: 261
Location: Torun, Poland

PostPosted: Thu Apr 06, 2006 5:47 am    Post subject: Reply with quote

larsivi wrote:
I'm on Kubuntu Dapper, while h3r3tic tried some Suse.

SuSE 10 Evaluation Smile

Ant:
Constructors of the Value class are buggy. At least the versions that take char[] and int. You call setString and setInt in them, but these functions are commented to work only on intialized GValue's. Thus g_value_init(gValue, GType.STRING) and g_value_init(gValue, GType.INT) need to be added before toString and toInt respectably in this(char[]) and this(int) in gobject.Value.Value Smile
Back to top
View user's profile Send private message MSN Messenger
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Thu Apr 06, 2006 6:19 am    Post subject: Reply with quote

h3r3tic wrote:
larsivi wrote:
I'm on Kubuntu Dapper, while h3r3tic tried some Suse.

SuSE 10 Evaluation Smile

Ant:
Constructors of the Value class are buggy. At least the versions that take char[] and int. You call setString and setInt in them, but these functions are commented to work only on intialized GValue's. Thus g_value_init(gValue, GType.STRING) and g_value_init(gValue, GType.INT) need to be added before toString and toInt respectably in this(char[]) and this(int) in gobject.Value.Value Smile


Great! Smile Thanks, h3r3tic, another two beers coming up.

Ant: This does at least give me all the visuals of the gui, although interesting things still seems to happen. I'll come back with more reports if necessary Smile
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Thu Apr 06, 2006 8:10 am    Post subject: Reply with quote

So you tried changing the ctors and it worked? excelent!
I'll make those changes.

if you want to start to understand how the wrapping works look at
http://www.dsource.org/projects/dui/browser/trunk/wrap/APILookupGObject.txt?rev=141#L234

every thing between "code: start" and "code: end" is copyed to the actual Value.d module.

Keep the bugs (and corrections) comming!

You think we'll be able to announce Duit on the D groups soon?

thanks larsivi,
thanks h3r3tic,

BTW you have the same lib versions I have, I'm also on Dapper (ubuntu).
some how the idle callback is too high priority do you have that also?

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


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Thu Apr 06, 2006 8:25 am    Post subject: Reply with quote

Ant wrote:

You think we'll be able to announce Duit on the D groups soon?


Probably Smile I seem to be able to do actual development now.

Quote:

some how the idle callback is too high priority do you have that also?

Ant


I only use the timeout callback for now.
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Thu Apr 06, 2006 4:06 pm    Post subject: Reply with quote

Ant,

Windows version is now working again, but you need to make a couple of changes first. I don't know how to modify your scripting system; maybe you can do it? I couldn't be bothered to try to figure it out right now.

Here's what I did. Most of these are windows specific fixes I guess. I don't know why linux is different (the difference doesn't make sense to me):

The main problem is that you have that you need to move most of the gdk_pixbuf_* functions out of the lib/gdk.d loader and into the lib/gdkpixbuf.d loader as we discussed before (except 7 pixbuf functions that nee to remain in gdk). I don't know why linux is different in this regard: linux appears to put all the pixbuf functions in gdk? I'll have to check on that. It's strange that windows doesn't.

First change,

For now add:

Code:

version (Windows)
    private import lib.gdkpixbuf;


to gdk/Pixbuf.d

Next remove this section from lib/gdk.d (starting at line 310, I think):

Code:

   GType function()gdk_pixbuf_get_type;
   GdkPixbuf* function(guchar* data, GdkColorspace colorspace, gboolean hasAlpha, int bitsPerSample, int width, int height, int rowstride, GdkPixbufDestroyNotify destroyFn, gpointer destroyFnData)gdk_pixbuf_new_from_data;
   GdkPixbuf* function(char** data)gdk_pixbuf_new_from_xpm_data;
   GdkPixbuf* function(gint dataLength, guint8* data, gboolean copyPixels, GError** error)gdk_pixbuf_new_from_inline;
   GdkPixbuf* function(GdkPixbuf* srcPixbuf, int srcX, int srcY, int width, int height)gdk_pixbuf_new_subpixbuf;
   GdkPixbuf* function(GdkPixbuf* pixbuf)gdk_pixbuf_copy;
   GdkColorspace function(GdkPixbuf* pixbuf)gdk_pixbuf_get_colorspace;
   int function(GdkPixbuf* pixbuf)gdk_pixbuf_get_n_channels;
   gboolean function(GdkPixbuf* pixbuf)gdk_pixbuf_get_has_alpha;
   int function(GdkPixbuf* pixbuf)gdk_pixbuf_get_bits_per_sample;
   guchar* function(GdkPixbuf* pixbuf)gdk_pixbuf_get_pixels;
   int function(GdkPixbuf* pixbuf)gdk_pixbuf_get_width;
   int function(GdkPixbuf* pixbuf)gdk_pixbuf_get_height;
   int function(GdkPixbuf* pixbuf)gdk_pixbuf_get_rowstride;
   gchar* function(GdkPixbuf* pixbuf, gchar* key)gdk_pixbuf_get_option;
   GdkPixbuf* function(char* filename, GError** error)gdk_pixbuf_new_from_file;
   GdkPixbuf* function(char* filename, int width, int height, GError** error)gdk_pixbuf_new_from_file_at_size;
   GdkPixbuf* function(char* filename, int width, int height, gboolean preserveAspectRatio, GError** error)gdk_pixbuf_new_from_file_at_scale;
   gboolean function(GdkPixbuf* pixbuf, char* filename, char* type, char** optionKeys, char** optionValues, GError** error)gdk_pixbuf_savev;
   gboolean function(GdkPixbuf* pixbuf, char* filename, char* type, GError** error, ... )gdk_pixbuf_save;
   gboolean function(GdkPixbuf* pixbuf, GdkPixbufSaveFunc saveFunc, gpointer userData, char* type, GError** error, ... )gdk_pixbuf_save_to_callback;
   gboolean function(GdkPixbuf* pixbuf, GdkPixbufSaveFunc saveFunc, gpointer userData, char* type, char** optionKeys, char** optionValues, GError** error)gdk_pixbuf_save_to_callbackv;
   gboolean function(GdkPixbuf* pixbuf, gchar** buffer, gsize* bufferSize, char* type, GError** error, ... )gdk_pixbuf_save_to_buffer;
   gboolean function(GdkPixbuf* pixbuf, gchar** buffer, gsize* bufferSize, char* type, char** optionKeys, char** optionValues, GError** error)gdk_pixbuf_save_to_bufferv;
   GdkPixbuf* function(GdkPixbuf* src, int destWidth, int destHeight, GdkInterpType interpType)gdk_pixbuf_scale_simple;
   void function(GdkPixbuf* src, GdkPixbuf* dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, GdkInterpType interpType)gdk_pixbuf_scale;
   GdkPixbuf* function(GdkPixbuf* src, int destWidth, int destHeight, GdkInterpType interpType, int overallAlpha, int checkSize, guint32 color1, guint32 color2)gdk_pixbuf_composite_color_simple;
   void function(GdkPixbuf* src, GdkPixbuf* dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, GdkInterpType interpType, int overallAlpha)gdk_pixbuf_composite;
   void function(GdkPixbuf* src, GdkPixbuf* dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, GdkInterpType interpType, int overallAlpha, int checkX, int checkY, int checkSize, guint32 color1, guint32 color2)gdk_pixbuf_composite_color;
   GdkPixbuf* function(GdkPixbuf* src, GdkPixbufRotation angle)gdk_pixbuf_rotate_simple;
   GdkPixbuf* function(GdkPixbuf* src, gboolean horizontal)gdk_pixbuf_flip;
   GdkPixbuf* function(GdkPixbuf* pixbuf, gboolean substituteColor, guchar r, guchar g, guchar b)gdk_pixbuf_add_alpha;
   void function(GdkPixbuf* srcPixbuf, int srcX, int srcY, int width, int height, GdkPixbuf* destPixbuf, int destX, int destY)gdk_pixbuf_copy_area;
   void function(GdkPixbuf* src, GdkPixbuf* dest, gfloat saturation, gboolean pixelate)gdk_pixbuf_saturate_and_pixelate;
   void function(GdkPixbuf* pixbuf, guint32 pixel)gdk_pixbuf_fill;
*/


and add those same functions to lib/gdkpixbuf.d

Also remove:

Code:

   { "gdk_pixbuf_get_type",  cast(void**)& gdk_pixbuf_get_type},
   { "gdk_pixbuf_new_from_data",  cast(void**)& gdk_pixbuf_new_from_data},
   { "gdk_pixbuf_new_from_xpm_data",  cast(void**)& gdk_pixbuf_new_from_xpm_data},
   { "gdk_pixbuf_new_from_inline",  cast(void**)& gdk_pixbuf_new_from_inline},
   { "gdk_pixbuf_new_subpixbuf",  cast(void**)& gdk_pixbuf_new_subpixbuf},
   { "gdk_pixbuf_copy",  cast(void**)& gdk_pixbuf_copy},
   { "gdk_pixbuf_get_colorspace",  cast(void**)& gdk_pixbuf_get_colorspace},
   { "gdk_pixbuf_get_n_channels",  cast(void**)& gdk_pixbuf_get_n_channels},
   { "gdk_pixbuf_get_has_alpha",  cast(void**)& gdk_pixbuf_get_has_alpha},
   { "gdk_pixbuf_get_bits_per_sample",  cast(void**)& gdk_pixbuf_get_bits_per_sample},
   { "gdk_pixbuf_get_pixels",  cast(void**)& gdk_pixbuf_get_pixels},
   { "gdk_pixbuf_get_width",  cast(void**)& gdk_pixbuf_get_width},
   { "gdk_pixbuf_get_height",  cast(void**)& gdk_pixbuf_get_height},
   { "gdk_pixbuf_get_rowstride",  cast(void**)& gdk_pixbuf_get_rowstride},
   { "gdk_pixbuf_get_option",  cast(void**)& gdk_pixbuf_get_option},
   { "gdk_pixbuf_new_from_file",  cast(void**)& gdk_pixbuf_new_from_file},
   { "gdk_pixbuf_new_from_file_at_size",  cast(void**)& gdk_pixbuf_new_from_file_at_size},
   { "gdk_pixbuf_new_from_file_at_scale",  cast(void**)& gdk_pixbuf_new_from_file_at_scale},
   { "gdk_pixbuf_savev",  cast(void**)& gdk_pixbuf_savev},
   { "gdk_pixbuf_save",  cast(void**)& gdk_pixbuf_save},
   { "gdk_pixbuf_save_to_callback",  cast(void**)& gdk_pixbuf_save_to_callback},
   { "gdk_pixbuf_save_to_callbackv",  cast(void**)& gdk_pixbuf_save_to_callbackv},
   { "gdk_pixbuf_save_to_buffer",  cast(void**)& gdk_pixbuf_save_to_buffer},
   { "gdk_pixbuf_save_to_bufferv",  cast(void**)& gdk_pixbuf_save_to_bufferv},
   { "gdk_pixbuf_scale_simple",  cast(void**)& gdk_pixbuf_scale_simple},
   { "gdk_pixbuf_scale",  cast(void**)& gdk_pixbuf_scale},
   { "gdk_pixbuf_composite_color_simple",  cast(void**)& gdk_pixbuf_composite_color_simple},
   { "gdk_pixbuf_composite",  cast(void**)& gdk_pixbuf_composite},
   { "gdk_pixbuf_composite_color",  cast(void**)& gdk_pixbuf_composite_color},
   { "gdk_pixbuf_rotate_simple",  cast(void**)& gdk_pixbuf_rotate_simple},
   { "gdk_pixbuf_flip",  cast(void**)& gdk_pixbuf_flip},
   { "gdk_pixbuf_add_alpha",  cast(void**)& gdk_pixbuf_add_alpha},
   { "gdk_pixbuf_copy_area",  cast(void**)& gdk_pixbuf_copy_area},
   { "gdk_pixbuf_saturate_and_pixelate",  cast(void**)& gdk_pixbuf_saturate_and_pixelate},
   { "gdk_pixbuf_fill",  cast(void**)& gdk_pixbuf_fill}


from lib/gdk.d and add those functions to the end of the array in lib/gdkpixbuf.d

After this, the windows version of the demo TestWindow.d builds and runs similarly to the linux version. There are still a few minor problems, but it runs nonetheless.

-JJR

[EDIT]

Of cource, I forgot. Doing the above might break the linux version, unless you can just version in these changes... but the move is significant and I need to make sure that it can be made to work on linux as well... it should. If it does, we need to just remove the version(Windows) in gdk/Pixbuf.d so that linux also imports lib.gdkpixbuf appropriately.
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Thu Apr 06, 2006 8:09 pm    Post subject: Reply with quote

Okay, I tested this modification on linux as well. It works just fine. Just remove the version(Windows) from gdk/Pixbuf.d above, since linux can adopt the same system without any changes.

The gdk_pixbuf shared library exists separately on both Windows and linux, thus the reason this will work on both systems. I noticed, though, that linux seems to include all the pixbuf functions in the gdk shared library, as well (either that or the shared library system works very differently on linux). This is something the windows version does not do. So we may as well support both systems by adopting their common ground.

Can you implement these changes, please, Ant?

-JJR
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Thu Apr 06, 2006 8:20 pm    Post subject: Reply with quote

Name changes for projects on dsource are at least tolerable now. Let me know if you want this to occur for dui --> duit.

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



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Thu Apr 06, 2006 10:09 pm    Post subject: Reply with quote

JJR wrote:
Can you implement these changes, please, Ant?

Yes, I understand what needs to be changed - relatively minor change on the wrapping...

thank you for figureing this out!

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



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Thu Apr 06, 2006 10:12 pm    Post subject: Reply with quote

brad wrote:
Name changes for projects on dsource are at least tolerable now. Let me know if you want this to occur for dui --> duit.

BA

That's good to now.
I vacilating between Duit, and GtkD or DGtk...
for sure I want to change from DUI because to the "other" DUI.

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


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Fri Apr 07, 2006 8:57 am    Post subject: Reply with quote

Ok, much is working quite well now, but there is at least one problem:

My main gui class, looks somewhat like this:

Code:

class FooGui : MainWindow {
    protected override int windowDelete(Event event, Widget widget)
    {
        return super.windowDelete( event, widget );
    }

}


In DUI, this code would return from the Dui main loop, and let the class starting the gui (itself a non-gui class) store any state (most of it unrelated to the gui). In Duit windowDelete seems to call exit(0) in MainWindow.windowDelete(), circumventing all shutdown code, which is bad for this application.

I don't know what's the correct fix, but changing the
Duit.exit(0);
to
Duit.mainQuit();
works for me.
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Fri Apr 07, 2006 9:13 am    Post subject: Reply with quote

larsivi wrote:
but changing the
Duit.exit(0);
to
Duit.mainQuit();
works for me.

You're absoulutly right, it's a bad mistake to have exit(0)...

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



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Fri Apr 07, 2006 12:57 pm    Post subject: Reply with quote

Ant wrote:
That's good to now.
I vacilating between Duit, and GtkD or DGtk...
for sure I want to change from DUI because to the "other" DUI.

Ant

To me, Duit seems too similar to DUI to be worth the effort of changing the name.

On the other hand, I like GtkD and DGtk a lot. I think they're both good because they highlight the relationship with GTK+.
Back to top
View user's profile Send private message AIM Address
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