XEmacs 21.4.20 "Double Solitaire".
[chise/xemacs-chise.git.1] / src / redisplay-x.c
index 1abe97a..daf3c27 100644 (file)
@@ -165,9 +165,9 @@ separate_textual_runs (unsigned char *text_storage,
 #ifdef MULE
          {
            Lisp_Object ccl_prog = XCHARSET_CCL_PROGRAM (charset);
-           need_ccl_conversion = !NILP (ccl_prog);
-           if (need_ccl_conversion)
-             setup_ccl_program (&char_converter, ccl_prog);
+           if ((!NILP (ccl_prog))
+                 && (setup_ccl_program (&char_converter, ccl_prog) >= 0))
+             need_ccl_conversion = 1;
          }
 #endif
        }
@@ -286,24 +286,24 @@ x_eol_cursor_width (void)
 }
 
 /*****************************************************************************
- x_output_begin
+ x_window_output_begin
 
  Perform any necessary initialization prior to an update.
  ****************************************************************************/
 static void
-x_output_begin (struct device *d)
+x_window_output_begin (struct window *w)
 {
 }
 
 /*****************************************************************************
- x_output_end
+ x_window_output_end
 
  Perform any necessary flushing of queues when an update has completed.
  ****************************************************************************/
 static void
-x_output_end (struct device *d)
+x_window_output_end (struct window *w)
 {
-  XFlush (DEVICE_X_DISPLAY (d));
+  XFlush (DEVICE_X_DISPLAY (WINDOW_XDEVICE (w)));
 }
 
 /*****************************************************************************
@@ -318,7 +318,7 @@ x_output_display_block (struct window *w, struct display_line *dl, int block,
                        int cursor_width, int cursor_height)
 {
   struct frame *f = XFRAME (w->frame);
-  Emchar_dynarr *buf = Dynarr_new (Emchar);
+  Emchar_dynarr *buf;
   Lisp_Object window;
 
   struct display_block *db = Dynarr_atp (dl->display_blocks, block);
@@ -345,7 +345,7 @@ x_output_display_block (struct window *w, struct display_line *dl, int block,
 
   if (end < 0)
     end = Dynarr_length (rba);
-  Dynarr_reset (buf);
+  buf = Dynarr_new (Emchar);
 
   while (elt < end)
     {
@@ -439,11 +439,12 @@ x_output_display_block (struct window *w, struct display_line *dl, int block,
              Lisp_Object instance;
              struct display_box dbox;
              struct display_glyph_area dga;
+
              redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
-                                                start_pixpos, rb->width,
-                                                &dbox, &dga);
+                                                rb->object.dglyph.yoffset, start_pixpos,
+                                                 rb->width, &dbox, &dga);
 
-             XSETWINDOW (window, w);
+              XSETWINDOW (window, w);
              instance = glyph_image_instance (rb->object.dglyph.glyph,
                                               window, ERROR_ME_NOT, 1);
              findex = rb->findex;
@@ -452,54 +453,38 @@ x_output_display_block (struct window *w, struct display_line *dl, int block,
                {
                  switch (XIMAGE_INSTANCE_TYPE (instance))
                    {
-                   case IMAGE_TEXT:
-                     {
-                       /* #### This is way losing.  See the comment in
-                          add_glyph_rune(). */
-                       Lisp_Object string =
-                         XIMAGE_INSTANCE_TEXT_STRING (instance);
-                       convert_bufbyte_string_into_emchar_dynarr
-                         (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
-                       
-                       x_output_string (w, dl, buf, xpos,
-                                        rb->object.dglyph.xoffset,
-                                        start_pixpos, -1, findex,
-                                        (rb->cursor_type == CURSOR_ON),
-                                        cursor_start, cursor_width,
-                                        cursor_height);
-                       Dynarr_reset (buf);
-                     }
-                     break;
-                     
                    case IMAGE_MONO_PIXMAP:
                    case IMAGE_COLOR_PIXMAP:
                      redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
                                               cursor_start, cursor_width,
                                               cursor_height, 0);
                      break;
-                     
+
                    case IMAGE_WIDGET:
+                     if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
+                             Qlayout))
+                       {
+                         redisplay_output_layout (window, instance, &dbox, &dga, findex,
+                                                  cursor_start, cursor_width,
+                                                  cursor_height);
+                         break;
+                       }
                    case IMAGE_SUBWINDOW:
                      redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
                                                  cursor_start, cursor_width,
                                                  cursor_height);
                      break;
