summaryrefslogtreecommitdiff
path: root/src/frame.h
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2010-01-09 13:16:32 +0900
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2010-01-09 13:16:32 +0900
commit4b00d3b1594378e77b3b485d1ed272be5bdab644 (patch)
treeec9fd6e300bf9619c3327345780ba85f1f839f15 /src/frame.h
parent69e2f18578cd9b5089a68787a1a6e80ca21e6256 (diff)
downloademacs-4b00d3b1594378e77b3b485d1ed272be5bdab644.tar.gz
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/frame.h')
-rw-r--r--src/frame.h15
1 files changed, 13 insertions, 2 deletions
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;
#define FRAME_TOP_MARGIN(F) \
(FRAME_MENU_BAR_LINES (F) + FRAME_TOOL_BAR_LINES (F))
+/* Pixel height of the top margin above. */
+
+#define FRAME_TOP_MARGIN_HEIGHT(f) \
+ (FRAME_TOP_MARGIN (f) * FRAME_LINE_HEIGHT (f))
+
/* Nonzero if this frame should display a menu bar
in a way that does not use any text lines. */
#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
@@ -975,7 +980,7 @@ extern Lisp_Object selected_frame;
at ROW/COL. */
#define FRAME_LINE_TO_PIXEL_Y(f, row) \
- (FRAME_INTERNAL_BORDER_WIDTH (f) \
+ ((row < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \
+ (row) * FRAME_LINE_HEIGHT (f))
#define FRAME_COL_TO_PIXEL_X(f, col) \
@@ -1000,7 +1005,13 @@ extern Lisp_Object selected_frame;
the pixel on FRAME at Y/X. */
#define FRAME_PIXEL_Y_TO_LINE(f, y) \
- (((y) - FRAME_INTERNAL_BORDER_WIDTH (f)) \
+ (((y) < FRAME_TOP_MARGIN_HEIGHT (f) \
+ ? (y) \
+ : ((y) < FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
+ ? (y) - (FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
+ /* Arrange for the division to round down. */ \
+ + FRAME_LINE_HEIGHT (f) - 1) \
+ : (y) - FRAME_INTERNAL_BORDER_WIDTH (f))) \
/ FRAME_LINE_HEIGHT (f))
#define FRAME_PIXEL_X_TO_COL(f, x) \