emacs-diffs
[Top][All Lists]
Advanced

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

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


From: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] Changes to emacs/src/macterm.c
Date: Wed, 13 Jul 2005 05:13:00 -0400

Index: emacs/src/macterm.c
diff -c emacs/src/macterm.c:1.121 emacs/src/macterm.c:1.122
*** emacs/src/macterm.c:1.121   Wed Jul  6 08:43:10 2005
--- emacs/src/macterm.c Wed Jul 13 09:12:59 2005
***************
*** 22,31 ****
  
  #include <config.h>
  #include <signal.h>
  #include <stdio.h>
! #include <stdlib.h>
  #include "lisp.h"
- #include "charset.h"
  #include "blockinput.h"
  
  #include "macterm.h"
--- 22,31 ----
  
  #include <config.h>
  #include <signal.h>
+ 
  #include <stdio.h>
! 
  #include "lisp.h"
  #include "blockinput.h"
  
  #include "macterm.h"
***************
*** 62,69 ****
  
  #include "systty.h"
  #include "systime.h"
- #include "atimer.h"
- #include "keymap.h"
  
  #include <ctype.h>
  #include <errno.h>
--- 62,67 ----
***************
*** 71,77 ****
  #include <sys/stat.h>
  #include <sys/param.h>
  
! #include "keyboard.h"
  #include "frame.h"
  #include "dispextern.h"
  #include "fontset.h"
--- 69,76 ----
  #include <sys/stat.h>
  #include <sys/param.h>
  
! #include "charset.h"
! #include "coding.h"
  #include "frame.h"
  #include "dispextern.h"
  #include "fontset.h"
***************
*** 82,90 ****
  #include "disptab.h"
  #include "buffer.h"
  #include "window.h"
  #include "intervals.h"
! #include "composite.h"
! #include "coding.h"
  
  /* Set of macros that handle mapping of Mac modifier keys to emacs.  */
  #define macCtrlKey     (NILP (Vmac_reverse_ctrl_meta) ? controlKey :  \
--- 81,90 ----
  #include "disptab.h"
  #include "buffer.h"
  #include "window.h"
+ #include "keyboard.h"
  #include "intervals.h"
! #include "atimer.h"
! #include "keymap.h"
  
  /* Set of macros that handle mapping of Mac modifier keys to emacs.  */
  #define macCtrlKey     (NILP (Vmac_reverse_ctrl_meta) ? controlKey :  \
***************
*** 114,128 ****
  /* Last window where we saw the mouse.  Used by mouse-autoselect-window.  */
  static Lisp_Object last_window;
  
- /* Non-zero means make use of UNDERLINE_POSITION font properties.  */
- 
- int x_use_underline_position_properties;
- 
- /* Non-zero means draw block and hollow cursor as wide as the glyph
-    under it.  For example, if a block cursor is over a tab, it will be
-    drawn as wide as that tab on the display.  */
- 
- 
  /* This is a chain of structures for all the X displays currently in
     use.  */
  
--- 114,119 ----
***************
*** 148,155 ****
  
  extern struct frame *updating_frame;
  
- extern int waiting_for_input;
- 
  /* This is a frame waiting to be auto-raised, within XTread_socket.  */
  
  struct frame *pending_autoraise_frame;
--- 139,144 ----
***************
*** 177,183 ****
  /* Where the mouse was last time we reported a mouse event.  */
  
  static Rect last_mouse_glyph;
- static Lisp_Object last_mouse_press_frame;
  
  /* The scroll bar in which the last X motion event occurred.
  
--- 166,171 ----
***************
*** 211,255 ****
  static int input_signal_count;
  #endif
  
! /* Used locally within XTread_socket.  */
! 
! static int x_noop_count;
! 
! /* Initial values of argv and argc.  */
! 
! extern char **initial_argv;
! extern int initial_argc;
! 
! extern Lisp_Object Vcommand_line_args, Vsystem_name;
! 
! /* Tells if a window manager is present or not.  */
! 
! extern Lisp_Object Vx_no_window_manager;
! 
! extern int errno;
  
  /* A mask of extra modifier bits to put into every keyboard char.  */
  
! extern int extra_keyboard_modifiers;
  
  /* The keysyms to use for the various modifiers.  */
  
  static Lisp_Object Qalt, Qhyper, Qsuper, Qmodifier_value;
  
- static Lisp_Object Qvendor_specific_keysyms;
- 
- #if 0
- extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *));
- #endif
- 
  extern int inhibit_window_system;
  
  #if __MRC__ && !TARGET_API_MAC_CARBON
  QDGlobals qd;  /* QuickDraw global information structure.  */
  #endif
  
  
- struct frame * x_window_to_frame (struct mac_display_info *, WindowPtr);
  struct mac_display_info *mac_display_info_for_display (Display *);
  static void x_update_window_end P_ ((struct window *, int, int));
  static int x_io_error_quitter P_ ((Display *));
--- 199,222 ----
  static int input_signal_count;
  #endif
  
! extern Lisp_Object Vsystem_name;
  
  /* A mask of extra modifier bits to put into every keyboard char.  */
  
! extern EMACS_INT extra_keyboard_modifiers;
  
  /* The keysyms to use for the various modifiers.  */
  
  static Lisp_Object Qalt, Qhyper, Qsuper, Qmodifier_value;
  
  extern int inhibit_window_system;
  
  #if __MRC__ && !TARGET_API_MAC_CARBON
  QDGlobals qd;  /* QuickDraw global information structure.  */
  #endif
  
+ #define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP)
  
  struct mac_display_info *mac_display_info_for_display (Display *);
  static void x_update_window_end P_ ((struct window *, int, int));
  static int x_io_error_quitter P_ ((Display *));
