#include "dragdrop.h"
#endif
+#ifdef HAVE_MENUBARS
+# include "menubar.h"
+#endif
+
#if defined (HAVE_OFFIX_DND)
#include "offix.h"
#endif
Lisp_Object Qkey_mapping;
Lisp_Object Qsans_modifiers;
-static void enqueue_gtk_dispatch_event (Lisp_Object event);
+void enqueue_gtk_dispatch_event (Lisp_Object event);
+/*
+ * Identify if the keysym is a modifier. This implementation mirrors x.org's
+ * IsModifierKey(), but for GDK keysyms.
+ */
+#ifdef GDK_ISO_Lock
#define IS_MODIFIER_KEY(keysym) \
((((keysym) >= GDK_Shift_L) && ((keysym) <= GDK_Hyper_R)) \
+ || (((keysym) >= GDK_ISO_Lock) && \
+ ((keysym) <= GDK_ISO_Last_Group_Lock)) \
|| ((keysym) == GDK_Mode_switch) \
|| ((keysym) == GDK_Num_Lock))
+#else
+#define IS_MODIFIER_KEY(keysym) \
+ ((((keysym) >= GDK_Shift_L) && ((keysym) <= GDK_Hyper_R)) \
+ || ((keysym) == GDK_Mode_switch) \
+ || ((keysym) == GDK_Num_Lock))
+#endif
\f
static Lisp_Object dispatch_event_queue, dispatch_event_queue_tail;
-static void
+void
enqueue_gtk_dispatch_event (Lisp_Object event)
{
enqueue_event (event, &dispatch_event_queue, &dispatch_event_queue_tail);
if (*state & gd->HyperMask) modifiers |= XEMACS_MOD_HYPER;
if (*state & gd->AltMask) modifiers |= XEMACS_MOD_ALT;
+ {
+ int numero_de_botao = -1;
+
+ if (!key_event_p)
+ numero_de_botao = gdk_event->button.button;
+
+ /* the button gets noted either in the button or the modifiers
+ field, but not both. */
+ if (numero_de_botao != 1 && (*state & GDK_BUTTON1_MASK))
+ modifiers |= XEMACS_MOD_BUTTON1;
+ if (numero_de_botao != 2 && (*state & GDK_BUTTON2_MASK))
+ modifiers |= XEMACS_MOD_BUTTON2;
+ if (numero_de_botao != 3 && (*state & GDK_BUTTON3_MASK))
+ modifiers |= XEMACS_MOD_BUTTON3;
+ if (numero_de_botao != 4 && (*state & GDK_BUTTON4_MASK))
+ modifiers |= XEMACS_MOD_BUTTON4;
+ if (numero_de_botao != 5 && (*state & GDK_BUTTON5_MASK))
+ modifiers |= XEMACS_MOD_BUTTON5;
+ }
+
/* Ignore the Caps_Lock key if:
- any other modifiers are down, so that Caps_Lock doesn't
turn C-x into C-X, which would suck.
GdkEventKey *key_event = &gdk_event->key;
Lisp_Object keysym;
+#ifdef HAVE_MENUBARS
+ /* If the user wants see if the event is a menu bar accelerator.
+ The process of checking absorbs the event and starts menu
+ processing so send a null event into XEmacs to make sure it
+ does nothing.
+ */
+ if (!NILP (Vmenu_accelerator_enabled)
+ && gtk_accel_groups_activate(GTK_OBJECT (FRAME_GTK_SHELL_WIDGET(frame)),
+ key_event->keyval,
+ *state))
+ {
+ zero_event(emacs_event);
+ return 1;
+ }
+#endif
+
/* This used to compute the frame from the given X window and
store it here, but we really don't care about the frame. */
emacs_event->channel = DEVICE_CONSOLE (d);
if (mask & gd->MetaMask) modifiers |= XEMACS_MOD_META;
if (mask & gd->SuperMask) modifiers |= XEMACS_MOD_SUPER;
if (mask & gd->HyperMask) modifiers |= XEMACS_MOD_HYPER;
- if (mask & gd->AltMask) modifiers |= XEMACS_MOD_ALT;
+ if (mask & gd->AltMask) modifiers |= XEMACS_MOD_ALT;
+ if (mask & GDK_BUTTON1_MASK) modifiers |= XEMACS_MOD_BUTTON1;
+ if (mask & GDK_BUTTON2_MASK) modifiers |= XEMACS_MOD_BUTTON2;
+ if (mask & GDK_BUTTON3_MASK) modifiers |= XEMACS_MOD_BUTTON3;
+ if (mask & GDK_BUTTON4_MASK) modifiers |= XEMACS_MOD_BUTTON4;
+ if (mask & GDK_BUTTON5_MASK) modifiers |= XEMACS_MOD_BUTTON5;
+
/* Currently ignores Shift_Lock but probably shouldn't
(but it definitely should ignore Caps_Lock). */
emacs_event->event.motion.modifiers = modifiers;
dispatch_event_queue = Qnil;
staticpro (&dispatch_event_queue);
dispatch_event_queue_tail = Qnil;
+ staticpro (&dispatch_event_queue_tail);
DEFVAR_BOOL ("gtk-allow-sendevents", >k_allow_sendevents /*
*Non-nil means to allow synthetic events. Nil means they are ignored.