aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2010-01-09 13:16:32 +0900
committerYAMAMOTO Mitsuharu2010-01-09 13:16:32 +0900
commit4b00d3b1594378e77b3b485d1ed272be5bdab644 (patch)
treeec9fd6e300bf9619c3327345780ba85f1f839f15 /src
parent69e2f18578cd9b5089a68787a1a6e80ca21e6256 (diff)
downloademacs-4b00d3b1594378e77b3b485d1ed272be5bdab644.tar.gz
emacs-4b00d3b1594378e77b3b485d1ed272be5bdab644.zip
Make line<->pixel_y conversion macros aware of native menu/tool bars.
They are placed above the internal border. This supersedes special treatment of native tool bars in the display code. This fixes wrong display position of native menu bars and bogus mouse highlighting of native tool bars, both of which can be found when internal border width is large. Also it fixes wrong flashed part on visible bell with native menu bars. * frame.h (FRAME_TOP_MARGIN_HEIGHT): New macro. (FRAME_LINE_TO_PIXEL_Y, FRAME_PIXEL_Y_TO_LINE): Take account of pseudo windows above internal border. * window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P): New macros. (WINDOW_TOP_EDGE_Y, WINDOW_BOTTOM_EDGE_Y): Take account of pseudo windows above internal border. * xdisp.c (get_glyph_string_clip_rects, init_glyph_string): Don't treat tool bar windows specially. * xfns.c (x_set_tool_bar_lines): Take account of menu bar height. * xterm.c (x_after_update_window_line): Don't treat tool bar windows specially. (XTflash): Take account of menu bar height. * w32term.c (x_after_update_window_line): Don't treat tool bar windows specially.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog22
-rw-r--r--src/frame.h15
-rw-r--r--src/w32term.c5
-rw-r--r--src/window.h18
-rw-r--r--src/xdisp.c12
-rw-r--r--src/xfns.c2
-rw-r--r--src/xterm.c9
7 files changed, 54 insertions, 29 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 80da326c1a9..309c663d1ef 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,25 @@
12010-01-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * frame.h (FRAME_TOP_MARGIN_HEIGHT): New macro.
4 (FRAME_LINE_TO_PIXEL_Y, FRAME_PIXEL_Y_TO_LINE): Take account of pseudo
5 windows above internal border.
6
7 * window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P): New macros.
8 (WINDOW_TOP_EDGE_Y, WINDOW_BOTTOM_EDGE_Y): Take account of pseudo
9 windows above internal border.
10
11 * xdisp.c (get_glyph_string_clip_rects, init_glyph_string): Don't treat
12 tool bar windows specially.
13
14 * xfns.c (x_set_tool_bar_lines): Take account of menu bar height.
15
16 * xterm.c (x_after_update_window_line): Don't treat tool bar windows
17 specially.
18 (XTflash): Take account of menu bar height.
19
20 * w32term.c (x_after_update_window_line): Don't treat tool bar windows
21 specially.
22
12010-01-08 Jan Djärv <jan.h.d@swipnet.se> 232010-01-08 Jan Djärv <jan.h.d@swipnet.se>
2 24
3 * dispnew.c (change_frame_size_1): newwidth == FRAME_COLS (f) must 25 * dispnew.c (change_frame_size_1): newwidth == FRAME_COLS (f) must
diff --git a/src/frame.h b/src/frame.h
index 8ed73c6c7d6..0386d7b4c84 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -590,6 +590,11 @@ typedef struct frame *FRAME_PTR;
590#define FRAME_TOP_MARGIN(F) \ 590#define FRAME_TOP_MARGIN(F) \
591 (FRAME_MENU_BAR_LINES (F) + FRAME_TOOL_BAR_LINES (F)) 591 (FRAME_MENU_BAR_LINES (F) + FRAME_TOOL_BAR_LINES (F))
592 592
593/* Pixel height of the top margin above. */
594
595#define FRAME_TOP_MARGIN_HEIGHT(f) \
596 (FRAME_TOP_MARGIN (f) * FRAME_LINE_HEIGHT (f))
597
593/* Nonzero if this frame should display a menu bar 598/* Nonzero if this frame should display a menu bar
594 in a way that does not use any text lines. */ 599 in a way that does not use any text lines. */
595#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ 600#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
@@ -975,7 +980,7 @@ extern Lisp_Object selected_frame;
975 at ROW/COL. */ 980 at ROW/COL. */
976 981
977#define FRAME_LINE_TO_PIXEL_Y(f, row) \ 982#define FRAME_LINE_TO_PIXEL_Y(f, row) \
978 (FRAME_INTERNAL_BORDER_WIDTH (f) \ 983 ((row < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \
979 + (row) * FRAME_LINE_HEIGHT (f)) 984 + (row) * FRAME_LINE_HEIGHT (f))
980 985
981#define FRAME_COL_TO_PIXEL_X(f, col) \ 986#define FRAME_COL_TO_PIXEL_X(f, col) \
@@ -1000,7 +1005,13 @@ extern Lisp_Object selected_frame;
1000 the pixel on FRAME at Y/X. */ 1005 the pixel on FRAME at Y/X. */
1001 1006
1002#define FRAME_PIXEL_Y_TO_LINE(f, y) \ 1007#define FRAME_PIXEL_Y_TO_LINE(f, y) \
1003 (((y) - FRAME_INTERNAL_BORDER_WIDTH (f)) \ 1008 (((y) < FRAME_TOP_MARGIN_HEIGHT (f) \
1009 ? (y) \
1010 : ((y) < FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
1011 ? (y) - (FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
1012 /* Arrange for the division to round down. */ \
1013 + FRAME_LINE_HEIGHT (f) - 1) \
1014 : (y) - FRAME_INTERNAL_BORDER_WIDTH (f))) \
1004 / FRAME_LINE_HEIGHT (f)) 1015 / FRAME_LINE_HEIGHT (f))
1005 1016
1006#define FRAME_PIXEL_X_TO_COL(f, x) \ 1017#define FRAME_PIXEL_X_TO_COL(f, x) \
diff --git a/src/w32term.c b/src/w32term.c
index 008042c810a..029e41e4bd9 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -734,11 +734,6 @@ x_after_update_window_line (desired_row)
734 { 734 {
735 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 735 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
736 736
737 /* Internal border is drawn below the tool bar. */
738 if (WINDOWP (f->tool_bar_window)
739 && w == XWINDOW (f->tool_bar_window))
740 y -= width;
741
742 BLOCK_INPUT; 737 BLOCK_INPUT;
743 { 738 {
744 HDC hdc = get_frame_dc (f); 739 HDC hdc = get_frame_dc (f);
diff --git a/src/window.h b/src/window.h
index 8b7d945fd13..bb6a0ff9123 100644
--- a/src/window.h
+++ b/src/window.h
@@ -400,18 +400,32 @@ struct window
400 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \ 400 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
401 + WINDOW_RIGHT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W)) 401 + WINDOW_RIGHT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
402 402
403/* 1 if W is a menu bar window. */
404
405#define WINDOW_MENU_BAR_P(W) \
406 (WINDOWP (WINDOW_XFRAME (W)->menu_bar_window) \
407 && (W) == XWINDOW (WINDOW_XFRAME (W)->menu_bar_window))
408
409/* 1 if W is a tool bar window. */
410
411#define WINDOW_TOOL_BAR_P(W) \
412 (WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \
413 && (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window))
414
403/* Return the frame y-position at which window W starts. 415/* Return the frame y-position at which window W starts.
404 This includes a header line, if any. */ 416 This includes a header line, if any. */
405 417
406#define WINDOW_TOP_EDGE_Y(W) \ 418#define WINDOW_TOP_EDGE_Y(W) \
407 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \ 419 (((WINDOW_MENU_BAR_P (W) || WINDOW_TOOL_BAR_P (W)) \
420 ? 0 : FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W))) \
408 + WINDOW_TOP_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W)) 421 + WINDOW_TOP_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W))
409 422
410/* Return the frame y-position before which window W ends. 423/* Return the frame y-position before which window W ends.
411 This includes a mode line, if any. */ 424 This includes a mode line, if any. */
412 425
413#define WINDOW_BOTTOM_EDGE_Y(W) \ 426#define WINDOW_BOTTOM_EDGE_Y(W) \
414 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \ 427 (((WINDOW_MENU_BAR_P (W) || WINDOW_TOOL_BAR_P (W)) \
428 ? 0 : FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W))) \
415 + WINDOW_BOTTOM_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W)) 429 + WINDOW_BOTTOM_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W))
416 430
417 431
diff --git a/src/xdisp.c b/src/xdisp.c
index 435f5dc5334..8d023fc5ae3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1981,12 +1981,6 @@ get_glyph_string_clip_rects (s, rects, n)
1981 r.y = WINDOW_HEADER_LINE_HEIGHT (s->w); 1981 r.y = WINDOW_HEADER_LINE_HEIGHT (s->w);
1982 else 1982 else
1983 r.y = max (0, s->row->y); 1983 r.y = max (0, s->row->y);
1984
1985 /* If drawing a tool-bar window, draw it over the internal border
1986 at the top of the window. */
1987 if (WINDOWP (s->f->tool_bar_window)
1988 && s->w == XWINDOW (s->f->tool_bar_window))
1989 r.y -= FRAME_INTERNAL_BORDER_WIDTH (s->f);
1990 } 1984 }
1991 1985
1992 r.y = WINDOW_TO_FRAME_PIXEL_Y (s->w, r.y); 1986 r.y = WINDOW_TO_FRAME_PIXEL_Y (s->w, r.y);
@@ -19424,12 +19418,6 @@ init_glyph_string (s, OPTIONAL_HDC (hdc) char2b, w, row, area, start, hl)
19424 s->first_glyph = row->glyphs[area] + start; 19418 s->first_glyph = row->glyphs[area] + start;
19425 s->height = row->height; 19419 s->height = row->height;
19426 s->y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 19420 s->y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
19427
19428 /* Display the internal border below the tool-bar window. */
19429 if (WINDOWP (s->f->tool_bar_window)
19430 && s->w == XWINDOW (s->f->tool_bar_window))
19431 s->y -= FRAME_INTERNAL_BORDER_WIDTH (s->f);
19432
19433 s->ybase = s->y + row->ascent; 19421 s->ybase = s->y + row->ascent;
19434} 19422}
19435 19423
diff --git a/src/xfns.c b/src/xfns.c
index b886a3ff674..572cf38e0c7 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1403,7 +1403,7 @@ x_set_tool_bar_lines (f, value, oldval)
1403 { 1403 {
1404 int height = FRAME_INTERNAL_BORDER_WIDTH (f); 1404 int height = FRAME_INTERNAL_BORDER_WIDTH (f);
1405 int width = FRAME_PIXEL_WIDTH (f); 1405 int width = FRAME_PIXEL_WIDTH (f);
1406 int y = nlines * FRAME_LINE_HEIGHT (f); 1406 int y = (FRAME_MENU_BAR_LINES (f) + nlines) * FRAME_LINE_HEIGHT (f);
1407 1407
1408 /* height can be zero here. */ 1408 /* height can be zero here. */
1409 if (height > 0 && width > 0) 1409 if (height > 0 && width > 0)
diff --git a/src/xterm.c b/src/xterm.c
index efd30f4a601..2093b68c110 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -753,11 +753,6 @@ x_after_update_window_line (desired_row)
753 { 753 {
754 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 754 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
755 755
756 /* Internal border is drawn below the tool bar. */
757 if (WINDOWP (f->tool_bar_window)
758 && w == XWINDOW (f->tool_bar_window))
759 y -= width;
760
761 BLOCK_INPUT; 756 BLOCK_INPUT;
762 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 757 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
763 0, y, width, height, False); 758 0, y, width, height, False);
@@ -3062,7 +3057,7 @@ XTflash (f)
3062 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 3057 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
3063 flash_left, 3058 flash_left,
3064 (FRAME_INTERNAL_BORDER_WIDTH (f) 3059 (FRAME_INTERNAL_BORDER_WIDTH (f)
3065 + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)), 3060 + FRAME_TOP_MARGIN_HEIGHT (f)),
3066 width, flash_height); 3061 width, flash_height);
3067 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 3062 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
3068 flash_left, 3063 flash_left,
@@ -3116,7 +3111,7 @@ XTflash (f)
3116 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 3111 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
3117 flash_left, 3112 flash_left,
3118 (FRAME_INTERNAL_BORDER_WIDTH (f) 3113 (FRAME_INTERNAL_BORDER_WIDTH (f)
3119 + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)), 3114 + FRAME_TOP_MARGIN_HEIGHT (f)),
3120 width, flash_height); 3115 width, flash_height);
3121 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 3116 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
3122 flash_left, 3117 flash_left,