In Gtk2 it can get complicated, dealing with all the signals. Tk is so much easier with ->Busy and ->Unbusy. Without a working snippet to play with, I can only offer you 2 snippets which show some of the complexities. The Perl/Gtk2 maillist may be a better source of answers for this. Otherwise show a chopped down working snippet to demonstrate your problem.
#!/usr/bin/perl use warnings; use strict; use Gtk2 -init; my $window = Gtk2::Window->new; $window->set( border_width => 15 ); $window->signal_connect( delete_event => sub { exit }); $window->set_size_request(300,200); my $vbox = Gtk2::VBox->new(); $window->add($vbox); my $label = Gtk2::Label->new("Not Busy"); my $button = Gtk2::Button->new ('Make Busy'); $button->signal_connect (clicked => \&clicked ); my $button1 = Gtk2::Button->new ('Test'); my $but1sig = $button1->signal_connect (clicked => \&clicked1 ); $vbox->pack_start( $label, 0, 0, 0 ); $vbox->pack_start( $button, 0, 0, 0 ); $vbox->pack_start( $button1, 0, 0, 0 ); $window->show_all; my $busycur = Gtk2::Gdk::Cursor->new('GDK_WATCH'); my $normcur = Gtk2::Gdk::Cursor->new('GDK_LEFT_PTR'); my $rootwin = $window->window(); Gtk2->main; ######################################################## sub clicked { my $cur_lab = $button->get_label(); if($cur_lab eq 'Make Busy'){ $button->set_label('Release'); $rootwin->set_cursor($busycur); $button1->signal_handler_block($but1sig); $label->set_text('Busy'); }elsif($cur_lab eq 'Release'){ $button->set_label('Make Busy'); $rootwin->set_cursor($normcur); $button1->signal_handler_unblock($but1sig); $label->set_text('Not Busy'); } } sub clicked1 { print "1\n"; }
#!/usr/bin/perl use warnings; use strict; use Glib qw/TRUE FALSE/; use Gtk2::Gdk::Keysyms; use Gtk2 '-init'; $|++; my $window = Gtk2::Window->new('toplevel'); $window->set_title('Z'); $window ->signal_connect( 'destroy' => \&delete_event ); $window->set_border_width(10); $window->set_size_request(300,200); my $vbox = Gtk2::VBox->new( FALSE, 6 ); $window->add($vbox); $vbox->set_border_width(2); my $hbox= Gtk2::HBox->new( FALSE, 6 ); $vbox->pack_end($hbox,FALSE,FALSE,0); $hbox->set_border_width(2); my $button = Gtk2::Button->new_from_stock('gtk-quit'); $hbox->pack_end( $button, FALSE, FALSE, 0 ); $button->signal_connect( clicked => \&delete_event ); my $button1 = Gtk2::Button->new('Global Grab'); $hbox->pack_end( $button1, FALSE, FALSE, 0 ); $button1->signal_connect( clicked => sub{ my $rc; $rc = Gtk2::Gdk->pointer_grab($window->window,1,['button-press-mask' +,'button-release-mask','pointer-motion-mask'],undef,undef,Gtk2->get_c +urrent_event_time); print "$rc\n"; $rc = Gtk2::Gdk->keyboard_grab($window->window,0,Gtk2->get_current_e +vent_time); print "$rc\n"; } ); $window->set_position('center'); $window->show_all(); $window->signal_connect( 'key_release_event' => \&keyrelease ); $window->signal_connect (event => sub { my ($item, $event) = @_; warn "event ".$event->type."\n"; print chr(07); #beep return 0; #return 1 prevents window from closing # return 0 lets the signal thru }); Gtk2->main; ##################################### sub delete_event { Gtk2->main_quit; return FALSE; } sub keyrelease { my ( $widget, $event ) = @_; print $event->keyval,"\n"; print chr(07); #beep if ( $event->keyval == $Gtk2::Gdk::Keysyms{q} ) { Gtk2->main_quit; } else { print "key was ", chr( $event->keyval ), "\n"; } }

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: Busy Windows Using Gtk2 by zentara
in thread Busy Windows Using Gtk2 by aecooper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.