emacs-devel
[Top][All Lists]
Advanced

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

Re: Extending fringe backgrounds to scroll bar gaps


From: YAMAMOTO Mitsuharu
Subject: Re: Extending fringe backgrounds to scroll bar gaps
Date: Fri, 15 Jun 2007 18:28:13 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 Emacs/22.1.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Fri, 15 Jun 2007 04:48:26 -0400, Richard Stallman <address@hidden> 
>>>>> said:

>     I've just installed this change only for Mac Carbon, to the
>     trunk.  Let's see if it works.

> Thank you.  In a month from now, if it works well, could you make it
> apply to all systems?

Yes.  But as I can't test it with W32, could Windows users try the
following patch?

                                     YAMAMOTO Mitsuharu
                                address@hidden

Index: src/w32term.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.c,v
retrieving revision 1.259
diff -c -p -r1.259 w32term.c
*** src/w32term.c       19 Feb 2007 14:45:39 -0000      1.259
--- src/w32term.c       15 Jun 2007 09:22:53 -0000
*************** w32_draw_fringe_bitmap (w, row, p)
*** 702,709 ****
  
    if (p->bx >= 0 && !p->overlay_p)
      {
!       w32_fill_area (f, hdc, face->background,
!                    p->bx, p->by, p->nx, p->ny);
      }
  
    if (p->which && p->which < max_fringe_bmp)
--- 702,735 ----
  
    if (p->bx >= 0 && !p->overlay_p)
      {
!       int bx = p->bx, nx = p->nx;
! 
!       /* If the fringe is adjacent to the left (right) scroll bar of a
!        leftmost (rightmost, respectively) window, then extend its
!        background to the gap between the fringe and the bar.  */
!       if ((WINDOW_LEFTMOST_P (w)
!          && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
!         || (WINDOW_RIGHTMOST_P (w)
!             && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)))
!       {
!         int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
! 
!         if (sb_width > 0)
!           {
!             int left = WINDOW_SCROLL_BAR_AREA_X (w);
!             int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w)
!                          * FRAME_COLUMN_WIDTH (f));
! 
!             if (left + width == bx)
!               {
!                 bx = left + sb_width;
!                 nx += width - sb_width;
!               }
!             else if (bx + nx == left)
!               nx += width - sb_width;
!           }
!       }
!       w32_fill_area (f, hdc, face->background, bx, p->by, nx, p->ny);
      }
  
    if (p->which && p->which < max_fringe_bmp)
