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: Tue, 15 Mar 2005 22:29:13 -0500

Index: emacs/src/macterm.c
diff -c emacs/src/macterm.c:1.104 emacs/src/macterm.c:1.105
*** emacs/src/macterm.c:1.104   Tue Mar 15 07:47:25 2005
--- emacs/src/macterm.c Wed Mar 16 03:29:13 2005
***************
*** 290,298 ****
  static void x_update_window_begin P_ ((struct window *));
  static void x_after_update_window_line P_ ((struct glyph_row *));
  
- void activate_scroll_bars (FRAME_PTR);
- void deactivate_scroll_bars (FRAME_PTR);
- 
  static int is_emacs_window (WindowPtr);
  
  int x_bitmap_icon (struct frame *, Lisp_Object);
--- 290,295 ----
***************
*** 350,357 ****
     commands.  Assume that the graphic port has already been set.  */
  
  static void
! mac_set_colors (GC gc)
  {
    mac_set_forecolor (gc->foreground);
    mac_set_backcolor (gc->background);
  }
--- 347,358 ----
     commands.  Assume that the graphic port has already been set.  */
  
  static void
! mac_set_colors (gc, bg_save)
!      GC gc;
!      RGBColor *bg_save;
  {
+   if (bg_save)
+     GetBackColor (bg_save);
    mac_set_forecolor (gc->foreground);
    mac_set_backcolor (gc->background);
  }
***************
*** 365,376 ****
       GC gc;
       int x1, y1, x2, y2;
  {
    SetPortWindowPort (w);
  
!   mac_set_colors (gc);
  
    MoveTo (x1, y1);
    LineTo (x2, y2);
  }
  
  void
--- 366,381 ----
       GC gc;
       int x1, y1, x2, y2;
  {
+   RGBColor old_bg;
+ 
    SetPortWindowPort (w);
  
!   mac_set_colors (gc, &old_bg);
  
    MoveTo (x1, y1);
    LineTo (x2, y2);
+ 
+   RGBBackColor (&old_bg);
  }
  
  void
***************
*** 386,392 ****
    GetGWorld (&old_port, &old_gdh);
    SetGWorld (p, NULL);
  
!   mac_set_colors (gc);
  
    LockPixels (GetGWorldPixMap (p));
    MoveTo (x1, y1);
--- 391,397 ----
    GetGWorld (&old_port, &old_gdh);
    SetGWorld (p, NULL);
  
!   mac_set_colors (gc, NULL);
  
    LockPixels (GetGWorldPixMap (p));
    MoveTo (x1, y1);
***************
*** 409,424 ****
    struct mac_output *mwp = (mac_output *) GetWRefCon (w);
    Rect r;
    XGCValues xgc;
  
    xgc.foreground = mwp->x_compatible.foreground_pixel;
    xgc.background = mwp->x_compatible.background_pixel;
  
    SetPortWindowPort (w);
  
!   mac_set_colors (&xgc);
    SetRect (&r, x, y, x + width, y + height);
  
    EraseRect (&r);
  }
  
  /* Mac version of XClearWindow.  */
--- 414,432 ----
    struct mac_output *mwp = (mac_output *) GetWRefCon (w);
    Rect r;
    XGCValues xgc;
+   RGBColor old_bg;
  
    xgc.foreground = mwp->x_compatible.foreground_pixel;
    xgc.background = mwp->x_compatible.background_pixel;
  
    SetPortWindowPort (w);
  
!   mac_set_colors (&xgc, &old_bg);
    SetRect (&r, x, y, x + width, y + height);
  
    EraseRect (&r);
+ 
+   RGBBackColor (&old_bg);
  }
  
  /* Mac version of XClearWindow.  */
***************
*** 436,442 ****
  
    SetPortWindowPort (w);
  
