unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Extending fringe backgrounds to scroll bar gaps
@ 2007-03-06  3:17 YAMAMOTO Mitsuharu
  2007-03-06  6:39 ` Jan Djärv
  2007-03-06 22:36 ` Richard Stallman
  0 siblings, 2 replies; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-03-06  3:17 UTC (permalink / raw)
  To: emacs-devel

There have been several reports/complaints about small gaps beside
toolkit scroll bars on the frame edges.  Some complained about the gap
with the frame edge, and others the one with the fringe of the window.
(I think the latter makes more sense because a scroll bar is
associated with its scrolling target, i.e., window, not with the
containing frame.)

According to *1 and *2, this is due to the restrictions that toolkit
scroll bars have a fixed width and each window must be placed on a
multiple of the frame default column width.  Though the latter is
planned to be relaxed in future, that will/should not happen before
the release, of course.

  *1 http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-07/msg00326.html
  *2 http://lists.gnu.org/archive/html/emacs-devel/2004-10/msg00291.html

I've just tried extending the fringe backgrounds to such scroll bar
gaps.  Its rough idea is already mentioned in *3.  I think this is
simple enough to incorporate before the release (if it works properly,
of course).  What do people think about that?

  *3 http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-09/msg00334.html

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

Index: src/xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.942
diff -c -p -r1.942 xterm.c
*** src/xterm.c	4 Mar 2007 18:28:49 -0000	1.942
--- src/xterm.c	6 Mar 2007 03:03:46 -0000
*************** x_draw_fringe_bitmap (w, row, p)
*** 720,725 ****
--- 720,727 ----
  
    if (p->bx >= 0 && !p->overlay_p)
      {
+       int bx = p->bx, nx = p->nx;
+ 
        /* In case the same realized face is used for fringes and
  	 for something displayed in the text (e.g. face `region' on
  	 mono-displays, the fill style may have been changed to
*************** x_draw_fringe_bitmap (w, row, p)
*** 729,736 ****
        else
  	XSetForeground (display, face->gc, face->background);
  
!       XFillRectangle (display, window, face->gc,
! 		      p->bx, p->by, p->nx, p->ny);
  
        if (!face->stipple)
  	XSetForeground (display, face->gc, face->foreground);
--- 731,764 ----
        else
  	XSetForeground (display, face->gc, face->background);
  
! #ifdef USE_TOOLKIT_SCROLL_BARS
!       /* 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;
! 	    }
! 	}
! #endif
!       XFillRectangle (display, window, face->gc, bx, p->by, nx, p->ny);
  
        if (!face->stipple)
  	XSetForeground (display, face->gc, face->foreground);
*************** x_scroll_bar_create (w, top, left, width
*** 4785,4790 ****
--- 4813,4821 ----
    XSETINT (bar->start, 0);
    XSETINT (bar->end, 0);
    bar->dragging = Qnil;
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   bar->fringe_extended_p = Qnil;
+ #endif
  
    /* Add bar to its frame's list of scroll bars.  */
    bar->next = FRAME_SCROLL_BARS (f);
*************** XTset_vertical_scroll_bar (w, portion, w
*** 4977,4982 ****
--- 5008,5016 ----
    struct scroll_bar *bar;
    int top, height, left, sb_left, width, sb_width;
    int window_y, window_height;
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   int fringe_extended_p;
+ #endif
  
    /* Get window dimensions.  */
    window_box (w, -1, 0, &window_y, 0, &window_height);
*************** XTset_vertical_scroll_bar (w, portion, w
*** 4997,5011 ****
    /* Compute the left edge of the scroll bar.  */
  #ifdef USE_TOOLKIT_SCROLL_BARS
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
!     sb_left = (left +
! 	       (WINDOW_RIGHTMOST_P (w)
! 		? width - sb_width - (width - sb_width) / 2
! 		: 0));
!   else
!     sb_left = (left +
! 	       (WINDOW_LEFTMOST_P (w)
! 		? (width - sb_width) / 2
! 		: width - sb_width));
  #else
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
      sb_left = left + width - sb_width;
--- 5031,5039 ----
    /* Compute the left edge of the scroll bar.  */
  #ifdef USE_TOOLKIT_SCROLL_BARS
    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);
  #else
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
      sb_left = left + width - sb_width;
*************** XTset_vertical_scroll_bar (w, portion, w
*** 5013,5026 ****
      sb_left = left;
  #endif
  
    /* Does the scroll bar exist yet?  */
    if (NILP (w->vertical_scroll_bar))
      {
        if (width > 0 && height > 0)
  	{
  	  BLOCK_INPUT;
! 	  x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			left, top, width, height, False);
  	  UNBLOCK_INPUT;
  	}
  
--- 5041,5073 ----
      sb_left = left;
  #endif
  
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   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));
+ #endif
+ 
    /* Does the scroll bar exist yet?  */
    if (NILP (w->vertical_scroll_bar))
      {
        if (width > 0 && height > 0)
  	{
  	  BLOCK_INPUT;
! #ifdef USE_TOOLKIT_SCROLL_BARS
! 	  if (fringe_extended_p)
! 	    x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			  sb_left, top, sb_width, height, False);
! 	  else
! #endif
! 	    x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			  left, top, width, height, False);
  	  UNBLOCK_INPUT;
  	}
  
