StatusIcon stack



A callback stack case in StatusIcon position_menu.  Nosing around its
code it calls out to the menu size_request to figure how big the menu is
(or would like to be).

--- GtkStatusIcon.xs    08 Oct 2008 09:30:39 +1100      1.10
+++ GtkStatusIcon.xs    08 Oct 2008 09:30:52 +1100      
@@ -93,7 +93,11 @@
                icon = SvGtkStatusIcon (ST (3));
        } else
                icon = SvGtkStatusIcon (ST (1));
+       /* PUTBACK/SPAGAIN because gtk_status_icon_position_menu() calls out
+          to menu->size_request, which may be a perl class closure */
+       PUTBACK;
        gtk_status_icon_position_menu (menu, &x, &y, &push_in, icon);
+       SPAGAIN;
        EXTEND (sp, 3);
        PUSHs (sv_2mortal (newSViv (x)));
        PUSHs (sv_2mortal (newSViv (y)));
--- GtkStatusIcon.t     06 Oct 2008 10:19:16 +1100      1.12
+++ GtkStatusIcon.t     06 Oct 2008 18:29:50 +1100      
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 use Gtk2::TestHelper
-  tests => 27,
+  tests => 30,
   at_least_version => [2, 10, 0, "Gtk2::StatusIcon is new in 2.10"];
 
 # $Id: GtkStatusIcon.t,v 1.12 2008/10/05 12:49:35 kaffeetisch Exp $
@@ -86,7 +86,13 @@
 $menu -> popdown();
 
 # Make sure the convenient way of calling works, too.
-ok (defined Gtk2::StatusIcon::position_menu($menu, $icon));
+{ my @ret = Gtk2::StatusIcon::position_menu($menu, $icon);
+  is (scalar @ret, 3);
+  my ($x, $y, $pushed_in) = @ret;
+  like($x, qr/^\d+$/);
+  like($y, qr/^\d+$/);
+  like($pushed_in, qr/^[01]$/); # boolean
+}
 
 # --------------------------------------------------------------------------- #
 

-- 
Mining jargon elucidated for the layman:
"Open at depth" -- we stopped drilling before finding just how thin
the ore body is.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]