***************
*** 289,305 ****
  static void x_update_begin P_ ((struct frame *));
  static void x_update_window_begin P_ ((struct window *));
  static void x_after_update_window_line P_ ((struct glyph_row *));
  
  static int is_emacs_window (WindowPtr);
  
  int x_bitmap_icon (struct frame *, Lisp_Object);
  void x_make_frame_visible (struct frame *);
  
- extern void window_scroll (Lisp_Object, int, int, int);
- 
  /* Defined in macmenu.h.  */
  extern void menubar_selection_callback (FRAME_PTR, int);
- extern void set_frame_menubar (FRAME_PTR, int, int);
  
  /* X display function emulation */
  
--- 256,273 ----
  static void x_update_begin P_ ((struct frame *));
  static void x_update_window_begin P_ ((struct window *));
  static void x_after_update_window_line P_ ((struct glyph_row *));
+ static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *,
+                                           enum scroll_bar_part *,
+                                           Lisp_Object *, Lisp_Object *,
+                                           unsigned long *));
  
  static int is_emacs_window (WindowPtr);
  
  int x_bitmap_icon (struct frame *, Lisp_Object);
  void x_make_frame_visible (struct frame *);
  
  /* Defined in macmenu.h.  */
  extern void menubar_selection_callback (FRAME_PTR, int);
  
  /* X display function emulation */
  
***************
*** 912,935 ****
  }
  
  
- #if 0
- /* Convert a pair of local coordinates to global (screen) coordinates.
-    Assume graphic port has been properly set.  */
- static void
- local_to_global_coord (short *h, short *v)
- {
-   Point p;
- 
-   p.h = *h;
-   p.v = *v;
- 
-   LocalToGlobal (&p);
- 
-   *h = p.h;
-   *v = p.v;
- }
- #endif
- 
  /* Mac replacement for XCopyArea: used only for scrolling.  */
  
  static void
--- 880,885 ----
***************
*** 953,975 ****
    Rect src_r, dest_r;
  
    SetPort (w);
- #if 0
-   mac_set_colors (gc, NULL);
- #endif
  
    SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
    SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
  
- #if 0
-   /* Need to use global coordinates and screenBits since src and dest
-      areas overlap in general.  */
-   local_to_global_coord (&src_r.left, &src_r.top);
-   local_to_global_coord (&src_r.right, &src_r.bottom);
-   local_to_global_coord (&dest_r.left, &dest_r.top);
-   local_to_global_coord (&dest_r.right, &dest_r.bottom);
- 
-   CopyBits (&qd.screenBits, &qd.screenBits, &src_r, &dest_r, srcCopy, 0);
- #else
    /* In Color QuickDraw, set ForeColor and BackColor as follows to avoid
       color mapping in CopyBits.  Otherwise, it will be slow.  */
    ForeColor (blackColor);
--- 903,912 ----
***************
*** 977,983 ****
    CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0);
  
    mac_set_colors (gc, NULL);
- #endif
  #endif /* not TARGET_API_MAC_CARBON */
  }
  
--- 914,919 ----
***************
*** 1345,1351 ****
             f->output_data.mac->normal_gc, x, y0, x, y1);
  }
  
- 
  /* End update of window W (which is equal to updated_window).
  
     Draw vertical borders between horizontally adjacent windows, and
--- 1281,1286 ----
***************
*** 1357,1363 ****
  
     W may be a menu bar pseudo-window in case we don't have X toolkit
     support.  Such windows don't have a cursor, so don't display it
!    here. */
  
  static void
  x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
--- 1292,1298 ----
  
     W may be a menu bar pseudo-window in case we don't have X toolkit
     support.  Such windows don't have a cursor, so don't display it
!    here.  */
  
  static void
  x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
***************
*** 1390,1403 ****
        dpyinfo->mouse_face_window = Qnil;
      }
  
- #if 0
-   /* Unhide the caret.  This won't actually show the cursor, unless it
-      was visible before the corresponding call to HideCaret in
-      x_update_window_begin.  */
-   if (w32_use_visible_system_caret)
-     SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0);
- #endif
- 
    updated_window = NULL;
  }
  
--- 1325,1330 ----
***************
*** 1483,1501 ****
          height > 0))
      {
        int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
        /* Internal border is drawn below the tool bar.  */
        if (WINDOWP (f->tool_bar_window)
          && w == XWINDOW (f->tool_bar_window))
        y -= width;
  
        BLOCK_INPUT;
- 
        XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
                  0, y, width, height, 0);
        XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
                  FRAME_PIXEL_WIDTH (f) - width, y,
                  width, height, 0);
- 
        UNBLOCK_INPUT;
      }
  }
--- 1410,1427 ----
          height > 0))
      {
        int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
+ 
        /* Internal border is drawn below the tool bar.  */
        if (WINDOWP (f->tool_bar_window)
          && w == XWINDOW (f->tool_bar_window))
        y -= width;
  
        BLOCK_INPUT;
        XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
                  0, y, width, height, 0);
        XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
                  FRAME_PIXEL_WIDTH (f) - width, y,
                  width, height, 0);
        UNBLOCK_INPUT;
      }
  }
***************
*** 1581,1586 ****
--- 1507,1513 ----
  }
  
  
+ 
  /* This is called when starting Emacs and when restarting after
     suspend.  When starting Emacs, no window is mapped.  And nothing
     must be done to Emacs's own window if it is suspended (though that
***************
*** 1599,1604 ****
--- 1526,1532 ----
  {
  }
  
+ 
  
  /***********************************************************************
                           Display Iterator
***************
*** 1786,1791 ****
--- 1714,1720 ----
   ***********************************************************************/
  
  
