Hacking:Code Snippets/Miscellaneous
From GIMP Developer Wiki
Determining compiler
To make use of GCC specific features, use the __GNUC__ macro:
#ifdef __GNUC__ ... #endif
You can also grep the code for __GNU to find out existing samples to learn from.
To make use of LLVM/Clang specific features, use the Clang language extensions.
See also:
Common predefined macros in GCC
Pre-defined Compiler Macros page at Sourceforge.net
Determining modifiers of keyboard events (Ctrl, Alt, etc.)
#include <gdk/gdkkeysyms.h> my_key_event_handler(const GdkEventKey *keyevent) { /* check for Ctrl (also on OS X; do not confuse with Cmd there!): */ if (keyevent->state & GDK_CONTROL_MASK) /* check for Alt: */ if (keyevent->state & GDK_MOD1_MASK) }