From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: "Juanma Barranquero" <lekktu@gmail.com>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Extending fringe backgrounds to scroll bar gaps
Date: Thu, 21 Jun 2007 11:18:39 +0900 [thread overview]
Message-ID: <wlwsxym4n4.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <f7ccd24b0706201542n2d99f06v479a5e8074d4605a@mail.gmail.com>
>>>>> 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)
next prev parent reply other threads:[~2007-06-21 2:18 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wlwsxym4n4.wl%mituharu@math.s.chiba-u.ac.jp \
--to=mituharu@math.s.chiba-u.ac.jp \
--cc=emacs-devel@gnu.org \
--cc=lekktu@gmail.com \
--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 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.