Re: detect ctrl+c in key_press_event handler



Hi Yann,

Doing it the long way may work...

static bool ctrldown = false ;
char codeforctrlkey = GDK_Control_L; // or whatever code is returned

gboolean keypresscallback ( GtkWidget * w, ...)
   {
   if ( event->keyval == codeforctrlkey )
      {
      ctrldown = true ;
      }
   else if ( ctrldown && (event->keyval == 'C') )
      {
      // action
      }
   }

gboolean keyreleasecallback ( GtkWidget * w, ...)
   {
   if ( event->keyval == codeforctrlkey )
      {
      ctrldown = false ;
      }
   }

Ken

--- On Sat, 30/1/10, Yann Leboulanger <asterix lagaule org> wrote:

From: Yann Leboulanger <asterix lagaule org>
Subject: detect ctrl+c in key_press_event handler
To: gtk-list gnome org
Date: Saturday, 30 January, 2010, 5:23 AM

Hi all,

I'd like to detect a ctrl+C in a key_press_event handler. I wrote (in
pygtk):

keyc, mod = gtk.accelerator_parse('<Control>c')
if event.state & mod and event.keyval == keyc:
   blabla

But that doesn't work on non-latin (russian) keyboard.

On those keyboard, keyc is 0

What's the correct way to detect that?

Thanks for your help
--
Yann Leboulanger
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list


New Email names for you!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!

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