!   mac_set_colors (&xgc);
  
  #if TARGET_API_MAC_CARBON
    {
--- 444,450 ----
  
    SetPortWindowPort (w);
  
!   mac_set_colors (&xgc, NULL);
  
  #if TARGET_API_MAC_CARBON
    {
***************
*** 464,469 ****
--- 472,478 ----
  {
    BitMap bitmap;
    Rect r;
+   RGBColor old_bg;
  
    bitmap.rowBytes = sizeof(unsigned short);
    bitmap.baseAddr = (char *)bits;
***************
*** 471,477 ****
  
    SetPortWindowPort (w);
  
!   mac_set_colors (gc);
    SetRect (&r, x, y, x + width, y + height);
  
  #if TARGET_API_MAC_CARBON
--- 480,486 ----
  
    SetPortWindowPort (w);
  
!   mac_set_colors (gc, &old_bg);
    SetRect (&r, x, y, x + width, y + height);
  
  #if TARGET_API_MAC_CARBON
***************
*** 483,488 ****
--- 492,499 ----
    CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r,
            overlay_p ? srcOr : srcCopy, 0);
  #endif /* not TARGET_API_MAC_CARBON */
+ 
+   RGBBackColor (&old_bg);
  }
  
  
***************
*** 631,643 ****
       unsigned int width, height;
  {
    Rect r;
  
    SetPortWindowPort (w);
  
!   mac_set_colors (gc);
    SetRect (&r, x, y, x + width, y + height);
  
    PaintRect (&r); /* using foreground color of gc */
  }
  
  
--- 642,657 ----
       unsigned int width, height;
  {
    Rect r;
+   RGBColor old_bg;
  
    SetPortWindowPort (w);
  
!   mac_set_colors (gc, &old_bg);
    SetRect (&r, x, y, x + width, y + height);
  
    PaintRect (&r); /* using foreground color of gc */
+ 
+   RGBBackColor (&old_bg);
  }
  
  
***************
*** 656,662 ****
  
    GetGWorld (&old_port, &old_gdh);
    SetGWorld (p, NULL);
!   mac_set_colors (gc);
    SetRect (&r, x, y, x + width, y + height);
  
    LockPixels (GetGWorldPixMap (p));
--- 670,676 ----
  
    GetGWorld (&old_port, &old_gdh);
    SetGWorld (p, NULL);
!   mac_set_colors (gc, NULL);
    SetRect (&r, x, y, x + width, y + height);
  
    LockPixels (GetGWorldPixMap (p));
***************
*** 679,691 ****
       unsigned int width, height;
  {
    Rect r;
  
    SetPortWindowPort (w);
  
!   mac_set_colors (gc);
    SetRect (&r, x, y, x + width + 1, y + height + 1);
  
    FrameRect (&r); /* using foreground color of gc */
  }
  
  
--- 693,708 ----
       unsigned int width, height;
  {
    Rect r;
+   RGBColor old_bg;
  
    SetPortWindowPort (w);
  
!   mac_set_colors (gc, &old_bg);
    SetRect (&r, x, y, x + width + 1, y + height + 1);
  
    FrameRect (&r); /* using foreground color of gc */
+ 
+   RGBBackColor (&old_bg);
  }
  
  
***************
*** 706,712 ****
  
    GetGWorld (&old_port, &old_gdh);
    SetGWorld (p, NULL);
!   mac_set_colors (gc);
    SetRect (&r, x, y, x + width + 1, y + height + 1);
  
    LockPixels (GetGWorldPixMap (p));
--- 723,729 ----
  
    GetGWorld (&old_port, &old_gdh);
    SetGWorld (p, NULL);
!   mac_set_colors (gc, NULL);
    SetRect (&r, x, y, x + width + 1, y + height + 1);
  
    LockPixels (GetGWorldPixMap (p));
***************
*** 728,733 ****
--- 745,752 ----
       char *buf;
       int nchars, mode, bytes_per_char;
  {
+   RGBColor old_bg;
+ 
    SetPortWindowPort (w);
  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
    UInt32 textFlags, savedFlags;
***************
*** 737,743 ****
    }
  #endif
  
!   mac_set_colors (gc);
  
    TextFont (gc->font->mac_fontnum);
    TextSize (gc->font->mac_fontsize);
--- 756,762 ----
    }
  #endif
  
!   mac_set_colors (gc, &old_bg);
  
    TextFont (gc->font->mac_fontnum);
    TextSize (gc->font->mac_fontsize);
***************
*** 746,751 ****
--- 765,772 ----
  
    MoveTo (x, y);
    DrawText (buf, 0, nchars * bytes_per_char);
+ 
+   RGBBackColor (&old_bg);
  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
    if (!NILP(Vmac_use_core_graphics))
      SwapQDTextFlags(savedFlags);
***************
*** 933,939 ****
  
    SetPort (w);
  #if 0
!   mac_set_colors (gc);
  #endif
  
    SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
--- 954,960 ----
  
    SetPort (w);
  #if 0
!   mac_set_colors (gc, NULL);
  #endif
  
    SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
***************
*** 955,961 ****
    BackColor (whiteColor);
    CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0);
  
!   mac_set_colors (gc);
  #endif
  #endif /* not TARGET_API_MAC_CARBON */
  }
