Author Topic: Mapping F10 key doesn't work  (Read 7804 times)

Offline schickb

  • Single posting newcomer
  • *
  • Posts: 9
Mapping F10 key doesn't work
« on: April 25, 2008, 08:07:50 pm »
I am using CB on Ubuntu 8.04 32bit. Mapping keyboard shortcuts to the F keys work for all that I have tried except the F10 key. When I assign that to something (like "next line"), and then hit the F10 key the File menu opens up. Anyone else seen this? I don't think F10 is a special key for gnome.

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Mapping F10 key doesn't work
« Reply #1 on: April 25, 2008, 10:32:48 pm »
Hi,

I assume that you are trying to map keys to fit the visual studio schema  :wink:

I encoutered this bug in the past in my application, and I ended up adding the following hack in the code:

Code
//add include file required for the hack
#ifdef __WXGTK20__
#include <gtk-2.0/gtk/gtk.h>
#endif

//add this code somewhere in the frame constructor
#if  defined(__WXGTK20__)
// A rather ugly hack here.  GTK V2 insists that F10 should be the
// accelerator for the menu bar.  We don't want that.  There is
// no sane way to turn this off, but we *can* get the same effect
// by setting the "menu bar accelerator" property to the name of a
// function key that is apparently legal, but doesn't really exist.
// (Or if it does, it certainly isn't a key we use.)
gtk_settings_set_string_property (gtk_settings_get_default (),
                                  "gtk-menu-bar-accel", "F15", "foo");

#endif

You will also need to update your makefile accordingly:
add to the include path:
Code
pkg-config --cflags gtk+-2.0

and to the lib path:
Code
pkg-config --libs gtk+-2.0

Works like a charm :)
Eran

Offline schickb

  • Single posting newcomer
  • *
  • Posts: 9
Re: Mapping F10 key doesn't work
« Reply #2 on: April 25, 2008, 11:12:51 pm »
Thanks, I'll give it a try. Or maybe I'll have to retrain the fingers at some point.

Offline chrisstankevitz

  • Single posting newcomer
  • *
  • Posts: 6
Re: Mapping F10 key doesn't work
« Reply #3 on: August 31, 2009, 05:10:05 am »
You will also need to update your makefile accordingly:
add to the include path:
Code
pkg-config --cflags gtk+-2.0

Hello,

I'm new to makefiles.  Can you tell me how to do this step for the CB configure.in file?  I would like to apply this hack to CB.

Thank you,

Chris

Offline yaoyansi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Mapping F10 key doesn't work
« Reply #4 on: September 02, 2014, 07:28:11 am »
Hi,

I assume that you are trying to map keys to fit the visual studio schema  :wink:

I encoutered this bug in the past in my application, and I ended up adding the following hack in the code:

Code
//add include file required for the hack
#ifdef __WXGTK20__
#include <gtk-2.0/gtk/gtk.h>
#endif

//add this code somewhere in the frame constructor
#if  defined(__WXGTK20__)
// A rather ugly hack here.  GTK V2 insists that F10 should be the
// accelerator for the menu bar.  We don't want that.  There is
// no sane way to turn this off, but we *can* get the same effect
// by setting the "menu bar accelerator" property to the name of a
// function key that is apparently legal, but doesn't really exist.
// (Or if it does, it certainly isn't a key we use.)
gtk_settings_set_string_property (gtk_settings_get_default (),
                                  "gtk-menu-bar-accel", "F15", "foo");

#endif

You will also need to update your makefile accordingly:
add to the include path:
Code
pkg-config --cflags gtk+-2.0

and to the lib path:
Code
pkg-config --libs gtk+-2.0

Works like a charm :)
Eran


Thanks for your solution. But I'm using the binary installer.
Will this hack code be integrated into C::B?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Mapping F10 key doesn't work
« Reply #5 on: September 02, 2014, 11:49:08 pm »
I don't think so...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]