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



zentara wrote:
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.

this isn't a gui program, all I want is wnck for window names to do text mode processing on them, but now I understand why it wsn't working, no gtk main loop.


#!/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




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