*************** XTset_vertical_scroll_bar (w, portion, w
*** 5047,5059 ****
  #ifdef USE_TOOLKIT_SCROLL_BARS
  
        /* Move/size the scroll bar widget.  */
!       if (mask)
  	{
  	  /* Since toolkit scroll bars are smaller than the space reserved
  	     for them on the frame, we have to clear "under" them.  */
  	  if (width > 0 && height > 0)
! 	    x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
!                           left, top, width, height, False);
  #ifdef USE_GTK
            xg_update_scrollbar_pos (f,
                                     SCROLL_BAR_X_WINDOW (bar),
--- 5094,5112 ----
  #ifdef USE_TOOLKIT_SCROLL_BARS
  
        /* Move/size the scroll bar widget.  */
!       if (mask || !NILP (bar->fringe_extended_p) != fringe_extended_p)
  	{
  	  /* Since toolkit scroll bars are smaller than the space reserved
  	     for them on the frame, we have to clear "under" them.  */
  	  if (width > 0 && height > 0)
! 	    {
! 	      if (fringe_extended_p)
! 		x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			      sb_left, top, sb_width, height, False);
! 	      else
! 		x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			      left, top, width, height, False);
! 	    }
  #ifdef USE_GTK
            xg_update_scrollbar_pos (f,
                                     SCROLL_BAR_X_WINDOW (bar),
*************** XTset_vertical_scroll_bar (w, portion, w
*** 5128,5133 ****
--- 5181,5188 ----
      }
  
  #ifdef USE_TOOLKIT_SCROLL_BARS
+   bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
+ 
    x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
  #else /* not USE_TOOLKIT_SCROLL_BARS */
    /* Set the scroll bar's current state, unless we're currently being
Index: src/xterm.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.h,v
retrieving revision 1.190
diff -c -p -r1.190 xterm.h
*** src/xterm.h	21 Jan 2007 04:18:14 -0000	1.190
--- src/xterm.h	6 Mar 2007 03:03:47 -0000
*************** struct scroll_bar
*** 807,812 ****
--- 807,818 ----
       place where the user grabbed it.  If the handle isn't currently
       being dragged, this is Qnil.  */
    Lisp_Object dragging;
+ 
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   /* 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;
+ #endif
  };
  
  /* The number of elements a vector holding a struct scroll_bar needs.  */

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-03-06  3:17 Extending fringe backgrounds to scroll bar gaps YAMAMOTO Mitsuharu
@ 2007-03-06  6:39 ` Jan Djärv
  2007-03-06  7:02   ` YAMAMOTO Mitsuharu
  2007-03-06 22:36 ` Richard Stallman
  1 sibling, 1 reply; 21+ messages in thread
From: Jan Djärv @ 2007-03-06  6:39 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel



YAMAMOTO Mitsuharu skrev:
> There have been several reports/complaints about small gaps beside
> toolkit scroll bars on the frame edges.  Some complained about the gap
> with the frame edge, and others the one with the fringe of the window.
> (I think the latter makes more sense because a scroll bar is
> associated with its scrolling target, i.e., window, not with the
> containing frame.)
> 
> According to *1 and *2, this is due to the restrictions that toolkit
> scroll bars have a fixed width and each window must be placed on a
> multiple of the frame default column width.  Though the latter is
> planned to be relaxed in future, that will/should not happen before
> the release, of course.
> 
>   *1 http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-07/msg00326.html
>   *2 http://lists.gnu.org/archive/html/emacs-devel/2004-10/msg00291.html
> 
> I've just tried extending the fringe backgrounds to such scroll bar
> gaps.  Its rough idea is already mentioned in *3.  I think this is
> simple enough to incorporate before the release (if it works properly,
> of course).  What do people think about that?
> 
>   *3 http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-09/msg00334.html
> 

Did you try this with Gtk+?  I think the background in that case is drawn by 
Gtk+ itself, so anything xterm.c does gets overwritten.  Or depending on the 
timing of expose events, sometimes Gtk+ gets to draw the background, sometimes 
it is done from xterm.c.

	Jan D.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-03-06  6:39 ` Jan Djärv
@ 2007-03-06  7:02   ` YAMAMOTO Mitsuharu
  2007-03-06  8:10     ` Jan Djärv
  0 siblings, 1 reply; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-03-06  7:02 UTC (permalink / raw)
  To: Jan Djärv; +Cc: emacs-devel

>>>>> On Tue, 06 Mar 2007 07:39:41 +0100, Jan Djärv <jan.h.d@swipnet.se> said:

> Did you try this with Gtk+?

Yes, I tried it with GTK+ 2.8.18 as well as Xaw3d and Motif.  They all
worked equally as far as I tested.

> I think the background in that case is drawn by Gtk+ itself, so
> anything xterm.c does gets overwritten.  Or depending on the timing
> of expose events, sometimes Gtk+ gets to draw the background,
> sometimes it is done from xterm.c.

The arguments passed to x_scroll_bar_create or xg_update_scrollbar_pos
don't include the gap.  So I think the area that is drawn by GTK+ does
not overlap with that is drawn by (patched) x_draw_fringe_bitmap.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-03-06  7:02   ` YAMAMOTO Mitsuharu
@ 2007-03-06  8:10     ` Jan Djärv
  0 siblings, 0 replies; 21+ messages in thread
From: Jan Djärv @ 2007-03-06  8:10 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

YAMAMOTO Mitsuharu skrev:
>>>>>> On Tue, 06 Mar 2007 07:39:41 +0100, Jan Djärv <jan.h.d@swipnet.se> said:
> 
>> Did you try this with Gtk+?
> 
> Yes, I tried it with GTK+ 2.8.18 as well as Xaw3d and Motif.  They all
> worked equally as far as I tested.
> 
>> I think the background in that case is drawn by Gtk+ itself, so
>> anything xterm.c does gets overwritten.  Or depending on the timing
>> of expose events, sometimes Gtk+ gets to draw the background,
>> sometimes it is done from xterm.c.
> 
> The arguments passed to x_scroll_bar_create or xg_update_scrollbar_pos
> don't include the gap.  So I think the area that is drawn by GTK+ does
> not overlap with that is drawn by (patched) x_draw_fringe_bitmap.
> 

Ok, that is good.

	Jan D.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-03-06  3:17 Extending fringe backgrounds to scroll bar gaps YAMAMOTO Mitsuharu
  2007-03-06  6:39 ` Jan Djärv
@ 2007-03-06 22:36 ` Richard Stallman
  2007-06-08 10:05   ` YAMAMOTO Mitsuharu
  1 sibling, 1 reply; 21+ messages in thread
From: Richard Stallman @ 2007-03-06 22:36 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

This should wait for after the release.
We only want to fix bugs now, and this is not quite a bug.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-03-06 22:36 ` Richard Stallman
@ 2007-06-08 10:05   ` YAMAMOTO Mitsuharu
  2007-06-10 13:19     ` Richard Stallman
  0 siblings, 1 reply; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-06-08 10:05 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>>>>> On Tue, 06 Mar 2007 17:36:39 -0500, Richard Stallman <rms@gnu.org> said:

> This should wait for after the release.  We only want to fix bugs
> now, and this is not quite a bug.

Is it OK to install this change to the trunk now?  Is anybody
preparing for another change that obviates this one?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

The original message follows:

There have been several reports/complaints about small gaps beside
toolkit scroll bars on the frame edges.  Some complained about the gap
with the frame edge, and others the one with the fringe of the window.
(I think the latter makes more sense because a scroll bar is
associated with its scrolling target, i.e., window, not with the
containing frame.)

According to *1 and *2, this is due to the restrictions that toolkit
scroll bars have a fixed width and each window must be placed on a
multiple of the frame default column width.  Though the latter is
planned to be relaxed in future, that will/should not happen before
the release, of course.

  *1 http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-07/msg00326.html
  *2 http://lists.gnu.org/archive/html/emacs-devel/2004-10/msg00291.html

I've just tried extending the fringe backgrounds to such scroll bar
gaps.  Its rough idea is already mentioned in *3.  I think this is
simple enough to incorporate before the release (if it works properly,
of course).  What do people think about that?

  *3 http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-09/msg00334.html

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

Index: src/xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.942
diff -c -p -r1.942 xterm.c
*** src/xterm.c	4 Mar 2007 18:28:49 -0000	1.942
--- src/xterm.c	6 Mar 2007 03:03:46 -0000
*************** x_draw_fringe_bitmap (w, row, p)
*** 720,725 ****
--- 720,727 ----
  
    if (p->bx >= 0 && !p->overlay_p)
      {
+       int bx = p->bx, nx = p->nx;
+ 
        /* In case the same realized face is used for fringes and
  	 for something displayed in the text (e.g. face `region' on
  	 mono-displays, the fill style may have been changed to
*************** x_draw_fringe_bitmap (w, row, p)
*** 729,736 ****
        else
  	XSetForeground (display, face->gc, face->background);
  
!       XFillRectangle (display, window, face->gc,
! 		      p->bx, p->by, p->nx, p->ny);
  
        if (!face->stipple)
  	XSetForeground (display, face->gc, face->foreground);
--- 731,764 ----
        else
  	XSetForeground (display, face->gc, face->background);
  
! #ifdef USE_TOOLKIT_SCROLL_BARS
!       /* 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;
! 	    }
! 	}
! #endif
!       XFillRectangle (display, window, face->gc, bx, p->by, nx, p->ny);
  
        if (!face->stipple)
  	XSetForeground (display, face->gc, face->foreground);
*************** x_scroll_bar_create (w, top, left, width
*** 4785,4790 ****
--- 4813,4821 ----
    XSETINT (bar->start, 0);
    XSETINT (bar->end, 0);
    bar->dragging = Qnil;
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   bar->fringe_extended_p = Qnil;
+ #endif
  
    /* Add bar to its frame's list of scroll bars.  */
    bar->next = FRAME_SCROLL_BARS (f);
*************** XTset_vertical_scroll_bar (w, portion, w
*** 4977,4982 ****
--- 5008,5016 ----
    struct scroll_bar *bar;
    int top, height, left, sb_left, width, sb_width;
    int window_y, window_height;
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   int fringe_extended_p;
+ #endif
  
    /* Get window dimensions.  */
    window_box (w, -1, 0, &window_y, 0, &window_height);
*************** XTset_vertical_scroll_bar (w, portion, w
*** 4997,5011 ****
    /* Compute the left edge of the scroll bar.  */
  #ifdef USE_TOOLKIT_SCROLL_BARS
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
!     sb_left = (left +
! 	       (WINDOW_RIGHTMOST_P (w)
! 		? width - sb_width - (width - sb_width) / 2
! 		: 0));
!   else
!     sb_left = (left +
! 	       (WINDOW_LEFTMOST_P (w)
! 		? (width - sb_width) / 2
! 		: width - sb_width));
  #else
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
      sb_left = left + width - sb_width;
--- 5031,5039 ----
    /* Compute the left edge of the scroll bar.  */
  #ifdef USE_TOOLKIT_SCROLL_BARS
    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);
  #else
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
      sb_left = left + width - sb_width;
*************** XTset_vertical_scroll_bar (w, portion, w
*** 5013,5026 ****
      sb_left = left;
  #endif
  
    /* Does the scroll bar exist yet?  */
    if (NILP (w->vertical_scroll_bar))
      {
        if (width > 0 && height > 0)
  	{
  	  BLOCK_INPUT;
! 	  x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			left, top, width, height, False);
  	  UNBLOCK_INPUT;
  	}
  
--- 5041,5073 ----
      sb_left = left;
  #endif
  
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   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));
+ #endif
+ 
    /* Does the scroll bar exist yet?  */
    if (NILP (w->vertical_scroll_bar))
      {
        if (width > 0 && height > 0)
  	{
  	  BLOCK_INPUT;
! #ifdef USE_TOOLKIT_SCROLL_BARS
! 	  if (fringe_extended_p)
! 	    x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			  sb_left, top, sb_width, height, False);
! 	  else
! #endif
! 	    x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			  left, top, width, height, False);
  	  UNBLOCK_INPUT;
  	}
  
*************** XTset_vertical_scroll_bar (w, portion, w
*** 5047,5059 ****
  #ifdef USE_TOOLKIT_SCROLL_BARS
  
        /* Move/size the scroll bar widget.  */
!       if (mask)
  	{
  	  /* Since toolkit scroll bars are smaller than the space reserved
  	     for them on the frame, we have to clear "under" them.  */
  	  if (width > 0 && height > 0)
! 	    x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
!                           left, top, width, height, False);
  #ifdef USE_GTK
            xg_update_scrollbar_pos (f,
                                     SCROLL_BAR_X_WINDOW (bar),
--- 5094,5112 ----
  #ifdef USE_TOOLKIT_SCROLL_BARS
  
        /* Move/size the scroll bar widget.  */
!       if (mask || !NILP (bar->fringe_extended_p) != fringe_extended_p)
  	{
  	  /* Since toolkit scroll bars are smaller than the space reserved
  	     for them on the frame, we have to clear "under" them.  */
  	  if (width > 0 && height > 0)
! 	    {
! 	      if (fringe_extended_p)
! 		x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			      sb_left, top, sb_width, height, False);
! 	      else
! 		x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			      left, top, width, height, False);
! 	    }
  #ifdef USE_GTK
            xg_update_scrollbar_pos (f,
                                     SCROLL_BAR_X_WINDOW (bar),
*************** XTset_vertical_scroll_bar (w, portion, w
*** 5128,5133 ****
--- 5181,5188 ----
      }
  
  #ifdef USE_TOOLKIT_SCROLL_BARS
+   bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
+ 
    x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
  #else /* not USE_TOOLKIT_SCROLL_BARS */
    /* Set the scroll bar's current state, unless we're currently being
Index: src/xterm.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.h,v
retrieving revision 1.190
diff -c -p -r1.190 xterm.h
*** src/xterm.h	21 Jan 2007 04:18:14 -0000	1.190
--- src/xterm.h	6 Mar 2007 03:03:47 -0000
*************** struct scroll_bar
*** 807,812 ****
--- 807,818 ----
       place where the user grabbed it.  If the handle isn't currently
       being dragged, this is Qnil.  */
    Lisp_Object dragging;
+ 
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   /* 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;
+ #endif
  };
  
  /* The number of elements a vector holding a struct scroll_bar needs.  */

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-08 10:05   ` YAMAMOTO Mitsuharu
@ 2007-06-10 13:19     ` Richard Stallman
  2007-06-14  8:53       ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 21+ messages in thread
From: Richard Stallman @ 2007-06-10 13:19 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

I have seen no comments on this.  Would people please study it?  The
most important questions are, (1) does this fix the problem, and (2)
does it look good?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-10 13:19     ` Richard Stallman
@ 2007-06-14  8:53       ` YAMAMOTO Mitsuharu
  2007-06-15  8:48         ` Richard Stallman
  0 siblings, 1 reply; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-06-14  8:53 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>>>>> On Sun, 10 Jun 2007 09:19:25 -0400, Richard Stallman <rms@gnu.org> said:

> I have seen no comments on this.  Would people please study it?  The
> most important questions are, (1) does this fix the problem, and (2)
> does it look good?

Most developers seem to be uninterested in this superficial issue :-)

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

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-14  8:53       ` YAMAMOTO Mitsuharu
@ 2007-06-15  8:48         ` Richard Stallman
  2007-06-15  9:28           ` YAMAMOTO Mitsuharu
  2007-07-27  8:49           ` YAMAMOTO Mitsuharu
  0 siblings, 2 replies; 21+ messages in thread
From: Richard Stallman @ 2007-06-15  8:48 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

    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?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-15  8:48         ` Richard Stallman
@ 2007-06-15  9:28           ` YAMAMOTO Mitsuharu
  2007-06-20 22:42             ` Juanma Barranquero
  2007-07-27  8:49           ` YAMAMOTO Mitsuharu
  1 sibling, 1 reply; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-06-15  9:28 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>>>>> On Fri, 15 Jun 2007 04:48:26 -0400, Richard Stallman <rms@gnu.org> 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
				mituharu@math.s.chiba-u.ac.jp

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.  */

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-15  9:28           ` YAMAMOTO Mitsuharu
@ 2007-06-20 22:42             ` Juanma Barranquero
  2007-06-21  2:18               ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 21+ messages in thread
From: Juanma Barranquero @ 2007-06-20 22:42 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: rms, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

On 6/15/07, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> wrote:

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

I've had to use "do {...} while (0)" in the definition of
w32_fill_area() in w32term.h in order to compile with your patch.

As for results, see the attached image. I don't think that was the
intended effect...

     Juanma



Index: src/w32term.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.h,v
retrieving revision 1.68
diff -u -2 -r1.68 w32term.h
--- src/w32term.h	22 Feb 2007 22:50:15 -0000	1.68
+++ src/w32term.h	20 Jun 2007 22:33:11 -0000
@@ -577,5 +581,5 @@

 #define w32_fill_area(f,hdc,pix,x,y,nx,ny) \
-{ \
+do { \
     RECT rect; \
     rect.left = x; \
@@ -584,5 +588,6 @@
     rect.bottom = y + ny; \
     w32_fill_rect (f,hdc,pix,&rect); \
-}
+} while (0)
+

 #define w32_clear_rect(f,hdc,lprect) \

[-- Attachment #2: emacs.png --]
[-- Type: image/png, Size: 5229 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-20 22:42             ` Juanma Barranquero
@ 2007-06-21  2:18               ` YAMAMOTO Mitsuharu
  2007-06-21  8:54                 ` Juanma Barranquero
  0 siblings, 1 reply; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-06-21  2:18 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: rms, emacs-devel

>>>>> On Thu, 21 Jun 2007 00:42:27 +0200, "Juanma Barranquero" <lekktu@gmail.com> said:

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

> I've had to use "do {...} while (0)" in the definition of
> w32_fill_area() in w32term.h in order to compile with your patch.

Thanks for testing.

> As for results, see the attached image. I don't think that was the
> intended effect...

Could you try the following one?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

Index: src/w32term.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.c,v
retrieving revision 1.260
diff -c -p -r1.260 w32term.c
*** src/w32term.c	20 Jun 2007 08:32:59 -0000	1.260
--- src/w32term.c	21 Jun 2007 01:33:18 -0000
*************** w32_draw_fringe_bitmap (w, row, p)
*** 682,687 ****
--- 682,719 ----
  
    hdc = get_frame_dc (f);
  
+   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);
+     }
+ 
    /* Must clip because of partially visible lines.  */
    rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
    if (p->y < rowY)
*************** w32_draw_fringe_bitmap (w, row, p)
*** 699,710 ****
    else
      w32_clip_to_row (w, row, -1, hdc);
  
-   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)
      {
        HBITMAP pixmap = fringe_bmp[p->which];
--- 731,736 ----
*************** x_scroll_bar_create (w, top, left, width
*** 3637,3642 ****
--- 3663,3669 ----
    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,
*** 3700,3705 ****
--- 3727,3733 ----
    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,
*** 3719,3727 ****
  
    /* 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))
--- 3747,3766 ----
  
    /* 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,
*** 3731,3737 ****
        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;
--- 3770,3779 ----
        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,
*** 3750,3756 ****
        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))
--- 3792,3799 ----
        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,
*** 3767,3777 ****
  	      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
--- 3810,3819 ----
  	      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,
*** 3801,3806 ****
--- 3843,3850 ----
            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	21 Jun 2007 01:33:18 -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.  */
*************** extern void w32_fill_rect ();
*** 576,589 ****
  extern void w32_clear_window ();
  
  #define w32_fill_area(f,hdc,pix,x,y,nx,ny) \
! { \
      RECT rect; \
      rect.left = x; \
      rect.top = y; \
      rect.right = x + nx; \
      rect.bottom = y + ny; \
      w32_fill_rect (f,hdc,pix,&rect); \
! }
  
  #define w32_clear_rect(f,hdc,lprect) \
  w32_fill_rect (f,hdc,f->output_data.x->background_pixel,lprect)
--- 580,593 ----
  extern void w32_clear_window ();
  
  #define w32_fill_area(f,hdc,pix,x,y,nx,ny) \
! do { \
      RECT rect; \
      rect.left = x; \
      rect.top = y; \
      rect.right = x + nx; \
      rect.bottom = y + ny; \
      w32_fill_rect (f,hdc,pix,&rect); \
! } while (0)
  
  #define w32_clear_rect(f,hdc,lprect) \
  w32_fill_rect (f,hdc,f->output_data.x->background_pixel,lprect)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-21  2:18               ` YAMAMOTO Mitsuharu
@ 2007-06-21  8:54                 ` Juanma Barranquero
  2007-06-21 11:30                   ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 21+ messages in thread
From: Juanma Barranquero @ 2007-06-21  8:54 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: rms, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 173 bytes --]

On 6/21/07, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> wrote:

> Could you try the following one?

That's more like it. See the attached image.

             Juanma

[-- Attachment #2: emacs.png --]
[-- Type: image/png, Size: 8272 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-21  8:54                 ` Juanma Barranquero
@ 2007-06-21 11:30                   ` YAMAMOTO Mitsuharu
  2007-06-21 11:47                     ` Juanma Barranquero
  0 siblings, 1 reply; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-06-21 11:30 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: rms, emacs-devel

>>>>> On Thu, 21 Jun 2007 10:54:08 +0200, "Juanma Barranquero" <lekktu@gmail.com> said:

> On 6/21/07, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
> wrote:
>> Could you try the following one?

> That's more like it. See the attached image.

Yes.  This is the intended one.  I would appreciate it if you could
use and test it for a while.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-21 11:30                   ` YAMAMOTO Mitsuharu
@ 2007-06-21 11:47                     ` Juanma Barranquero
  2007-06-21 22:17                       ` Juanma Barranquero
  0 siblings, 1 reply; 21+ messages in thread
From: Juanma Barranquero @ 2007-06-21 11:47 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: rms, emacs-devel

On 6/21/07, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> wrote:

> Yes.  This is the intended one.  I would appreciate it if you could
> use and test it for a while.

Will do. Though the real way to test it is commit it and see whether
someone shouts. It's only us Windows users after all :)

             Juanma

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-21 11:47                     ` Juanma Barranquero
@ 2007-06-21 22:17                       ` Juanma Barranquero
  2007-06-22  2:14                         ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 21+ messages in thread
From: Juanma Barranquero @ 2007-06-21 22:17 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: rms, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 141 bytes --]

I'm seeing a redisplay bug with your patch.

C-x 2, and then grab the modeline with the cursor and drag it up and down.

             Juanma

[-- Attachment #2: emacs.png --]
[-- Type: image/png, Size: 4409 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-21 22:17                       ` Juanma Barranquero
@ 2007-06-22  2:14                         ` YAMAMOTO Mitsuharu
  2007-06-22  8:19                           ` Juanma Barranquero
  0 siblings, 1 reply; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-06-22  2:14 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: rms, emacs-devel

>>>>> On Fri, 22 Jun 2007 00:17:48 +0200, "Juanma Barranquero" <lekktu@gmail.com> said:

> I'm seeing a redisplay bug with your patch.

> C-x 2, and then grab the modeline with the cursor and drag it up and
> down.

Could you try adding `w32_set_clip_rectangle (hdc, NULL);' just before
the call to w32_fill_area from w32_draw_fringe_bitmap?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-22  2:14                         ` YAMAMOTO Mitsuharu
@ 2007-06-22  8:19                           ` Juanma Barranquero
  2007-06-23  2:05                             ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 21+ messages in thread
From: Juanma Barranquero @ 2007-06-22  8:19 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: rms, emacs-devel

On 6/22/07, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> wrote:

> Could you try adding `w32_set_clip_rectangle (hdc, NULL);' just before
> the call to w32_fill_area from w32_draw_fringe_bitmap?

It doesn't help. The redisplay bug is still present. BTW, it only
happens AFAICS when `indicate-empty-lines' is t and the fringe is
showing the empty lines bitmap.

             Juanma

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-22  8:19                           ` Juanma Barranquero
@ 2007-06-23  2:05                             ` YAMAMOTO Mitsuharu
  2007-06-25  9:45                               ` Juanma Barranquero
  0 siblings, 1 reply; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-06-23  2:05 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: rms, emacs-devel

>>>>> On Fri, 22 Jun 2007 10:19:18 +0200, "Juanma Barranquero" <lekktu@gmail.com> said:

> It doesn't help. The redisplay bug is still present. BTW, it only
> happens AFAICS when `indicate-empty-lines' is t and the fringe is
> showing the empty lines bitmap.

I could reproduce it also on Mac with indicate-empty-lines, left
scroll bar, and half-width fringes.  The fringe background was not
extended when the bitmap fills the fringe.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

Index: src/w32term.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.c,v
retrieving revision 1.260
diff -c -p -r1.260 w32term.c
*** src/w32term.c	20 Jun 2007 08:32:59 -0000	1.260
--- src/w32term.c	22 Jun 2007 23:20:32 -0000
*************** w32_draw_fringe_bitmap (w, row, p)
*** 682,687 ****
--- 682,741 ----
  
    hdc = get_frame_dc (f);
  
+   if (!p->overlay_p)
+     {
+       int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny;
+ 
+       /* 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 (bx < 0)
+ 		{
+ 		  /* Bitmap fills the fringe.  */
+ 		  if (left + width == p->x)
+ 		    bx = left + sb_width;
+ 		  else if (p->x + p->wd == left)
+ 		    bx = left;
+ 		  if (bx >= 0)
+ 		    {
+ 		      int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
+ 
+ 		      nx = width - sb_width;
+ 		      by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
+ 							    row->y));
+ 		      ny = row->visible_height;
+ 		    }
+ 		}
+ 	      else
+ 		{
+ 		  if (left + width == bx)
+ 		    {
+ 		      bx = left + sb_width;
+ 		      nx += width - sb_width;
+ 		    }
+ 		  else if (bx + nx == left)
+ 		    nx += width - sb_width;
+ 		}
+ 	    }
+ 	}
+ 
+       if (bx >= 0 && nx > 0)
+ 	w32_fill_area (f, hdc, face->background, bx, by, nx, ny);
+     }
+ 
    /* Must clip because of partially visible lines.  */
    rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
    if (p->y < rowY)
