Re: OK, now gtk_signal_emit_by_name() is confusing me!!!



On Thu, 17 Aug 2000, rhfreeman wrote:

 Hi Rich, 

> Hi folks,
> 
> Now, I'm *REALLY* curious. First I have this bit of code, which breaks:
> 
>   gtk_signal_emit_by_name(GTK_OBJECT(w_layout[current].drawing_area),
> "expose_event");
> 
> static void expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer
> current_ptr)
> {
>   gint current=GPOINTER_TO_INT(current_ptr);
>   gdk_draw_pixmap(widget->window,
> widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
>                   w_layout[current].drawing_pixmap, 0, 0, 0, 0,
>                   w_layout[current].width, w_layout[current].height);
> }
>   gtk_signal_connect(GTK_OBJECT(w_layout[current].drawing_area),
> "expose_event", GTK_SIGNAL_FUNC(expose_event), GINT_TO_POINTER(current));
> 
> Which doesn't work at all, and gives me this:
> 
> Gtk-WARNING **: gtk_signal_collect_params(): invalid NULL pointer for return
> argument type `gboolean'
> 
> .. and doesn't do the event.


 I've already told you what to do in my recent mail to you - the handler for
"expose-event" returns a gbool (so correct your function first), and when
doing gtk_signal_emit_by_name, you have to add a parameter - the pointer to
return value, so your call should look like

  GdkEventExpose event;/*fill it as necessary*/
  gboolean retval;

  gtk_signal_emit_by_name(GTK_OBJECT(w_layout[current].drawing_area),
 "expose_event",&event,&retval);

> I also have this:
> static void clist_size(GtkWidget *clist, GtkAllocation *allocation, gpointer
> current_ptr)
> {
>  // does stuff
> }
> 
> gtk_signal_emit_by_name(GTK_OBJECT(wl->signal_lists), "size_allocate");
> 
> gtk_signal_connect(GTK_OBJECT(w_layout[i].signal_lists), "size_allocate",
> GTK_SIGNAL_FUNC(clist_size), GINT_TO_POINTER(i));
> 
> Works without a problem!!!

 That's because handler is not expected to return a value.

> Ideas?
> 
> Also, does anyone know why putting a clist into a scrolled window blocks the
> size_allocate signal and neither the clist nor the window recieves it until
> I resize the whole window?
 
 I don't know.

> Ta,
> 
> Rich
> 

 Best regards,
  -Vlad






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