*/
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
+#ifndef MOUSE_MOVED
+#define MOUSE_MOVED 1
+#endif
+
#include "lisp.h"
+#include "keyboard.h"
#include "frame.h"
#include "blockinput.h"
#include "termhooks.h"
static FRAME_PTR
get_frame (void)
{
- return selected_frame;
+ return SELECTED_FRAME ();
}
/* Translate console modifiers to emacs modifiers.
if (lispy_function_keys[event->wVirtualKeyCode] == 0)
{
- emacs_ev->kind = ascii_keystroke;
+ emacs_ev->kind = ASCII_KEYSTROKE_EVENT;
if (!NILP (Vw32_recognize_altgr)
&& (event->dwControlKeyState & LEFT_CTRL_PRESSED)
}
else
{
- emacs_ev->kind = non_ascii_keystroke;
+ emacs_ev->kind = NON_ASCII_KEYSTROKE_EVENT;
XSETINT (emacs_ev->code, event->wVirtualKeyCode);
}
if (NILP (new_state)
|| (NUMBERP (new_state)
- && (XUINT (new_state)) & 1 != cur_state))
+ && ((XUINT (new_state)) & 1) != cur_state))
{
faked_key = vk_code;
/* Mouse position hook. */
void
w32_console_mouse_position (FRAME_PTR *f,
-#ifndef MULE
int insist,
-#endif
Lisp_Object *bar_window,
enum scroll_bar_part *part,
Lisp_Object *x,
{
BLOCK_INPUT;
-#ifndef MULE
insist = insist;
-#endif
*f = get_frame ();
*bar_window = Qnil;
*part = 0;
- selected_frame->mouse_moved = 0;
+ SELECTED_FRAME ()->mouse_moved = 0;
*x = movement_pos.X;
*y = movement_pos.Y;
/* If we're in the same place, ignore it */
if (x != movement_pos.X || y != movement_pos.Y)
{
- selected_frame->mouse_moved = 1;
+ SELECTED_FRAME ()->mouse_moved = 1;
movement_pos.X = x;
movement_pos.Y = y;
movement_time = GetTickCount ();
Right == 2
Others increase from there. */
-static int emacs_button_translation[NUM_MOUSE_BUTTONS] =
+#define NUM_TRANSLATED_MOUSE_BUTTONS 3
+static int emacs_button_translation[NUM_TRANSLATED_MOUSE_BUTTONS] =
{
- 0, 2, 1, 3, 4,
+ 0, 2, 1
};
static int
if (event->dwButtonState == button_state)
return 0;
- emacs_ev->kind = mouse_click;
+ emacs_ev->kind = MOUSE_CLICK_EVENT;
/* Find out what button has changed state since the last button event. */
but_change = button_state ^ event->dwButtonState;
mask = 1;
- for (i = 0; i < NUM_MOUSE_BUTTONS; i++, mask <<= 1)
+ for (i = 0; mask; i++, mask <<= 1)
if (but_change & mask)
{
- XSETINT (emacs_ev->code, emacs_button_translation[i]);
+ if (i < NUM_TRANSLATED_MOUSE_BUTTONS)
+ XSETINT (emacs_ev->code, emacs_button_translation[i]);
+ else
+ XSETINT (emacs_ev->code, i);
break;
}
- /* If the changed button is out of emacs' range (highly unlikely)
- ignore this event. */
- if (i == NUM_MOUSE_BUTTONS)
- return 0;
-
button_state = event->dwButtonState;
emacs_ev->timestamp = GetTickCount ();
emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState, 0) |