--- 976,982 ----
    BackColor (whiteColor);
    CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0);
  
!   mac_set_colors (gc, NULL);
  #endif
  #endif /* not TARGET_API_MAC_CARBON */
  }
***************
*** 1395,1407 ****
    FRAME_MAC_DISPLAY_INFO (f)->mouse_face_defer = 0;
  
    BLOCK_INPUT;
-   /* Reset the background color of Mac OS Window to that of the frame after
-      update so that it is used by Mac Toolbox to clear the update region 
before
-      an update event is generated.  */
-   SetPortWindowPort (FRAME_MAC_WINDOW (f));
- 
-   mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
- 
  #if TARGET_API_MAC_CARBON
    EnableScreenUpdates ();
  #endif
--- 1416,1421 ----
***************
*** 4471,4520 ****
  }
  
  
- void
- activate_scroll_bars (frame)
-      FRAME_PTR frame;
- {
-   Lisp_Object bar;
-   ControlHandle ch;
- 
-   bar = FRAME_SCROLL_BARS (frame);
-   while (! NILP (bar))
-     {
-       ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar));
- #if 1 /* TARGET_API_MAC_CARBON */
-       ActivateControl (ch);
- #else
-       SetControlMaximum (ch,
-                        VERTICAL_SCROLL_BAR_TOP_RANGE (frame,
-                                                       XINT (XSCROLL_BAR (bar)
-                                                             ->height)) - 1);
- #endif
-       bar = XSCROLL_BAR (bar)->next;
-     }
- }
- 
- 
- void
- deactivate_scroll_bars (frame)
-      FRAME_PTR frame;
- {
-   Lisp_Object bar;
-   ControlHandle ch;
- 
-   bar = FRAME_SCROLL_BARS (frame);
-   while (! NILP (bar))
-     {
-       ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar));
- #if 1 /* TARGET_API_MAC_CARBON */
-       DeactivateControl (ch);
- #else
-       SetControlMaximum (ch, -1);
- #endif
-       bar = XSCROLL_BAR (bar)->next;
-     }
- }
- 
  /* Handle a mouse click on the scroll bar BAR.  If *EMACS_EVENT's kind
     is set to something other than NO_EVENT, it is enqueued.
  
--- 4485,4490 ----
***************
*** 4845,4855 ****
       struct frame *f;
       Cursor cursor;
  {
- #if TARGET_API_MAC_CARBON
    SetThemeCursor (cursor);
- #else
-   SetCursor (*cursor);
- #endif
  }
  
  
--- 4815,4821 ----
***************
*** 5274,5279 ****
--- 5240,5250 ----
    x_wm_set_size_hint (f, (long) 0, 0);
  
    SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0);
+ #if TARGET_API_MAC_CARBON
+   if (f->output_data.mac->hourglass_control)
+     MoveControl (f->output_data.mac->hourglass_control,
+                pixelwidth - HOURGLASS_WIDTH, 0);
+ #endif
  
    /* Now, strictly speaking, we can't be sure that this is accurate,
       but the window manager will get around to dealing with the size
***************
*** 7185,7195 ****
  
  Point saved_menu_event_location;
  
- #if !TARGET_API_MAC_CARBON
- /* Place holder for the default arrow cursor.  */
- CursPtr arrow_cursor;
- #endif
- 
  /* Apple Events */
  static void init_required_apple_events (void);
  static pascal OSErr
--- 7156,7161 ----
***************
*** 7392,7399 ****
    InitCursor ();
  
  #if !TARGET_API_MAC_CARBON
-   arrow_cursor = &qd.arrow;
- 
    /* set up some extra stack space for use by emacs */
    SetApplLimit ((Ptr) ((long) GetApplLimit () - EXTRA_STACK_ALLOC));
  
--- 7358,7363 ----
***************
*** 7454,7468 ****
            RgnHandle region = NewRgn ();
  
            GetPortVisibleRegion (GetWindowPort (win), region);
-           UpdateControls (win, region);
            GetRegionBounds (region, &r);
            DisposeRgn (region);
          }
  #else
-         UpdateControls (win, win->visRgn);
          r = (*win->visRgn)->rgnBBox;
- #endif
          expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top);
  
            handling_window_update = 0;
          }
--- 7418,7433 ----
            RgnHandle region = NewRgn ();
  
            GetPortVisibleRegion (GetWindowPort (win), region);
            GetRegionBounds (region, &r);