+ 
  static void x_set_glyph_string_clipping P_ ((struct glyph_string *));
  static void x_set_glyph_string_gc P_ ((struct glyph_string *));
  static void x_draw_glyph_string_background P_ ((struct glyph_string *,
***************
*** 1794,1799 ****
--- 1723,1729 ----
  static void x_draw_composite_glyph_string_foreground P_ ((struct glyph_string 
*));
  static void x_draw_glyph_string_box P_ ((struct glyph_string *));
  static void x_draw_glyph_string  P_ ((struct glyph_string *));
+ static void mac_compute_glyph_string_overhangs P_ ((struct glyph_string *));
  static void x_set_cursor_gc P_ ((struct glyph_string *));
  static void x_set_mode_line_face_gc P_ ((struct glyph_string *));
  static void x_set_mouse_face_gc P_ ((struct glyph_string *));
***************
*** 3397,3403 ****
      }
  }
  
- 
  
  /* Specify how many text lines, from the top of the window,
     should be affected by insert-lines and delete-lines operations.
--- 3327,3332 ----
***************
*** 3832,3874 ****
  
  
  
- #if 0
- /* Mouse clicks and mouse movement.  Rah.  */
- 
- /* Prepare a mouse-event in *RESULT for placement in the input queue.
- 
-    If the event is a button press, then note that we have grabbed
-    the mouse.  */
- 
- static Lisp_Object
- construct_mouse_click (result, event, f)
-      struct input_event *result;
-      EventRecord *event;
-      struct frame *f;
- {
-   Point mouseLoc;
- 
-   result->kind = MOUSE_CLICK_EVENT;
-   result->code = 0;  /* only one mouse button */
-   result->timestamp = event->when;
-   result->modifiers = event->what == mouseDown ? down_modifier : up_modifier;
- 
-   mouseLoc = event->where;
- 
-   SetPortWindowPort (FRAME_MAC_WINDOW (f));
- 
-   GlobalToLocal (&mouseLoc);
-   XSETINT (result->x, mouseLoc.h);
-   XSETINT (result->y, mouseLoc.v);
- 
-   XSETFRAME (result->frame_or_window, f);
- 
-   result->arg = Qnil;
-   return Qnil;
- }
- #endif
- 
- 
  /* Function to report a mouse movement to the mainstream Emacs code.
     The input handler calls this.
  
--- 3761,3766 ----
***************
*** 3924,3941 ****
      }
  }
  
- /* This is used for debugging, to turn off note_mouse_highlight.  */
- 
- int disable_mouse_highlight;
- 
- 
  
  /************************************************************************
                              Mouse Face
   ************************************************************************/
  
- static struct scroll_bar *x_window_to_scroll_bar ();
- static void x_scroll_bar_report_motion ();
  static int glyph_rect P_ ((struct frame *f, int, int, Rect *));
  
  
--- 3816,3826 ----
***************
*** 4147,4166 ****
  static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval));
  static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode));
  static void construct_scroll_bar_click P_ ((struct scroll_bar *, int,
-                                           unsigned long,
                                            struct input_event *));
  static OSErr get_control_part_bounds P_ ((ControlHandle, ControlPartCode,
                                          Rect *));
  static void x_scroll_bar_handle_press P_ ((struct scroll_bar *,
                                           ControlPartCode,
-                                          unsigned long,
                                           struct input_event *));
  static void x_scroll_bar_handle_release P_ ((struct scroll_bar *,
-                                            unsigned long,
                                             struct input_event *));
  static void x_scroll_bar_handle_drag P_ ((WindowPtr, struct scroll_bar *,
!                                         Point, unsigned long,
!                                         struct input_event *));
  static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *,
                                                int, int, int));
  
--- 4032,4047 ----
  static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval));
  static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode));
  static void construct_scroll_bar_click P_ ((struct scroll_bar *, int,
                                            struct input_event *));
  static OSErr get_control_part_bounds P_ ((ControlHandle, ControlPartCode,
                                          Rect *));
  static void x_scroll_bar_handle_press P_ ((struct scroll_bar *,
                                           ControlPartCode,
                                           struct input_event *));
  static void x_scroll_bar_handle_release P_ ((struct scroll_bar *,
                                             struct input_event *));
  static void x_scroll_bar_handle_drag P_ ((WindowPtr, struct scroll_bar *,
!                                         Point, struct input_event *));
  static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *,
                                                int, int, int));
  
***************
*** 4259,4268 ****
  }
  
  static void
! construct_scroll_bar_click (bar, part, timestamp, bufp)
       struct scroll_bar *bar;
       int part;
-      unsigned long timestamp;
       struct input_event *bufp;
  {
    bufp->kind = SCROLL_BAR_CLICK_EVENT;
--- 4140,4148 ----
  }
  
  static void
! construct_scroll_bar_click (bar, part, bufp)
       struct scroll_bar *bar;
       int part;
       struct input_event *bufp;
  {
    bufp->kind = SCROLL_BAR_CLICK_EVENT;
***************
*** 4270,4276 ****
    bufp->arg = Qnil;
    bufp->part = part;
    bufp->code = 0;
-   bufp->timestamp = timestamp;
    XSETINT (bufp->x, 0);
    XSETINT (bufp->y, 0);
    bufp->modifiers = 0;
--- 4150,4155 ----
***************
*** 4294,4303 ****
  }
  
  static void
! x_scroll_bar_handle_press (bar, part_code, timestamp, bufp)
       struct scroll_bar *bar;
       ControlPartCode part_code;
