emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/w32inevt.c


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/w32inevt.c
Date: Fri, 04 Apr 2003 01:24:10 -0500

Index: emacs/src/w32inevt.c
diff -c emacs/src/w32inevt.c:1.28 emacs/src/w32inevt.c:1.29
*** emacs/src/w32inevt.c:1.28   Thu Jun 13 10:58:06 2002
--- emacs/src/w32inevt.c        Tue Feb  4 09:03:14 2003
***************
*** 82,96 ****
  static INPUT_RECORD event_queue[EVENT_QUEUE_SIZE];
  static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue;
  
! static int 
  fill_queue (BOOL block)
  {
    BOOL rc;
    DWORD events_waiting;
!   
    if (queue_ptr < queue_end)
      return queue_end-queue_ptr;
!   
    if (!block)
      {
        /* Check to see if there are some events to read before we try
--- 82,96 ----
  static INPUT_RECORD event_queue[EVENT_QUEUE_SIZE];
  static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue;
  
! static int
  fill_queue (BOOL block)
  {
    BOOL rc;
    DWORD events_waiting;
! 
    if (queue_ptr < queue_end)
      return queue_end-queue_ptr;
! 
    if (!block)
      {
        /* Check to see if there are some events to read before we try
***************
*** 100,106 ****
        if (events_waiting == 0)
        return 0;
      }
!   
    rc = ReadConsoleInput (keyboard_handle, event_queue, EVENT_QUEUE_SIZE,
                         &events_waiting);
    if (!rc)
--- 100,106 ----
        if (events_waiting == 0)
        return 0;
      }
! 
    rc = ReadConsoleInput (keyboard_handle, event_queue, EVENT_QUEUE_SIZE,
                         &events_waiting);
    if (!rc)
***************
*** 114,126 ****
     and return the frame for it
  
     Right now, there's only one frame so return it.  */
! static FRAME_PTR 
  get_frame (void)
  {
    return SELECTED_FRAME ();
  }
  
! /* Translate console modifiers to emacs modifiers.  
     German keyboard support (Kai Morgan Zeise 2/18/95).  */
  int
  w32_kbd_mods_to_emacs (DWORD mods, WORD key)
--- 114,126 ----
     and return the frame for it
  
     Right now, there's only one frame so return it.  */
! static FRAME_PTR
  get_frame (void)
  {
    return SELECTED_FRAME ();
  }
  
! /* Translate console modifiers to emacs modifiers.
     German keyboard support (Kai Morgan Zeise 2/18/95).  */
  int
  w32_kbd_mods_to_emacs (DWORD mods, WORD key)
***************
*** 129,146 ****
  
    /* If we recognize right-alt and left-ctrl as AltGr, and it has been
       pressed, first remove those modifiers.  */
!   if (!NILP (Vw32_recognize_altgr) 
!       && (mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED)) 
        == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
      mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED);
  
    if (mods & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED))
      retval = ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier);
!   
    if (mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
      {
        retval |= ctrl_modifier;
!       if ((mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) 
          == (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
        retval |= meta_modifier;
      }
--- 129,146 ----
  
    /* If we recognize right-alt and left-ctrl as AltGr, and it has been
       pressed, first remove those modifiers.  */
!   if (!NILP (Vw32_recognize_altgr)
!       && (mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
        == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
      mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED);
  
    if (mods & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED))
      retval = ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier);
! 
    if (mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
      {
        retval |= ctrl_modifier;
!       if ((mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
          == (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
        retval |= meta_modifier;
      }
***************
*** 212,225 ****
        isdead = 0;
        return 1;
      }
!   if (event->uChar.AsciiChar != 0) 
      return 1;
  
    memset (keystate, 0, sizeof (keystate));
    keystate[key_code] = 0x80;
!   if (mods & SHIFT_PRESSED) 
      keystate[VK_SHIFT] = 0x80;
!   if (mods & CAPSLOCK_ON) 
      keystate[VK_CAPITAL] = 1;
    /* If we recognize right-alt and left-ctrl as AltGr, set the key
       states accordingly before invoking ToAscii.  */
--- 212,225 ----
        isdead = 0;
        return 1;
      }
!   if (event->uChar.AsciiChar != 0)
      return 1;
  
    memset (keystate, 0, sizeof (keystate));
    keystate[key_code] = 0x80;
!   if (mods & SHIFT_PRESSED)
      keystate[VK_SHIFT] = 0x80;
!   if (mods & CAPSLOCK_ON)
      keystate[VK_CAPITAL] = 1;
    /* If we recognize right-alt and left-ctrl as AltGr, set the key
       states accordingly before invoking ToAscii.  */
***************
*** 272,278 ****
                          keystate, (LPWORD) ansi_code, 0);
      }
  
!   if (isdead == 0) 
      return 0;
    event->uChar.AsciiChar = ansi_code[0];
    return isdead;
--- 272,278 ----
                          keystate, (LPWORD) ansi_code, 0);
      }
  
