From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: Native scrollbars? [was: visible-bell patch for Mac OS X] Date: Sat, 13 Feb 2010 16:32:48 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <87ljffx7zr.fsf@stupidchicken.com> <87bpg90x1s.fsf@stupidchicken.com> <4B7605BF.10404@harpegolden.net> <873a15x02e.fsf@uwakimon.sk.tsukuba.ac.jp> <4B763C71.7060807@harpegolden.net> <4B764A8D.6020802@harpegolden.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1266046391 9303 80.91.229.12 (13 Feb 2010 07:33:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Feb 2010 07:33:11 +0000 (UTC) Cc: "Stephen J. Turnbull" , Chong Yidong , Filipe Cabecinhas , emacs-devel@gnu.org To: David De La Harpe Golden Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 13 08:33:04 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NgCUx-0006wQ-HH for ged-emacs-devel@m.gmane.org; Sat, 13 Feb 2010 08:33:03 +0100 Original-Received: from localhost ([127.0.0.1]:55778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NgCUw-0004vz-IS for ged-emacs-devel@m.gmane.org; Sat, 13 Feb 2010 02:33:02 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NgCUo-0004sn-HD for emacs-devel@gnu.org; Sat, 13 Feb 2010 02:32:54 -0500 Original-Received: from [140.186.70.92] (port=48849 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NgCUm-0004rQ-7q for emacs-devel@gnu.org; Sat, 13 Feb 2010 02:32:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NgCUk-0001jy-RT for emacs-devel@gnu.org; Sat, 13 Feb 2010 02:32:52 -0500 Original-Received: from ntp.math.s.chiba-u.ac.jp ([133.82.132.2]:63999 helo=mathmail.math.s.chiba-u.ac.jp) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NgCUk-0001jq-5D for emacs-devel@gnu.org; Sat, 13 Feb 2010 02:32:50 -0500 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 540BEC0557; Sat, 13 Feb 2010 16:32:48 +0900 (JST) In-Reply-To: <4B764A8D.6020802@harpegolden.net> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-detected-operating-system: by eggs.gnu.org: NetBSD 3.0 (DF) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:121093 Archived-At: >>>>> On Sat, 13 Feb 2010 06:45:33 +0000, David De La Harpe Golden 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);