how to get right button click state



how are you ?
 
can you help me?
       now , i am studying gtk .
       how to get right button click state?
       now , i want to get the right button click state , but i only get the left button state .
       my code is here:
 
 
 
gint On_StreamDraw_Button_Press (GtkWidget *widget, GdkEventMotion *event)
{
   gint x;
   gint y;
 
   GdkModifierType state;
   GdkDrawable* pixmap;
   pixmap = widget->window;
 

   /* --- If it's a hint... (combining several events) --- */
   if (event->is_hint)
   {
        /* --- Get new position --- */
        gdk_window_get_pointer (event->window, &x, &y, &state);  
   }
   else
   {
        /* --- Get new position --- */
        x = event->x;
        y = event->y;
        state = (GdkModifierType)event->state; 
    }
 
    /* --- If the mouse button is down --- */
    if ((state & GDK_BUTTON2_MASK) && (pixmap != NULL))
    {
        g_message("Button2\n");
    }
 
    /* --- If the mouse button is down --- */
    if ((state & GDK_BUTTON1_MASK) && (pixmap != NULL))
    {
        g_message("Button1\n");
    }
 
    return 0;
}
 
 
but , when i click right button , no message print , when i click left button , print the message : "the message :Button1"
 
can you tell me the reason ?
thans.
 


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