unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: Extending fringe backgrounds to scroll bar gaps
Date: Fri, 08 Jun 2007 19:05:44 +0900	[thread overview]
Message-ID: <wlir9y3gnb.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <E1HOiGt-0000ta-Nm@fencepost.gnu.org>

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

  reply	other threads:[~2007-06-08 10:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wlir9y3gnb.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).