]> code.delx.au - gnu-emacs/blobdiff - src/w32term.c
src/w32*.c: Make functions static.
[gnu-emacs] / src / w32term.c
index 5dfe6a363d32c848a636b6116730d6ddeb090f7e..a082aa32b691f673b0b4e96fd0567e311dac2c45 100644 (file)
@@ -21,7 +21,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <signal.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <setjmp.h>
 #include "lisp.h"
 #include "blockinput.h"
@@ -268,7 +267,9 @@ static void x_draw_bar_cursor (struct window *, struct glyph_row *, int,
 static void w32_clip_to_row (struct window *, struct glyph_row *, int, HDC);
 static BOOL my_show_window (struct frame *, HWND, int);
 static void my_set_window_pos (HWND, HWND, int, int, int, int, UINT);
+#if 0
 static void my_set_focus (struct frame *, HWND);
+#endif
 static void my_set_foreground_window (HWND);
 static void my_destroy_window (struct frame *, HWND);
 
@@ -323,7 +324,7 @@ XGCValues *
 XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv)
 {
   XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues));
-  bzero (gc, sizeof (XGCValues));
+  memset (gc, 0, sizeof (XGCValues));
 
   XChangeGC (ignore, gc, mask, xgcv);
 
@@ -737,7 +738,6 @@ w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   HDC hdc;
   struct face *face = p->face;
-  int rowY;
 
   hdc = get_frame_dc (f);
 
@@ -796,21 +796,7 @@ w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
     }
 
   /* Must clip because of partially visible lines.  */
