Re: A couple of questions



On Wed, 16 Aug 2000, rhfreeman wrote:

 Hi, 

> Hi folks,
> 
> Just need to pick your brains about somethings!
> 
> I've got this few lines of code scattered around in my code (in this
> order)....
> 
>   gtk_signal_emit_by_name(GTK_OBJECT(w_layout[current].drawing_area),
> "expose_event", GINT_TO_POINTER(current));
>  
> 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));
> 
> When the gtk_signal_emit_by_name() is called, I get this warning:
> 
> Gtk-WARNING **: gtk_signal_collect_params(): invalid NULL pointer for return
> argument type `gboolean'

 gtk_signal_emit_by_name accepts a variable list of arguments, the last one is
ptr to return value (you don't pass it). Also, GINT_TO_POINTER(current) you
pass to it will be used for GdkEventExpose *event, not for 'current_ptr' 
(it's bound when you connect the signal!).

> Any ideas?
> 
> On a second similar-ish front, if I've got this:
> 
>   gtk_signal_connect(GTK_OBJECT(w_layout[i].drawing_area),
> "button_press_event", (GtkSignalFunc) button_press_event,
> GINT_TO_POINTER(i));
> 
> to detect mouse clicks. Is there anyway I can tell if the shift button was
> being held down at the same time as the click????

 The .state member of GdkEventButton passed contains the currently pressed
modifiers (it means the same as in GdkEventKey).
 
> Ta folks!!
> 
> Rich
> 

 Best regards,
  -Vlad






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