emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/w32term.c


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/w32term.c
Date: Sun, 20 Jan 2002 18:11:52 -0500

Index: emacs/src/w32term.c
diff -c emacs/src/w32term.c:1.137 emacs/src/w32term.c:1.138
*** emacs/src/w32term.c:1.137   Sun Jan 20 09:54:48 2002
--- emacs/src/w32term.c Sun Jan 20 18:11:52 2002
***************
*** 222,231 ****
  
  /* The handle of the frame that currently owns the system caret.  */
  HWND w32_system_caret_hwnd;
- int w32_system_caret_width;
  int w32_system_caret_height;
  int w32_system_caret_x;
  int w32_system_caret_y;
  
  /* Flag to enable Unicode output in case users wish to use programs
     like Twinbridge on '95 rather than installed system level support
--- 222,231 ----
  
  /* The handle of the frame that currently owns the system caret.  */
  HWND w32_system_caret_hwnd;
  int w32_system_caret_height;
  int w32_system_caret_x;
  int w32_system_caret_y;
+ int w32_use_visible_system_caret;
  
  /* Flag to enable Unicode output in case users wish to use programs
     like Twinbridge on '95 rather than installed system level support
***************
*** 593,598 ****
--- 593,601 ----
    struct frame *f = XFRAME (WINDOW_FRAME (w));
    struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f);
  
+   /* Hide the system caret during an update.  */
+   SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0);
+ 
    updated_window = w;
    set_output_cursor (&w->cursor);
  
***************
*** 714,719 ****
--- 717,727 ----
        dpyinfo->mouse_face_window = Qnil;
      }
  
+   /* Unhide the caret.  This won't actually show the cursor, unless it
+      was visible before the corresponding call to HideCaret in
+      x_update_window_begin.  */
+   SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0);
+ 
    updated_window = NULL;
  }
  
***************
*** 9690,9696 ****
        w->phys_cursor.y = glyph_row->y;
        w->phys_cursor.hpos = hpos;
        w->phys_cursor.vpos = vpos;
!       w->phys_cursor_type = new_cursor_type;
        w->phys_cursor_on_p = 1;
  
        /* If this is the active cursor, we need to track it with the
--- 9698,9716 ----
        w->phys_cursor.y = glyph_row->y;
        w->phys_cursor.hpos = hpos;
        w->phys_cursor.vpos = vpos;
! 
!       /* If the user wants to use the system caret, make sure our own
!        cursor remains invisible.  */
!       if (w32_use_visible_system_caret)
!       {
!         if (w->phys_cursor_type != NO_CURSOR)
!           x_erase_phys_cursor (w);
! 
!         new_cursor_type = w->phys_cursor_type = NO_CURSOR;
!       }
!       else
!       w->phys_cursor_type = new_cursor_type;
! 
        w->phys_cursor_on_p = 1;
  
        /* If this is the active cursor, we need to track it with the
***************
*** 9698,9730 ****
         and speech synthesizers can follow the cursor.  */
        if (active_cursor)
        {
!         struct glyph * cursor_glyph = get_phys_cursor_glyph (w);
!         if (cursor_glyph)
!           {
!             HWND hwnd = FRAME_W32_WINDOW (f);
!             int caret_width = cursor_glyph->pixel_width;
!             w32_system_caret_x
!               = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
!             w32_system_caret_y
!               = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
!                  + glyph_row->ascent - w->phys_cursor_ascent);
! 
!             /* If the size of the active cursor changed, destroy the old
!                system caret.  */
!             if (w32_system_caret_hwnd
!                 && (w32_system_caret_height != w->phys_cursor_height
!                     || w32_system_caret_width != caret_width))
!               PostMessage (hwnd, WM_EMACS_DESTROY_CARET, 0, 0);
  
!             if (!w32_system_caret_hwnd)
!               {
!                 w32_system_caret_height = w->phys_cursor_height;
!                 w32_system_caret_width = caret_width;
!               }
  
!             /* Move the system caret.  */
!             PostMessage (hwnd, WM_EMACS_TRACK_CARET, 0, 0);
!           }
        }
  
        switch (new_cursor_type)
--- 9718,9741 ----
         and speech synthesizers can follow the cursor.  */
        if (active_cursor)
        {
!         HWND hwnd = FRAME_W32_WINDOW (f);
  
!         w32_system_caret_x
!           = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
!         w32_system_caret_y
!           = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
!              + glyph_row->ascent - w->phys_cursor_ascent);
! 
!         /* If the size of the active cursor changed, destroy the old
!            system caret.  */
!         if (w32_system_caret_hwnd
!             && (w32_system_caret_height != w->phys_cursor_height))
!           PostMessage (hwnd, WM_EMACS_DESTROY_CARET, 0, 0);
  
!         w32_system_caret_height = w->phys_cursor_height;
! 
!         /* Move the system caret.  */
!         PostMessage (hwnd, WM_EMACS_TRACK_CARET, 0, 0);
        }
  
        switch (new_cursor_type)
***************
*** 11019,11025 ****
  
    w32_system_caret_hwnd = NULL;
    w32_system_caret_height = 0;
-   w32_system_caret_width = 0;
    w32_system_caret_x = 0;
    w32_system_caret_y = 0;
  
--- 11030,11035 ----
***************
*** 11152,11157 ****
--- 11162,11185 ----
    previous_help_echo = Qnil;
    staticpro (&previous_help_echo);
    help_echo_pos = -1;
+ 
+   DEFVAR_BOOL ("w32-use-visible-system-caret",
+              &w32_use_visible_system_caret,
+              doc: /* Flag to make the system caret visible.
+ When this is non-nil, Emacs will indicate the position of point by
+ using the system caret instead of drawing its own cursor.  Some screen
+ reader software does not track the system cursor properly when it is
+ invisible, and gets confused by Emacs drawing its own cursor, so this
+ variable is initialized to t when Emacs detects that screen reader 
+ software is running as it starts up.
+ 
+ When this variable is set, other variables affecting the appearance of
+ the cursor have no effect.  */);
+ 
+   /* Initialize w32_use_visible_system_caret based on whether a screen
+      reader is in use.  */
+   SystemParametersInfo (SPI_GETSCREENREADER, 0,
+                       &w32_use_visible_system_caret, 0);
  
    DEFVAR_BOOL ("x-stretch-cursor", &x_stretch_cursor_p,
               doc: /* *Non-nil means draw block cursor as wide as the glyph 
under it.



reply via email to

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