[gtkada] testgtk/testcairo.adb patch proposal.

Pascal p.p14 at orange.fr
Sat Jul 14 09:41:08 CEST 2012


Hello, in testgtk-testcairo from GtkAda GPL 2012, the program doesn't exit when closing the window.
Here is a patch proposal:

--- ./testcairo.adb.0	2012-05-18 10:03:44.000000000 +0200
+++ ./testcairo.adb	2012-07-12 09:41:26.000000000 +0200
@@ -67,6 +67,18 @@
 
    --  The tests implemented in this example program
 
+   package Window_Cb is new Gtk.Handlers.Return_Callback
+     (Gtk_Window_Record, Boolean);
+   --  Callback for delete_event.
+   function On_Main_Window_Delete_Event
+     (Object : access Gtk_Window_Record'Class) return Boolean
+   is
+      pragma Unreferenced (Object);
+   begin
+      Gtk.Main.Main_Quit;
+      return True;
+   end On_Main_Window_Delete_Event;
+
    package Event_Cb is new Gtk.Handlers.Return_Callback
      (Gtk_Drawing_Area_Record, Boolean);
 
@@ -284,6 +296,10 @@
    Event_Cb.Connect (Area, "expose_event",
                      Event_Cb.To_Marshaller (Expose_Cb'Access));
 
+   Window_Cb.Connect
+     (Win, "delete_event",
+      Window_Cb.To_Marshaller (On_Main_Window_Delete_Event'Access));
+
    Show_All (Win);
    Gtk.Main.Main;
 end Testcairo;

HTH, Pascal.
http://blady.pagesperso-orange.fr




More information about the gtkada mailing list