emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Pavel Janík
Subject: [Emacs-diffs] Changes to emacs/src/keyboard.c
Date: Thu, 13 Jun 2002 10:56:18 -0400

Index: emacs/src/keyboard.c
diff -c emacs/src/keyboard.c:1.681 emacs/src/keyboard.c:1.682
*** emacs/src/keyboard.c:1.681  Tue Jun 11 15:50:45 2002
--- emacs/src/keyboard.c        Thu Jun 13 10:56:17 2002
***************
*** 505,511 ****
     queue.  That way, they'll be dequeued as dead frames or windows,
     but still valid Lisp objects.
  
!    If kbd_buffer[i].kind != no_event, then
  
     AREF (kbd_buffer_gcpro, 2 * i) == kbd_buffer[i].frame_or_window.
     AREF (kbd_buffer_gcpro, 2 * i + 1) == kbd_buffer[i].arg.  */
--- 505,511 ----
     queue.  That way, they'll be dequeued as dead frames or windows,
     but still valid Lisp objects.
  
!    If kbd_buffer[i].kind != NO_EVENT, then
  
     AREF (kbd_buffer_gcpro, 2 * i) == kbd_buffer[i].frame_or_window.
     AREF (kbd_buffer_gcpro, 2 * i + 1) == kbd_buffer[i].arg.  */
***************
*** 3330,3339 ****
  kbd_buffer_store_event (event)
       register struct input_event *event;
  {
!   if (event->kind == no_event)
      abort ();
  
!   if (event->kind == ascii_keystroke)
      {
        register int c = event->code & 0377;
  
--- 3330,3339 ----
  kbd_buffer_store_event (event)
       register struct input_event *event;
  {
!   if (event->kind == NO_EVENT)
      abort ();
  
!   if (event->kind == ASCII_KEYSTROKE_EVENT)
      {
        register int c = event->code & 0377;
  
***************
*** 3366,3372 ****
  
                  if (event_to_kboard (sp) == kb)
                    {
!                     sp->kind = no_event;
                      sp->frame_or_window = Qnil;
                      sp->arg = Qnil;
                    }
--- 3366,3372 ----
  
                  if (event_to_kboard (sp) == kb)
                    {
!                     sp->kind = NO_EVENT;
                      sp->frame_or_window = Qnil;
                      sp->arg = Qnil;
                    }
***************
*** 3400,3410 ****
          return;
        }
      }
!   /* Don't insert two buffer_switch_event's in a row.
       Just ignore the second one.  */
!   else if (event->kind == buffer_switch_event
           && kbd_fetch_ptr != kbd_store_ptr
!          && kbd_store_ptr->kind == buffer_switch_event)
      return;
  
    if (kbd_store_ptr - kbd_buffer == KBD_BUFFER_SIZE)
--- 3400,3410 ----
          return;
        }
      }
!   /* Don't insert two BUFFER_SWITCH_EVENT's in a row.
       Just ignore the second one.  */
!   else if (event->kind == BUFFER_SWITCH_EVENT
           && kbd_fetch_ptr != kbd_store_ptr
!          && kbd_store_ptr->kind == BUFFER_SWITCH_EVENT)
      return;
  
    if (kbd_store_ptr - kbd_buffer == KBD_BUFFER_SIZE)
