Thanks for the replies, Khen1950fx and zentara!
Khen1950fx, I think I didn't explain the problem clearly enough. The example I gave is
truly a minimal example, in the sense that the sound I/O stuff is necessary in order
to produce the buggy behavior. The problem is not that the "foo" button is small and
hard to see, it's that it actually isn't rendered at all. If I take your code
and put the sound I/O back in, I get this:
#!/usr/bin/perl
use strict;
use warnings;
use Gtk2 '-init';
use IO::File;
my $mw = Gtk2::Window->new('toplevel');
my $t = Gtk2::Table->new(1, 2, 0);
$mw->add($t);
my $label = Gtk2::Label->new('Example');
$t->attach_defaults($label, 0, 1, 0, 1);
$label->show;
my $button = Gtk2::Button->new('foo');
$t->attach_defaults($button, 0, 1, 1, 2);
$button->signal_connect( 'clicked' => sub { exit } );
$button->show;
$mw->show_all;
my $dsp = new IO::File("</dev/dsp");
my $event_source_tag = Glib::IO->add_watch(
fileno($dsp),
'in',
sub {
my $buff = " " x 1024;
my $nread = read($dsp,$buff,1024);
return 1;
}
);
Gtk2->main;
0;
This works on the same machine where my original example works, and fails on the same
machine where my original example fails.
Here is a rundown on which machines it works on and which it fails on:
AMD Athlon 64 X2 4200+, Gigabyte GA-M61P-S3, onboard sound, Ubuntu 10.10 -- works
Dell Optiplex GX260, 1.8 GHz P4, 512 Mb, 40 Gb, onboard sound, Ubuntu 10.04 -- fails
Dell Optiplex GX260, 1.8 GHz P4, 512 Mb, 40 Gb, onboard sound, Ubuntu 10.10 -- fails
Core 2 Duo E8400, 3 GHz, Gigabyte EP45-UD3P mobo, onboard sound, Ubuntu 10.04 -- fails
HP, Ubuntu 10.10 -- fails
I suspect that the problem has something to do with event handling in Gtk. Maybe the program gets overloaded with events and never gets a chance to draw the widget? But I don't understand why it's hardware-dependent, and I don't understand how to fix it :-(
|