Re: libwnck doesn't work well in gtk-perl?



On Tue, 20 Mar 2007 20:17:16 -0400
Shaya Potter <spotter cs columbia edu> wrote:

I don't know if this is the best fix, but your script will work if you update
the event-loop each cycle.  By the way, using a while loop and sleep
in a gui, is BAD BAD BAD. Use a timer instead to call the sub every second.

#!/usr/bin/perl
use strict;
use Gtk2;
use Gnome2::Wnck;
Gtk2->init();

while (1) {
        sleep 1;

Gtk2->main_iteration while Gtk2->events_pending;


        my $screen = Gnome2::Wnck::Screen->get(0);
        $screen->force_update();

        my @windows_list = $screen->get_windows();

        foreach my $window (@windows_list) {
                my $name = $window->get_name();
                print "name = $name\n";
        }

}

zentara

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html



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