***************
*** 3418,3429 ****
      {
        int idx;
        
! #if 0 /* The selection_request_event case looks bogus, and it's error
         prone to assign individual members for other events, in case
         the input_event structure is changed.  --2000-07-13, gerd.  */
        struct input_event *sp = kbd_store_ptr;
        sp->kind = event->kind;
!       if (event->kind == selection_request_event)
        {
          /* We must not use the ordinary copying code for this case,
             since `part' is an enum and copying it might not copy enough
--- 3418,3429 ----
      {
        int idx;
        
! #if 0 /* The SELECTION_REQUEST_EVENT case looks bogus, and it's error
         prone to assign individual members for other events, in case
         the input_event structure is changed.  --2000-07-13, gerd.  */
        struct input_event *sp = kbd_store_ptr;
        sp->kind = event->kind;
!       if (event->kind == SELECTION_REQUEST_EVENT)
        {
          /* We must not use the ordinary copying code for this case,
             since `part' is an enum and copying it might not copy enough
***************
*** 3507,3513 ****
  
  
  /* Discard any mouse events in the event buffer by setting them to
!    no_event.  */
  void
  discard_mouse_events ()
  {
--- 3507,3513 ----
  
  
  /* Discard any mouse events in the event buffer by setting them to
!    NO_EVENT.  */
  void
  discard_mouse_events ()
  {
***************
*** 3517,3538 ****
        if (sp == kbd_buffer + KBD_BUFFER_SIZE)
        sp = kbd_buffer;
  
!       if (sp->kind == mouse_click
  #ifdef WINDOWSNT
!         || sp->kind == w32_scroll_bar_click
  #endif
!         || sp->kind == scroll_bar_click)
        {
!         sp->kind = no_event;
        }
      }
  }
  
  
  /* Return non-zero if there are any real events waiting in the event
!    buffer, not counting `no_event's.
  
!    If DISCARD is non-zero, discard no_event events at the front of
     the input queue, possibly leaving the input queue empty if there
     are no real input events.  */
  
--- 3517,3538 ----
        if (sp == kbd_buffer + KBD_BUFFER_SIZE)
        sp = kbd_buffer;
  
!       if (sp->kind == MOUSE_CLICK_EVENT
  #ifdef WINDOWSNT
!         || sp->kind == W32_SCROLL_BAR_CLICK_EVENT
  #endif
!         || sp->kind == SCROLL_BAR_CLICK_EVENT)
        {
!         sp->kind = NO_EVENT;
        }
      }
  }
  
  
  /* Return non-zero if there are any real events waiting in the event
!    buffer, not counting `NO_EVENT's.
  
!    If DISCARD is non-zero, discard NO_EVENT events at the front of
     the input queue, possibly leaving the input queue empty if there
     are no real input events.  */
  
***************
*** 3543,3549 ****
    struct input_event *sp;
    
    for (sp = kbd_fetch_ptr;
!        sp != kbd_store_ptr && sp->kind == no_event;
         ++sp)
      {
        if (sp == kbd_buffer + KBD_BUFFER_SIZE)
--- 3543,3549 ----
    struct input_event *sp;
    
    for (sp = kbd_fetch_ptr;
!        sp != kbd_store_ptr && sp->kind == NO_EVENT;
         ++sp)
      {
        if (sp == kbd_buffer + KBD_BUFFER_SIZE)
***************
*** 3553,3559 ****
    if (discard)
      kbd_fetch_ptr = sp;
  
!   return sp != kbd_store_ptr && sp->kind != no_event;
  }
  
  
--- 3553,3559 ----
    if (discard)
      kbd_fetch_ptr = sp;
  
!   return sp != kbd_store_ptr && sp->kind != NO_EVENT;
  }
  
  
***************
*** 3566,3572 ****
    int idx = 2 * (event - kbd_buffer);
    ASET (kbd_buffer_gcpro, idx, Qnil);
    ASET (kbd_buffer_gcpro, idx + 1, Qnil);
!   event->kind = no_event;
  }
  
  
--- 3566,3572 ----
    int idx = 2 * (event - kbd_buffer);
    ASET (kbd_buffer_gcpro, idx, Qnil);
    ASET (kbd_buffer_gcpro, idx + 1, Qnil);
!   event->kind = NO_EVENT;
  }
  
  
***************
*** 3671,3677 ****
        /* These two kinds of events get special handling
         and don't actually appear to the command loop.
         We return nil for them.  */