*************** w32_draw_fringe_bitmap (w, row, p)
*** 699,710 ****
    else
      w32_clip_to_row (w, row, -1, hdc);
  
-   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)
      {
        HBITMAP pixmap = fringe_bmp[p->which];
--- 753,758 ----
*************** x_scroll_bar_create (w, top, left, width
*** 3637,3642 ****
--- 3685,3691 ----
    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,
*** 3700,3705 ****
--- 3749,3755 ----
    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,
*** 3719,3727 ****
  
    /* 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))
--- 3769,3788 ----
  
    /* 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,
*** 3731,3737 ****
        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;
--- 3792,3801 ----
        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,
*** 3750,3756 ****
        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))
--- 3814,3821 ----
        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,
*** 3767,3777 ****
  	      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
--- 3832,3841 ----
  	      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,
*** 3801,3806 ****
--- 3865,3872 ----
            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	22 Jun 2007 23:20:32 -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.  */
*************** extern void w32_fill_rect ();
*** 576,589 ****
  extern void w32_clear_window ();
  
  #define w32_fill_area(f,hdc,pix,x,y,nx,ny) \
! { \
      RECT rect; \
      rect.left = x; \
      rect.top = y; \
      rect.right = x + nx; \
      rect.bottom = y + ny; \
      w32_fill_rect (f,hdc,pix,&rect); \
! }
  
  #define w32_clear_rect(f,hdc,lprect) \
  w32_fill_rect (f,hdc,f->output_data.x->background_pixel,lprect)
--- 580,593 ----
  extern void w32_clear_window ();
  
  #define w32_fill_area(f,hdc,pix,x,y,nx,ny) \
! do { \
      RECT rect; \
      rect.left = x; \
      rect.top = y; \
      rect.right = x + nx; \
      rect.bottom = y + ny; \
      w32_fill_rect (f,hdc,pix,&rect); \
! } while (0)
  
  #define w32_clear_rect(f,hdc,lprect) \
  w32_fill_rect (f,hdc,f->output_data.x->background_pixel,lprect)
Index: src/xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.947
diff -c -p -r1.947 xterm.c
*** src/xterm.c	8 Jun 2007 20:06:31 -0000	1.947
--- src/xterm.c	22 Jun 2007 23:20:32 -0000
*************** x_draw_fringe_bitmap (w, row, p)
*** 720,727 ****
    else
      x_clip_to_row (w, row, -1, gc);
  
!   if (p->bx >= 0 && !p->overlay_p)
      {
        /* In case the same realized face is used for fringes and
  	 for something displayed in the text (e.g. face `region' on
  	 mono-displays, the fill style may have been changed to
--- 720,729 ----
    else
      x_clip_to_row (w, row, -1, gc);
  
!   if (!p->overlay_p)
      {
+       int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny;
+ 
        /* In case the same realized face is used for fringes and
  	 for something displayed in the text (e.g. face `region' on
  	 mono-displays, the fill style may have been changed to
*************** x_draw_fringe_bitmap (w, row, p)
*** 731,738 ****
        else
  	XSetForeground (display, face->gc, face->background);
  
!       XFillRectangle (display, window, face->gc,
! 		      p->bx, p->by, p->nx, p->ny);
  
        if (!face->stipple)
  	XSetForeground (display, face->gc, face->foreground);
--- 733,787 ----
        else
  	XSetForeground (display, face->gc, face->background);
  
! #ifdef USE_TOOLKIT_SCROLL_BARS
!       /* 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 (bx < 0)
! 		{
! 		  /* Bitmap fills the fringe.  */
! 		  if (left + width == p->x)
! 		    bx = left + sb_width;
! 		  else if (p->x + p->wd == left)
! 		    bx = left;
! 		  if (bx >= 0)
! 		    {
! 		      int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
! 
! 		      nx = width - sb_width;
! 		      by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
! 							    row->y));
! 		      ny = row->visible_height;
! 		    }
! 		}
! 	      else
! 		{
! 		  if (left + width == bx)
! 		    {
! 		      bx = left + sb_width;
! 		      nx += width - sb_width;
! 		    }
! 		  else if (bx + nx == left)
! 		    nx += width - sb_width;
! 		}
! 	    }
! 	}
! #endif
!       if (bx >= 0 && nx > 0)
! 	XFillRectangle (display, window, face->gc, bx, by, nx, ny);
  
        if (!face->stipple)
  	XSetForeground (display, face->gc, face->foreground);