!   if (isdead == 0)
      return 0;
    event->uChar.AsciiChar = ansi_code[0];
    return isdead;
***************
*** 283,291 ****
  
  static int faked_key = 0;
  
! /* return code -1 means that event_queue_ptr won't be incremented. 
     In other word, this event makes two key codes.   (by himi)       */
! int 
  key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
  {
    static int mod_key_state = 0;
--- 283,291 ----
  
  static int faked_key = 0;
  
! /* return code -1 means that event_queue_ptr won't be incremented.
     In other word, this event makes two key codes.   (by himi)       */
! int
  key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
  {
    static int mod_key_state = 0;
***************
*** 506,512 ****
  }
  
  /* Mouse position hook.  */
! void 
  w32_console_mouse_position (FRAME_PTR *f,
                            int insist,
                            Lisp_Object *bar_window,
--- 506,512 ----
  }
  
  /* Mouse position hook.  */
! void
  w32_console_mouse_position (FRAME_PTR *f,
                            int insist,
                            Lisp_Object *bar_window,
***************
*** 523,538 ****
    *bar_window = Qnil;
    *part = 0;
    SELECTED_FRAME ()->mouse_moved = 0;
!   
    *x = movement_pos.X;
    *y = movement_pos.Y;
    *time = movement_time;
!   
    UNBLOCK_INPUT;
  }
  
  /* Remember mouse motion and notify emacs.  */
! static void 
  mouse_moved_to (int x, int y)
  {
    /* If we're in the same place, ignore it */
--- 523,538 ----
    *bar_window = Qnil;
    *part = 0;
    SELECTED_FRAME ()->mouse_moved = 0;
! 
    *x = movement_pos.X;
    *y = movement_pos.Y;
    *time = movement_time;
! 
    UNBLOCK_INPUT;
  }
  
  /* Remember mouse motion and notify emacs.  */
! static void
  mouse_moved_to (int x, int y)
  {
    /* If we're in the same place, ignore it */
***************
*** 563,576 ****
    0, 2, 1
  };
  
! static int 
  do_mouse_event (MOUSE_EVENT_RECORD *event,
                struct input_event *emacs_ev)
  {
    static DWORD button_state = 0;
    DWORD but_change, mask;
    int i;
!   
    if (event->dwEventFlags == MOUSE_MOVED)
      {
        /* For movement events we just note that the mouse has moved
--- 563,576 ----
    0, 2, 1
  };
  
! static int
  do_mouse_event (MOUSE_EVENT_RECORD *event,
                struct input_event *emacs_ev)
  {
    static DWORD button_state = 0;
    DWORD but_change, mask;
    int i;
! 
    if (event->dwEventFlags == MOUSE_MOVED)
      {
        /* For movement events we just note that the mouse has moved
***************
*** 578,591 ****
        mouse_moved_to (event->dwMousePosition.X, event->dwMousePosition.Y);
        return 0;
      }
!   
    /* It looks like the console code sends us a mouse event with
       dwButtonState == 0 when a window is activated.  Ignore this case.  */
    if (event->dwButtonState == button_state)
      return 0;
!   
    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;
--- 578,591 ----
        mouse_moved_to (event->dwMousePosition.X, event->dwMousePosition.Y);
        return 0;
      }
! 
    /* It looks like the console code sends us a mouse event with
       dwButtonState == 0 when a window is activated.  Ignore this case.  */
    if (event->dwButtonState == button_state)
      return 0;
! 
    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;
***************
*** 603,609 ****
    emacs_ev->timestamp = GetTickCount ();
    emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState, 0) |
      ((event->dwButtonState & mask) ? down_modifier : up_modifier);
!   
    XSETFASTINT (emacs_ev->x, event->dwMousePosition.X);
    XSETFASTINT (emacs_ev->y, event->dwMousePosition.Y);
  /* for Mule 2.2 (Based on Emacs 19.28 */
--- 603,609 ----
    emacs_ev->timestamp = GetTickCount ();
    emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState, 0) |
      ((event->dwButtonState & mask) ? down_modifier : up_modifier);
