Re: GTK_RUN_FIRST and return from default signal handler



On Thu, Aug 27, 1998 at 12:08:10PM -0400, Owen Taylor wrote:
> > gtk won't let me set up a signal where the default handler is GTK_RUN_FIRST
> > and there is a return type ...
> > 
> > this means that the return type will only be taken from the default handler
> > which is NOT what I want ... (if I connect the signal somewhere else the
> > return value is ignored unless the default handler is NULL) ... this seems
> > to be NOT right
> 
> The reason the combination of GTK_RUN_FIRST and a return value is
> considered bad is that with the combination there is no way to
> connect a signal handler and not change the return value.
> 
> Making such a signal GTK_RUN_LAST gives the application programmer
> the option of either overriding the return value (connect_after())
> or not overriding it (conect()).

(must have been to late yesterday)

true ... though given some circumstances it might not make sense to
do that ... since sometimes you might want to connect just to change
the value of the return ...

having said that ... then why is there connect_after and not
connect_before ... that would get rid of this problem .. plus it
would make it more useful .... you connect if you don't really care
or if you want to use what's the default ... and you do
connect_before/after, if you want the signal handler to run at an
explicit time, no matter if its GTK_RUN_LAST or GTK_RUN_FIRST

> >  ... I solve it by not having ANY return from the return 
> > handler (making it a void function and casting it) ... this is ugly
> 
> Hmmm, that sounds like a recipe for getting a junk result.

yes it is ... and it didn't really work right :)

(as long as you're looking for a true value it will work most of
the time:)

I had to change that

> > wouldn't jsut the opposite make sense ... allow only GTK_RUN_FIRST when there
> > is a return type
> > 
> > plus the message says:
> > 
> > Gtk-WARNING **: gtk_signal_newv(): signal "pressed" with return value `gboolean' excludes GTK_RUN_LAST
> 
> [...]
> 
> > which sounds very confusing to me .. it seems like the code is actually
> > excluding GTK_RUN_FIRST
> Yes, that warning message is messed up. I've changed it to:
> 
> Gtk-WARNING **: gtk_signal_newv(): signal "pressed" - return value "gboolean" is incompatible with GTK_RUN_FIRST.

yes ... that would be a far better error message

George

-- 
------------------------------------------------------------------------------
George Lebl <jirka@5z.com> http://www.5z.com/jirka/
------------------------------------------------------------------------------
  The following implements RSA in perl and is illegal to export from the US:

          #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
          $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
          lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)



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