-      unsigned long timestamp;
       struct input_event *bufp;
  {
    int part = control_part_code_to_scroll_bar_part (part_code);
--- 4173,4181 ----
  }
  
  static void
! x_scroll_bar_handle_press (bar, part_code, bufp)
       struct scroll_bar *bar;
       ControlPartCode part_code;
       struct input_event *bufp;
  {
    int part = control_part_code_to_scroll_bar_part (part_code);
***************
*** 4307,4313 ****
  
    if (part != scroll_bar_handle)
      {
!       construct_scroll_bar_click (bar, part, timestamp, bufp);
        HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code);
        set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY);
      }
--- 4185,4191 ----
  
    if (part != scroll_bar_handle)
      {
!       construct_scroll_bar_click (bar, part, bufp);
        HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code);
        set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY);
      }
***************
*** 4318,4331 ****
  }
  
  static void
! x_scroll_bar_handle_release (bar, timestamp, bufp)
       struct scroll_bar *bar;
-      unsigned long timestamp;
       struct input_event *bufp;
  {
    if (last_scroll_bar_part != scroll_bar_handle
        || !GC_NILP (bar->dragging))
!     construct_scroll_bar_click (bar, scroll_bar_end_scroll, timestamp, bufp);
  
    HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0);
    set_scroll_bar_timer (kEventDurationForever);
--- 4196,4208 ----
  }
  
  static void
! x_scroll_bar_handle_release (bar, bufp)
       struct scroll_bar *bar;
       struct input_event *bufp;
  {
    if (last_scroll_bar_part != scroll_bar_handle
        || !GC_NILP (bar->dragging))
!     construct_scroll_bar_click (bar, scroll_bar_end_scroll, bufp);
  
    HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0);
    set_scroll_bar_timer (kEventDurationForever);
***************
*** 4336,4346 ****
  }
  
  static void
! x_scroll_bar_handle_drag (win, bar, mouse_pos, timestamp, bufp)
       WindowPtr win;
       struct scroll_bar *bar;
       Point mouse_pos;
-      unsigned long timestamp;
       struct input_event *bufp;
  {
    ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
--- 4213,4222 ----
  }
  
  static void
! x_scroll_bar_handle_drag (win, bar, mouse_pos, bufp)
       WindowPtr win;
       struct scroll_bar *bar;
       Point mouse_pos;
       struct input_event *bufp;
  {
    ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
***************
*** 4360,4372 ****
        top_range = (XINT (bar->track_height) - (r.bottom - r.top)) *
        (1.0 + (float) GetControlViewSize (ch) / GetControl32BitMaximum (ch))
        + .5;
!       
        if (top < 0)
        top = 0;
        if (top > top_range)
        top = top_range;
  
!       construct_scroll_bar_click (bar, scroll_bar_handle, timestamp, bufp);
        XSETINT (bufp->x, top);
        XSETINT (bufp->y, top_range);
      }
--- 4236,4248 ----
        top_range = (XINT (bar->track_height) - (r.bottom - r.top)) *
        (1.0 + (float) GetControlViewSize (ch) / GetControl32BitMaximum (ch))
        + .5;
! 
        if (top < 0)
        top = 0;
        if (top > top_range)
        top = top_range;
  
!       construct_scroll_bar_click (bar, scroll_bar_handle, bufp);
        XSETINT (bufp->x, top);
        XSETINT (bufp->y, top_range);
      }
***************
*** 4404,4410 ****
        else if (part != last_scroll_bar_part
               || scroll_bar_timer_event_posted_p)
        {
!         construct_scroll_bar_click (bar, part, timestamp, bufp);
          last_scroll_bar_part = part;
          HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code);
          set_scroll_bar_timer (SCROLL_BAR_CONTINUOUS_DELAY);
--- 4280,4286 ----
        else if (part != last_scroll_bar_part
               || scroll_bar_timer_event_posted_p)
        {
!         construct_scroll_bar_click (bar, part, bufp);
          last_scroll_bar_part = part;
          HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code);
          set_scroll_bar_timer (SCROLL_BAR_CONTINUOUS_DELAY);
***************
*** 4475,4485 ****
    r.bottom = disp_top + disp_height;
  
  #if TARGET_API_MAC_CARBON
!   ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0,
!                  kControlScrollBarProc, (long) bar);
  #else
!   ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0,
!                  scrollBarProc, (long) bar);
  #endif
    SET_SCROLL_BAR_CONTROL_HANDLE (bar, ch);
  
--- 4351,4361 ----
    r.bottom = disp_top + disp_height;
  
  #if TARGET_API_MAC_CARBON
!   ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", width < disp_height,
!                  0, 0, 0, kControlScrollBarProc, (long) bar);
  #else
!   ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", width < disp_height,
!                  0, 0, 0, scrollBarProc, (long) bar);
  #endif
    SET_SCROLL_BAR_CONTROL_HANDLE (bar, ch);
  
***************
*** 4604,4613 ****
--- 4480,4491 ----
    UNBLOCK_INPUT;
  }
  
+ 
  /* Set the handle of the vertical scroll bar for WINDOW to indicate
     that we are displaying PORTION characters out of a total of WHOLE
     characters, starting at POSITION.  If WINDOW has no scroll bar,
     create one.  */
+ 
  static void
  XTset_vertical_scroll_bar (w, portion, whole, position)
       struct window *w;
***************
*** 4702,4708 ****
            MoveControl (ch, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, 
disp_top);
            SizeControl (ch, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
                       disp_height);
!           ShowControl (ch);
  
            /* Remember new settings.  */
            XSETINT (bar->left, sb_left);