+           expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top);
+           UpdateControls (win, region);
            DisposeRgn (region);
          }
  #else
          r = (*win->visRgn)->rgnBBox;
          expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top);
+         UpdateControls (win, win->visRgn);
+ #endif
  
            handling_window_update = 0;
          }
***************
*** 7955,7962 ****
       EventRef event;
       void *data;
  {
-   extern Lisp_Object Qcontrol;
- 
    WindowPtr wp;
    OSStatus result;
    UInt32 attributes;
--- 7920,7925 ----
***************
*** 8226,8232 ****
          Rect r;
          struct frame *f = mac_window_to_frame (window);
  
-         mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
          GetWindowPortBounds (window, &r);
          OffsetRect (&r, -r.left, -r.top);
          RectRgn (hilite_rgn, &r);
--- 8189,8194 ----
***************
*** 8244,8250 ****
        {
          struct frame *f = mac_window_to_frame (window);
  
-         mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
          HideDragHilite (theDrag);
          SetThemeCursor (kThemeArrowCursor);
        }
--- 8206,8211 ----
***************
*** 8736,8747 ****
                    /* ticks to milliseconds */
  
                    if (dpyinfo->grabbed && tracked_scroll_bar
! #if TARGET_API_MAC_CARBON
!                       || ch != 0
! #else
!                       || control_part_code != 0
! #endif
!                       )
                      {
                        struct scroll_bar *bar;
  
--- 8697,8705 ----
                    /* ticks to milliseconds */
  
                    if (dpyinfo->grabbed && tracked_scroll_bar
!                       /* control_part_code becomes kControlNoPart if
!                          a progress indicator is clicked.  */
!                       || ch != 0 && control_part_code != kControlNoPart)
                      {
                        struct scroll_bar *bar;
  
***************
*** 8910,8915 ****
--- 8868,8874 ----
        case activateEvt:
          {
            WindowPtr window_ptr = (WindowPtr) er.message;
+           ControlRef root_control;
  
  #if USE_CARBON_EVENTS
            if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
***************
*** 8926,8931 ****
--- 8885,8891 ----
              break;
  
            f = mac_window_to_frame (window_ptr);
+           GetRootControl (window_ptr, &root_control);
  
            if ((er.modifiers & activeFlag) != 0)
              {
***************
*** 8933,8939 ****
                Point mouse_loc = er.where;
  
                x_new_focus_frame (dpyinfo, f);
!               activate_scroll_bars (f);
  
                SetPortWindowPort (window_ptr);
                GlobalToLocal (&mouse_loc);
--- 8893,8899 ----
                Point mouse_loc = er.where;
  
                x_new_focus_frame (dpyinfo, f);
!               ActivateControl (root_control);
  
                SetPortWindowPort (window_ptr);
                GlobalToLocal (&mouse_loc);
***************
*** 8950,8956 ****
                if (f == dpyinfo->x_focus_frame)
                  {
                    x_new_focus_frame (dpyinfo, 0);
!                   deactivate_scroll_bars (f);
                  }
  
  
--- 8910,8916 ----
                if (f == dpyinfo->x_focus_frame)
                  {
                    x_new_focus_frame (dpyinfo, 0);
!                   DeactivateControl (root_control);
                  }
  
  
***************
*** 9288,9308 ****
    f->output_data.mac->mouse_pixel = 0xff00ff;
    f->output_data.mac->cursor_foreground_pixel = 0x0000ff;
  
- #if TARGET_API_MAC_CARBON
    f->output_data.mac->text_cursor = kThemeIBeamCursor;
    f->output_data.mac->nontext_cursor = kThemeArrowCursor;
    f->output_data.mac->modeline_cursor = kThemeArrowCursor;
    f->output_data.mac->hand_cursor = kThemePointingHandCursor;
    f->output_data.mac->hourglass_cursor = kThemeWatchCursor;
    f->output_data.mac->horizontal_drag_cursor = kThemeResizeLeftRightCursor;
- #else
-   f->output_data.mac->text_cursor = GetCursor (iBeamCursor);
-   f->output_data.mac->nontext_cursor = &arrow_cursor;
-   f->output_data.mac->modeline_cursor = &arrow_cursor;
-   f->output_data.mac->hand_cursor = &arrow_cursor;
-   f->output_data.mac->hourglass_cursor = GetCursor (watchCursor);
-   f->output_data.mac->horizontal_drag_cursor = &arrow_cursor;
- #endif
  
    FRAME_FONTSET (f) = -1;
    f->output_data.mac->explicit_parent = 0;
--- 9248,9259 ----




reply via email to

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