*************** x_scroll_bar_create (w, top, left, width
*** 3638,3643 ****
--- 3664,3670 ----
    XSETINT (bar->start, 0);
    XSETINT (bar->end, 0);
    bar->dragging = Qnil;
+   bar->fringe_extended_p = Qnil;
  
    /* Requires geometry to be set before call to create the real window */
  
*************** w32_set_vertical_scroll_bar (w, portion,
*** 3701,3706 ****
--- 3728,3734 ----
    struct scroll_bar *bar;
    int top, height, left, sb_left, width, sb_width;
    int window_y, window_height;
+   int fringe_extended_p;
  
    /* Get window dimensions.  */
    window_box (w, -1, 0, &window_y, 0, &window_height);
*************** w32_set_vertical_scroll_bar (w, portion,
*** 3720,3728 ****
  
    /* Compute the left edge of the scroll bar.  */
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
!     sb_left = left + width - sb_width - (width - sb_width) / 2;
    else
!     sb_left = left + (width - sb_width) / 2;
  
    /* Does the scroll bar exist yet?  */
    if (NILP (w->vertical_scroll_bar))
--- 3748,3767 ----
  
    /* Compute the left edge of the scroll bar.  */
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
!     sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0);
    else
!     sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width);
! 
!   if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
!     fringe_extended_p = (WINDOW_LEFTMOST_P (w)
!                        && WINDOW_LEFT_FRINGE_WIDTH (w)
!                        && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
!                            || WINDOW_LEFT_MARGIN_COLS (w) == 0));
!   else
!     fringe_extended_p = (WINDOW_RIGHTMOST_P (w)
!                        && WINDOW_RIGHT_FRINGE_WIDTH (w)
!                        && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
!                            || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
  
    /* Does the scroll bar exist yet?  */
    if (NILP (w->vertical_scroll_bar))
*************** w32_set_vertical_scroll_bar (w, portion,
*** 3732,3738 ****
        if (width > 0 && height > 0)
        {
          hdc = get_frame_dc (f);
!         w32_clear_area (f, hdc, left, top, width, height);
          release_frame_dc (f, hdc);
        }
        UNBLOCK_INPUT;
--- 3771,3780 ----
        if (width > 0 && height > 0)
        {
          hdc = get_frame_dc (f);
!         if (fringe_extended_p)
!           w32_clear_area (f, hdc, sb_left, top, sb_width, height);
!         else
!           w32_clear_area (f, hdc, left, top, width, height);
          release_frame_dc (f, hdc);
        }
        UNBLOCK_INPUT;
*************** w32_set_vertical_scroll_bar (w, portion,
*** 3751,3757 ****
        if ( XINT (bar->left) == sb_left
             && XINT (bar->top) == top
             && XINT (bar->width) ==  sb_width
!            && XINT (bar->height) == height )
          {
            /* Redraw after clear_frame. */
            if (!my_show_window (f, hwnd, SW_NORMAL))
--- 3793,3800 ----
        if ( XINT (bar->left) == sb_left
             && XINT (bar->top) == top
             && XINT (bar->width) ==  sb_width
!            && XINT (bar->height) == height
!          && !NILP (bar->fringe_extended_p) == fringe_extended_p )
          {
            /* Redraw after clear_frame. */
            if (!my_show_window (f, hwnd, SW_NORMAL))
*************** w32_set_vertical_scroll_bar (w, portion,
*** 3768,3778 ****
              hdc = get_frame_dc (f);
              /* Since Windows scroll bars are smaller than the space reserved
                 for them on the frame, we have to clear "under" them.  */
!             w32_clear_area (f, hdc,
!                             left,
!                             top,
!                             width,
!                             height);
              release_frame_dc (f, hdc);
            }
            /* Make sure scroll bar is "visible" before moving, to ensure the
--- 3811,3820 ----
              hdc = get_frame_dc (f);
              /* Since Windows scroll bars are smaller than the space reserved
                 for them on the frame, we have to clear "under" them.  */
!             if (fringe_extended_p)
!               w32_clear_area (f, hdc, sb_left, top, sb_width, height);
!             else
!               w32_clear_area (f, hdc, left, top, width, height);
              release_frame_dc (f, hdc);
            }
            /* Make sure scroll bar is "visible" before moving, to ensure the
*************** w32_set_vertical_scroll_bar (w, portion,
*** 3802,3807 ****
--- 3844,3851 ----
            UNBLOCK_INPUT;
          }
      }
+   bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
+ 
    w32_set_scroll_bar_thumb (bar, portion, position, whole);
  
    XSETVECTOR (w->vertical_scroll_bar, bar);
Index: src/w32term.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.h,v
retrieving revision 1.68
diff -c -p -r1.68 w32term.h
*** src/w32term.h       22 Feb 2007 22:50:15 -0000      1.68
--- src/w32term.h       15 Jun 2007 09:22:53 -0000
*************** struct scroll_bar {
*** 487,492 ****
--- 487,496 ----
       place where the user grabbed it.  If the handle isn't currently
       being dragged, this is Qnil.  */
    Lisp_Object dragging;
+ 
+   /* t if the background of the fringe that is adjacent to a scroll
+      bar is extended to the gap between the fringe and the bar.  */
+   Lisp_Object fringe_extended_p;
  };
  
  /* The number of elements a vector holding a struct scroll_bar needs.  */




reply via email to

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