--- 4580,4587 ----
            MoveControl (ch, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, 
disp_top);
            SizeControl (ch, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
                       disp_height);
!         if (sb_width < disp_height)
!           ShowControl (ch);
  
            /* Remember new settings.  */
            XSETINT (bar->left, sb_left);
***************
*** 4805,4810 ****
--- 4684,4690 ----
       struct window *window;
  {
    struct scroll_bar *bar;
+   struct frame *f;
  
    /* We can't redeem this window's scroll bar if it doesn't have one.  */
    if (NILP (window->vertical_scroll_bar))
***************
*** 4813,4848 ****
    bar = XSCROLL_BAR (window->vertical_scroll_bar);
  
    /* Unlink it from the condemned list.  */
!   {
!     FRAME_PTR f = XFRAME (WINDOW_FRAME (window));
! 
!     if (NILP (bar->prev))
!       {
!       /* If the prev pointer is nil, it must be the first in one of
!            the lists.  */
!       if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar))
!         /* It's not condemned.  Everything's fine.  */
!         return;
!       else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
!                    window->vertical_scroll_bar))
!         FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next;
!       else
!         /* If its prev pointer is nil, it must be at the front of
!              one or the other!  */
!         abort ();
!       }
!     else
!       XSCROLL_BAR (bar->prev)->next = bar->next;
  
!     if (! NILP (bar->next))
!       XSCROLL_BAR (bar->next)->prev = bar->prev;
  
!     bar->next = FRAME_SCROLL_BARS (f);
!     bar->prev = Qnil;
!     XSETVECTOR (FRAME_SCROLL_BARS (f), bar);
!     if (! NILP (bar->next))
!       XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
!   }
  }
  
  /* Remove all scroll bars on FRAME that haven't been saved since the
--- 4693,4725 ----
    bar = XSCROLL_BAR (window->vertical_scroll_bar);
  
    /* Unlink it from the condemned list.  */
!   f = XFRAME (WINDOW_FRAME (window));
!   if (NILP (bar->prev))
!     {
!       /* If the prev pointer is nil, it must be the first in one of
!        the lists.  */
!       if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar))
!       /* It's not condemned.  Everything's fine.  */
!       return;
!       else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
!                  window->vertical_scroll_bar))
!       FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next;
!       else
!       /* If its prev pointer is nil, it must be at the front of
!          one or the other!  */
!       abort ();
!     }
!   else
!     XSCROLL_BAR (bar->prev)->next = bar->next;
  
!   if (! NILP (bar->next))
!     XSCROLL_BAR (bar->next)->prev = bar->prev;
  
!   bar->next = FRAME_SCROLL_BARS (f);
!   bar->prev = Qnil;
!   XSETVECTOR (FRAME_SCROLL_BARS (f), bar);
!   if (! NILP (bar->next))
!     XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
  }
  
  /* Remove all scroll bars on FRAME that haven't been saved since the
***************
*** 4981,4988 ****
  
  #endif /* !USE_TOOLKIT_SCROLL_BARS */
  
! /* Return information to the user about the current position of the
!    mouse on the scroll bar.  */
  
  static void
  x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
--- 4858,4865 ----
  
  #endif /* !USE_TOOLKIT_SCROLL_BARS */
  
! /* Return information to the user about the current position of the mouse
!    on the scroll bar.  */
  
  static void
  x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
***************
*** 5500,5505 ****
--- 5377,5383 ----
  }
  
  
+ 
  /* Calculate the absolute position in frame F
     from its current recorded position values and gravity.  */
  
***************
*** 5731,5737 ****
    UNBLOCK_INPUT;
  #endif
  }
- 
  
  /* focus shifting, raising and lowering.  */
  
--- 5609,5614 ----
***************
*** 5758,5763 ****
--- 5635,5641 ----
  }
  
  /* Raise frame F.  */
+ 
  void
  x_raise_frame (f)
       struct frame *f;
***************
*** 5771,5776 ****
--- 5649,5655 ----
  }
  
  /* Lower frame F.  */
+ 
  void
  x_lower_frame (f)
       struct frame *f;
***************
*** 6179,6187 ****
  }
  
  /* the global font name table */
! char **font_name_table = NULL;
! int font_name_table_size = 0;
! int font_name_count = 0;
  
  /* Alist linking character set strings to Mac text encoding and Emacs
     coding system. */
--- 6058,6066 ----
  }
  
  /* the global font name table */
! static char **font_name_table = NULL;
! static int font_name_table_size = 0;
! static int font_name_count = 0;
  
  /* Alist linking character set strings to Mac text encoding and Emacs
     coding system. */
***************
*** 7435,7456 ****
  #define MIN_DOC_SIZE 64
  #define MAX_DOC_SIZE 32767
  
- #if 0
- /* sleep time for WaitNextEvent */
- #define WNE_SLEEP_AT_SUSPEND 10
- #define WNE_SLEEP_AT_RESUME  1
- 
- /* the flag appl_is_suspended is used both for determining the sleep
-    time to be passed to WaitNextEvent and whether the cursor should be
-    drawn when updating the display.  The cursor is turned off when
-    Emacs is suspended.  Redrawing it is unnecessary and what needs to
-    be done depends on whether the cursor lies inside or outside the
-    redraw region.  So we might as well skip drawing it when Emacs is
-    suspended.  */
- static Boolean app_is_suspended = false;
- static long app_sleep_time = WNE_SLEEP_AT_RESUME;
- #endif
- 
  #define EXTRA_STACK_ALLOC (256 * 1024)
  
  #define ARGV_STRING_LIST_ID 129