*************** x_scroll_bar_create (w, top, left, width
*** 4787,4792 ****
--- 4836,4844 ----
    XSETINT (bar->start, 0);
    XSETINT (bar->end, 0);
    bar->dragging = Qnil;
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   bar->fringe_extended_p = Qnil;
+ #endif
  
    /* Add bar to its frame's list of scroll bars.  */
    bar->next = FRAME_SCROLL_BARS (f);
*************** XTset_vertical_scroll_bar (w, portion, w
*** 4979,4984 ****
--- 5031,5039 ----
    struct scroll_bar *bar;
    int top, height, left, sb_left, width, sb_width;
    int window_y, window_height;
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   int fringe_extended_p;
+ #endif
  
    /* Get window dimensions.  */
    window_box (w, -1, 0, &window_y, 0, &window_height);
*************** XTset_vertical_scroll_bar (w, portion, w
*** 4999,5013 ****
    /* Compute the left edge of the scroll bar.  */
  #ifdef USE_TOOLKIT_SCROLL_BARS
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
!     sb_left = (left +
! 	       (WINDOW_RIGHTMOST_P (w)
! 		? width - sb_width - (width - sb_width) / 2
! 		: 0));
!   else
!     sb_left = (left +
! 	       (WINDOW_LEFTMOST_P (w)
! 		? (width - sb_width) / 2
! 		: width - sb_width));
  #else
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
      sb_left = left + width - sb_width;
--- 5054,5062 ----
    /* Compute the left edge of the scroll bar.  */
  #ifdef USE_TOOLKIT_SCROLL_BARS
    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);
  #else
    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
      sb_left = left + width - sb_width;
*************** XTset_vertical_scroll_bar (w, portion, w
*** 5015,5028 ****
      sb_left = left;
  #endif
  
    /* Does the scroll bar exist yet?  */
    if (NILP (w->vertical_scroll_bar))
      {
        if (width > 0 && height > 0)
  	{
  	  BLOCK_INPUT;
! 	  x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			left, top, width, height, False);
  	  UNBLOCK_INPUT;
  	}
  
--- 5064,5096 ----
      sb_left = left;
  #endif
  
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   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));
+ #endif
+ 
    /* Does the scroll bar exist yet?  */
    if (NILP (w->vertical_scroll_bar))
      {
        if (width > 0 && height > 0)
  	{
  	  BLOCK_INPUT;
! #ifdef USE_TOOLKIT_SCROLL_BARS
! 	  if (fringe_extended_p)
! 	    x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			  sb_left, top, sb_width, height, False);
! 	  else
! #endif
! 	    x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			  left, top, width, height, False);
  	  UNBLOCK_INPUT;
  	}
  