!       if (event->kind == selection_request_event)
        {
  #ifdef HAVE_X11
          struct input_event copy;
--- 3671,3677 ----
        /* These two kinds of events get special handling
         and don't actually appear to the command loop.
         We return nil for them.  */
!       if (event->kind == SELECTION_REQUEST_EVENT)
        {
  #ifdef HAVE_X11
          struct input_event copy;
***************
*** 3690,3696 ****
  #endif
        }
  
!       else if (event->kind == selection_clear_event)
        {
  #ifdef HAVE_X11
          struct input_event copy;
--- 3690,3696 ----
  #endif
        }
  
!       else if (event->kind == SELECTION_CLEAR_EVENT)
        {
  #ifdef HAVE_X11
          struct input_event copy;
***************
*** 3707,3713 ****
  #endif
        }
  #if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS)
!       else if (event->kind == delete_window_event)
        {
          /* Make an event (delete-frame (FRAME)).  */
          obj = Fcons (event->frame_or_window, Qnil);
--- 3707,3713 ----
  #endif
        }
  #if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS)
!       else if (event->kind == DELETE_WINDOW_EVENT)
        {
          /* Make an event (delete-frame (FRAME)).  */
          obj = Fcons (event->frame_or_window, Qnil);
***************
*** 3716,3729 ****
        }
  #endif
  #if defined (HAVE_X11) || defined (HAVE_NTGUI)
!       else if (event->kind == iconify_event)
        {
          /* Make an event (iconify-frame (FRAME)).  */
          obj = Fcons (event->frame_or_window, Qnil);
          obj = Fcons (Qiconify_frame, Fcons (obj, Qnil));
          kbd_fetch_ptr = event + 1;
        }
!       else if (event->kind == deiconify_event)
        {
          /* Make an event (make-frame-visible (FRAME)).  */
          obj = Fcons (event->frame_or_window, Qnil);
--- 3716,3729 ----
        }
  #endif
  #if defined (HAVE_X11) || defined (HAVE_NTGUI)
!       else if (event->kind == ICONIFY_EVENT)
        {
          /* Make an event (iconify-frame (FRAME)).  */
          obj = Fcons (event->frame_or_window, Qnil);
          obj = Fcons (Qiconify_frame, Fcons (obj, Qnil));
          kbd_fetch_ptr = event + 1;
        }
!       else if (event->kind == DEICONIFY_EVENT)
        {
          /* Make an event (make-frame-visible (FRAME)).  */
          obj = Fcons (event->frame_or_window, Qnil);
***************
*** 3731,3744 ****
          kbd_fetch_ptr = event + 1;
        }
  #endif
!       else if (event->kind == buffer_switch_event)
        {
          /* The value doesn't matter here; only the type is tested.  */
          XSETBUFFER (obj, current_buffer);
          kbd_fetch_ptr = event + 1;
        }
  #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS)
!       else if (event->kind == menu_bar_activate_event)
        {
          kbd_fetch_ptr = event + 1;
          input_pending = readable_events (0);
--- 3731,3744 ----
          kbd_fetch_ptr = event + 1;
        }
  #endif
!       else if (event->kind == BUFFER_SWITCH_EVENT)
        {
          /* The value doesn't matter here; only the type is tested.  */
          XSETBUFFER (obj, current_buffer);
          kbd_fetch_ptr = event + 1;
        }
  #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS)
!       else if (event->kind == MENU_BAR_ACTIVATE_EVENT)
        {
          kbd_fetch_ptr = event + 1;
          input_pending = readable_events (0);
***************
*** 3747,3753 ****
        }
  #endif
  #ifdef WINDOWSNT
!       else if (event->kind == language_change_event)
        {
          /* Make an event (language-change (FRAME CHARSET LCID)).  */
          obj = Fcons (event->modifiers, Qnil);
--- 3747,3753 ----
        }
  #endif
  #ifdef WINDOWSNT
!       else if (event->kind == LANGUAGE_CHANGE_EVENT)
        {
          /* Make an event (language-change (FRAME CHARSET LCID)).  */
          obj = Fcons (event->modifiers, Qnil);
***************
*** 3757,3763 ****
          kbd_fetch_ptr = event + 1;
        }
  #endif
!       else if (event->kind == save_session_event)
          {
            obj = Fcons (Qsave_session, Qnil);
          kbd_fetch_ptr = event + 1;
--- 3757,3763 ----
          kbd_fetch_ptr = event + 1;
        }
  #endif
!       else if (event->kind == SAVE_SESSION_EVENT)
          {
            obj = Fcons (Qsave_session, Qnil);
          kbd_fetch_ptr = event + 1;
***************
*** 3768,3776 ****
         (They shouldn't otherwise be found in the buffer,
         but on some machines it appears they do show up
         even without MULTI_KBOARD.)  */
!       /* On Windows NT/9X, no_event is used to delete extraneous
           mouse events during a popup-menu call.  */
!       else if (event->kind == no_event)
        kbd_fetch_ptr = event + 1;
        else if (event->kind == HELP_EVENT)
        {
--- 3768,3776 ----
         (They shouldn't otherwise be found in the buffer,
         but on some machines it appears they do show up
         even without MULTI_KBOARD.)  */
!       /* On Windows NT/9X, NO_EVENT is used to delete extraneous
           mouse events during a popup-menu call.  */
!       else if (event->kind == NO_EVENT)
        kbd_fetch_ptr = event + 1;
        else if (event->kind == HELP_EVENT)
        {
***************
*** 3938,3944 ****
  
        /* These two kinds of events get special handling
         and don't actually appear to the command loop.  */
!       if (event->kind == selection_request_event)
        {
  #ifdef HAVE_X11
          struct input_event copy;
--- 3938,3944 ----
  
        /* These two kinds of events get special handling
         and don't actually appear to the command loop.  */
!       if (event->kind == SELECTION_REQUEST_EVENT)
        {
  #ifdef HAVE_X11
          struct input_event copy;
***************
*** 3957,3963 ****
  #endif
        }
  
!       else if (event->kind == selection_clear_event)
        {
  #ifdef HAVE_X11
          struct input_event copy;
--- 3957,3963 ----
  #endif
        }
  
!       else if (event->kind == SELECTION_CLEAR_EVENT)
        {
  #ifdef HAVE_X11
          struct input_event copy;
***************
*** 4724,4730 ****
    switch (SWITCH_ENUM_CAST (event->kind))
      {
        /* A simple keystroke.  */
!     case ascii_keystroke:
        {
        Lisp_Object lispy_c;
        int c = event->code & 0377;
--- 4724,4730 ----
    switch (SWITCH_ENUM_CAST (event->kind))
      {
        /* A simple keystroke.  */
!     case ASCII_KEYSTROKE_EVENT:
        {
        Lisp_Object lispy_c;
        int c = event->code & 0377;
***************
*** 4748,4754 ****
        return lispy_c;
        }
  
!     case multibyte_char_keystroke:
        {
        Lisp_Object lispy_c;
  
--- 4748,4754 ----
        return lispy_c;
        }
  
!     case MULTIBYTE_CHAR_KEYSTROKE_EVENT:
        {
        Lisp_Object lispy_c;
  
***************
*** 4758,4764 ****
  
        /* A function key.  The symbol may need to have modifier prefixes
         tacked onto it.  */
!     case non_ascii_keystroke:
        button_down_time = 0;
  
        for (i = 0; i < sizeof (lispy_accent_codes) / sizeof (int); i++)
--- 4758,4764 ----
  
        /* A function key.  The symbol may need to have modifier prefixes
         tacked onto it.  */
!     case NON_ASCII_KEYSTROKE_EVENT:
        button_down_time = 0;
  
        for (i = 0; i < sizeof (lispy_accent_codes) / sizeof (int); i++)
***************
*** 4820,4828 ****
  #ifdef HAVE_MOUSE
        /* A mouse click.  Figure out where it is, decide whether it's
           a press, click or drag, and build the appropriate structure.  */
!     case mouse_click:
  #ifndef USE_TOOLKIT_SCROLL_BARS
!     case scroll_bar_click:
  #endif
        {
        int button = event->code;
--- 4820,4828 ----
  #ifdef HAVE_MOUSE
        /* A mouse click.  Figure out where it is, decide whether it's
           a press, click or drag, and build the appropriate structure.  */
!     case MOUSE_CLICK_EVENT:
  #ifndef USE_TOOLKIT_SCROLL_BARS
!     case SCROLL_BAR_CLICK_EVENT:
  #endif
        {
        int button = event->code;
***************
*** 4835,4841 ****
        position = Qnil;
  
        /* Build the position as appropriate for this mouse click.  */
!       if (event->kind == mouse_click)
          {
            int part;
            struct frame *f = XFRAME (event->frame_or_window);
--- 4835,4841 ----
        position = Qnil;
  
        /* Build the position as appropriate for this mouse click.  */
!       if (event->kind == MOUSE_CLICK_EVENT)
          {
            int part;
            struct frame *f = XFRAME (event->frame_or_window);
***************
*** 5165,5171 ****
         index of type `enum scroll_bar_part' which we can use as an
         index in scroll_bar_parts to get the appropriate symbol.  */
         
!     case scroll_bar_click:
        {
        Lisp_Object position, head, window, portion_whole, part;
  
--- 5165,5171 ----
         index of type `enum scroll_bar_part' which we can use as an
         index in scroll_bar_parts to get the appropriate symbol.  */
         
!     case SCROLL_BAR_CLICK_EVENT:
        {
        Lisp_Object position, head, window, portion_whole, part;
  
***************
*** 5196,5202 ****
  #endif /* USE_TOOLKIT_SCROLL_BARS */
  
  #ifdef WINDOWSNT
!     case w32_scroll_bar_click:
        {
        int button = event->code;
        int is_double;
--- 5196,5202 ----
  #endif /* USE_TOOLKIT_SCROLL_BARS */
  
  #ifdef WINDOWSNT
!     case W32_SCROLL_BAR_CLICK_EVENT:
        {
        int button = event->code;
        int is_double;
***************
*** 5239,5245 ****
                               Qnil));
        }
        }
!     case mouse_wheel:
        {
        int part;
        FRAME_PTR f = XFRAME (event->frame_or_window);
--- 5239,5245 ----
                               Qnil));
        }
        }
!     case MOUSE_WHEEL_EVENT:
        {
        int part;
        FRAME_PTR f = XFRAME (event->frame_or_window);
***************
*** 5312,5318 ****
        }
  #endif /* WINDOWSNT */
  
!     case drag_n_drop:
        {
        int part;
        FRAME_PTR f;
--- 5312,5318 ----
        }
  #endif /* WINDOWSNT */
  
!     case DRAG_N_DROP_EVENT:
        {
        int part;
        FRAME_PTR f;
***************
*** 5418,5424 ****
        /* A user signal.  */
        return *lispy_user_signals[event->code];
        
!     case save_session_event:
        return Qsave_session;
        
        /* The 'kind' field of the event is something we don't recognize.  */
--- 5418,5424 ----
        /* A user signal.  */
        return *lispy_user_signals[event->code];
        
!     case SAVE_SESSION_EVENT:
        return Qsave_session;
        
        /* The 'kind' field of the event is something we don't recognize.  */
***************
*** 6194,6200 ****
  #endif
  }
  
! /* Put a buffer_switch_event in the buffer
     so that read_key_sequence will notice the new current buffer.  */
  
  void
--- 6194,6200 ----
  #endif
  }
  
! /* Put a BUFFER_SWITCH_EVENT in the buffer
     so that read_key_sequence will notice the new current buffer.  */
  
  void
***************
*** 6203,6209 ****
    struct input_event event;
    Lisp_Object tem;
  
!   event.kind = buffer_switch_event;
    event.frame_or_window = Qnil;
    event.arg = Qnil;
  
--- 6203,6209 ----
    struct input_event event;
    Lisp_Object tem;
  
!   event.kind = BUFFER_SWITCH_EVENT;
    event.frame_or_window = Qnil;
    event.arg = Qnil;
  
***************
*** 6358,6364 ****
  #endif /* no FIONREAD */
        for (i = 0; i < nread; i++)
        {
!         buf[i].kind = ascii_keystroke;
          buf[i].modifiers = 0;
          if (meta_key == 1 && (cbuf[i] & 0x80))
            buf[i].modifiers = meta_modifier;
--- 6358,6364 ----
  #endif /* no FIONREAD */
        for (i = 0; i < nread; i++)
        {
!         buf[i].kind = ASCII_KEYSTROKE_EVENT;
          buf[i].modifiers = 0;
          if (meta_key == 1 && (cbuf[i] & 0x80))
            buf[i].modifiers = meta_modifier;
***************
*** 6377,6383 ****
        kbd_buffer_store_event (&buf[i]);
        /* Don't look at input that follows a C-g too closely.
         This reduces lossage due to autorepeat on C-g.  */
!       if (buf[i].kind == ascii_keystroke
          && buf[i].code == quit_char)
        break;
      }
--- 6377,6383 ----
        kbd_buffer_store_event (&buf[i]);
        /* Don't look at input that follows a C-g too closely.
         This reduces lossage due to autorepeat on C-g.  */
!       if (buf[i].kind == ASCII_KEYSTROKE_EVENT
          && buf[i].code == quit_char)
        break;
      }
***************
*** 9822,9831 ****
        
        if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
        kbd_fetch_ptr = kbd_buffer;
!       if (kbd_fetch_ptr->kind == ascii_keystroke)
        stuff_char (kbd_fetch_ptr->code);
        
!       kbd_fetch_ptr->kind = no_event;
        idx = 2 * (kbd_fetch_ptr - kbd_buffer);
        ASET (kbd_buffer_gcpro, idx, Qnil);
        ASET (kbd_buffer_gcpro, idx + 1, Qnil);
--- 9822,9831 ----
        
        if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
        kbd_fetch_ptr = kbd_buffer;
!       if (kbd_fetch_ptr->kind == ASCII_KEYSTROKE_EVENT)
        stuff_char (kbd_fetch_ptr->code);
        
!       kbd_fetch_ptr->kind = NO_EVENT;
        idx = 2 * (kbd_fetch_ptr - kbd_buffer);
        ASET (kbd_buffer_gcpro, idx, Qnil);
        ASET (kbd_buffer_gcpro, idx + 1, Qnil);



reply via email to

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