--- 7314,7319 ----
***************
*** 7487,7494 ****
  Lisp_Object Vmac_pass_control_to_system;
  
  /* Points to the variable `inev' in the function XTread_socket.  It is
!    used for passing an input event to the function back from a Carbon
!    event handler.  */
  static struct input_event *read_socket_inev = NULL;
  #endif
  
--- 7350,7357 ----
  Lisp_Object Vmac_pass_control_to_system;
  
  /* Points to the variable `inev' in the function XTread_socket.  It is
!    used for passing an input event to the function back from
!    Carbon/Apple event handlers.  */
  static struct input_event *read_socket_inev = NULL;
  #endif
  
***************
*** 7496,7503 ****
     drag and drop events.  */
  Lisp_Object Qmac_ready_for_drag_n_drop;
  
- Lisp_Object drag_and_drop_file_list;
- 
  Point saved_menu_event_location;
  
  /* Apple Events */
--- 7359,7364 ----
***************
*** 7833,7852 ****
  do_app_resume ()
  {
    /* Window-activate events will do the job. */
- #if 0
-   app_is_suspended = false;
-   app_sleep_time = WNE_SLEEP_AT_RESUME;
- #endif
  }
  
  static void
  do_app_suspend ()
  {
    /* Window-deactivate events will do the job. */
- #if 0
-   app_is_suspended = true;
-   app_sleep_time = WNE_SLEEP_AT_SUSPEND;
- #endif
  }
  
  
--- 7694,7705 ----
***************
*** 8400,8407 ****
        XSETINT (read_socket_inev->x, point.h);
        XSETINT (read_socket_inev->y, point.v);
        XSETFRAME (read_socket_inev->frame_or_window, f);
-       read_socket_inev->timestamp =
-         EventTimeToTicks (GetEventTime (event)) * (1000/60);
  
        return noErr;
        }
--- 8253,8258 ----
***************
*** 8475,8485 ****
  }
  
  
- /* Defined in mac.c.  */
- extern int
- path_from_vol_dir_name (char *, int, short, long, char *);
- 
- 
  /* Called when we receive an AppleEvent with an ID of
     "kAEOpenDocuments".  This routine gets the direct parameter,
     extracts the FSSpecs in it, and puts their names on a list.  */
--- 8326,8331 ----
***************
*** 8503,8508 ****
--- 8349,8357 ----
    DescType actual_type;
    Size actual_size;
    SelectionRange position;
+   Lisp_Object file_list = Qnil;
+ 
+   xassert (read_socket_inev);
  
    err = AEGetParamDesc (message, keyDirectObject, typeAEList, &the_desc);
    if (err != noErr)
***************
*** 8510,8519 ****
  
    err = AEGetParamPtr (message, keyAEPosition, typeChar, &actual_type, 
&position, sizeof(SelectionRange), &actual_size);
    if (err == noErr)
!     drag_and_drop_file_list = Fcons (list3 (make_number (position.lineNum + 
1),
!                                           make_number (position.startRange + 
1),
!                                           make_number (position.endRange + 
1)),
!                                    drag_and_drop_file_list);
  
    /* Check to see that we got all of the required parameters from the
       event descriptor.  For an 'odoc' event this should just be the
--- 8359,8368 ----
  
    err = AEGetParamPtr (message, keyAEPosition, typeChar, &actual_type, 
&position, sizeof(SelectionRange), &actual_size);
    if (err == noErr)
!     file_list = Fcons (list3 (make_number (position.lineNum + 1),
!                             make_number (position.startRange + 1),
!                             make_number (position.endRange + 1)),
!                      file_list);
  
    /* Check to see that we got all of the required parameters from the
       event descriptor.  For an 'odoc' event this should just be the
***************
*** 8567,8577 ****
                                          sizeof (unix_path_name) - 1) == noErr)
  #endif
              /* x-dnd functions expect undecoded filenames.  */
!             drag_and_drop_file_list =
!               Fcons (make_unibyte_string (unix_path_name,
!                                           strlen (unix_path_name)),
!                      drag_and_drop_file_list);
          }
        }
    }
  
--- 8416,8463 ----
                                          sizeof (unix_path_name) - 1) == noErr)
  #endif
              /* x-dnd functions expect undecoded filenames.  */
!             file_list = Fcons (make_unibyte_string (unix_path_name,
!                                                     strlen (unix_path_name)),
!                                file_list);
!         }
!       }
! 
!     /* Build a DRAG_N_DROP_EVENT type event as is done in
!        constuct_drag_n_drop in w32term.c.  */
!     if (!NILP (file_list))
!       {
!       struct frame *f = mac_focus_frame (&one_mac_display_info);
!       WindowPtr wp;
!       Lisp_Object frame;
! 
!       read_socket_inev->kind = DRAG_N_DROP_EVENT;
!       read_socket_inev->code = 0;
!       read_socket_inev->modifiers = 0;
! 
!       XSETINT (read_socket_inev->x, 0);
!       XSETINT (read_socket_inev->y, 0);
! 
!       XSETFRAME (frame, f);
!       read_socket_inev->frame_or_window = Fcons (frame, file_list);
! 
! #if 0
!       /* Regardless of whether Emacs was suspended or in the
!          foreground, ask it to redraw its entire screen.  Otherwise
!          parts of the screen can be left in an inconsistent
!          state.  */
!       wp = FRAME_MAC_WINDOW (f);
!       if (wp)
! #if TARGET_API_MAC_CARBON
!         {
!           Rect r;
! 
!           GetWindowPortBounds (wp, &r);
!           InvalWindowRect (wp, &r);
          }
+ #else /* not TARGET_API_MAC_CARBON */
+       InvalRect (&(wp->portRect));
+ #endif /* not TARGET_API_MAC_CARBON */
+ #endif
        }
    }
  