*************** XTset_vertical_scroll_bar (w, portion, w
*** 5049,5061 ****
  #ifdef USE_TOOLKIT_SCROLL_BARS
  
        /* Move/size the scroll bar widget.  */
!       if (mask)
  	{
  	  /* Since toolkit scroll bars are smaller than the space reserved
  	     for them on the frame, we have to clear "under" them.  */
  	  if (width > 0 && height > 0)
! 	    x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
!                           left, top, width, height, False);
  #ifdef USE_GTK
            xg_update_scrollbar_pos (f,
                                     SCROLL_BAR_X_WINDOW (bar),
--- 5117,5135 ----
  #ifdef USE_TOOLKIT_SCROLL_BARS
  
        /* Move/size the scroll bar widget.  */
!       if (mask || !NILP (bar->fringe_extended_p) != fringe_extended_p)
  	{
  	  /* Since toolkit scroll bars are smaller than the space reserved
  	     for them on the frame, we have to clear "under" them.  */
  	  if (width > 0 && height > 0)
! 	    {
! 	      if (fringe_extended_p)
! 		x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			      sb_left, top, sb_width, height, False);
! 	      else
! 		x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! 			      left, top, width, height, False);
! 	    }
  #ifdef USE_GTK
            xg_update_scrollbar_pos (f,
                                     SCROLL_BAR_X_WINDOW (bar),
*************** XTset_vertical_scroll_bar (w, portion, w
*** 5130,5135 ****
--- 5204,5211 ----
      }
  
  #ifdef USE_TOOLKIT_SCROLL_BARS
+   bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
+ 
    x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
  #else /* not USE_TOOLKIT_SCROLL_BARS */
    /* Set the scroll bar's current state, unless we're currently being
Index: src/xterm.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.h,v
retrieving revision 1.190
diff -c -p -r1.190 xterm.h
*** src/xterm.h	21 Jan 2007 04:18:14 -0000	1.190
--- src/xterm.h	22 Jun 2007 23:20:33 -0000
*************** struct scroll_bar
*** 807,812 ****
--- 807,818 ----
       place where the user grabbed it.  If the handle isn't currently
       being dragged, this is Qnil.  */
    Lisp_Object dragging;
+ 
+ #ifdef USE_TOOLKIT_SCROLL_BARS
+   /* 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;
+ #endif
  };
  
  /* The number of elements a vector holding a struct scroll_bar needs.  */

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-23  2:05                             ` YAMAMOTO Mitsuharu
@ 2007-06-25  9:45                               ` Juanma Barranquero
  0 siblings, 0 replies; 21+ messages in thread
From: Juanma Barranquero @ 2007-06-25  9:45 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: rms, emacs-devel

On 6/23/07, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> wrote:

> I could reproduce it also on Mac with indicate-empty-lines, left
> scroll bar, and half-width fringes.  The fringe background was not
> extended when the bitmap fills the fringe.

Your patch seems to be working fine. I think at this point the best
thing to do is commit it to the trunk so it gets wider testing.

             Juanma

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Extending fringe backgrounds to scroll bar gaps
  2007-06-15  8:48         ` Richard Stallman
  2007-06-15  9:28           ` YAMAMOTO Mitsuharu
@ 2007-07-27  8:49           ` YAMAMOTO Mitsuharu
  1 sibling, 0 replies; 21+ messages in thread
From: YAMAMOTO Mitsuharu @ 2007-07-27  8:49 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>>>>> On Fri, 15 Jun 2007 04:48:26 -0400, Richard Stallman <rms@gnu.org> 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?

Done.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2007-07-27  8:49 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06  3:17 Extending fringe backgrounds to scroll bar gaps YAMAMOTO Mitsuharu
2007-03-06  6:39 ` Jan Djärv
2007-03-06  7:02   ` YAMAMOTO Mitsuharu
2007-03-06  8:10     ` Jan Djärv
2007-03-06 22:36 ` Richard Stallman
2007-06-08 10:05   ` YAMAMOTO Mitsuharu
2007-06-10 13:19     ` Richard Stallman
2007-06-14  8:53       ` YAMAMOTO Mitsuharu
2007-06-15  8:48         ` Richard Stallman
2007-06-15  9:28           ` YAMAMOTO Mitsuharu
2007-06-20 22:42             ` Juanma Barranquero
2007-06-21  2:18               ` YAMAMOTO Mitsuharu
2007-06-21  8:54                 ` Juanma Barranquero
2007-06-21 11:30                   ` YAMAMOTO Mitsuharu
2007-06-21 11:47                     ` Juanma Barranquero
2007-06-21 22:17                       ` Juanma Barranquero
2007-06-22  2:14                         ` YAMAMOTO Mitsuharu
2007-06-22  8:19                           ` Juanma Barranquero
2007-06-23  2:05                             ` YAMAMOTO Mitsuharu
2007-06-25  9:45                               ` Juanma Barranquero
2007-07-27  8:49           ` YAMAMOTO Mitsuharu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).