/[emacs]/emacs/src/macterm.c
ViewVC logotype

Diff of /emacs/src/macterm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.47.2.8 by miles, Sat Sep 4 09:14:27 2004 UTC revision 1.47.2.9 by miles, Thu Oct 14 08:49:53 2004 UTC
# Line 50  Boston, MA 02111-1307, USA.  */ Line 50  Boston, MA 02111-1307, USA.  */
50  #include <TextUtils.h>  #include <TextUtils.h>
51  #include <LowMem.h>  #include <LowMem.h>
52  #include <Controls.h>  #include <Controls.h>
53    #include <Windows.h>
54  #if defined (__MRC__) || (__MSL__ >= 0x6000)  #if defined (__MRC__) || (__MSL__ >= 0x6000)
55  #include <ControlDefinitions.h>  #include <ControlDefinitions.h>
56  #endif  #endif
# Line 1292  x_update_window_end (w, cursor_on_p, mou Line 1293  x_update_window_end (w, cursor_on_p, mou
1293                                  output_cursor.vpos,                                  output_cursor.vpos,
1294                                  output_cursor.x, output_cursor.y);                                  output_cursor.x, output_cursor.y);
1295    
1296        x_draw_vertical_border (w);        if (draw_window_fringes (w, 1))
1297            x_draw_vertical_border (w);
       draw_window_fringes (w);  
