Re: [gtk-list] Re: multi-tasking



On Sun, 22 Feb 1998, Brian C. Lane wrote:

> On Sun, 22 Feb 1998, Brian C. Lane wrote:
> 
> > reason I wasn't using a button is the border that is placed around the
> > pixmap -- is there a way to turn this off in butons?
> 
>   I still have the above question, but...
> 
> > 
> >   Now I have a problem where it sigsegv's on me when I press the button.
> > It is related to the clicked event because I have tried removing all other
> >   Does this sound like a bug or am I doing something else wrong? I'm using
> > GTK+ v0.99.3
> 
>   I was trying to call a click callback with (GtkWidget *, GdkEvent *), so
> I fixed that, and passed it the Widget* when connecting the clicked event.
> But now that brings up another question, how do I tell which mouse button
> was clicked to activate it? I have a volume button that increases the
> volume with a left click and decreases it with a right click.

for GtkWidget::button_press_event and GtkWidget::button_release_event
signals you do:
gint
my_button_press_event_handler (GtkWidget          *widget,
                               GdkEventButton     *event,
                               gpointer            func_data)
{
  printf ("button %d\n", event.button);
  return TRUE;
}

for the GtkButton::clicked signal you could fetch the current
event via gtk_get_current_event() which will be of type GDK_BUTTON_RELEASE
in the clicked handler. but also the event.button will always be 1 since
GtkButton::clicked will only be emitted if mouse button 1 was released.


>   Also, now my down image is drawn before executing the cdrom function,
> but it isn't drawn as back up until it completes, even though my debugging
> output shows that it is getting press_event, release_event, click_event.
> Apparently the image isn't being redrawn between the release event (where
> the image is  changed back to the up image) and the click event.
> 
>   Maybe I am really better off starting a timer when it is hit and letting
> that handle the processing...

maybe you should just call gtk_widget_draw (image, NULL) on your image to
force expose it and ignore the drawing queue.
> 
>   Thanks!
> 
>     Brian
> 

---
ciaoTJ



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