-                     
-                   case IMAGE_LAYOUT:
-                     redisplay_output_layout (w, instance, &dbox, &dga, findex,
-                                              cursor_start, cursor_width,
-                                              cursor_height);
-                     break;
-                     
+
                    case IMAGE_NOTHING:
                      /* nothing is as nothing does */
                      break;
-                     
+
+                   case IMAGE_TEXT:
                    case IMAGE_POINTER:
                    default:
-                     abort ();
+                     ABORT ();
                    }
-                 IMAGE_INSTANCE_OPTIMIZE_OUTPUT 
+                 IMAGE_INSTANCE_OPTIMIZE_OUTPUT
                    (XIMAGE_INSTANCE (instance)) = 0;
                }
 
@@ -507,7 +492,7 @@ x_output_display_block (struct window *w, struct display_line *dl, int block,
              elt++;
            }
          else
-           abort ();
+           ABORT ();
        }
     }
 
@@ -530,7 +515,7 @@ x_output_display_block (struct window *w, struct display_line *dl, int block,
 /*****************************************************************************
  x_bevel_area
 
- Draw a shadows for the given area in the given face.
+ Draw shadows for the given area in the given face.
  ****************************************************************************/
 static void
 x_bevel_area (struct window *w, face_index findex,
@@ -987,7 +972,9 @@ x_output_string (struct window *w, struct display_line *dl,
       /* We draw underlines in the same color as the text. */
       if (cachel->underline)
        {
-         unsigned long upos, uthick;
+         /* upos is naturally signed, why would anyone think otherwise?
+            uthick is signed to avoid unsigned propagation. */
+         long upos, uthick;
          XFontStruct *xfont;
 
          xfont = FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font));
@@ -1015,7 +1002,9 @@ x_output_string (struct window *w, struct display_line *dl,
        }
 
       if (cachel->strikethru) {
-       unsigned long ascent,descent,upos, uthick;
+       /* ascent, descent, and upos are naturally signed; why would anyone
+          think otherwise?  uthick is signed to avoid unsigned propagation. */
+       long ascent, descent, upos, uthick;
        XFontStruct *xfont;
 
        xfont = FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font));
@@ -1722,6 +1711,7 @@ x_redraw_exposed_window (struct window *w, int x, int y, int width, int height)
       f->windows_structure_changed = 1;
     }
 
+  redisplay_clear_top_of_window (w);
   if (window_needs_vertical_divider (w))
     {
       x_output_vertical_divider (w, 0);
@@ -2016,7 +2006,7 @@ x_flash (struct device *d)
                      w->pixel_width, flash_height);
     }
   else
-    /* If it is short, flash it all.  */ 
+    /* If it is short, flash it all.  */
     XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
                    w->pixel_width, w->pixel_height);
 
@@ -2049,7 +2039,7 @@ x_flash (struct device *d)
                      w->pixel_width, flash_height);
     }
   else
-    /* If it is short, flash it all.  */ 
+    /* If it is short, flash it all.  */
     XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
                    w->pixel_width, w->pixel_height);
 
@@ -2080,8 +2070,8 @@ x_ring_bell (struct device *d, int volume, int pitch, int duration)
       /* #### grab server? */
       XGetKeyboardControl (display, &state);
 
-      ctl.bell_pitch    = (pitch    >= 0 ? pitch    : state.bell_pitch);
-      ctl.bell_duration = (duration >= 0 ? duration : state.bell_duration);
+      ctl.bell_pitch    = (pitch    >= 0 ? pitch    : (int) state.bell_pitch);
+      ctl.bell_duration = (duration >= 0 ? duration : (int) state.bell_duration);
       XChangeKeyboardControl (display, KBBellPitch|KBBellDuration, &ctl);
 
       XBell (display, (volume * 2) - 100);
@@ -2111,8 +2101,8 @@ console_type_create_redisplay_x (void)
   CONSOLE_HAS_METHOD (x, output_vertical_divider);
   CONSOLE_HAS_METHOD (x, clear_region);
   CONSOLE_HAS_METHOD (x, clear_frame);
-  CONSOLE_HAS_METHOD (x, output_begin);
-  CONSOLE_HAS_METHOD (x, output_end);
+  CONSOLE_HAS_METHOD (x, window_output_begin);
+  CONSOLE_HAS_METHOD (x, window_output_end);
   CONSOLE_HAS_METHOD (x, flash);
   CONSOLE_HAS_METHOD (x, ring_bell);
   CONSOLE_HAS_METHOD (x, bevel_area);