emacs-devel
[Top][All Lists]
Advanced

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

Re: visible-bell patch for Mac OS X


From: YAMAMOTO Mitsuharu
Subject: Re: visible-bell patch for Mac OS X
Date: Tue, 02 Feb 2010 10:40:46 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Tue, 02 Feb 2010 08:33:22 +0900, YAMAMOTO Mitsuharu <address@hidden> 
>>>>> said:

>>> The patch consists of ~80 lines.  Is it considered a "tiny
>>> change"?

>> I have started the copyright assignment process with Filipe.

> Besides that, I'd suggest reverting the patch for now for several
> reasons: it does not work on the second frame, it gives inconsistent
> flashed area when the scroll bars are placed on the left side, and
> it breaks GNUstep builds.

And it is also inconsistent when there is a header line at the top, as
I pointed out before in the previous proposal for a similar patch by
another person:

  http://lists.gnu.org/archive/html/emacs-devel/2009-03/msg00412.html

I tried to do more consistent exclusion of the scroll bars from the
flashed area.  The patch below is against the Mac port:

  http://lists.gnu.org/archive/html/emacs-devel/2010-01/msg01487.html

                                     YAMAMOTO Mitsuharu
                                address@hidden

=== modified file 'src/macterm.c'
*** src/macterm.c       2010-01-13 09:32:45 +0000
--- src/macterm.c       2010-02-02 01:19:04 +0000
***************
*** 737,742 ****
--- 737,776 ----
  }
  
  
+ static void
+ mac_invert_rectangles (f, rectangles, n)
+      struct frame *f;
+      const Rect *rectangles;
+      int n;
+ {
+   int i;
+ 
+   for (i = 0; i < n; i++)
+     mac_invert_rectangle (f, rectangles[i].left, rectangles[i].top,
+                         rectangles[i].right - rectangles[i].left,
+                         rectangles[i].bottom - rectangles[i].top);
+   if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
+     {
+       Lisp_Object bar;
+ 
+       if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
+       for (bar = FRAME_SCROLL_BARS (f); !NILP (bar);
+            bar = XSCROLL_BAR (bar)->next)
+         {
+           struct scroll_bar *b = XSCROLL_BAR (bar);
+           Rect bar_rect, r;
+ 
+           SetRect (&bar_rect, b->left, b->top,
+                    b->left + b->width, b->top + b->height);
+           for (i = 0; i < n; i++)
+             if (SectRect (rectangles + i, &bar_rect, &r))
+               mac_invert_rectangle (f, r.left, r.top,
+                                     r.right - r.left, r.bottom - r.top);
+         }
+     }
+ }
+ 
+ 
  /* Mac replacement for XCopyArea: used only for scrolling.  */
  
  /* Defined in either mactoolbox.c or macappkit.m.  */
***************
*** 2866,2873 ****
    /* These will be the left and right margins of the rectangles.  */
    int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
    int flash_right = FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
- 
    int width;
  
    /* Don't flash the area between a scroll bar and the frame
       edge it is next to.  */
--- 2900,2908 ----
    /* These will be the left and right margins of the rectangles.  */
    int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
    int flash_right = FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
    int width;
+   Rect rects[2];
+   int nrects;
  
    /* Don't flash the area between a scroll bar and the frame
       edge it is next to.  */
***************
*** 2887,2910 ****
  
    width = flash_right - flash_left;
  
-   BLOCK_INPUT;
- 
-   /* If window is tall, flash top and bottom line.  */
    if (height > 3 * FRAME_LINE_HEIGHT (f))
      {
!       mac_invert_rectangle (f, flash_left,
!                           (FRAME_INTERNAL_BORDER_WIDTH (f)
!                            + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT 
(f)),
!                           width, flash_height);
!       mac_invert_rectangle (f, flash_left,
!                           (height - flash_height
!                            - FRAME_INTERNAL_BORDER_WIDTH (f)),
!                           width, flash_height);
      }
    else
!     /* If it is short, flash it all.  */
!     mac_invert_rectangle (f, flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
!                         width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
  
    x_flush (f);
  
--- 2922,2953 ----
  
    width = flash_right - flash_left;
  
    if (height > 3 * FRAME_LINE_HEIGHT (f))
      {
!       /* If window is tall, flash top and bottom line.  */
!       rects[0].left = rects[1].left = flash_left;
!       rects[0].top = (FRAME_INTERNAL_BORDER_WIDTH (f)
!                   + FRAME_TOP_MARGIN_HEIGHT (f));
!       rects[0].right = rects[1].right = flash_left + width;
!       rects[0].bottom = rects[0].top + flash_height;
!       rects[1].top = height - flash_height - FRAME_INTERNAL_BORDER_WIDTH (f);
!       rects[1].bottom = rects[1].top + flash_height;
!       nrects = 2;
      }
    else
!     {
!       /* If it is short, flash it all.  */
!       rects[0].left = flash_left;
!       rects[0].top = FRAME_INTERNAL_BORDER_WIDTH (f);
!       rects[0].right = rects[0].left + width;
!       rects[0].bottom = rects[0].top + (height
!                                       - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
!       nrects = 1;
!     }
! 
!   BLOCK_INPUT;
! 
!   mac_invert_rectangles (f, rects, nrects);
  
    x_flush (f);
  
***************
*** 2940,2961 ****
        }
    }
  
!   /* If window is tall, flash top and bottom line.  */
!   if (height > 3 * FRAME_LINE_HEIGHT (f))
!     {
!       mac_invert_rectangle (f, flash_left,
!                           (FRAME_INTERNAL_BORDER_WIDTH (f)
!                            + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT 
(f)),
!                           width, flash_height);
!       mac_invert_rectangle (f, flash_left,
!                           (height - flash_height
!                            - FRAME_INTERNAL_BORDER_WIDTH (f)),
!                           width, flash_height);
!     }
!   else
!     /* If it is short, flash it all.  */
!     mac_invert_rectangle (f, flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
!                         width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
  
    x_flush (f);
  
--- 2983,2989 ----
        }
    }
  
!   mac_invert_rectangles (f, rects, nrects);
  
    x_flush (f);
  





reply via email to

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