[perl-Gtk3] Fix warnings from the Gtk3::Menu tests



commit 3b346922a6d9b27033aed3fe432e30bc517980e2
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Aug 2 16:13:24 2015 +0200

    Fix warnings from the Gtk3::Menu tests
    
    As of gtk+ 3.16, the menu position callback receives the x, y arguments
    again.
    
    https://rt.cpan.org/Ticket/Display.html?id=105835

 lib/Gtk3.pm   |    4 ++--
 t/overrides.t |   19 ++++++++++++++-----
 2 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index 79b06b8..1374087 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -1704,8 +1704,8 @@ have as many options anymore as they had in Gtk2.  Changes to arguments will
 not be propagated to the next signal handler, and only the updated position can
 and must be returned.
 
-=item * Gtk3::Menu: The position callback passed to popup() does not receive x
-and y parameters anymore.
+=item * Gtk3::Menu: In gtk+ < 3.16, the position callback passed to popup()
+does not receive x and y parameters.
 
 =item * Gtk3::RadioAction: The constructor now follows the C API.
 
diff --git a/t/overrides.t b/t/overrides.t
index 041e0aa..fe0b3e7 100644
--- a/t/overrides.t
+++ b/t/overrides.t
@@ -232,11 +232,20 @@ SKIP: {
   note('Gtk3::Menu::popup and popup_for_device');
   {
     my $menu = Gtk3::Menu->new;
-    my $position_callback = sub {
-      my ($menu, $data) = @_;
-      isa_ok ($menu, "Gtk3::Menu");
-      return @$data;
-    };
+    my $position_callback;
+    if (Gtk3::CHECK_VERSION (3, 16, 0)) {
+      $position_callback = sub {
+        my ($menu, $x, $y, $data) = @_;
+        isa_ok ($menu, "Gtk3::Menu");
+        return @$data;
+      };
+    } else {
+      $position_callback = sub {
+        my ($menu, $data) = @_;
+        isa_ok ($menu, "Gtk3::Menu");
+        return @$data;
+      };
+    }
     $menu->popup (undef, undef, $position_callback, [50, 50], 1, 0);
     $menu->popup_for_device (undef, undef, undef, $position_callback, [50, 50, Glib::TRUE], 1, 0);
   }



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