***************
*** 8665,8675 ****
    ItemReference theItem;
    HFSFlavor data;
    Size size = sizeof (HFSFlavor);
  
    if (GetFrontWindowOfClass (kMovableModalWindowClass, false))
      return dragNotAcceptedErr;
  
!   drag_and_drop_file_list = Qnil;
    GetDragMouse (theDrag, &mouse, 0L);
    CountDragItems (theDrag, &items);
    for (index = 1; index <= items; index++)
--- 8551,8562 ----
    ItemReference theItem;
    HFSFlavor data;
    Size size = sizeof (HFSFlavor);
+   Lisp_Object file_list;
  
    if (GetFrontWindowOfClass (kMovableModalWindowClass, false))
      return dragNotAcceptedErr;
  
!   file_list = Qnil;
    GetDragMouse (theDrag, &mouse, 0L);
    CountDragItems (theDrag, &items);
    for (index = 1; index <= items; index++)
***************
*** 8695,8709 ****
                                        sizeof (unix_path_name) - 1) == noErr)
  #endif
            /* x-dnd functions expect undecoded filenames.  */
!             drag_and_drop_file_list =
!             Fcons (make_unibyte_string (unix_path_name,
!                                         strlen (unix_path_name)),
!                    drag_and_drop_file_list);
        }
      }
    /* If there are items in the list, construct an event and post it to
       the queue like an interrupt using kbd_buffer_store_event.  */
!   if (!NILP (drag_and_drop_file_list))
      {
        struct input_event event;
        Lisp_Object frame;
--- 8582,8595 ----
                                        sizeof (unix_path_name) - 1) == noErr)
  #endif
            /* x-dnd functions expect undecoded filenames.  */
!             file_list = Fcons (make_unibyte_string (unix_path_name,
!                                                   strlen (unix_path_name)),
!                              file_list);
        }
      }
    /* If there are items in the list, construct an event and post it to
       the queue like an interrupt using kbd_buffer_store_event.  */