1298    
1299        UNBLOCK_INPUT;        UNBLOCK_INPUT;
1300      }      }
# Line 3893  remember_mouse_glyph (f1, gx, gy) Line 3893  remember_mouse_glyph (f1, gx, gy)
3893    
3894    
3895  static WindowPtr  static WindowPtr
3896  mac_front_window ()  front_emacs_window ()
3897  {  {
3898  #if TARGET_API_MAC_CARBON  #if TARGET_API_MAC_CARBON
3899    return GetFrontWindowOfClass (kDocumentWindowClass, true);    WindowPtr wp = GetFrontWindowOfClass (kDocumentWindowClass, true);
3900    
3901      while (wp && !is_emacs_window (wp))
3902        wp = GetNextWindowOfClass (wp, kDocumentWindowClass, true);
3903  #else  #else
3904    WindowPtr front_window = FrontWindow ();    WindowPtr wp = FrontWindow ();
3905    
3906    if (tip_window && front_window == tip_window)    while (wp && (wp == tip_window || !is_emacs_window (wp)))
3907      return GetNextWindow (front_window);      wp = GetNextWindow (wp);
   else  
     return front_window;  
3908  #endif  #endif
3909    
3910      return wp;
3911  }  }
3912    
3913  #define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP)  #define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP)
# Line 3940  XTmouse_position (fp, insist, bar_window Line 3943  XTmouse_position (fp, insist, bar_window
3943  {  {
3944    Point mouse_pos;    Point mouse_pos;
3945    int ignore1, ignore2;    int ignore1, ignore2;
3946    WindowPtr wp = mac_front_window ();    WindowPtr wp = front_emacs_window ();
3947    struct frame *f;    struct frame *f;
3948    Lisp_Object frame, tail;    Lisp_Object frame, tail;
3949    
# Line 4557  x_scroll_bar_report_motion (fp, bar_wind Line 4560  x_scroll_bar_report_motion (fp, bar_wind
4560       unsigned long *time;       unsigned long *time;
4561  {  {
4562    struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);    struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
4563    WindowPtr wp = mac_front_window ();    WindowPtr wp = front_emacs_window ();
4564    Point mouse_pos;    Point mouse_pos;
4565    struct frame *f = mac_window_to_frame (wp);    struct frame *f = mac_window_to_frame (wp);
4566    int win_y, top_range;    int win_y, top_range;
# Line 5053  xim_close_dpy (dpyinfo) Line 5056  xim_close_dpy (dpyinfo)
5056   */   */
5057    
5058    
5059    void
5060    mac_get_window_bounds (f, inner, outer)
5061         struct frame *f;
5062         Rect *inner, *outer;
5063    {
5064    #if TARGET_API_MAC_CARBON
5065      GetWindowBounds (FRAME_MAC_WINDOW (f), kWindowContentRgn, inner);
5066      GetWindowBounds (FRAME_MAC_WINDOW (f), kWindowStructureRgn, outer);
5067    #else /* not TARGET_API_MAC_CARBON */
5068      RgnHandle region = NewRgn ();
5069    
5070      GetWindowRegion (FRAME_MAC_WINDOW (f), kWindowContentRgn, region);
5071      *inner = (*region)->rgnBBox;
5072      GetWindowRegion (FRAME_MAC_WINDOW (f), kWindowStructureRgn, region);
5073      *outer = (*region)->rgnBBox;
5074      DisposeRgn (region);
5075    #endif /* not TARGET_API_MAC_CARBON */
5076    }
5077    
5078    
5079  /* Calculate the absolute position in frame F  /* Calculate the absolute position in frame F
5080     from its current recorded position values and gravity.  */     from its current recorded position values and gravity.  */
5081    
# Line 5060  void Line 5083  void
5083  x_calc_absolute_position (f)  x_calc_absolute_position (f)
5084       struct frame *f;       struct frame *f;
5085  {  {
5086    Point pt;    int width_diff = 0, height_diff = 0;
5087    int flags = f->size_hint_flags;    int flags = f->size_hint_flags;
5088      Rect inner, outer;
5089    
5090    pt.h = pt.v = 0;    /* We have nothing to do if the current position
5091         is already for the top-left corner.  */
5092      if (! ((flags & XNegative) || (flags & YNegative)))
5093        return;
5094    
5095    /* Find the position of the outside upper-left corner of    /* Find the offsets of the outside upper-left corner of
5096       the inner window, with respect to the outer window.  */       the inner window, with respect to the outer window.  */
5097    if (f->output_data.mac->parent_desc != FRAME_MAC_DISPLAY_INFO (f)->root_window)    mac_get_window_bounds (f, &inner, &outer);
     {  
       GrafPtr savePort;  
       GetPort (&savePort);  
5098    
5099        SetPortWindowPort (FRAME_MAC_WINDOW (f));    width_diff = (outer.right - outer.left) - (inner.right - inner.left);
5100      height_diff = (outer.bottom - outer.top) - (inner.bottom - inner.top);
 #if TARGET_API_MAC_CARBON  
       {  
         Rect r;  
   
         GetWindowPortBounds (FRAME_MAC_WINDOW (f), &r);  
         SetPt(&pt, r.left,  r.top);  
       }  
 #else /* not TARGET_API_MAC_CARBON */  
       SetPt(&pt, FRAME_MAC_WINDOW (f)->portRect.left,  FRAME_MAC_WINDOW (f)->portRect.top);  
 #endif /* not TARGET_API_MAC_CARBON */  
       LocalToGlobal (&pt);  
       SetPort (savePort);  
     }  
5101    
5102    /* Treat negative positions as relative to the leftmost bottommost    /* Treat negative positions as relative to the leftmost bottommost
5103       position that fits on the screen.  */       position that fits on the screen.  */
5104    if (flags & XNegative)    if (flags & XNegative)
5105      f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width      f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width
5106                     - 2 * f->border_width - pt.h                     - width_diff
5107                     - FRAME_PIXEL_WIDTH (f)                     - FRAME_PIXEL_WIDTH (f)
5108                     + f->left_pos);                     + f->left_pos);
5109    /* NTEMACS_TODO: Subtract menubar height?  */  
5110    if (flags & YNegative)    if (flags & YNegative)
5111      f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height      f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height
5112                    - 2 * f->border_width - pt.v                    - height_diff
5113                    - FRAME_PIXEL_HEIGHT (f)                    - FRAME_PIXEL_HEIGHT (f)
5114                    + f->top_pos);                    + f->top_pos);
5115    
5116    /* The left_pos and top_pos    /* The left_pos and top_pos
5117       are now relative to the top and left screen edges,       are now relative to the top and left screen edges,
5118       so the flags should correspond.  */       so the flags should correspond.  */
# Line 5119  x_set_offset (f, xoff, yoff, change_grav Line 5131  x_set_offset (f, xoff, yoff, change_grav
5131       register int xoff, yoff;       register int xoff, yoff;
5132       int change_gravity;       int change_gravity;
5133  {  {
   int modified_top, modified_left;  
   
5134    if (change_gravity > 0)    if (change_gravity > 0)
5135      {      {
5136        f->top_pos = yoff;        f->top_pos = yoff;
# Line 5137  x_set_offset (f, xoff, yoff, change_grav Line 5147  x_set_offset (f, xoff, yoff, change_grav
5147    BLOCK_INPUT;    BLOCK_INPUT;
5148    x_wm_set_size_hint (f, (long) 0, 0);    x_wm_set_size_hint (f, (long) 0, 0);
5149    
5150    modified_left = f->left_pos;  #if TARGET_API_MAC_CARBON
5151    modified_top = f->top_pos;    MoveWindowStructure (FRAME_MAC_WINDOW (f), f->left_pos, f->top_pos);
5152      /* If the title bar is completely outside the screen, adjust the
5153         position. */
5154      ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn,
5155                               kWindowConstrainMoveRegardlessOfFit
5156                               | kWindowConstrainAllowPartial, NULL, NULL);
5157      x_real_positions (f, &f->left_pos, &f->top_pos);
5158    #else
5159      {
5160        Rect inner, outer, screen_rect, dummy;
5161        RgnHandle region = NewRgn ();
5162    
5163    MoveWindow (FRAME_MAC_WINDOW (f), modified_left + 6,      mac_get_window_bounds (f, &inner, &outer);
5164                modified_top + 42, false);      f->x_pixels_diff = inner.left - outer.left;
5165        f->y_pixels_diff = inner.top - outer.top;
5166        MoveWindow (FRAME_MAC_WINDOW (f), f->left_pos + f->x_pixels_diff,
5167                    f->top_pos + f->y_pixels_diff, false);
5168    
5169        /* If the title bar is completely outside the screen, adjust the
5170           position.  The variable `outer' holds the title bar rectangle.
5171           The variable `inner' holds slightly smaller one than `outer',
5172           so that the calculation of overlapping may not become too
5173           strict.  */
5174        GetWindowRegion (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, region);
5175        outer = (*region)->rgnBBox;
5176        DisposeRgn (region);
5177        inner = outer;
5178        InsetRect (&inner, 8, 8);
5179        screen_rect = qd.screenBits.bounds;
5180        screen_rect.top += GetMBarHeight ();
5181    
5182        if (!SectRect (&inner, &screen_rect, &dummy))
5183          {
5184            if (inner.right <= screen_rect.left)
5185              f->left_pos = screen_rect.left;
5186            else if (inner.left >= screen_rect.right)
5187              f->left_pos = screen_rect.right - (outer.right - outer.left);
5188    
5189            if (inner.bottom <= screen_rect.top)
5190              f->top_pos = screen_rect.top;
5191            else if (inner.top >= screen_rect.bottom)
5192              f->top_pos = screen_rect.bottom - (outer.bottom - outer.top);
5193    
5194            MoveWindow (FRAME_MAC_WINDOW (f), f->left_pos + f->x_pixels_diff,
5195                        f->top_pos + f->y_pixels_diff, false);
5196          }
5197      }
5198    #endif
5199    
5200    UNBLOCK_INPUT;    UNBLOCK_INPUT;
5201  }  }
# Line 5280  x_raise_frame (f) Line 5334  x_raise_frame (f)
5334       struct frame *f;       struct frame *f;
5335  {  {
5336    if (f->async_visible)    if (f->async_visible)
5337      SelectWindow (FRAME_MAC_WINDOW (f));      {
5338          BLOCK_INPUT;
5339          SelectWindow (FRAME_MAC_WINDOW (f));
5340          UNBLOCK_INPUT;
5341        }
5342  }  }
5343    
5344  /* Lower frame F.  */  /* Lower frame F.  */
# Line 5289  x_lower_frame (f) Line 5347  x_lower_frame (f)
5347       struct frame *f;       struct frame *f;
5348  {  {
5349    if (f->async_visible)    if (f->async_visible)
5350      SendBehind (FRAME_MAC_WINDOW (f), nil);      {
5351          BLOCK_INPUT;
5352          SendBehind (FRAME_MAC_WINDOW (f), nil);
5353          UNBLOCK_INPUT;
5354        }
5355  }  }
5356    
5357  static void  static void
# Line 6926  x_find_ccl_program (fontp) Line 6988  x_find_ccl_program (fontp)
6988  /* true when cannot handle any Mac OS events */  /* true when cannot handle any Mac OS events */
6989  static int handling_window_update = 0;  static int handling_window_update = 0;
6990    
6991    #if 0
6992  /* the flag appl_is_suspended is used both for determining the sleep  /* the flag appl_is_suspended is used both for determining the sleep
6993     time to be passed to WaitNextEvent and whether the cursor should be     time to be passed to WaitNextEvent and whether the cursor should be
6994     drawn when updating the display.  The cursor is turned off when     drawn when updating the display.  The cursor is turned off when
# Line 6935  static int handling_window_update = 0; Line 6998  static int handling_window_update = 0;
6998     suspended.  */     suspended.  */
6999  static Boolean app_is_suspended = false;  static Boolean app_is_suspended = false;
7000  static long app_sleep_time = WNE_SLEEP_AT_RESUME;  static long app_sleep_time = WNE_SLEEP_AT_RESUME;
7001    #endif
7002    
7003  #define EXTRA_STACK_ALLOC (256 * 1024)  #define EXTRA_STACK_ALLOC (256 * 1024)
7004    
# Line 7261  is_emacs_window (WindowPtr win) Line 7325  is_emacs_window (WindowPtr win)
7325  static void  static void
7326  do_app_resume ()  do_app_resume ()
7327  {  {
7328      /* Window-activate events will do the job. */
7329    #if 0
7330    WindowPtr wp;    WindowPtr wp;
7331    struct frame *f;    struct frame *f;
7332    
7333    wp = mac_front_window ();    wp = front_emacs_window ();
7334    if (is_emacs_window (wp))    if (wp)
7335      {      {
7336        f = mac_window_to_frame (wp);        f = mac_window_to_frame (wp);
7337    
# Line 7278  do_app_resume () Line 7344  do_app_resume ()
7344    
7345    app_is_suspended = false;    app_is_suspended = false;
7346    app_sleep_time = WNE_SLEEP_AT_RESUME;    app_sleep_time = WNE_SLEEP_AT_RESUME;
7347    #endif
7348  }  }
7349    
7350  static void  static void
7351  do_app_suspend ()  do_app_suspend ()
7352  {  {
7353      /* Window-deactivate events will do the job. */
7354    #if 0
7355    WindowPtr wp;    WindowPtr wp;
7356    struct frame *f;    struct frame *f;
7357    
7358    wp = mac_front_window ();    wp = front_emacs_window ();
7359    if (is_emacs_window (wp))    if (wp)
7360      {      {
7361        f = mac_window_to_frame (wp);        f = mac_window_to_frame (wp);
7362    
# Line 7300  do_app_suspend () Line 7369  do_app_suspend ()
7369    
7370    app_is_suspended = true;    app_is_suspended = true;
7371    app_sleep_time = WNE_SLEEP_AT_SUSPEND;    app_sleep_time = WNE_SLEEP_AT_SUSPEND;
7372    #endif
7373  }  }
7374    
7375    
# Line 7308  do_mouse_moved (mouse_pos, f) Line 7378  do_mouse_moved (mouse_pos, f)
7378       Point mouse_pos;       Point mouse_pos;
7379       FRAME_PTR *f;       FRAME_PTR *f;
7380  {  {
7381    WindowPtr wp = mac_front_window ();    WindowPtr wp = front_emacs_window ();
7382    struct x_display_info *dpyinfo;    struct x_display_info *dpyinfo;
7383    
7384    if (is_emacs_window (wp))    if (wp)
7385      {      {
7386        *f = mac_window_to_frame (wp);        *f = mac_window_to_frame (wp);
7387        dpyinfo = FRAME_MAC_DISPLAY_INFO (*f);        dpyinfo = FRAME_MAC_DISPLAY_INFO (*f);
# Line 7373  do_menu_choice (SInt32 menu_choice) Line 7443  do_menu_choice (SInt32 menu_choice)
7443    
7444      default:      default:
7445        {        {
7446          struct frame *f = mac_window_to_frame (mac_front_window ());          struct frame *f = mac_window_to_frame (front_emacs_window ());
7447          MenuHandle menu = GetMenuHandle (menu_id);          MenuHandle menu = GetMenuHandle (menu_id);
7448          if (menu)          if (menu)
7449            {            {
# Line 7426  do_zoom_window (WindowPtr w, int zoom_in Line 7496  do_zoom_window (WindowPtr w, int zoom_in
7496    GrafPtr save_port;    GrafPtr save_port;
7497    Rect zoom_rect, port_rect;    Rect zoom_rect, port_rect;
7498    Point top_left;    Point top_left;
7499    int w_title_height, columns, rows, width, height, dummy, x, y;    int w_title_height, columns, rows;
7500    struct frame *f = mac_window_to_frame (w);    struct frame *f = mac_window_to_frame (w);
7501    
   GetPort (&save_port);  
   
   SetPortWindowPort (w);  
   
   /* Clear window to avoid flicker.  */  
7502  #if TARGET_API_MAC_CARBON  #if TARGET_API_MAC_CARBON
7503    {    {
7504      Rect r;      Point standard_size;
     BitMap bm;  
7505    
7506      GetWindowPortBounds (w, &r);      standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7507      EraseRect (&r);      standard_size.v = FRAME_MAC_DISPLAY_INFO (f)->height;
7508    
7509      if (zoom_in_or_out == inZoomOut)      if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
7510          zoom_in_or_out = inZoomIn;
7511        else
7512        {        {
7513          /* calculate height of window's title bar (hard card it for now).  */          /* Adjust the standard size according to character boundaries.  */
         w_title_height = 20 + GetMBarHeight ();  
   
         /* get maximum height of window into zoom_rect.bottom -  
            zoom_rect.top */  
         GetQDGlobalsScreenBits (&bm);  
         zoom_rect = bm.bounds;  
         zoom_rect.top += w_title_height;  
         InsetRect (&zoom_rect, 8, 4);  /* not too tight */  
7514    
7515          zoom_rect.right = zoom_rect.left          columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
7516            + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);          rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
7517            standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
7518          SetWindowStandardState (w, &zoom_rect);          standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
7519            GetWindowBounds (w, kWindowContentRgn, &port_rect);
7520            if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
7521                && port_rect.left == zoom_rect.left
7522                && port_rect.top == zoom_rect.top)
7523              zoom_in_or_out = inZoomIn;
7524            else
7525              zoom_in_or_out = inZoomOut;
7526        }        }
7527    
7528        ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
7529    }    }
7530  #else /* not TARGET_API_MAC_CARBON */  #else /* not TARGET_API_MAC_CARBON */
7531      GetPort (&save_port);
7532    
7533      SetPortWindowPort (w);
7534    
7535      /* Clear window to avoid flicker.  */
7536    EraseRect (&(w->portRect));    EraseRect (&(w->portRect));
7537    if (zoom_in_or_out == inZoomOut)    if (zoom_in_or_out == inZoomOut)
7538      {      {
# Line 7479  do_zoom_window (WindowPtr w, int zoom_in Line 7551  do_zoom_window (WindowPtr w, int zoom_in
7551        zoom_rect.right = zoom_rect.left        zoom_rect.right = zoom_rect.left
7552          + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);          + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7553    
7554          /* Adjust the standard size according to character boundaries.  */
7555          rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
7556          zoom_rect.bottom =
7557            zoom_rect.top + FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
7558    
7559        (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState        (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState
7560          = zoom_rect;          = zoom_rect;
7561      }      }
 #endif /* not TARGET_API_MAC_CARBON */  
7562    
7563    ZoomWindow (w, zoom_in_or_out, w == mac_front_window ());    ZoomWindow (w, zoom_in_or_out, w == front_emacs_window ());
7564    
7565      SetPort (save_port);
7566    #endif /* not TARGET_API_MAC_CARBON */
7567    
7568    /* retrieve window size and update application values */    /* retrieve window size and update application values */
7569  #if TARGET_API_MAC_CARBON  #if TARGET_API_MAC_CARBON
# Line 7495  do_zoom_window (WindowPtr w, int zoom_in Line 7574  do_zoom_window (WindowPtr w, int zoom_in
7574    rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top);    rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top);
7575    columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left);    columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left);
7576    x_set_window_size (f, 0, columns, rows);    x_set_window_size (f, 0, columns, rows);
7577      x_real_positions (f, &f->left_pos, &f->top_pos);
   SetPort (save_port);  
7578  }  }
7579    
7580  /* Initialize Drag And Drop to allow files to be dropped onto emacs frames */  /* Initialize Drag And Drop to allow files to be dropped onto emacs frames */
# Line 8046  XTread_socket (sd, expected, hold_quit) Line 8124  XTread_socket (sd, expected, hold_quit)
8124    if (NILP (Fboundp (Qmac_ready_for_drag_n_drop)))    if (NILP (Fboundp (Qmac_ready_for_drag_n_drop)))
8125      event_mask -= highLevelEventMask;      event_mask -= highLevelEventMask;
8126    
8127    while (WaitNextEvent (event_mask, &er,    while (WaitNextEvent (event_mask, &er, 0L, NULL))
8128                          (expected ? app_sleep_time : 0L), NULL))  #else /* USE_CARBON_EVENTS */
8129  #else    while (!ReceiveNextEvent (0, NULL, kEventDurationNoWait,
   while (!ReceiveNextEvent (0, NULL,  
                             (expected ? TicksToEventTime (app_sleep_time) : 0),  
8130                              kEventRemoveFromQueue, &eventRef))                              kEventRemoveFromQueue, &eventRef))
8131  #endif /* !USE_CARBON_EVENTS */  #endif /* USE_CARBON_EVENTS */
8132      {      {
8133        int do_help = 0;        int do_help = 0;
8134        struct frame *f;        struct frame *f;
8135    
       expected = 0;  
   
8136        /* It is necessary to set this (additional) argument slot of an        /* It is necessary to set this (additional) argument slot of an
8137           event to nil because keyboard.c protects incompletely           event to nil because keyboard.c protects incompletely
8138           processed event from being garbage collected by placing them           processed event from being garbage collected by placing them
# Line 8073  XTread_socket (sd, expected, hold_quit) Line 8147  XTread_socket (sd, expected, hold_quit)
8147          switch (GetEventClass (eventRef))          switch (GetEventClass (eventRef))
8148            {            {
8149            case kEventClassWindow:            case kEventClassWindow:
8150              if (GetEventKind (eventRef) == kEventWindowBoundsChanged)              if (GetEventKind (eventRef) == kEventWindowBoundsChanged)
8151                {                {
8152                  WindowPtr window_ptr;                  WindowPtr window_ptr;
8153                  GetEventParameter(eventRef, kEventParamDirectObject,                  GetEventParameter(eventRef, kEventParamDirectObject,
# Line 8081  XTread_socket (sd, expected, hold_quit) Line 8155  XTread_socket (sd, expected, hold_quit)
8155                                    NULL, &window_ptr);                                    NULL, &window_ptr);
8156                  f = mac_window_to_frame (window_ptr);                  f = mac_window_to_frame (window_ptr);
8157                  if (f && !f->async_iconified)                  if (f && !f->async_iconified)
8158                    {                    x_real_positions (f, &f->left_pos, &f->top_pos);
                     int x, y;  
                       
                     x_real_positions (f, &x, &y);  
                     f->left_pos = x;  
                     f->top_pos = y;  
                   }  
8159                  SendEventToEventTarget (eventRef, toolbox_dispatcher);                  SendEventToEventTarget (eventRef, toolbox_dispatcher);
8160                }                }
8161              break;              break;
# Line 8096  XTread_socket (sd, expected, hold_quit) Line 8164  XTread_socket (sd, expected, hold_quit)
8164                {                {
8165                  SInt32 delta;                  SInt32 delta;
8166                  Point point;                  Point point;
8167                  WindowPtr window_ptr = mac_front_window ();                  WindowPtr window_ptr = front_emacs_window ();
8168    
8169                  if (!IsValidWindowPtr (window_ptr))                  if (!IsValidWindowPtr (window_ptr))
8170                    {                    {
# Line 8158  XTread_socket (sd, expected, hold_quit) Line 8226  XTread_socket (sd, expected, hold_quit)
8226                }                }
8227              else              else
8228                {                {
8229                  window_ptr = FrontWindow ();                  part_code = FindWindow (er.where, &window_ptr);
8230                  if (tip_window && window_ptr == tip_window)                  if (tip_window && window_ptr == tip_window)
8231                    {                    {
8232                      HideWindow (tip_window);                      HideWindow (tip_window);
8233                      window_ptr = FrontWindow ();                      part_code = FindWindow (er.where, &window_ptr);
8234                    }                    }
   
                 if (!is_emacs_window (window_ptr))  
                   break;  
   
                 part_code = FindWindow (er.where, &window_ptr);  
8235                }                }
8236    
8237                if (er.what != mouseDown && part_code != inContent)
8238                  break;
8239    
8240              switch (part_code)              switch (part_code)
8241                {                {
8242                case inMenuBar:                case inMenuBar:
8243                  if (er.what == mouseDown)                  f = mac_window_to_frame (front_emacs_window ());
8244                    {                  saved_menu_event_location = er.where;
8245                      f = mac_window_to_frame (mac_front_window ());                  inev.kind = MENU_BAR_ACTIVATE_EVENT;
8246                      saved_menu_event_location = er.where;                  XSETFRAME (inev.frame_or_window, f);
                     inev.kind = MENU_BAR_ACTIVATE_EVENT;  
                     XSETFRAME (inev.frame_or_window, f);  
                   }  
8247                  break;                  break;
8248    
8249                case inContent:                case inContent:
8250                  if (window_ptr != mac_front_window ())                  if (window_ptr != front_emacs_window ())
8251                    SelectWindow (window_ptr);                    SelectWindow (window_ptr);
8252                  else                  else
8253                    {                    {
# Line 8281  XTread_socket (sd, expected, hold_quit) Line 8344  XTread_socket (sd, expected, hold_quit)
8344                        }                        }
8345                      else                      else
8346                        {                        {
8347                          if (dpyinfo->grabbed & (1 << inev.code) == 0)                          if ((dpyinfo->grabbed & (1 << inev.code)) == 0)
8348                            /* If a button is released though it was not                            /* If a button is released though it was not
8349                               previously pressed, that would be because                               previously pressed, that would be because
8350                               of multi-button emulation.  */                               of multi-button emulation.  */
# Line 8304  XTread_socket (sd, expected, hold_quit) Line 8367  XTread_socket (sd, expected, hold_quit)
8367    
8368                case inDrag:                case inDrag:
8369  #if TARGET_API_MAC_CARBON  #if TARGET_API_MAC_CARBON
8370                  if (er.what == mouseDown)                  DragWindow (window_ptr, er.where, NULL);
                   {  
                     BitMap bm;  
   
                     GetQDGlobalsScreenBits (&bm);  
                     DragWindow (window_ptr, er.where, &bm.bounds);  
                   }  
8371  #else /* not TARGET_API_MAC_CARBON */  #else /* not TARGET_API_MAC_CARBON */
8372                  DragWindow (window_ptr, er.where, &qd.screenBits.bounds);                  DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
8373  #endif /* not TARGET_API_MAC_CARBON */  #endif /* not TARGET_API_MAC_CARBON */
8374                  /* Update the frame parameters.  */                  /* Update the frame parameters.  */
8375                  {                  {
8376                    struct frame *f = mac_window_to_frame (window_ptr);                    struct frame *f = mac_window_to_frame (window_ptr);
8377    
8378                    if (f && !f->async_iconified)                    if (f && !f->async_iconified)
8379                      {                      x_real_positions (f, &f->left_pos, &f->top_pos);
                       int x, y;  
                         
                       x_real_positions (f, &x, &y);  
                       f->left_pos = x;  
                       f->top_pos = y;  
                     }  
8380                  }                  }
8381                  break;                  break;
8382    
# Line 8339  XTread_socket (sd, expected, hold_quit) Line 8391  XTread_socket (sd, expected, hold_quit)
8391    
8392                  /* window resize handling added --ben */                  /* window resize handling added --ben */
8393                case inGrow:                case inGrow:
8394                  if (er.what == mouseDown)                  do_grow_window (window_ptr, &er);
8395                    {                  break;
                     do_grow_window(window_ptr, &er);  
                     break;  
                   }  
8396    
8397                  /* window zoom handling added --ben */                  /* window zoom handling added --ben */
8398                case inZoomIn:                case inZoomIn:
# Line 8415  XTread_socket (sd, expected, hold_quit) Line 8464  XTread_socket (sd, expected, hold_quit)
8464    
8465              if (!is_emacs_window (window_ptr))              if (!is_emacs_window (window_ptr))
8466                break;                break;
8467                
8468              f = mac_window_to_frame (window_ptr);              f = mac_window_to_frame (window_ptr);
8469    
8470              if ((er.modifiers & activeFlag) != 0)              if ((er.modifiers & activeFlag) != 0)
# Line 8486  XTread_socket (sd, expected, hold_quit) Line 8535  XTread_socket (sd, expected, hold_quit)
8535  #endif  #endif
8536    
8537  #if TARGET_API_MAC_CARBON  #if TARGET_API_MAC_CARBON
8538              if (!IsValidWindowPtr (mac_front_window ()))              if (!IsValidWindowPtr (front_emacs_window ()))
8539                {                {
8540                  SysBeep (1);                  SysBeep (1);
8541                  break;                  break;
# Line 8590  XTread_socket (sd, expected, hold_quit) Line 8639  XTread_socket (sd, expected, hold_quit)
8639            inev.modifiers = mac_to_emacs_modifiers (er.modifiers);            inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
8640  #endif  #endif
8641            XSETFRAME (inev.frame_or_window,            XSETFRAME (inev.frame_or_window,
8642                       mac_window_to_frame (mac_front_window ()));                       mac_window_to_frame (front_emacs_window ()));
8643            inev.timestamp = er.when * (1000 / 60);  /* ticks to milliseconds */            inev.timestamp = er.when * (1000 / 60);  /* ticks to milliseconds */
8644            break;            break;
8645    
# Line 8607  XTread_socket (sd, expected, hold_quit) Line 8656  XTread_socket (sd, expected, hold_quit)
8656                WindowPtr wp;                WindowPtr wp;
8657                Lisp_Object frame;                Lisp_Object frame;
8658    
8659                wp = mac_front_window ();                wp = front_emacs_window ();
8660    
8661                if (!wp)                if (!wp)
8662                  {                  {
8663                    struct frame *f = XFRAME (XCAR (Vframe_list));                    struct frame *f = XFRAME (XCAR (Vframe_list));
8664                    CollapseWindow (FRAME_MAC_WINDOW (f), false);                    CollapseWindow (FRAME_MAC_WINDOW (f), false);
8665                    wp = mac_front_window ();                    wp = front_emacs_window ();
8666                  }                  }
8667    
8668                if (wp && is_emacs_window (wp))                if (wp)
8669                  f = mac_window_to_frame (wp);                  f = mac_window_to_frame (wp);
8670    
8671                inev.kind = DRAG_N_DROP_EVENT;                inev.kind = DRAG_N_DROP_EVENT;
# Line 8742  make_mac_frame (FRAME_PTR fp) Line 8791  make_mac_frame (FRAME_PTR fp)
8791    
8792    mwp = fp->output_data.mac;    mwp = fp->output_data.mac;
8793    
8794      BLOCK_INPUT;
8795    if (making_terminal_window)    if (making_terminal_window)
8796      {      {
8797        if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL,        if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL,
# Line 8769  make_mac_frame (FRAME_PTR fp) Line 8819  make_mac_frame (FRAME_PTR fp)
8819      /* so that update events can find this mac_output struct */      /* so that update events can find this mac_output struct */
8820    mwp->mFP = fp;  /* point back to emacs frame */    mwp->mFP = fp;  /* point back to emacs frame */
8821    
   SetPortWindowPort (mwp->mWP);  
   
8822    SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false);    SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false);
8823      UNBLOCK_INPUT;
8824  }  }
8825    
8826    
# Line 9073  mac_check_for_quit_char () Line 9122  mac_check_for_quit_char ()
9122        e.arg = Qnil;        e.arg = Qnil;
9123        e.modifiers = NULL;        e.modifiers = NULL;
9124        e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);        e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);
9125        XSETFRAME (e.frame_or_window, mac_window_to_frame (mac_front_window ()));        XSETFRAME (e.frame_or_window, mac_window_to_frame (front_emacs_window ()));
9126        /* Remove event from queue to prevent looping. */        /* Remove event from queue to prevent looping. */
9127        RemoveEventFromQueue (GetMainEventQueue (), event);        RemoveEventFromQueue (GetMainEventQueue (), event);
9128        ReleaseEvent (event);        ReleaseEvent (event);
# Line 9194  mac_initialize () Line 9243  mac_initialize ()
9243    signal (SIGPIPE, x_connection_signal);    signal (SIGPIPE, x_connection_signal);
9244  #endif  #endif
9245    
9246      BLOCK_INPUT;
9247    mac_initialize_display_info ();    mac_initialize_display_info ();
9248    
9249  #if TARGET_API_MAC_CARBON  #if TARGET_API_MAC_CARBON
# Line 9212  mac_initialize () Line 9262  mac_initialize ()
9262    if (!inhibit_window_system)    if (!inhibit_window_system)
9263      MakeMeTheFrontProcess ();      MakeMeTheFrontProcess ();
9264  #endif  #endif
9265      UNBLOCK_INPUT;
9266  }  }
9267    
9268    

Legend:
Removed from v.1.47.2.8  
changed lines
  Added in v.1.47.2.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26