all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: David De La Harpe Golden <david@harpegolden.net>
Cc: "Stephen J. Turnbull" <stephen@xemacs.org>,
	Chong Yidong <cyd@stupidchicken.com>,
	Filipe Cabecinhas <filcab@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: Native scrollbars? [was: visible-bell patch for Mac OS X]
Date: Sat, 13 Feb 2010 16:32:48 +0900	[thread overview]
Message-ID: <wlfx55bnfj.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <4B764A8D.6020802@harpegolden.net>

>>>>> On Sat, 13 Feb 2010 06:45:33 +0000, David De La Harpe Golden <david@harpegolden.net> said:

> It's quite a minor and transient effect (on my system anyway).
> Still, I guess the flash inversion area in xterm.c/XTflash() is
> winding up a bit off somehow - the intent of the code does seem to
> be that scrollbars should be excluded from the area, but maybe it's
> only working for some cases.

The current code just trims off the margins outside leftmost left (or
rightmost right) scroll bars.

Just adding more excluded area at the edge positions gives
inconsistent result as found in multiple patches proposed for the NS
port, because scroll bars might overlap with the flashed area at some
non-edge positions.  I think a consistent way is to avoid inversion
(or re-invert to recover the original image) for the overlapped area:

  http://lists.gnu.org/archive/html/emacs-devel/2010-02/msg00038.html

The above mail includes a patch for the Mac port using re-inversion,
and it can be ported to GTK+ as below.  Though I've never observed
flicker by re-inversion of overlapped area, that might happen in
principle (this is not an issue for the Mac port because of
double-buffering).  Maybe create a Pixmap for the inverted area first?

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

=== modified file 'src/xterm.c'
*** src/xterm.c	2010-01-19 04:32:47 +0000
--- src/xterm.c	2010-02-03 08:47:20 +0000
***************
*** 3037,3045 ****
        int flash_height = FRAME_LINE_HEIGHT (f);
        /* 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.  */
--- 3037,3047 ----
        int flash_height = FRAME_LINE_HEIGHT (f);
        /* These will be the left and right margins of the rectangles.  */
        int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
!       int flash_right = (FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, FRAME_COLS (f))
! 			 - FRAME_INTERNAL_BORDER_WIDTH (f));
        int width;
+       XRectangle rects[2];
+       int i, nrects;
  
        /* Don't flash the area between a scroll bar and the frame
  	 edge it is next to.  */
***************
*** 3059,3083 ****
  
        width = flash_right - flash_left;
  
-       /* If window is tall, flash top and bottom line.  */
        if (height > 3 * FRAME_LINE_HEIGHT (f))
  	{
! 	  XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 			  flash_left,
! 			  (FRAME_INTERNAL_BORDER_WIDTH (f)
! 			   + FRAME_TOP_MARGIN_HEIGHT (f)),
! 			  width, flash_height);
! 	  XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 			  flash_left,
! 			  (height - flash_height
! 			   - FRAME_INTERNAL_BORDER_WIDTH (f)),
! 			  width, flash_height);
  	}
        else
! 	/* If it is short, flash it all.  */
  	XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 			flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
! 			width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
  
        x_flush (f);
  
--- 3061,3113 ----
  
        width = flash_right - flash_left;
  
        if (height > 3 * FRAME_LINE_HEIGHT (f))
  	{
! 	  /* If window is tall, flash top and bottom line.  */
! 	  STORE_NATIVE_RECT (rects[0],
! 			     flash_left, (FRAME_INTERNAL_BORDER_WIDTH (f)
! 					  + FRAME_TOP_MARGIN_HEIGHT (f)),
! 			     width, flash_height);
! 	  rects[1] = rects[0];
! 	  rects[1].y = height - flash_height - FRAME_INTERNAL_BORDER_WIDTH (f);
! 	  nrects = 2;
  	}
        else
! 	{
! 	  /* If it is short, flash it all.  */
! 	  STORE_NATIVE_RECT (rects[0],
! 			     flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
! 			     width,
! 			     height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
! 	  nrects = 1;
! 	}
! 
!       for (i = 0; i < nrects; i++)
  	XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 			rects[i].x, rects[i].y,
! 			rects[i].width, rects[i].height);
! #ifdef USE_GTK
!       /* In case scroll bars don't have their own windows, we cancel
! 	 color flipping for scroll bar area.  */
!       if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
! 	{
! 	  Lisp_Object bar;
! 
! 	  for (bar = FRAME_SCROLL_BARS (f); !NILP (bar);
! 	       bar = XSCROLL_BAR (bar)->next)
! 	    {
! 	      struct scroll_bar *b = XSCROLL_BAR (bar);
! 	      XRectangle bar_rect, r;
! 
! 	      STORE_NATIVE_RECT (bar_rect, b->left, b->top,
! 				 b->width, b->height);
! 	      for (i = 0; i < nrects; i++)
! 		if (x_intersect_rectangles (rects + i, &bar_rect, &r))
! 		  XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 				  r.x, r.y, r.width, r.height);
! 	    }
! 	}
! #endif	/* USE_GTK */
  
        x_flush (f);
  
