Hi

So here they are. Initially I was making my changes versus gtk2forpascal from sourceforge, but now I made them versus FPC sources, since I can't connect to gtk2forpascal cvs on sourceforge. I also noticed that version from FPC tree already contains some of the fixes I was going to send... excellent.

I'm attaching patch to packages/extra/gtk2/, it fixes various small things: compiling gtk_demo, {$linklib c} and {$linklib pthread} needed under FreeBSD, using HasGTK2_2 symbol in gtk2.pas, correct name for identifier TGtkAccelGroupFindFunc, and four missing functions for GtkWindow (gtk_window_fullscreen/unfullscreen, gtk_window_set_keep_above/below).

Note that I added {$define GTK2_2} at the beginning of gtk2.pas -- I think that GTK >= 2.2 is installed pretty everywhere where any GTK 2.x is installed. But this may be a matter of personal experience, so feel free to remove this bit if you think that's better.

And here you can find my gtkglext translation (12 KB):
http://www.camelot.homedns.org/~michalis/unofficial/gtkglext.tar.gz

I tested it (gtk 2 bindings with my patches and gtkglext) on Linux, FreeBSD (5.3) and Win32. In the gtkglext archive you will find subdirectory examples/, there is one simple test program using gtkglext, gears.pas. This is rewritten in Pascal version of gears.c from gtkglext examples. You can also look at the units and programs on my www page, they use gtk2 and gtkglext, though they are not very good example programs for teaching how to use gtkglext (since gtk code is there embedded in rather large unit).

Michalis.

Index: examples/gtk_demo/stock_browser.inc
===================================================================
RCS file: /FPC/CVS/fpc/packages/extra/gtk2/examples/gtk_demo/stock_browser.inc,v
retrieving revision 1.1
diff -u -u -r1.1 stock_browser.inc
--- examples/gtk_demo/stock_browser.inc 24 Jan 2005 21:58:04 -0000      1.1
+++ examples/gtk_demo/stock_browser.inc 1 Mar 2005 01:16:18 -0000
@@ -68,7 +68,7 @@
   stock_item_info_get_type := StockItemInfoType;
 end;
 
-function STOCK_ITEM_INFO_TYPE: GType; inline;
+function STOCK_ITEM_INFO_TYPE: GType;
 begin
   STOCK_ITEM_INFO_TYPE := stock_item_info_get_type;
 end;
Index: glib/glib2.pas
===================================================================
RCS file: /FPC/CVS/fpc/packages/extra/gtk2/glib/glib2.pas,v
retrieving revision 1.3
diff -u -u -r1.3 glib2.pas
--- glib/glib2.pas      3 Feb 2005 21:59:45 -0000       1.3
+++ glib/glib2.pas      1 Mar 2005 01:16:27 -0000
@@ -61,6 +61,11 @@
   {$endif}
 {$endif}
 
+{$ifdef FREEBSD}
+  {$linklib c}
+  {$linklib pthread}
+{$endif}
+
 {$IFNDEF KYLIX}
   {$PACKRECORDS C}
 {$ELSE}
Index: gtk+/gtk/gtk2.pas
===================================================================
RCS file: /FPC/CVS/fpc/packages/extra/gtk2/gtk+/gtk/gtk2.pas,v
retrieving revision 1.2
diff -u -u -r1.2 gtk2.pas
--- gtk+/gtk/gtk2.pas   31 Jan 2005 14:08:25 -0000      1.2
+++ gtk+/gtk/gtk2.pas   1 Mar 2005 01:16:28 -0000
@@ -18,6 +18,8 @@
   }
 unit gtk2; // keep unit name lowercase for kylix
 
+{$define GTK2_2}
+
 {$H+}
 {$IFDEF FPC}
   {$mode objfpc}
@@ -28,15 +30,18 @@
 
 {$IFDEF GTK2_2}
 {$DEFINE HasGTK2_0}
+{$DEFINE HasGTK2_2}
 {$ENDIF}
 
 {$IFDEF GTK2_4}
 {$DEFINE HasGTK2_0}
+{$DEFINE HasGTK2_2}
 {$DEFINE HasGTK2_4}
 {$ENDIF}
 
 {$IFDEF GTK2_6}
 {$DEFINE HasGTK2_0}
+{$DEFINE HasGTK2_2}
 {$DEFINE HasGTK2_4}
 {$DEFINE HasGTK2_6}
 {$ENDIF}
Index: gtk+/gtk/gtkaccelgroup.inc
===================================================================
RCS file: /FPC/CVS/fpc/packages/extra/gtk2/gtk+/gtk/gtkaccelgroup.inc,v
retrieving revision 1.1
diff -u -u -r1.1 gtkaccelgroup.inc
--- gtk+/gtk/gtkaccelgroup.inc  24 Jan 2005 21:58:04 -0000      1.1
+++ gtk+/gtk/gtkaccelgroup.inc  1 Mar 2005 01:16:29 -0000
@@ -50,7 +50,8 @@
         accel_path_quark : TGQuark;
      end;
 
-  Tgtk_accel_group_find_func = function (key:PGtkAccelKey; closure:PGClosure; 
data:gpointer):gboolean;
+  Tgtk_accel_group_find_func = function (key:PGtkAccelKey; closure:PGClosure; 
data:gpointer):gboolean; cdecl;
+  TGtkAccelGroupFindFunc = Tgtk_accel_group_find_func;
 {$ENDIF read_interface_types}
 
 
//------------------------------------------------------------------------------
Index: gtk+/gtk/gtkwindow.inc
===================================================================
RCS file: /FPC/CVS/fpc/packages/extra/gtk2/gtk+/gtk/gtkwindow.inc,v
retrieving revision 1.1
diff -u -u -r1.1 gtkwindow.inc
--- gtk+/gtk/gtkwindow.inc      24 Jan 2005 21:58:04 -0000      1.1
+++ gtk+/gtk/gtkwindow.inc      1 Mar 2005 01:16:35 -0000
@@ -233,6 +233,14 @@
 procedure gtk_window_unstick(window:PGtkWindow); cdecl; external gtklib;
 procedure gtk_window_maximize(window:PGtkWindow); cdecl; external gtklib;
 procedure gtk_window_unmaximize(window:PGtkWindow); cdecl; external gtklib;
+
+{$ifdef HasGTK2_2}
+procedure gtk_window_fullscreen(window: PGtkWindow); cdecl; external gtklib;
+procedure gtk_window_unfullscreen(window: PGtkWindow); cdecl; external gtklib;
+procedure gtk_window_set_keep_above(window: PGtkWindow; setting: gboolean); 
cdecl; external gtklib;
+procedure gtk_window_set_keep_below(window: PGtkWindow; setting: gboolean); 
cdecl; external gtklib;
+{$endif HasGTK2_2}
+
 procedure gtk_window_begin_resize_drag(window:PGtkWindow; edge:TGdkWindowEdge; 
button:gint; root_x:gint; root_y:gint;
             timestamp:guint32); cdecl; external gtklib;
 procedure gtk_window_begin_move_drag(window:PGtkWindow; button:gint; 
root_x:gint; root_y:gint; timestamp:guint32); cdecl; external gtklib;
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to