-  rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
-  if (p->y < rowY)
-    {
-      /* Adjust position of "bottom aligned" bitmap on partially
-        visible last row.  */
-      int oldY = row->y;
-      int oldVH = row->visible_height;
-      row->visible_height = p->h;
-      row->y -= rowY - p->y;
-      w32_clip_to_row (w, row, -1, hdc);
-      row->y = oldY;
-      row->visible_height = oldVH;
-    }
-  else
-    w32_clip_to_row (w, row, -1, hdc);
+  w32_clip_to_row (w, row, -1, hdc);
 
   if (p->which && p->which < max_fringe_bmp)
     {
@@ -2119,17 +2105,34 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
     {
-      /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
-        as wide as the stretch glyph.  */
+      /* If `x-stretch-cursor' is nil, don't draw a block cursor as
+        wide as the stretch glyph.  */
       int width, background_width = s->background_width;
-      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
+      int x = s->x;
 
-      if (x < left_x)
+      if (!s->row->reversed_p)
        {
-         background_width -= left_x - x;
-         x = left_x;
+         int left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+         if (x < left_x)
+           {
+             background_width -= left_x - x;
+             x = left_x;
+           }
+       }
+      else
+       {
+         /* In R2L rows, draw the cursor on the right edge of the
+            stretch glyph.  */
+         int right_x = window_box_right_offset (s->w, TEXT_AREA);
+
+         if (x + background_width > right_x)
+           background_width -= x - right_x;
+         x += background_width;
        }
       width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
+      if (s->row->reversed_p)
+       x -= width;
 
       /* Draw cursor.  */
       x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
@@ -2143,7 +2146,10 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
          RECT r;
           HDC hdc = s->hdc;
 
-         x += width;
+         if (!s->row->reversed_p)
+           x += width;
+         else
+           x = s->x;
          if (s->row->mouse_face_p
              && cursor_in_mouse_face_p (s->w))
            {
@@ -2359,7 +2365,7 @@ x_draw_glyph_string (struct glyph_string *s)
 
       /* Draw strike-through.  */
       if (s->face->strike_through_p
-          && !FONT_TEXTMETRIC(s->font).tmStruckOut)
+          && !FONT_TEXTMETRIC (s->font).tmStruckOut)
         {
           unsigned long h = 1;
           unsigned long dy = (s->height - h) / 2;
@@ -3294,7 +3300,7 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar,
       BLOCK_INPUT;
       si.cbSize = sizeof (si);
       si.fMask = SIF_POS | SIF_PAGE;
-      GetScrollInfo(w, SB_CTL, &si);
+      GetScrollInfo (w, SB_CTL, &si);
       near_bottom_p = si.nPos + si.nPage >= range;
       UNBLOCK_INPUT;
       if (!near_bottom_p)
@@ -3381,12 +3387,14 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter,
 #endif
 }
 
+#if 0
 static void
 my_set_focus (struct frame * f, HWND hwnd)
 {
   SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS,
               (WPARAM) hwnd, 0);
 }
+#endif
 
 static void
 my_set_foreground_window (HWND hwnd)
@@ -3946,7 +3954,7 @@ static char dbcs_lead = 0;
    recursively with different messages by the system.
 */
 
-int
+static int
 w32_read_socket (struct terminal *terminal, int expected,
                 struct input_event *hold_quit)
 {
@@ -4169,7 +4177,7 @@ w32_read_socket (struct terminal *terminal, int expected,
                temp_index = 0;
              temp_buffer[temp_index++] = msg.msg.wParam;
              inev.kind = MULTIMEDIA_KEY_EVENT;
-             inev.code = GET_APPCOMMAND_LPARAM(msg.msg.lParam);
+             inev.code = GET_APPCOMMAND_LPARAM (msg.msg.lParam);
              inev.modifiers = msg.dwModifiers;
              XSETFRAME (inev.frame_or_window, f);
              inev.timestamp = msg.msg.time;
@@ -4217,7 +4225,7 @@ w32_read_socket (struct terminal *terminal, int expected,
                     selected now and last mouse movement event was
                     not in it.  Minibuffer window will be selected
                     only when it is active.  */
-                 if (WINDOWP(window)
+                 if (WINDOWP (window)
                      && !EQ (window, last_window)
                      && !EQ (window, selected_window)
                      /* For click-to-focus window managers
@@ -4888,6 +4896,11 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row,
 
          w->phys_cursor_width = width;
 
+         /* If the character under cursor is R2L, draw the bar cursor
+            on the right of its glyph, rather than on the left.  */
+         if ((cursor_glyph->resolved_level & 1) != 0)
+           x += cursor_glyph->pixel_width - width;
+
          w32_fill_area (f, hdc, cursor_color, x,
                         WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
                         width, row->height);
@@ -5344,8 +5357,8 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
     rect.right = pixelwidth;
     rect.bottom = pixelheight;
 
-    AdjustWindowRect(&rect, f->output_data.w32->dwStyle,
-                    FRAME_EXTERNAL_MENU_BAR (f));
+    AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
+                     FRAME_EXTERNAL_MENU_BAR (f));
 
     my_set_window_pos (FRAME_W32_WINDOW (f),
                       NULL,
@@ -5587,8 +5600,8 @@ x_make_frame_visible (struct frame *f)
 
          /* Adjust vertical window position in order to avoid being
             covered by a task bar placed at the bottom of the desktop. */
-         SystemParametersInfo(SPI_GETWORKAREA, 0, &workarea_rect, 0);
-         GetWindowRect(FRAME_W32_WINDOW(f), &window_rect);
+         SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0);
+         GetWindowRect (FRAME_W32_WINDOW(f), &window_rect);
          if (window_rect.bottom > workarea_rect.bottom
              && window_rect.top > workarea_rect.top)
            f->top_pos = max (window_rect.top
@@ -5709,8 +5722,7 @@ x_iconify_frame (struct frame *f)
 /* Free X resources of frame F.  */
 
 void
-x_free_frame_resources (f)
-     struct frame *f;
+x_free_frame_resources (struct frame *f)
 {
   struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
 
@@ -5826,7 +5838,7 @@ w32_initialize_display_info (Lisp_Object display_name)
 {
   struct w32_display_info *dpyinfo = &one_w32_display_info;
 
-  bzero (dpyinfo, sizeof (*dpyinfo));
+  memset (dpyinfo, 0, sizeof (*dpyinfo));
 
   /* Put it on w32_display_name_list.  */
   w32_display_name_list = Fcons (Fcons (display_name, Qnil),
@@ -6145,7 +6157,7 @@ x_delete_display (struct w32_display_info *dpyinfo)
     }
     dpyinfo->color_list = NULL;
     if (dpyinfo->palette)
-      DeleteObject(dpyinfo->palette);
+      DeleteObject (dpyinfo->palette);
   }
   xfree (dpyinfo->w32_id_name);