***************
*** 3113,3137 ****
  	  }
        }
  
!       /* If window is tall, flash top and bottom line.  */
!       if (height > 3 * FRAME_LINE_HEIGHT (f))
  	{
! 	  XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 			  flash_left,
! 			  (FRAME_INTERNAL_BORDER_WIDTH (f)
! 			   + FRAME_TOP_MARGIN_HEIGHT (f)),
! 			  width, flash_height);
! 	  XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 			  flash_left,
! 			  (height - flash_height
! 			   - FRAME_INTERNAL_BORDER_WIDTH (f)),
! 			  width, flash_height);
  	}
!       else
! 	/* If it is short, flash it all.  */
! 	XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 			flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
! 			width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
  
        XFreeGC (FRAME_X_DISPLAY (f), gc);
        x_flush (f);
--- 3143,3172 ----
  	  }
        }
  
!       for (i = 0; i < nrects; i++)
! 	XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 			rects[i].x, rects[i].y,
! 			rects[i].width, rects[i].height);
! #ifdef USE_GTK
!       if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
  	{
! 	  Lisp_Object bar;
! 
! 	  for (bar = FRAME_SCROLL_BARS (f); !NILP (bar);
! 	       bar = XSCROLL_BAR (bar)->next)
! 	    {
! 	      struct scroll_bar *b = XSCROLL_BAR (bar);
! 	      XRectangle bar_rect, r;
! 
! 	      STORE_NATIVE_RECT (bar_rect, b->left, b->top,
! 				 b->width, b->height);
! 	      for (i = 0; i < nrects; i++)
! 		if (x_intersect_rectangles (rects + i, &bar_rect, &r))
! 		  XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
! 				  r.x, r.y, r.width, r.height);
! 	    }
  	}
! #endif	/* USE_GTK */
  
        XFreeGC (FRAME_X_DISPLAY (f), gc);
        x_flush (f);









  reply	other threads:[~2010-02-13  7:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-30 13:34 visible-bell patch for Mac OS X Filipe Cabecinhas
2010-01-31  3:34 ` Chong Yidong
2010-02-01  0:41   ` YAMAMOTO Mitsuharu
2010-02-01 15:56     ` Chong Yidong
2010-02-01 23:33       ` YAMAMOTO Mitsuharu
2010-02-02  1:40         ` YAMAMOTO Mitsuharu
2010-02-02  1:45           ` YAMAMOTO Mitsuharu
2010-02-02  8:47           ` Leo
2010-02-13  1:30         ` YAMAMOTO Mitsuharu
2010-02-13  1:51           ` David De La Harpe Golden
2010-02-13  3:54             ` Native scrollbars? [was: visible-bell patch for Mac OS X] Stephen J. Turnbull
2010-02-13  5:45               ` David De La Harpe Golden
2010-02-13  6:45                 ` David De La Harpe Golden
2010-02-13  7:32                   ` YAMAMOTO Mitsuharu [this message]
2010-02-13 13:32                   ` Jan Djärv
2010-02-13  9:00               ` Native scrollbars? David Kastrup
2010-02-13 10:02                 ` Eli Zaretskii
2010-02-13 12:23                 ` Jan Djärv
2010-02-13 12:46                   ` David Kastrup
2010-02-13 13:40                     ` Jan Djärv
2010-02-13 14:26                       ` David Kastrup
2010-02-13 13:50                     ` Stephen J. Turnbull
2010-02-13  6:45             ` visible-bell patch for Mac OS X YAMAMOTO Mitsuharu
2010-02-13  7:01               ` David De La Harpe Golden
2010-02-13  7:54               ` Jan Djärv

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

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

  git send-email \
    --in-reply-to=wlfx55bnfj.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=cyd@stupidchicken.com \
    --cc=david@harpegolden.net \
    --cc=emacs-devel@gnu.org \
    --cc=filcab@gmail.com \
    --cc=stephen@xemacs.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.