!   if (!NILP (file_list))
      {
        struct input_event event;
        Lisp_Object frame;
***************
*** 8720,8726 ****
        XSETINT (event.x, mouse.h);
        XSETINT (event.y, mouse.v);
        XSETFRAME (frame, f);
!       event.frame_or_window = Fcons (frame, drag_and_drop_file_list);
        event.arg = Qnil;
        /* Post to the interrupt queue */
        kbd_buffer_store_event (&event);
--- 8606,8612 ----
        XSETINT (event.x, mouse.h);
        XSETINT (event.y, mouse.v);
        XSETFRAME (frame, f);
!       event.frame_or_window = Fcons (frame, file_list);
        event.arg = Qnil;
        /* Post to the interrupt queue */
        kbd_buffer_store_event (&event);
***************
*** 8979,8984 ****
--- 8865,8871 ----
      {
        int do_help = 0;
        struct frame *f;
+       unsigned long timestamp;
  
        /* It is necessary to set this (additional) argument slot of an
         event to nil because keyboard.c protects incompletely
***************
*** 8989,8994 ****
--- 8876,8887 ----
        inev.arg = Qnil;
  
  #if USE_CARBON_EVENTS
+       timestamp = GetEventTime (eventRef) / kEventDurationMillisecond;
+ #else
+       timestamp = er.when * (1000 / 60); /* ticks to milliseconds */
+ #endif
+ 
+ #if USE_CARBON_EVENTS
        /* Handle new events */
        if (!mac_convert_event_ref (eventRef, &er))
        {
***************
*** 9089,9096 ****
  #endif
                    XSETINT (inev.x, mouse_loc.h);
                    XSETINT (inev.y, mouse_loc.v);
-                   inev.timestamp = er.when * (1000 / 60);
-                   /* ticks to milliseconds */
  
                    if (dpyinfo->grabbed && tracked_scroll_bar
                        || ch != 0
--- 8982,8987 ----
***************
*** 9124,9133 ****
                                                     &er, &inev);
                        else if (er.what == mouseDown)
                          x_scroll_bar_handle_press (bar, control_part_code,
!                                                    inev.timestamp, &inev);
                        else
!                         x_scroll_bar_handle_release (bar, inev.timestamp,
!                                                      &inev);
  #else  /* not USE_TOOLKIT_SCROLL_BARS */
                        x_scroll_bar_handle_click (bar, control_part_code,
                                                   &er, &inev);
--- 9015,9023 ----
                                                     &er, &inev);
                        else if (er.what == mouseDown)
                          x_scroll_bar_handle_press (bar, control_part_code,
!                                                    &inev);
                        else
!                         x_scroll_bar_handle_release (bar, &inev);
  #else  /* not USE_TOOLKIT_SCROLL_BARS */
                        x_scroll_bar_handle_click (bar, control_part_code,
                                                   &er, &inev);
***************
*** 9301,9308 ****
                  if (dpyinfo->grabbed && tracked_scroll_bar)
  #ifdef USE_TOOLKIT_SCROLL_BARS
                    x_scroll_bar_handle_drag (wp, tracked_scroll_bar,
!                                             mouse_pos, er.when * (1000 / 60),
!                                             &inev);
  #else /* not USE_TOOLKIT_SCROLL_BARS */
                    x_scroll_bar_note_movement (tracked_scroll_bar,
                                                mouse_pos.v
--- 9191,9197 ----
                  if (dpyinfo->grabbed && tracked_scroll_bar)
  #ifdef USE_TOOLKIT_SCROLL_BARS
                    x_scroll_bar_handle_drag (wp, tracked_scroll_bar,
!                                             mouse_pos, &inev);
  #else /* not USE_TOOLKIT_SCROLL_BARS */
                    x_scroll_bar_note_movement (tracked_scroll_bar,
                                                mouse_pos.v
***************
*** 9390,9400 ****
  
                    EVENT_INIT (event);
                    event.kind = NO_EVENT;
!                   x_scroll_bar_handle_release (tracked_scroll_bar,
!                                                er.when * (1000 / 60),
!                                                &event);
                    if (event.kind != NO_EVENT)
                      {
                        kbd_buffer_store_event_hold (&event, hold_quit);
                        count++;
                      }
--- 9279,9288 ----
  
                    EVENT_INIT (event);
                    event.kind = NO_EVENT;
!                   x_scroll_bar_handle_release (tracked_scroll_bar, &event);
                    if (event.kind != NO_EVENT)
                      {
+                       event.timestamp = timestamp;
                        kbd_buffer_store_event_hold (&event, hold_quit);
                        count++;
                      }
***************
*** 9470,9475 ****
--- 9358,9364 ----
                  event.kind = LANGUAGE_CHANGE_EVENT;
                  event.arg = Qnil;
                  event.code = current_key_script;
+                 event.timestamp = timestamp;
                  kbd_buffer_store_event (&event);
                  count++;
                }
***************
*** 9534,9591 ****
  #else
          inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
  #endif
          XSETFRAME (inev.frame_or_window, mac_focus_frame (dpyinfo));
-         inev.timestamp = er.when * (1000 / 60);  /* ticks to milliseconds */
          break;
  
        case kHighLevelEvent:
!         drag_and_drop_file_list = Qnil;
! 
!         AEProcessAppleEvent(&er);
! 
!         /* Build a DRAG_N_DROP_EVENT type event as is done in
!            constuct_drag_n_drop in w32term.c.  */
!         if (!NILP (drag_and_drop_file_list))
!           {
!             struct frame *f = mac_focus_frame (dpyinfo);
!             WindowPtr wp;
!             Lisp_Object frame;
! 
!             inev.kind = DRAG_N_DROP_EVENT;
!             inev.code = 0;
!             inev.timestamp = er.when * (1000 / 60);
!             /* ticks to milliseconds */
! #if USE_CARBON_EVENTS
!             inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
! #else
!             inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
! #endif
! 
!             XSETINT (inev.x, 0);
!             XSETINT (inev.y, 0);
! 
!             XSETFRAME (frame, f);
!             inev.frame_or_window = Fcons (frame, drag_and_drop_file_list);
! 
! #if 0
!             /* Regardless of whether Emacs was suspended or in the
!                foreground, ask it to redraw its entire screen.
!                Otherwise parts of the screen can be left in an
!                inconsistent state.  */
!             wp = FRAME_MAC_WINDOW (f);
!             if (wp)
! #if TARGET_API_MAC_CARBON
!               {
!                 Rect r;
  
-                 GetWindowPortBounds (wp, &r);
-                 InvalWindowRect (wp, &r);
-               }
- #else /* not TARGET_API_MAC_CARBON */
-                 InvalRect (&(wp->portRect));
- #endif /* not TARGET_API_MAC_CARBON */
- #endif
-           }
        default:
          break;
        }
--- 9423,9440 ----
  #else
          inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
  #endif
+         inev.modifiers |= (extra_keyboard_modifiers
+                            & (meta_modifier | alt_modifier
+                               | hyper_modifier | super_modifier));
          XSETFRAME (inev.frame_or_window, mac_focus_frame (dpyinfo));
          break;
  
        case kHighLevelEvent:
!         read_socket_inev = &inev;
!         AEProcessAppleEvent (&er);
!         read_socket_inev = NULL;
!         break;
  
        default:
          break;
        }
***************
*** 9595,9600 ****
--- 9444,9450 ----
  
        if (inev.kind != NO_EVENT)
        {
+         inev.timestamp = timestamp;
          kbd_buffer_store_event_hold (&inev, hold_quit);
          count++;
        }
***************
*** 10067,10073 ****
        kbd_buffer_store_event (&e);
      }
  }
! #endif /* MAC_OSX */
  
  static void
  init_menu_bar ()
--- 9917,9923 ----
        kbd_buffer_store_event (&e);
      }
  }
! #endif        /* MAC_OSX */
  
  static void
  init_menu_bar ()
***************
*** 10170,10176 ****
                                   off the bottom */
    baud_rate = 19200;
  
-   x_noop_count = 0;
    last_tool_bar_item = -1;
    any_help_event_p = 0;
  
--- 10020,10025 ----
***************
*** 10242,10253 ****
    staticpro (&last_mouse_scroll_bar);
    last_mouse_scroll_bar = Qnil;
  
-   staticpro (&Qvendor_specific_keysyms);
-   Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
- 
-   staticpro (&last_mouse_press_frame);
-   last_mouse_press_frame = Qnil;
- 
    Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop");
    staticpro (&Qmac_ready_for_drag_n_drop);
  
--- 10091,10096 ----
***************
*** 10258,10271 ****
  #else
    Vx_toolkit_scroll_bars = Qnil;
  #endif
- 
-   DEFVAR_BOOL ("x-use-underline-position-properties",
-                &x_use_underline_position_properties,
-      doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties.
- nil means ignore them.  If you encounter fonts with bogus
- UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
- to 4.1, set this to nil.  */);
-   x_use_underline_position_properties = 0;
  
    staticpro (&last_mouse_motion_frame);
    last_mouse_motion_frame = Qnil;
--- 10101,10106 ----




reply via email to

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