Re: [gtk-list] motion-notify-event with right mouse button?!?



Udo Giacomozzi wrote:
> 
> [resending this msg as it seems I probably have trouble with the list
> mailman]
> 
> Is it normal that the motion-notify-event (when moving the mouse over a
> widget) comes only when button 1 is pressed?
> What can I do so that it is signaled when button 3 is pressed, too?
> 

You have to set the X event mask of the widget (before it is realized,
i.e. do it straight after creating the widget.)

Here's what I use:

  GtkWidget *placeholder = gtk_drawing_area_new ();
  gtk_widget_set_events (placeholder,
 			 gtk_widget_get_events (placeholder)
			 | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK
			 | GDK_BUTTON_RELEASE_MASK
			 | GDK_POINTER_MOTION_MASK | GDK_BUTTON1_MOTION_MASK);

(Actually I don't think the gtk_widget_get_events () call is necessary)

You need to set the GDK_BUTTON3_MOTION_MASK.

You then connect the signal handler as normal:

  gtk_signal_connect (GTK_OBJECT (placeholder), "motion_notify_event",
		      GTK_SIGNAL_FUNC (editor_on_motion_notify), NULL);


Damon




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