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: Extending fringe backgrounds to scroll bar gaps Date: Thu, 21 Jun 2007 11:18:39 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: 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: sea.gmane.org 1182392334 25986 80.91.229.12 (21 Jun 2007 02:18:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 21 Jun 2007 02:18:54 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org To: "Juanma Barranquero" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 21 04:18:52 2007 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.50) id 1I1CG4-0008MW-Ft for ged-emacs-devel@m.gmane.org; Thu, 21 Jun 2007 04:18:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I1CG3-0006TD-MN for ged-emacs-devel@m.gmane.org; Wed, 20 Jun 2007 22:18:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I1CFz-0006T8-Qj for emacs-devel@gnu.org; Wed, 20 Jun 2007 22:18:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I1CFy-0006Sw-8s for emacs-devel@gnu.org; Wed, 20 Jun 2007 22:18:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I1CFy-0006St-6H for emacs-devel@gnu.org; Wed, 20 Jun 2007 22:18:46 -0400 Original-Received: from ntp.math.s.chiba-u.ac.jp ([133.82.132.2] helo=mathmail.math.s.chiba-u.ac.jp) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I1CFv-0002Q4-Ov; Wed, 20 Jun 2007 22:18:44 -0400 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 4DFFA2C43; Thu, 21 Jun 2007 11:18:39 +0900 (JST) In-Reply-To: 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.1.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-detected-kernel: 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:73490 Archived-At: >>>>> On Thu, 21 Jun 2007 00:42:27 +0200, "Juanma Barranquero" 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)