emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99277: Make line<->pixel_y conversio


From: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99277: Make line<->pixel_y conversion macros aware of native menu/tool bars.
Date: Sat, 09 Jan 2010 13:16:32 +0900
User-agent: Bazaar (2.0.2)

------------------------------------------------------------
revno: 99277
committer: YAMAMOTO Mitsuharu <address@hidden>
branch nick: trunk
timestamp: Sat 2010-01-09 13:16:32 +0900
message:
  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.
modified:
  src/ChangeLog
  src/frame.h
  src/w32term.c
  src/window.h
  src/xdisp.c
  src/xfns.c
  src/xterm.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-01-08 21:42:14 +0000
+++ b/src/ChangeLog     2010-01-09 04:16:32 +0000
@@ -1,3 +1,25 @@
+2010-01-09  YAMAMOTO Mitsuharu  <address@hidden>
+
+       * 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.
+
 2010-01-08  Jan Djärv  <address@hidden>
 
        * dispnew.c (change_frame_size_1): newwidth == FRAME_COLS  (f) must

=== modified file 'src/frame.h'
--- a/src/frame.h       2010-01-04 05:35:18 +0000
+++ b/src/frame.h       2010-01-09 04:16:32 +0000
@@ -590,6 +590,11 @@
 #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 @@
    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 @@
    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) \

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2010-01-04 05:35:18 +0000
+++ b/src/w32term.c     2010-01-09 04:16:32 +0000
@@ -734,11 +734,6 @@
     {
       int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
 
-      /* Internal border is drawn below the tool bar.  */
-      if (WINDOWP (f->tool_bar_window)
-         && w == XWINDOW (f->tool_bar_window))
-       y -= width;
-
       BLOCK_INPUT;
       {
        HDC hdc = get_frame_dc (f);

=== modified file 'src/window.h'
--- a/src/window.h      2010-01-04 05:35:18 +0000
+++ b/src/window.h      2010-01-09 04:16:32 +0000
@@ -400,18 +400,32 @@
   (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
    + WINDOW_RIGHT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
 
+/* 1 if W is a menu bar window.  */
+
+#define WINDOW_MENU_BAR_P(W) \
+  (WINDOWP (WINDOW_XFRAME (W)->menu_bar_window) \
+   && (W) == XWINDOW (WINDOW_XFRAME (W)->menu_bar_window))
+
+/* 1 if W is a tool bar window.  */
+
+#define WINDOW_TOOL_BAR_P(W) \
+  (WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \
+   && (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window))
+
 /* Return the frame y-position at which window W starts.
    This includes a header line, if any.  */
 
 #define WINDOW_TOP_EDGE_Y(W) \
-  (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
+  (((WINDOW_MENU_BAR_P (W) || WINDOW_TOOL_BAR_P (W)) \
+    ? 0 : FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W))) \
    + WINDOW_TOP_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W))
 
 /* Return the frame y-position before which window W ends.
    This includes a mode line, if any.  */
 
 #define WINDOW_BOTTOM_EDGE_Y(W) \
-  (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
+  (((WINDOW_MENU_BAR_P (W) || WINDOW_TOOL_BAR_P (W)) \
+    ? 0 : FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W))) \
    + WINDOW_BOTTOM_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W))
 
 

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2010-01-04 05:35:18 +0000
+++ b/src/xdisp.c       2010-01-09 04:16:32 +0000
@@ -1981,12 +1981,6 @@
        r.y = WINDOW_HEADER_LINE_HEIGHT (s->w);
       else
        r.y = max (0, s->row->y);
-
-      /* If drawing a tool-bar window, draw it over the internal border
-        at the top of the window.  */
-      if (WINDOWP (s->f->tool_bar_window)
-         && s->w == XWINDOW (s->f->tool_bar_window))
-       r.y -= FRAME_INTERNAL_BORDER_WIDTH (s->f);
     }
 
   r.y = WINDOW_TO_FRAME_PIXEL_Y (s->w, r.y);
@@ -19424,12 +19418,6 @@
   s->first_glyph = row->glyphs[area] + start;
   s->height = row->height;
   s->y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
-
-  /* Display the internal border below the tool-bar window.  */
-  if (WINDOWP (s->f->tool_bar_window)
-      && s->w == XWINDOW (s->f->tool_bar_window))
-    s->y -= FRAME_INTERNAL_BORDER_WIDTH (s->f);
-
   s->ybase = s->y + row->ascent;
 }
 

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2010-01-04 05:35:18 +0000
+++ b/src/xfns.c        2010-01-09 04:16:32 +0000
@@ -1403,7 +1403,7 @@
     {
       int height = FRAME_INTERNAL_BORDER_WIDTH (f);
       int width = FRAME_PIXEL_WIDTH (f);
-      int y = nlines * FRAME_LINE_HEIGHT (f);
+      int y = (FRAME_MENU_BAR_LINES (f) + nlines) * FRAME_LINE_HEIGHT (f);
 
       /* height can be zero here. */
       if (height > 0 && width > 0)

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2010-01-06 15:55:00 +0000
+++ b/src/xterm.c       2010-01-09 04:16:32 +0000
@@ -753,11 +753,6 @@
     {
       int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
 
-      /* Internal border is drawn below the tool bar.  */
-      if (WINDOWP (f->tool_bar_window)
-         && w == XWINDOW (f->tool_bar_window))
-       y -= width;
-
       BLOCK_INPUT;
       x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
                    0, y, width, height, False);
@@ -3062,7 +3057,7 @@
          XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
                          flash_left,
                          (FRAME_INTERNAL_BORDER_WIDTH (f)
-                          + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)),
+                          + FRAME_TOP_MARGIN_HEIGHT (f)),
                          width, flash_height);
          XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
                          flash_left,
@@ -3116,7 +3111,7 @@
          XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
                          flash_left,
                          (FRAME_INTERNAL_BORDER_WIDTH (f)
-                          + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)),
+                          + FRAME_TOP_MARGIN_HEIGHT (f)),
                          width, flash_height);
          XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
                          flash_left,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]