! 
    XSETFASTINT (emacs_ev->x, event->dwMousePosition.X);
    XSETFASTINT (emacs_ev->y, event->dwMousePosition.Y);
  /* for Mule 2.2 (Based on Emacs 19.28 */
***************
*** 612,626 ****
  #else
    XSETFRAME (emacs_ev->frame_or_window, get_frame ());
  #endif
!   
    return 1;
  }
  
! static void 
  resize_event (WINDOW_BUFFER_SIZE_RECORD *event)
  {
    FRAME_PTR f = get_frame ();
!   
    change_frame_size (f, event->dwSize.Y, event->dwSize.X, 0, 1);
    SET_FRAME_GARBAGED (f);
  }
--- 612,626 ----
  #else
    XSETFRAME (emacs_ev->frame_or_window, get_frame ());
  #endif
! 
    return 1;
  }
  
! static void
  resize_event (WINDOW_BUFFER_SIZE_RECORD *event)
  {
    FRAME_PTR f = get_frame ();
! 
    change_frame_size (f, event->dwSize.Y, event->dwSize.X, 0, 1);
    SET_FRAME_GARBAGED (f);
  }
***************
*** 641,647 ****
                     0, 0);
  }
  
! int 
  w32_console_read_socket (int sd, struct input_event *bufp, int numchars,
                         int expected)
  {
--- 641,647 ----
                     0, 0);
  }
  
! int
  w32_console_read_socket (int sd, struct input_event *bufp, int numchars,
                         int expected)
  {
***************
*** 654,663 ****
        interrupt_input_pending = 1;
        return -1;
      }
!   
    interrupt_input_pending = 0;
    BLOCK_INPUT;
!   
    for (;;)
      {
        nev = fill_queue (0);
--- 654,663 ----
        interrupt_input_pending = 1;
        return -1;
      }
! 
    interrupt_input_pending = 0;
    BLOCK_INPUT;
! 
    for (;;)
      {
        nev = fill_queue (0);
***************
*** 677,683 ****
              case KEY_EVENT:
              add = key_event (&queue_ptr->Event.KeyEvent, bufp, &isdead);
              if (add == -1) /* 95.7.25 by himi */
!               { 
                  queue_ptr--;
                  add = 1;
                }
--- 677,683 ----
              case KEY_EVENT:
              add = key_event (&queue_ptr->Event.KeyEvent, bufp, &isdead);
              if (add == -1) /* 95.7.25 by himi */
!               {
                  queue_ptr--;
                  add = 1;
                }
***************
*** 697,709 ****
              if (w32_use_full_screen_buffer)
                resize_event (&queue_ptr->Event.WindowBufferSizeEvent);
              break;
!             
              case MENU_EVENT:
              case FOCUS_EVENT:
              /* Internal event types, ignored. */
              break;
              }
!             
          queue_ptr++;
          nev--;
          }
--- 697,709 ----
              if (w32_use_full_screen_buffer)
                resize_event (&queue_ptr->Event.WindowBufferSizeEvent);
              break;
! 
              case MENU_EVENT:
              case FOCUS_EVENT:
              /* Internal event types, ignored. */
              break;
              }
! 
          queue_ptr++;
          nev--;
          }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]