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

gtk priority constants



I wonder if the GTK_PRIORITY_RESIZE, GDK_PRIORITY_REDRAW and
GDK_PRIORITY_EVENTS constants could be offered within perl, perhaps per
below.  They can be good for putting idle or i/o stuff in at levels just
above or below what gtk will be doing (the redraw is the only one I've
got an immediate interest in :).

Index: Gtk2.pm
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/Gtk2.pm,v
retrieving revision 1.113
diff -u -r1.113 Gtk2.pm
--- Gtk2.pm	16 Dec 2007 19:54:29 -0000	1.113
+++ Gtk2.pm	30 Dec 2007 21:44:10 -0000
@@ -39,6 +39,8 @@
 
 our @ISA = qw(DynaLoader);
 
+use constant GTK_PRIORITY_RESIZE => Glib::G_PRIORITY_HIGH_IDLE + 10;
+
 sub import {
 	my $class = shift;
 
@@ -90,6 +92,9 @@
 sub USHORTS { 16 };
 sub ULONGS { 32 };
 
+use constant { GDK_PRIORITY_EVENTS => Glib::G_PRIORITY_DEFAULT,
+               GDK_PRIORITY_REDRAW => Glib::G_PRIORITY_HIGH_IDLE + 20 };
+
 package Gtk2::Gdk::Atom;
 
 use overload
@@ -263,6 +268,12 @@
 
 =back
 
+=head1 CONSTANTS
+
+=head2 Gtk2::GTK_PRIORITY_RESIZE
+
+See L<Gtk2::Gdk> and L<Glib> for other standard priority levels.
+
 =head1 SEE ALSO
 
 L<perl>(1), L<Glib>(3pm).
Index: xs/Gdk.xs
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/xs/Gdk.xs,v
retrieving revision 1.23
diff -u -r1.23 Gdk.xs
--- xs/Gdk.xs	15 Sep 2007 14:33:01 -0000	1.23
+++ xs/Gdk.xs	30 Dec 2007 21:44:10 -0000
@@ -22,6 +22,25 @@
 
 MODULE = Gtk2::Gdk	PACKAGE = Gtk2::Gdk	PREFIX = gdk_
 
+=for object Gtk2::Gdk
+=cut
+
+=head1 CONSTANTS
+
+=head2 Gtk2::Gdk::GDK_PRIORITY_EVENTS
+
+=over 4
+
+=back
+
+=head2 Gtk2::Gdk::GDK_PRIORITY_REDRAW
+
+=over 4
+
+=back
+
+=cut
+
 ##  void gdk_init (gint *argc, gchar ***argv) 
 gboolean
 gdk_init (class=NULL)
Index: t/00.Gtk2.t
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/00.Gtk2.t,v
retrieving revision 1.21
diff -u -r1.21 00.Gtk2.t
--- t/00.Gtk2.t	14 May 2006 10:57:07 -0000	1.21
+++ t/00.Gtk2.t	30 Dec 2007 21:44:11 -0000
@@ -14,7 +14,7 @@
 
 # NOTE: this is the bootstrap test -- no Gtk2::TestHelper here!
 
-use Test::More tests => 35;
+use Test::More tests => 36;
 BEGIN { use_ok('Gtk2') };
 
 #########################
@@ -43,6 +43,9 @@
 ok (Gtk2::Pango->CHECK_VERSION(0,0,0), 'CHECK_VERSION pass');
 ok (!Gtk2::Pango->CHECK_VERSION(50,0,0), 'CHECK_VERSION fail');
 
+my $number = qr/^\d+$/;
+like(Gtk2::GTK_PRIORITY_RESIZE, $number);
+
 SKIP:
 {
 	Gtk2->disable_setlocale;
Index: t/Gdk.t
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/Gdk.t,v
retrieving revision 1.18
diff -u -r1.18 Gdk.t
--- t/Gdk.t	15 Sep 2007 14:32:56 -0000	1.18
+++ t/Gdk.t	30 Dec 2007 21:44:11 -0000
@@ -16,7 +16,7 @@
 
 if (Gtk2::Gdk->init_check )
 {
-	plan tests => 17;
+	plan tests => 19;
 }
 else
 {
@@ -74,6 +74,9 @@
 like(Gtk2::Gdk -> screen_width_mm(), $number);
 like(Gtk2::Gdk -> screen_height_mm(), $number);
 
+like(Gtk2::Gdk::GDK_PRIORITY_EVENTS, $number);
+like(Gtk2::Gdk::GDK_PRIORITY_REDRAW, $number);
+
 my $window = Gtk2::Window -> new();
 $window -> show_now();
 


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