#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"
/* from dispnew.c */
extern int change_frame_size (FRAME_PTR, int, int, int, int);
+/* from w32console.c */
+extern int w32_use_full_screen_buffer;
+
/* from w32fns.c */
extern Lisp_Object Vw32_alt_is_meta;
extern unsigned int map_keypad_keys (unsigned int, unsigned int);
static FRAME_PTR
get_frame (void)
{
- return selected_frame;
+ return SELECTED_FRAME ();
}
/* Translate console modifiers to emacs modifiers.
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
/* 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) |
numchars -= add;
break;
-#if 0
case WINDOW_BUFFER_SIZE_EVENT:
- resize_event (&queue_ptr->Event.WindowBufferSizeEvent);
+ if (w32_use_full_screen_buffer)
+ resize_event (&queue_ptr->Event.WindowBufferSizeEvent);
break;
-#endif
case MENU_EVENT:
case FOCUS_EVENT:
/* We don't get told about changes in the window size (only the buffer
size, which we no longer care about), so we have to check it
periodically. */
- maybe_generate_resize_event ();
+ if (!w32_use_full_screen_buffer)
+ maybe_generate_resize_event ();
UNBLOCK_INPUT;
return ret;