From f1010549551eb7a4311b3dd31b7f1c965a0dbec9 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Fri, 7 Oct 2005 21:47:18 +0000 Subject: *** empty log message *** --- src/ChangeLog | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index deb3ca4fbe9..74635e6df75 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2005-10-07 Kim F. Storm + + * dispnew.c (redraw_overlapped_rows, redraw_overlapping_rows) + [!HAVE_WINDOW_SYSTEM]: Don't declare them... + (update_window) [!HAVE_WINDOW_SYSTEM]: ...and don't call them. + 2005-10-07 YAMAMOTO Mitsuharu * dispextern.h (struct glyph_string): Rename member for_overlaps_p @@ -15,19 +21,17 @@ * xdisp.c: Rename member for_overlaps_p in struct glyph_string to for_overlaps. (get_glyph_string_clip_rects): New function created from - get_glyph_string_clip_rect. Set clipping rectangles according to - the value of for_overlaps. Enable to store multiple clipping - rectangles. + get_glyph_string_clip_rect. Set clipping rectangles according to the + value of for_overlaps. Enable to store multiple clipping rectangles. (get_glyph_string_clip_rect): Use get_glyph_string_clip_rects. (fill_composite_glyph_string, fill_glyph_string, draw_glyphs): Rename argument OVERLAPS_P to OVERLAPS. All uses in macros changed. (x_fix_overlapping_area): Add OVERLAPS arg. Pass it to draw_glyphs. (draw_phys_cursor_glyph): Set width of erased cursor to use it for - calculating clipping rectangles later. Call - x_fix_overlapping_area with new OVERLAPS arg to draw only erased - cursor area. - (expose_overlaps): Call x_fix_overlapping_area with new - OVERLAPS arg to draw overlaps in both preceding and succeeding rows. + calculating clipping rectangles later. Call x_fix_overlapping_area + with new OVERLAPS arg to draw only erased cursor area. + (expose_overlaps): Call x_fix_overlapping_area with new OVERLAPS arg + to draw overlaps in both preceding and succeeding rows. * xterm.c, w32term.c, macterm.c: Rename member for_overlaps_p in struct glyph_string to for_overlaps. -- cgit v1.2.1 From 93e023fcee6863f22cebaf51dfe140a187f9eadc Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Fri, 7 Oct 2005 21:47:49 +0000 Subject: (redraw_overlapped_rows, redraw_overlapping_rows) [!HAVE_WINDOW_SYSTEM]: Don't declare them... (update_window) [!HAVE_WINDOW_SYSTEM]: ...and don't call them. --- src/dispnew.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/dispnew.c b/src/dispnew.c index 43cfd46da39..09a957b6dce 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3963,6 +3963,7 @@ update_single_window (w, force_p) } } +#ifdef HAVE_WINDOW_SYSTEM /* Redraw lines from the current matrix of window W that are overlapped by other rows. YB is bottom-most y-position in W. */ @@ -4069,6 +4070,8 @@ redraw_overlapping_rows (w, yb) } } +#endif /* HAVE_WINDOW_SYSTEM */ + #ifdef GLYPH_DEBUG @@ -4229,11 +4232,13 @@ update_window (w, force_p) /* Fix the appearance of overlapping/overlapped rows. */ if (!paused_p && !w->pseudo_window_p) { +#ifdef HAVE_WINDOW_SYSTEM if (changed_p && rif->fix_overlapping_area) { redraw_overlapped_rows (w, yb); redraw_overlapping_rows (w, yb); } +#endif /* Make cursor visible at cursor position of W. */ set_window_cursor_after_update (w); -- cgit v1.2.1 From ef1b4c9ecd7ad3896a7ef1bdd7f24aeb47359ead Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Fri, 7 Oct 2005 22:16:46 +0000 Subject: *** empty log message *** --- src/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 74635e6df75..74244702feb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-10-08 Kim F. Storm + + * window.c (window_tree, Fwindow_tree): Rename fns added 2005-10-04. + 2005-10-07 Kim F. Storm * dispnew.c (redraw_overlapped_rows, redraw_overlapping_rows) -- cgit v1.2.1 From c16e1cc347476e4995c2eac6e99d2781688e8fc5 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Fri, 7 Oct 2005 22:17:05 +0000 Subject: (window_tree, Fwindow_tree): Rename fns added 2005-10-04. --- src/window.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/window.c b/src/window.c index d282c2dd3f4..3e9354a7ba8 100644 --- a/src/window.c +++ b/src/window.c @@ -6232,7 +6232,7 @@ usage: (save-window-excursion BODY ...) */) ***********************************************************************/ static Lisp_Object -window_split_tree (w) +window_tree (w) struct window *w; { Lisp_Object tail = Qnil; @@ -6245,10 +6245,10 @@ window_split_tree (w) XSETWINDOW (wn, w); if (!NILP (w->hchild)) wn = Fcons (Qnil, Fcons (Fwindow_edges (wn), - window_split_tree (XWINDOW (w->hchild)))); + window_tree (XWINDOW (w->hchild)))); else if (!NILP (w->vchild)) wn = Fcons (Qt, Fcons (Fwindow_edges (wn), - window_split_tree (XWINDOW (w->vchild)))); + window_tree (XWINDOW (w->vchild)))); if (NILP (result)) { @@ -6268,12 +6268,12 @@ window_split_tree (w) -DEFUN ("window-split-tree", Fwindow_split_tree, Swindow_split_tree, +DEFUN ("window-tree", Fwindow_tree, Swindow_tree, 0, 1, 0, - doc: /* Return the window split tree for frame FRAME. + doc: /* Return the window tree for frame FRAME. The return value is a list of the form (ROOT MINI), where ROOT -represents the window split tree of the frame's root window, and MINI +represents the window tree of the frame's root window, and MINI is the frame's minibuffer window. If the root window is not split, ROOT is the root window itself. @@ -6301,7 +6301,7 @@ selected frame. */) if (!FRAME_LIVE_P (f)) return Qnil; - return window_split_tree (XWINDOW (FRAME_ROOT_WINDOW (f))); + return window_tree (XWINDOW (FRAME_ROOT_WINDOW (f))); } @@ -7110,7 +7110,7 @@ The selected frame is the one whose configuration has changed. */); defsubr (&Sset_window_configuration); defsubr (&Scurrent_window_configuration); defsubr (&Ssave_window_excursion); - defsubr (&Swindow_split_tree); + defsubr (&Swindow_tree); defsubr (&Sset_window_margins); defsubr (&Swindow_margins); defsubr (&Sset_window_fringes); -- cgit v1.2.1 From 2be96ef8f959ced275347ce76c34094451c65ced Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sat, 8 Oct 2005 02:27:47 +0000 Subject: (MAX_CLIP_RECTS): New define. (struct _XGC): New member clip_region. (struct _XGC) [MAC_OSX && USE_ATSUI]: New members n_clip_rects and clip_rects. --- src/macgui.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/macgui.h b/src/macgui.h index 378dbcd9e5c..6e2adb092c6 100644 --- a/src/macgui.h +++ b/src/macgui.h @@ -192,6 +192,19 @@ typedef struct _XGC /* QuickDraw background color. */ RGBColor back_color; + +#define MAX_CLIP_RECTS 2 + /* QuickDraw clipping region. */ + RgnHandle clip_region; + +#if defined (MAC_OSX) && USE_ATSUI + /* Number of clipping rectangles used in Quartz 2D drawing. */ + int n_clip_rects; + + /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate + is in QuickDraw's. */ + CGRect clip_rects[MAX_CLIP_RECTS]; +#endif } *GC; #define GCForeground (1L<<2) -- cgit v1.2.1 From 1c4ac540607ae99e769fa04064c0a179720afa40 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sat, 8 Oct 2005 02:28:09 +0000 Subject: (GC_CLIP_REGION): New macro. (saved_port_clip_region): New variable. (mac_begin_clip, mac_end_clip): New functions. (XDrawLine, mac_erase_rectangle, mac_draw_bitmap, XFillRectangle) (mac_draw_rectangle, mac_draw_string_common, mac_copy_area) (mac_copy_area_with_mask, mac_scroll_area): Use them. (mac_set_clip_rectangle, mac_reset_clipping): Remove functions. [USE_ATSUI] (atsu_get_text_layout_with_text_ptr) [MAC_OS_X_VERSION_MAX_ALLOWED < 1020]: Specify kATSLineFractDisable. (mac_draw_string_common) [MAC_OSX && USE_ATSUI]: Clip to clipping rectangles stored in gc. (XFreeGC): Dispose clipping region. (mac_set_clip_rectangles, mac_reset_clip_rectangles): New functions. (x_draw_fringe_bitmap, x_set_glyph_string_clipping) (x_draw_relief_rect, x_draw_box_rect, x_draw_stretch_glyph_string) (x_draw_glyph_string, x_clip_to_row, x_draw_hollow_cursor) (x_draw_bar_cursor): Use them. (x_set_glyph_string_clipping): Use get_glyph_string_clip_rects to get multiple clipping rectangles. --- src/macterm.c | 208 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 145 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/macterm.c b/src/macterm.c index 94a2c4d5434..7d75e962e9c 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -270,8 +270,38 @@ extern void menubar_selection_callback (FRAME_PTR, int); #define GC_FORE_COLOR(gc) (&(gc)->fore_color) #define GC_BACK_COLOR(gc) (&(gc)->back_color) #define GC_FONT(gc) ((gc)->xgcv.font) +#define GC_CLIP_REGION(gc) ((gc)->clip_region) #define MAC_WINDOW_NORMAL_GC(w) (((mac_output *) GetWRefCon (w))->normal_gc) +static RgnHandle saved_port_clip_region = NULL; + +static void +mac_begin_clip (region) + RgnHandle region; +{ + static RgnHandle new_region = NULL; + + if (saved_port_clip_region == NULL) + saved_port_clip_region = NewRgn (); + if (new_region == NULL) + new_region = NewRgn (); + + if (region) + { + GetClip (saved_port_clip_region); + SectRgn (saved_port_clip_region, region, new_region); + SetClip (new_region); + } +} + +static void +mac_end_clip (region) + RgnHandle region; +{ + if (region) + SetClip (saved_port_clip_region); +} + /* X display function emulation */ @@ -297,8 +327,10 @@ XDrawLine (display, w, gc, x1, y1, x2, y2) RGBForeColor (GC_FORE_COLOR (gc)); + mac_begin_clip (GC_CLIP_REGION (gc)); MoveTo (x1, y1); LineTo (x2, y2); + mac_end_clip (GC_CLIP_REGION (gc)); } void @@ -339,7 +371,9 @@ mac_erase_rectangle (w, gc, x, y, width, height) RGBBackColor (GC_BACK_COLOR (gc)); SetRect (&r, x, y, x + width, y + height); + mac_begin_clip (GC_CLIP_REGION (gc)); EraseRect (&r); + mac_end_clip (GC_CLIP_REGION (gc)); RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); } @@ -406,6 +440,7 @@ mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p) RGBBackColor (GC_BACK_COLOR (gc)); SetRect (&r, x, y, x + width, y + height); + mac_begin_clip (GC_CLIP_REGION (gc)); #if TARGET_API_MAC_CARBON LockPortBits (GetWindowPort (w)); CopyBits (&bitmap, GetPortBitMapForCopyBits (GetWindowPort (w)), @@ -415,41 +450,12 @@ mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p) CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r, overlay_p ? srcOr : srcCopy, 0); #endif /* not TARGET_API_MAC_CARBON */ + mac_end_clip (GC_CLIP_REGION (gc)); RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); } -/* Mac replacement for XSetClipRectangles. */ - -static void -mac_set_clip_rectangle (display, w, r) - Display *display; - WindowPtr w; - Rect *r; -{ - SetPortWindowPort (w); - - ClipRect (r); -} - - -/* Mac replacement for XSetClipMask. */ - -static void -mac_reset_clipping (display, w) - Display *display; - WindowPtr w; -{ - Rect r; - - SetPortWindowPort (w); - - SetRect (&r, -32767, -32767, 32767, 32767); - ClipRect (&r); -} - - /* Mac replacement for XCreateBitmapFromBitmapData. */ static void @@ -577,7 +583,9 @@ XFillRectangle (display, w, gc, x, y, width, height) RGBForeColor (GC_FORE_COLOR (gc)); SetRect (&r, x, y, x + width, y + height); + mac_begin_clip (GC_CLIP_REGION (gc)); PaintRect (&r); /* using foreground color of gc */ + mac_end_clip (GC_CLIP_REGION (gc)); } @@ -625,7 +633,9 @@ mac_draw_rectangle (display, w, gc, x, y, width, height) RGBForeColor (GC_FORE_COLOR (gc)); SetRect (&r, x, y, x + width + 1, y + height + 1); + mac_begin_clip (GC_CLIP_REGION (gc)); FrameRect (&r); /* using foreground color of gc */ + mac_end_clip (GC_CLIP_REGION (gc)); } @@ -678,7 +688,7 @@ atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics #else - kATSLineIsDisplayOnly + kATSLineIsDisplayOnly | kATSLineFractDisable #endif ; ATSUAttributeValuePtr values[] = {&line_layout}; @@ -782,10 +792,12 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, if (NILP (Vmac_use_core_graphics)) { #endif + mac_begin_clip (GC_CLIP_REGION (gc)); MoveTo (x, y); ATSUDrawText (text_layout, kATSUFromTextBeginning, kATSUToTextEnd, kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); + mac_end_clip (GC_CLIP_REGION (gc)); #ifdef MAC_OSX } else @@ -793,7 +805,6 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, CGrafPtr port; CGContextRef context; Rect rect; - RgnHandle region = NewRgn (); float port_height; ATSUAttributeTag tags[] = {kATSUCGContextTag}; ByteCount sizes[] = {sizeof (CGContextRef)}; @@ -803,16 +814,15 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, QDBeginCGContext (port, &context); GetPortBounds (port, &rect); port_height = rect.bottom - rect.top; - GetClip (region); - GetRegionBounds (region, &rect); - /* XXX: This is not correct if the clip region is not a - simple rectangle. */ - CGContextClipToRect (context, - CGRectMake (rect.left, - port_height - rect.bottom, - rect.right - rect.left, - rect.bottom - rect.top)); - DisposeRgn (region); + if (gc->n_clip_rects) + { + CGContextTranslateCTM (context, 0, port_height); + CGContextScaleCTM (context, 1, -1); + CGContextClipToRects (context, gc->clip_rects, + gc->n_clip_rects); + CGContextScaleCTM (context, 1, -1); + CGContextTranslateCTM (context, 0, -port_height); + } CGContextSetRGBFillColor (context, RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, @@ -843,8 +853,10 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, TextFace (GC_FONT (gc)->mac_fontface); TextMode (mode); + mac_begin_clip (GC_CLIP_REGION (gc)); MoveTo (x, y); DrawText (buf, 0, nchars * bytes_per_char); + mac_end_clip (GC_CLIP_REGION (gc)); #if USE_ATSUI } #endif @@ -943,6 +955,7 @@ mac_copy_area (display, src, dest, gc, src_x, src_y, width, height, dest_x, ForeColor (blackColor); BackColor (whiteColor); + mac_begin_clip (GC_CLIP_REGION (gc)); LockPixels (GetGWorldPixMap (src)); #if TARGET_API_MAC_CARBON LockPortBits (GetWindowPort (dest)); @@ -955,6 +968,7 @@ mac_copy_area (display, src, dest, gc, src_x, src_y, width, height, dest_x, &src_r, &dest_r, srcCopy, 0); #endif /* not TARGET_API_MAC_CARBON */ UnlockPixels (GetGWorldPixMap (src)); + mac_end_clip (GC_CLIP_REGION (gc)); RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); } @@ -981,6 +995,7 @@ mac_copy_area_with_mask (display, src, mask, dest, gc, src_x, src_y, ForeColor (blackColor); BackColor (whiteColor); + mac_begin_clip (GC_CLIP_REGION (gc)); LockPixels (GetGWorldPixMap (src)); LockPixels (GetGWorldPixMap (mask)); #if TARGET_API_MAC_CARBON @@ -995,6 +1010,7 @@ mac_copy_area_with_mask (display, src, mask, dest, gc, src_x, src_y, #endif /* not TARGET_API_MAC_CARBON */ UnlockPixels (GetGWorldPixMap (mask)); UnlockPixels (GetGWorldPixMap (src)); + mac_end_clip (GC_CLIP_REGION (gc)); RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); } @@ -1031,7 +1047,9 @@ mac_scroll_area (display, w, gc, src_x, src_y, width, height, dest_x, dest_y) color mapping in CopyBits. Otherwise, it will be slow. */ ForeColor (blackColor); BackColor (whiteColor); + mac_begin_clip (GC_CLIP_REGION (gc)); CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); + mac_end_clip (GC_CLIP_REGION (gc)); RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); #endif /* not TARGET_API_MAC_CARBON */ @@ -1166,6 +1184,8 @@ XFreeGC (display, gc) Display *display; GC gc; { + if (gc->clip_region) + DisposeRgn (gc->clip_region); xfree (gc); } @@ -1236,6 +1256,70 @@ XSetFont (display, gc, font) } +/* Mac replacement for XSetClipRectangles. */ + +static void +mac_set_clip_rectangles (display, gc, rectangles, n) + Display *display; + GC gc; + Rect *rectangles; + int n; +{ + int i; + + if (n < 0 || n > MAX_CLIP_RECTS) + abort (); + if (n == 0) + { + if (gc->clip_region) + { + DisposeRgn (gc->clip_region); + gc->clip_region = NULL; + } + } + else + { + if (gc->clip_region == NULL) + gc->clip_region = NewRgn (); + RectRgn (gc->clip_region, rectangles); + if (n > 1) + { + RgnHandle region = NewRgn (); + + for (i = 1; i < n; i++) + { + RectRgn (region, rectangles + i); + UnionRgn (gc->clip_region, region, gc->clip_region); + } + DisposeRgn (region); + } + } +#if defined (MAC_OSX) && USE_ATSUI + gc->n_clip_rects = n; + + for (i = 0; i < n; i++) + { + Rect *rect = rectangles + i; + + gc->clip_rects[i] = CGRectMake (rect->left, rect->top, + rect->right - rect->left, + rect->bottom - rect->top); + } +#endif +} + + +/* Mac replacement for XSetClipMask. */ + +static INLINE void +mac_reset_clip_rectangles (display, gc) + Display *display; + GC gc; +{ + mac_set_clip_rectangles (display, gc, NULL, 0); +} + + /* Mac replacement for XSetWindowBackground. */ void @@ -1647,7 +1731,7 @@ x_draw_fringe_bitmap (w, row, p) XSetForeground (display, face->gc, gcv.foreground); } - mac_reset_clipping (display, window); + mac_reset_clip_rectangles (display, gc); } @@ -2122,9 +2206,11 @@ static INLINE void x_set_glyph_string_clipping (s) struct glyph_string *s; { - Rect r; - get_glyph_string_clip_rect (s, &r); - mac_set_clip_rectangle (s->display, s->window, &r); + Rect rects[MAX_CLIP_RECTS]; + int n; + + n = get_glyph_string_clip_rects (s, rects, MAX_CLIP_RECTS); + mac_set_clip_rectangles (s->display, s->gc, rects, n); } @@ -2341,7 +2427,7 @@ x_draw_glyph_string_foreground (s) { if (s->two_byte_p) XDrawImageString16 (s->display, s->window, s->gc, x, - s->ybase - boff, s->char2b, s->nchars); + s->ybase - boff, s->char2b, s->nchars); else XDrawImageString (s->display, s->window, s->gc, x, s->ybase - boff, char1b, s->nchars); @@ -2749,7 +2835,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, gc = f->output_data.mac->white_relief.gc; else gc = f->output_data.mac->black_relief.gc; - mac_set_clip_rectangle (dpy, window, clip_rect); + mac_set_clip_rectangles (dpy, gc, clip_rect, 1); /* Top. */ if (top_p) @@ -2764,13 +2850,12 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, XDrawLine (dpy, window, gc, left_x + i, top_y + i, left_x + i, bottom_y - i); - mac_reset_clipping (dpy, window); + mac_reset_clip_rectangles (dpy, gc); if (raised_p) gc = f->output_data.mac->black_relief.gc; else gc = f->output_data.mac->white_relief.gc; - mac_set_clip_rectangle (dpy, window, - clip_rect); + mac_set_clip_rectangles (dpy, gc, clip_rect, 1); /* Bottom. */ if (bot_p) @@ -2785,7 +2870,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, XDrawLine (dpy, window, gc, right_x - i, top_y + i + 1, right_x - i, bottom_y - i - 1); - mac_reset_clipping (dpy, window); + mac_reset_clip_rectangles (dpy, gc); } @@ -2807,7 +2892,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, XGetGCValues (s->display, s->gc, GCForeground, &xgcv); XSetForeground (s->display, s->gc, s->face->box_color); - mac_set_clip_rectangle (s->display, s->window, clip_rect); + mac_set_clip_rectangles (s->display, s->gc, clip_rect, 1); /* Top. */ XFillRectangle (s->display, s->window, s->gc, @@ -2828,7 +2913,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, right_x - width + 1, top_y, width, bottom_y - top_y + 1); XSetForeground (s->display, s->gc, xgcv.foreground); - mac_reset_clipping (s->display, s->window); + mac_reset_clip_rectangles (s->display, s->gc); } @@ -3182,7 +3267,6 @@ x_draw_image_glyph_string (s) x_set_glyph_string_clipping (s); mac_copy_area (s->display, pixmap, s->window, s->gc, 0, 0, s->background_width, s->height, s->x, s->y); - mac_reset_clipping (s->display, s->window); XFreePixmap (s->display, pixmap); } else @@ -3234,7 +3318,7 @@ x_draw_stretch_glyph_string (s) gc = s->face->gc; get_glyph_string_clip_rect (s, &r); - mac_set_clip_rectangle (s->display, s->window, &r); + mac_set_clip_rectangles (s->display, gc, &r, 1); #if 0 /* MAC_TODO: stipple */ if (s->face->stipple) @@ -3247,8 +3331,6 @@ x_draw_stretch_glyph_string (s) else #endif /* MAC_TODO */ mac_erase_rectangle (s->window, gc, x, y, w, h); - - mac_reset_clipping (s->display, s->window); } } else if (!s->background_filled_p) @@ -3397,7 +3479,7 @@ x_draw_glyph_string (s) } /* Reset clipping. */ - mac_reset_clipping (s->display, s->window); + mac_reset_clip_rectangles (s->display, s->gc); } /* Shift display to make room for inserted glyphs. */ @@ -5270,7 +5352,7 @@ x_clip_to_row (w, row, area, gc) clip_rect.right = clip_rect.left + window_width; clip_rect.bottom = clip_rect.top + row->visible_height; - mac_set_clip_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), &clip_rect); + mac_set_clip_rectangles (FRAME_MAC_DISPLAY (f), gc, &clip_rect, 1); } @@ -5313,7 +5395,7 @@ x_draw_hollow_cursor (w, row) /* Set clipping, draw the rectangle, and reset clipping again. */ x_clip_to_row (w, row, TEXT_AREA, gc); mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h); - mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f)); + mac_reset_clip_rectangles (dpy, gc); } @@ -5397,7 +5479,7 @@ x_draw_bar_cursor (w, row, width, kind) cursor_glyph->pixel_width, width); - mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f)); + mac_reset_clip_rectangles (dpy, gc); } } @@ -7610,7 +7692,7 @@ XLoadQueryFont (Display *dpy, char *fontname) ATSUFontFeatureType types[] = {kAllTypographicFeaturesType}; ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector}; Lisp_Object font_id_cons; - + font_id_cons = Fgethash (Fdowncase (make_unibyte_string (mfontname, strlen (mfontname))), -- cgit v1.2.1 From 9dc9af1b8bcc976818b84bff133d9f5dd0d3ce0f Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sat, 8 Oct 2005 02:28:37 +0000 Subject: (mac_term_init): Add types to extern. (struct mac_output): Remove members mWP and pending_menu_activation. Put members scroll_bar_foreground_pixel and scroll_bar_background_pixel in #if 0. (FRAME_MAC_WINDOW, FRAME_X_WINDOW): Use window_desc. --- src/macterm.h | 84 ++++++++++------------------------------------------------- 1 file changed, 14 insertions(+), 70 deletions(-) (limited to 'src') diff --git a/src/macterm.h b/src/macterm.h index b3855f142c6..e7a5fc2450e 100644 --- a/src/macterm.h +++ b/src/macterm.h @@ -39,8 +39,8 @@ Boston, MA 02110-1301, USA. */ #define BLACK_PIX_DEFAULT(f) RGB_TO_ULONG(0,0,0) #define WHITE_PIX_DEFAULT(f) RGB_TO_ULONG(255,255,255) -#define FONT_WIDTH(f) ((f)->max_bounds.width) -#define FONT_HEIGHT(f) ((f)->ascent + (f)->descent) +#define FONT_WIDTH(f) ((f)->max_bounds.width) +#define FONT_HEIGHT(f) ((f)->ascent + (f)->descent) #define FONT_BASE(f) ((f)->ascent) #define FONT_DESCENT(f) ((f)->descent) @@ -82,16 +82,8 @@ struct mac_display_info /* Whether the screen supports color */ int color_p; -#if 0 - /* Number of bits per pixel on this screen. */ - int n_cbits; -#endif - /* Dimensions of this screen. */ int height, width; -#if 0 - int height_in,width_in; -#endif /* Mask of things that cause the mouse to be grabbed. */ int grabbed; @@ -111,33 +103,12 @@ struct mac_display_info /* Resource data base */ XrmDatabase xrdb; -#if 0 - /* color palette information. */ - int has_palette; - struct w32_palette_entry * color_list; - unsigned num_colors; - HPALETTE palette; - - /* deferred action flags checked when starting frame update. */ - int regen_palette; - - /* Keystroke that has been faked by Emacs and will be ignored when - received; value is reset after key is received. */ - int faked_key; - -#endif - /* A table of all the fonts we have already loaded. */ struct font_info *font_table; /* The current capacity of font_table. */ int font_table_size; - /* The number of fonts actually stored in the font table. - font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= - n_fonts <= font_table_size. and font_table[i].name != 0. */ - int n_fonts; - /* Minimum width over all characters in all fonts in font_table. */ int smallest_char_width; @@ -148,7 +119,7 @@ struct mac_display_info GC scratch_cursor_gc; /* These variables describe the range of text currently shown in its - mouse-face, together with the window they apply to. As long as + mouse-face, together with the window they apply to. As long as the mouse stays within this range, we need not redraw anything on its account. Rows and columns are glyph matrix positions in MOUSE_FACE_WINDOW. */ @@ -168,7 +139,6 @@ struct mac_display_info /* FRAME and X, Y position of mouse when last checked for highlighting. X and Y can be negative or out of range for the frame. */ struct frame *mouse_face_mouse_frame; - int mouse_face_mouse_x, mouse_face_mouse_y; /* Nonzero means defer mouse-motion highlighting. */ @@ -181,6 +151,11 @@ struct mac_display_info char *mac_id_name; + /* The number of fonts actually stored in the font table. + font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= + n_fonts <= font_table_size and font_table[i].name != 0. */ + int n_fonts; + /* Pointer to bitmap records. */ struct mac_bitmap_record *bitmaps; @@ -237,7 +212,7 @@ extern int unibyte_display_via_language_environment; extern struct x_display_info *x_display_info_for_display P_ ((Display *)); extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object)); -extern struct mac_display_info *mac_term_init (); +extern struct mac_display_info *mac_term_init P_ ((Lisp_Object, char *, char *)); extern Lisp_Object x_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); extern struct font_info *x_get_font_info P_ ((struct frame *f, int)); @@ -262,33 +237,8 @@ struct mac_output { /* Menubar "widget" handle. */ int menubar_widget; - Window mWP; /* pointer to QuickDraw window */ FRAME_PTR mFP; /* points back to the frame struct */ -#if 0 - int mNumCols; /* number of characters per column */ - int mNumRows; /* number of characters per row */ - int mLineHeight; /* height of one line of text in pixels */ - int mCharWidth; /* width of one character in pixels */ - int mHomeX; /* X pixel coordinate of lower left - corner of character at (0, 0) */ - int mHomeY; /* Y pixel coordinate of lower left - corner of character at (0, 0) */ - int mHighlight; /* current highlight state (0 = off). */ - int mTermWinSize; /* num of lines from top of window - affected by ins_del_lines; set by - set_terminal_window. */ -#endif /* 0 */ - -#if 0 - /* stuffs used by xfaces.c */ - struct face **param_faces; - int n_param_faces; - struct face **computed_faces; - int n_computed_faces; - int size_computed_faces; -#endif - /* Here are the Graphics Contexts for the default font. */ GC normal_gc; /* Normal video */ GC reverse_gc; /* Reverse video */ @@ -322,6 +272,7 @@ struct mac_output { unsigned long mouse_pixel; unsigned long cursor_foreground_pixel; +#if 0 /* Foreground color for scroll bars. A value of -1 means use the default (black for non-toolkit scroll bars). */ unsigned long scroll_bar_foreground_pixel; @@ -330,6 +281,7 @@ struct mac_output { default (background color of the frame for non-toolkit scroll bars). */ unsigned long scroll_bar_background_pixel; +#endif /* Descriptor for the cursor in use for this window. */ Cursor text_cursor; @@ -357,10 +309,6 @@ struct mac_output { ControlRef hourglass_control; #endif -#if 0 - DWORD dwStyle; -#endif - /* This is the Emacs structure for the display this frame is on. */ /* struct w32_display_info *display_info; */ @@ -377,10 +325,6 @@ struct mac_output { /* Nonzero means a menu command is being processed. */ char menu_command_in_progress; - /* Nonzero means menubar is about to become active, but should be - brought up to date first. */ - volatile char pending_menu_activation; - /* Relief GCs, colors etc. */ struct relief { @@ -404,8 +348,8 @@ typedef struct mac_output mac_output; #define FRAME_X_OUTPUT(f) ((f)->output_data.mac) /* Return the Mac window used for displaying data in frame F. */ -#define FRAME_MAC_WINDOW(f) ((f)->output_data.mac->mWP) -#define FRAME_X_WINDOW(f) ((f)->output_data.mac->mWP) +#define FRAME_MAC_WINDOW(f) ((f)->output_data.mac->window_desc) +#define FRAME_X_WINDOW(f) ((f)->output_data.mac->window_desc) #define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.x->foreground_pixel) #define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.x->background_pixel) @@ -531,7 +475,7 @@ struct scroll_bar { /* Return the inside width of a vertical scroll bar, given the outside width. */ -#define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f,width) \ +#define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \ ((width) \ - VERTICAL_SCROLL_BAR_LEFT_BORDER \ - VERTICAL_SCROLL_BAR_RIGHT_BORDER \ -- cgit v1.2.1 From 61e62f5f738f8a195c11daf061ba165f9adf2d0b Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sat, 8 Oct 2005 02:29:25 +0000 Subject: (x_create_gc, x_free_gc) [MAC_OS]: Add BLOCK_INPUT. Add debug code. --- src/ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ src/xfaces.c | 6 ++++++ 2 files changed, 42 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 74244702feb..d466f5d3bf2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,39 @@ +2005-10-08 YAMAMOTO Mitsuharu + + * macgui.h (MAX_CLIP_RECTS): New define. + (struct _XGC): New member clip_region. + (struct _XGC) [MAC_OSX && USE_ATSUI]: New members n_clip_rects and + clip_rects. + + * macterm.c (GC_CLIP_REGION): New macro. + (saved_port_clip_region): New variable. + (mac_begin_clip, mac_end_clip): New functions. + (XDrawLine, mac_erase_rectangle, mac_draw_bitmap, XFillRectangle) + (mac_draw_rectangle, mac_draw_string_common, mac_copy_area) + (mac_copy_area_with_mask, mac_scroll_area): Use them. + (mac_set_clip_rectangle, mac_reset_clipping): Remove functions. + [USE_ATSUI] (atsu_get_text_layout_with_text_ptr) + [MAC_OS_X_VERSION_MAX_ALLOWED < 1020]: Specify kATSLineFractDisable. + (mac_draw_string_common) [MAC_OSX && USE_ATSUI]: Clip to clipping + rectangles stored in gc. + (XFreeGC): Dispose clipping region. + (mac_set_clip_rectangles, mac_reset_clip_rectangles): New functions. + (x_draw_fringe_bitmap, x_set_glyph_string_clipping) + (x_draw_relief_rect, x_draw_box_rect, x_draw_stretch_glyph_string) + (x_draw_glyph_string, x_clip_to_row, x_draw_hollow_cursor) + (x_draw_bar_cursor): Use them. + (x_set_glyph_string_clipping): Use get_glyph_string_clip_rects to + get multiple clipping rectangles. + + * macterm.h (mac_term_init): Add types to extern. + (struct mac_output): Remove members mWP and pending_menu_activation. + Put members scroll_bar_foreground_pixel and + scroll_bar_background_pixel in #if 0. + (FRAME_MAC_WINDOW, FRAME_X_WINDOW): Use window_desc. + + * xfaces.c (x_create_gc, x_free_gc) [MAC_OS]: Add BLOCK_INPUT. + Add debug code. + 2005-10-08 Kim F. Storm * window.c (window_tree, Fwindow_tree): Rename fns added 2005-10-04. diff --git a/src/xfaces.c b/src/xfaces.c index 49ba6d334ec..f13fdf74909 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -790,7 +790,10 @@ x_create_gc (f, mask, xgcv) XGCValues *xgcv; { GC gc; + BLOCK_INPUT; gc = XCreateGC (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), mask, xgcv); + UNBLOCK_INPUT; + IF_DEBUG (++ngcs); return gc; } @@ -799,7 +802,10 @@ x_free_gc (f, gc) struct frame *f; GC gc; { + BLOCK_INPUT; + IF_DEBUG (xassert (--ngcs >= 0)); XFreeGC (FRAME_MAC_DISPLAY (f), gc); + UNBLOCK_INPUT; } #endif /* MAC_OS */ -- cgit v1.2.1 From e313fc07dda725c02e43890e59b13c9e661eec83 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sun, 9 Oct 2005 06:56:14 +0000 Subject: * emacs.c (standard_args): Removed options -i, -itype, --icon-type, added -nb, --no-bitmap-icon. * xfns.c (Fx_create_frame): Make bitmapIcon have default on. --- src/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d466f5d3bf2..d9b2eb7ab3c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2005-10-09 Jan Dj,Ad(Brv + + * emacs.c (standard_args): Removed options -i, -itype, --icon-type, + added -nb, --no-bitmap-icon. + + * xfns.c (Fx_create_frame): Make bitmapIcon have default on. + 2005-10-08 YAMAMOTO Mitsuharu * macgui.h (MAX_CLIP_RECTS): New define. -- cgit v1.2.1 From 84f2588006e1efea7ac2a7bed7198c216ea0f82c Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sun, 9 Oct 2005 06:56:31 +0000 Subject: * xfns.c (Fx_create_frame): Make bitmapIcon have default on. --- src/xfns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/xfns.c b/src/xfns.c index a0f6f3b3743..979a0a3435a 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3277,7 +3277,7 @@ This function is an internal primitive--use `make-frame' instead. */) /* We need to do this after creating the X window, so that the icon-creation functions can say whose icon they're describing. */ - x_default_parameter (f, parms, Qicon_type, Qnil, + x_default_parameter (f, parms, Qicon_type, Qt, "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); x_default_parameter (f, parms, Qauto_raise, Qnil, -- cgit v1.2.1 From 55c9bfe532eb8ab382a5219963a76bf35e438095 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sun, 9 Oct 2005 06:57:00 +0000 Subject: * emacs.c (standard_args): Removed options -i, -itype, --icon-type, added -nb, --no-bitmap-icon. --- src/emacs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/emacs.c b/src/emacs.c index 80281d4f26b..497cdd7943f 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -311,7 +311,7 @@ Display options:\n\ --fullscreen, -fs make first frame fullscreen\n\ --fullwidth, -fw make the first frame wide as the screen\n\ --geometry, -g GEOMETRY window geometry\n\ ---icon-type, -i use picture of gnu for Emacs icon\n\ +--no-bitmap-icon, -nb do not use picture of gnu for Emacs icon\n\ --iconic start Emacs in iconified state\n\ --internal-border, -ib WIDTH width between text and main border\n\ --line-spacing, -lsp PIXELS additional space to put between lines\n\ @@ -1828,8 +1828,7 @@ struct standard_args standard_args[] = { "-u", "--user", 30, 1 }, { "-user", 0, 30, 1 }, { "-debug-init", "--debug-init", 20, 0 }, - { "-i", "--icon-type", 15, 0 }, - { "-itype", 0, 15, 0 }, + { "-nb", "--no-bitmap-icon", 15, 0 }, { "-iconic", "--iconic", 15, 0 }, { "-D", "--basic-display", 12, 0}, { "-basic-display", 0, 12, 0}, -- cgit v1.2.1 From 41791a20d7136db79a0b44a281b65216de35a4cf Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sun, 9 Oct 2005 16:53:35 +0000 Subject: (Fwindow_end): Don't try to redisplay if non-interactive. --- src/ChangeLog | 6 +++++- src/window.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d9b2eb7ab3c..693ddb3bf57 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,10 @@ +2005-10-09 Romain Francoise + + * window.c (Fwindow_end): Don't try to redisplay if non-interactive. + 2005-10-09 Jan Dj,Ad(Brv - * emacs.c (standard_args): Removed options -i, -itype, --icon-type, + * emacs.c (standard_args): Removed options -i, -itype, --icon-type, added -nb, --no-bitmap-icon. * xfns.c (Fx_create_frame): Make bitmapIcon have default on. diff --git a/src/window.c b/src/window.c index 3e9354a7ba8..9ef4fc2eacd 100644 --- a/src/window.c +++ b/src/window.c @@ -1029,7 +1029,8 @@ if it isn't already recorded. */) if (! NILP (update) && ! (! NILP (w->window_end_valid) - && XFASTINT (w->last_modified) >= MODIFF)) + && XFASTINT (w->last_modified) >= MODIFF) + && !noninteractive) { struct text_pos startp; struct it it; -- cgit v1.2.1 From 008171a4e0c745ade79ab36779f8ca8c9c692f1c Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 10 Oct 2005 13:41:06 +0000 Subject: (Fwindow_tree): Fix spelling. --- src/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/window.c b/src/window.c index 9ef4fc2eacd..ff01b2c902c 100644 --- a/src/window.c +++ b/src/window.c @@ -6279,7 +6279,7 @@ is the frame's minibuffer window. If the root window is not split, ROOT is the root window itself. Otherwise, ROOT is a list (DIR EDGES W1 W2 ...) where DIR is nil for a -horisontal split, and t for a vertical split, EDGES gives the combined +horizontal split, and t for a vertical split, EDGES gives the combined size and position of the subwindows in the split, and the rest of the elements are the subwindows in the split. Each of the subwindows may again be a window or a list representing a window split, and so on. -- cgit v1.2.1 From 66a9dbbea53f608635026eb2d7b01b30b5c150c0 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 10 Oct 2005 14:52:50 +0000 Subject: (Fredirect_frame_focus): Fix typos in docstring. (next_frame, prev_frame, set_term_frame_name): Make static. --- src/frame.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/frame.c b/src/frame.c index d423138fc9a..624e1a89b86 100644 --- a/src/frame.c +++ b/src/frame.c @@ -901,7 +901,7 @@ DEFUN ("frame-list", Fframe_list, Sframe_list, If MINIBUF is 0, include all visible and iconified frames. Otherwise, include all frames. */ -Lisp_Object +static Lisp_Object next_frame (frame, minibuf) Lisp_Object frame; Lisp_Object minibuf; @@ -978,7 +978,7 @@ next_frame (frame, minibuf) If MINIBUF is 0, include all visible and iconified frames. Otherwise, include all frames. */ -Lisp_Object +static Lisp_Object prev_frame (frame, minibuf) Lisp_Object frame; Lisp_Object minibuf; @@ -1813,7 +1813,7 @@ Focus redirection is useful for temporarily redirecting keystrokes to a surrogate minibuffer frame when a frame doesn't have its own minibuffer window. -A frame's focus redirection can be changed by select-frame. If frame +A frame's focus redirection can be changed by `select-frame'. If frame FOO is selected, and then a different frame BAR is selected, any frames redirecting their focus to FOO are shifted to redirect their focus to BAR. This allows focus redirection to work properly when the @@ -1821,7 +1821,7 @@ user switches from one frame to another using `select-window'. This means that a frame whose focus is redirected to itself is treated differently from a frame whose focus is redirected to nil; the former -is affected by select-frame, while the latter is not. +is affected by `select-frame', while the latter is not. The redirection lasts until `redirect-frame-focus' is called to change it. */) (frame, focus_frame) @@ -1952,7 +1952,7 @@ frame_name_fnn_p (str, len) /* Set the name of the terminal frame. Also used by MSDOS frames. Modeled after x_set_name which is used for WINDOW frames. */ -void +static void set_term_frame_name (f, name) struct frame *f; Lisp_Object name; -- cgit v1.2.1 From 04bc79457e5c97febd4fdb3d9b5a6df754a66086 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 10 Oct 2005 14:59:07 +0000 Subject: *** empty log message *** --- src/ChangeLog | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 693ddb3bf57..d9e64625393 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2005-10-10 Juanma Barranquero + + * frame.c (Fredirect_frame_focus): Fix typos in docstring. + (next_frame, prev_frame, set_term_frame_name): Make static. + + * window.c (Fwindow_tree): Fix spelling. + 2005-10-09 Romain Francoise * window.c (Fwindow_end): Don't try to redisplay if non-interactive. @@ -219,9 +226,9 @@ * systime.h (get_operating_system_release): ... here. - * xterm.c (set_vertical_scroll_bar): Move prototype ... - (handle_one_xevent): Refer to union field to match the type - required by the function definition. + * xterm.c (handle_one_xevent): Refer to union field to match the + type required by the function definition. + (set_vertical_scroll_bar): Move prototype ... * xterm.h: ... here. -- cgit v1.2.1 From f9e36a6dc971d61c8439f0a7d0b1df5a8e77f886 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Mon, 10 Oct 2005 16:14:00 +0000 Subject: -nb changed to -nbi --- src/ChangeLog | 4 ++++ src/emacs.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d9e64625393..dada003404a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-10-10 Jan Dj,Ad(Brv + + * emacs.c (USAGE3, standard_args): -nb => -nbi + 2005-10-10 Juanma Barranquero * frame.c (Fredirect_frame_focus): Fix typos in docstring. diff --git a/src/emacs.c b/src/emacs.c index 497cdd7943f..4eee9e0e534 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -311,7 +311,7 @@ Display options:\n\ --fullscreen, -fs make first frame fullscreen\n\ --fullwidth, -fw make the first frame wide as the screen\n\ --geometry, -g GEOMETRY window geometry\n\ ---no-bitmap-icon, -nb do not use picture of gnu for Emacs icon\n\ +--no-bitmap-icon, -nbi do not use picture of gnu for Emacs icon\n\ --iconic start Emacs in iconified state\n\ --internal-border, -ib WIDTH width between text and main border\n\ --line-spacing, -lsp PIXELS additional space to put between lines\n\ @@ -1828,7 +1828,7 @@ struct standard_args standard_args[] = { "-u", "--user", 30, 1 }, { "-user", 0, 30, 1 }, { "-debug-init", "--debug-init", 20, 0 }, - { "-nb", "--no-bitmap-icon", 15, 0 }, + { "-nbi", "--no-bitmap-icon", 15, 0 }, { "-iconic", "--iconic", 15, 0 }, { "-D", "--basic-display", 12, 0}, { "-basic-display", 0, 12, 0}, -- cgit v1.2.1 From 9b909870cde9d5d7b101a3c21478f65e7d3a3b63 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Mon, 10 Oct 2005 19:02:10 +0000 Subject: (remember_mouse_glyph): New function. (note_mouse_movement): Use it to remember the current glyph if changed. (XTmouse_position): Fix calculation of fake glyph under mouse. Move code to calculate glyph under mouse into remember_mouse_glyph. --- src/ChangeLog | 9 ++++++++ src/xterm.c | 69 +++++++++++++++++++++++++++++++++++++---------------------- 2 files changed, 52 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index dada003404a..b1dca8abe3c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2005-10-10 Jason Rumney + + * xterm.c (remember_mouse_glyph): New function. + (note_mouse_movement): Use it to remember the current glyph if + changed. + (XTmouse_position): Fix calculation of fake glyph under mouse. + Move code to calculate glyph under mouse into + remember_mouse_glyph. + 2005-10-10 Jan Dj,Ad(Brv * emacs.c (USAGE3, standard_args): -nb => -nbi diff --git a/src/xterm.c b/src/xterm.c index af62cfd0c75..c2fb207bcb1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3582,6 +3582,8 @@ construct_mouse_click (result, event, f) static XMotionEvent last_mouse_motion_event; static Lisp_Object last_mouse_motion_frame; +static void remember_mouse_glyph P_ ((struct frame *, int, int)); + static void note_mouse_movement (frame, event) FRAME_PTR frame; @@ -3607,6 +3609,8 @@ note_mouse_movement (frame, event) frame->mouse_moved = 1; last_mouse_scroll_bar = Qnil; note_mouse_highlight (frame, event->x, event->y); + /* Remember which glyph we're now on. */ + remember_mouse_glyph (frame, event->x, event->y); } } @@ -3677,6 +3681,44 @@ glyph_rect (f, x, y, rect) } +/* Remember which glyph the mouse is over. + */ +static void +remember_mouse_glyph (f1, win_x, win_y) + FRAME_PTR f1; + int win_x, win_y; +{ + int width, height, gx, gy; + + /* Try getting the rectangle of the actual glyph. */ + if (!glyph_rect (f1, win_x, win_y, &last_mouse_glyph)) + { + /* If there is no glyph under the mouse, then we divide the screen + into a grid of the smallest glyph in the frame, and use that + as our "glyph". */ + width = FRAME_SMALLEST_CHAR_WIDTH (f1); + height = FRAME_SMALLEST_FONT_HEIGHT (f1); + gx = win_x; + gy = win_y; + + /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to + round down even for negative values. */ + if (gx < 0) + gx -= width - 1; + if (gy < 0) + gy -= height - 1; + + gx = gx / width * width; + gy = gy / width * width; + + last_mouse_glyph.width = width; + last_mouse_glyph.height = height; + last_mouse_glyph.x = gx; + last_mouse_glyph.y = gy; + } +} + + /* Return the current position of the mouse. *FP should be a frame which indicates which display to ask about. @@ -3863,32 +3905,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) on it, i.e. into the same rectangles that matrices on the frame are divided into. */ - int width, height, gx, gy; - XRectangle rect; - - if (glyph_rect (f1, win_x, win_y, &rect)) - last_mouse_glyph = rect; - else - { - width = FRAME_SMALLEST_CHAR_WIDTH (f1); - height = FRAME_SMALLEST_FONT_HEIGHT (f1); - gx = win_x; - gy = win_y; - - /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to - round down even for negative values. */ - if (gx < 0) - gx -= width - 1; - if (gy < 0) - gy -= height - 1; - gx = (gx + width - 1) / width * width; - gy = (gy + height - 1) / height * height; - - last_mouse_glyph.width = width; - last_mouse_glyph.height = height; - last_mouse_glyph.x = gx; - last_mouse_glyph.y = gy; - } + remember_mouse_glyph (f1, win_x, win_y); *bar_window = Qnil; *part = 0; -- cgit v1.2.1 From 58af55912424b29b7fc385bc506e2056bc25b2a6 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Mon, 10 Oct 2005 20:49:55 +0000 Subject: *** empty log message *** --- src/ChangeLog | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b1dca8abe3c..51026ce3406 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,15 +1,13 @@ 2005-10-10 Jason Rumney * xterm.c (remember_mouse_glyph): New function. - (note_mouse_movement): Use it to remember the current glyph if - changed. + (note_mouse_movement): Use it to remember the current glyph if changed. (XTmouse_position): Fix calculation of fake glyph under mouse. - Move code to calculate glyph under mouse into - remember_mouse_glyph. + Move code to calculate glyph under mouse into remember_mouse_glyph. 2005-10-10 Jan Dj,Ad(Brv - * emacs.c (USAGE3, standard_args): -nb => -nbi + * emacs.c (USAGE3, standard_args): -nb => -nbi. 2005-10-10 Juanma Barranquero @@ -24,8 +22,8 @@ 2005-10-09 Jan Dj,Ad(Brv - * emacs.c (standard_args): Removed options -i, -itype, --icon-type, - added -nb, --no-bitmap-icon. + * emacs.c (standard_args): Remove options -i, -itype, --icon-type. + Add options -nb, --no-bitmap-icon. * xfns.c (Fx_create_frame): Make bitmapIcon have default on. -- cgit v1.2.1 From 74051a928f2ad4ce263a49f4f8990d19f4e56268 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Mon, 10 Oct 2005 22:50:01 +0000 Subject: *** empty log message *** --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 51026ce3406..6f68b6a441a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-10-11 Kim F. Storm + + * keyboard.c (make_lispy_position): Fix buffer position calculation for + mouse click or movement in fringe. + 2005-10-10 Jason Rumney * xterm.c (remember_mouse_glyph): New function. -- cgit v1.2.1 From 31ab1f0585b47a6dbe54b5451e94c1ed64bf1347 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Mon, 10 Oct 2005 22:54:03 +0000 Subject: (make_lispy_position): Fix buffer position calculation for mouse click or movement in fringe. --- src/ChangeLog | 2 ++ src/keyboard.c | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6f68b6a441a..f0c9084da54 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2005-10-11 Kim F. Storm + * xterm.c (glyph_rect): Return 0 if position is outside text area. + * keyboard.c (make_lispy_position): Fix buffer position calculation for mouse click or movement in fringe. diff --git a/src/keyboard.c b/src/keyboard.c index 3826d460e3f..1d118c7a57b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5096,6 +5096,7 @@ make_lispy_position (f, x, y, time) posn = (part == ON_LEFT_FRINGE) ? Qleft_fringe : Qright_fringe; rx = 0; dx = wx; + wx = (part == ON_LEFT_FRINGE) ? 0 : window_box_width (w, TEXT_AREA); if (part == ON_RIGHT_FRINGE) dx -= (window_box_width (w, LEFT_MARGIN_AREA) + window_box_width (w, TEXT_AREA) -- cgit v1.2.1 From f0ad2f4c896ffd59f3f0e7fc3c717b52e8205c1a Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Mon, 10 Oct 2005 22:54:19 +0000 Subject: (glyph_rect): Return 0 if position is outside text area. --- src/xterm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xterm.c b/src/xterm.c index c2fb207bcb1..a4ad061e8db 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3647,8 +3647,9 @@ glyph_rect (f, x, y, rect) Lisp_Object window; struct window *w; struct glyph_row *r, *end_row; + enum window_part part; - window = window_from_coordinates (f, x, y, 0, &x, &y, 0); + window = window_from_coordinates (f, x, y, &part, &x, &y, 0); if (NILP (window)) return 0; @@ -3656,6 +3657,9 @@ glyph_rect (f, x, y, rect) r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); end_row = r + w->current_matrix->nrows - 1; + if (part != ON_TEXT) + return 0; + for (; r < end_row && r->enabled_p; ++r) { if (r->y >= y) -- cgit v1.2.1 From 71b7a47f7972000021bade3c1cab8e34a0ce9d0c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Tue, 11 Oct 2005 03:35:54 +0000 Subject: (PER_CHAR_METRIC): Remove unused macro. (fm_font_family_alist): New variable. (syms_of_macterm): Initialize and staticpro it. (decode_mac_font_name): Replace '-' in family name with '_' if it occurs just once. Lower family name. (parse_x_font_name): Rename from x_font_name_to_mac_font_name. All uses changed. Remove argument MF and code conversion for it. Add argument SIZE. Rename argument MF_DECODED to FAMILY, and CS to CHARSET. Parse font size. Lower family name. Return integer value for status of parsing. (init_font_name_table) [USE_ATSUI]: Use decode_mac_font_name. Don't use Fdowncase because family name is already lowered by decode_mac_font_name. (init_font_name_table): Always call decode_mac_font_name. Add pair of family name and its reference to fm_font_family_alist. (mac_clear_font_name_table): Clear fm_font_family_alist. (XLoadQueryFont): Move font size parsing part to parse_x_font_name. Lookup fm_font_family_alist to get font family reference. (XLoadQueryFont) [USE_ATSUI]: Don't use Fdowncase because family name is already lowered by parse_x_font_name. --- src/ChangeLog | 30 +++- src/macterm.c | 496 ++++++++++++++++++++++++++++++---------------------------- 2 files changed, 281 insertions(+), 245 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f0c9084da54..c723c3ee9c1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,26 @@ +2005-10-11 YAMAMOTO Mitsuharu + + * macterm.c (PER_CHAR_METRIC): Remove unused macro. + (fm_font_family_alist): New variable. + (syms_of_macterm): Initialize and staticpro it. + (decode_mac_font_name): Replace '-' in family name with '_' if it + occurs just once. Lower family name. + (parse_x_font_name): Rename from x_font_name_to_mac_font_name. + All uses changed. Remove argument MF and code conversion for it. + Add argument SIZE. Rename argument MF_DECODED to FAMILY, and CS + to CHARSET. Parse font size. Lower family name. Return integer + value for status of parsing. + (init_font_name_table) [USE_ATSUI]: Use decode_mac_font_name. + Don't use Fdowncase because family name is already lowered by + decode_mac_font_name. + (init_font_name_table): Always call decode_mac_font_name. Add + pair of family name and its reference to fm_font_family_alist. + (mac_clear_font_name_table): Clear fm_font_family_alist. + (XLoadQueryFont): Move font size parsing part to parse_x_font_name. + Lookup fm_font_family_alist to get font family reference. + (XLoadQueryFont) [USE_ATSUI]: Don't use Fdowncase because family + name is already lowered by parse_x_font_name. + 2005-10-11 Kim F. Storm * xterm.c (glyph_rect): Return 0 if position is outside text area. @@ -52,7 +75,7 @@ [MAC_OS_X_VERSION_MAX_ALLOWED < 1020]: Specify kATSLineFractDisable. (mac_draw_string_common) [MAC_OSX && USE_ATSUI]: Clip to clipping rectangles stored in gc. - (XFreeGC): Dispose clipping region. + (XFreeGC): Dispose of clipping region. (mac_set_clip_rectangles, mac_reset_clip_rectangles): New functions. (x_draw_fringe_bitmap, x_set_glyph_string_clipping) (x_draw_relief_rect, x_draw_box_rect, x_draw_stretch_glyph_string) @@ -3772,7 +3795,7 @@ [TARGET_API_MAC_CARBON] (Fx_file_dialog): Use MAXPATHLEN for size of filename string. Set event callback function when creating dialog boxes. Add code conversions for filenames. Don't dispose - apple event descriptor record if failed to create it. + of apple event descriptor record if failed to create it. * macterm.c: Include sys/param.h. [USE_CARBON_EVENTS] (mac_handle_window_event): Add handler for @@ -6879,7 +6902,8 @@ (x_scroll_bar_handle_click): Set `(PORTION . WHOLE)' part in a scroll-bar click event. (mac_define_frame_cursor): Change the pointer shape. - (x_free_frame_resources): Reset tip_window to NULL when it is disposed. + (x_free_frame_resources): Reset tip_window to NULL when it is + disposed of. [!TARGET_API_MAC_CARBON] (arrow_cursor): New variable. [!TARGET_API_MAC_CARBON] (do_init_managers): Initialize arrow_cursor. (do_window_update): Don't do anything if the updated window is the diff --git a/src/macterm.c b/src/macterm.c index 7d75e962e9c..2142698bbf4 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -1766,19 +1766,6 @@ static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *)); static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, int *)); -/* Return a pointer to per-char metric information in FONT of a - character pointed by B which is a pointer to an XChar2b. */ - -#define PER_CHAR_METRIC(font, b) \ - ((font)->per_char \ - ? ((font)->per_char + (b)->byte2 - (font)->min_char_or_byte2 \ - + (((font)->min_byte1 || (font)->max_byte1) \ - ? (((b)->byte1 - (font)->min_byte1) \ - * ((font)->max_char_or_byte2 - (font)->min_char_or_byte2 + 1)) \ - : 0)) \ - : &((font)->max_bounds)) - - /* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B is not contained in the font. */ @@ -6843,7 +6830,13 @@ static char **font_name_table = NULL; static int font_name_table_size = 0; static int font_name_count = 0; +/* Alist linking font family names to Font Manager font family + references (which can also be used as QuickDraw font IDs). We use + an alist because hash tables are not ready when the terminal frame + for Mac OS Classic is created. */ +static Lisp_Object fm_font_family_alist; #if USE_ATSUI +/* Hash table linking font family names to ATSU font IDs. */ static Lisp_Object atsu_font_id_hash; #endif @@ -6893,24 +6886,39 @@ decode_mac_font_name (name, size, coding_system) struct coding_system coding; char *buf, *p; - for (p = name; *p; p++) - if (!isascii (*p) || iscntrl (*p)) - break; + if (!NILP (coding_system) && !NILP (Fcoding_system_p (coding_system))) + { + for (p = name; *p; p++) + if (!isascii (*p) || iscntrl (*p)) + break; - if (*p == '\0' - || NILP (coding_system) || NILP (Fcoding_system_p (coding_system))) - return; + if (*p) + { + setup_coding_system (coding_system, &coding); + coding.src_multibyte = 0; + coding.dst_multibyte = 1; + coding.mode |= CODING_MODE_LAST_BLOCK; + coding.composing = COMPOSITION_DISABLED; + buf = (char *) alloca (size); + + decode_coding (&coding, name, buf, strlen (name), size - 1); + bcopy (buf, name, coding.produced); + name[coding.produced] = '\0'; + } + } - setup_coding_system (coding_system, &coding); - coding.src_multibyte = 0; - coding.dst_multibyte = 1; - coding.mode |= CODING_MODE_LAST_BLOCK; - coding.composing = COMPOSITION_DISABLED; - buf = (char *) alloca (size); + /* If there's just one occurrence of '-' in the family name, it is + replaced with '_'. (More than one occurrence of '-' means a + "FOUNDRY-FAMILY-CHARSET"-style name.) */ + p = strchr (name, '-'); + if (p && strchr (p + 1, '-') == NULL) + *p = '_'; - decode_coding (&coding, name, buf, strlen (name), size - 1); - bcopy (buf, name, coding.produced); - name[coding.produced] = '\0'; + for (p = name; *p; p++) + /* On Mac OS X 10.3, tolower also converts non-ASCII characters + for some locales. */ + if (isascii (*p)) + *p = tolower (*p); } @@ -6949,32 +6957,46 @@ mac_to_x_fontname (name, size, style, charset) } -/* Convert an X font spec to the corresponding mac font name, which - can then be passed to GetFNum after conversion to a Pascal string. - For ordinary Mac fonts, this should just be their names, like - "monaco", "Taipei", etc. Fonts converted from the GNU intlfonts - collection contain their charset designation in their names, like - "ETL-Fixed-iso8859-1", "ETL-Fixed-koi8-r", etc. Both types of font - names are handled accordingly. */ -static void -x_font_name_to_mac_font_name (xf, mf, mf_decoded, style, cs) - char *xf, *mf, *mf_decoded; +/* Parse fully-specified and instantiated X11 font spec XF, and store + the results to FAMILY, *SIZE, *STYLE, and CHARSET. Return 1 if the + parsing succeeded, and 0 otherwise. For FAMILY and CHARSET, the + caller must allocate at least 256 and 32 bytes respectively. For + ordinary Mac fonts, the value stored to FAMILY should just be their + names, like "monaco", "Taipei", etc. Fonts converted from the GNU + intlfonts collection contain their charset designation in their + names, like "ETL-Fixed-iso8859-1", "ETL-Fixed-koi8-r", etc. Both + types of font names are handled accordingly. */ + +const int kDefaultFontSize = 12; + +static int +parse_x_font_name (xf, family, size, style, charset) + char *xf, *family; + int *size; Style *style; - char *cs; + char *charset; { - Str31 foundry; - Str255 family; - char weight[20], slant[2], *p; - Lisp_Object charset_info, coding_system = Qnil; - struct coding_system coding; + Str31 foundry, weight; + int point_size, avgwidth; + char slant[2], *p; - strcpy (mf, ""); + if (sscanf (xf, "-%31[^-]-%255[^-]-%31[^-]-%1[^-]-%*[^-]-%*[^-]-%d-%d-%*[^-]-%*[^-]-%*c-%d-%31s", + foundry, family, weight, slant, size, + &point_size, &avgwidth, charset) != 8 + && sscanf (xf, "-%31[^-]-%255[^-]-%31[^-]-%1[^-]-%*[^-]--%d-%d-%*[^-]-%*[^-]-%*c-%d-%31s", + foundry, family, weight, slant, size, + &point_size, &avgwidth, charset) != 8) + return 0; - if (sscanf (xf, "-%31[^-]-%255[^-]-%19[^-]-%1[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%31s", - foundry, family, weight, slant, cs) != 5 && - sscanf (xf, "-%31[^-]-%255[^-]-%19[^-]-%1[^-]-%*[^-]--%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%31s", - foundry, family, weight, slant, cs) != 5) - return; + if (*size == 0) + { + if (point_size > 0) + *size = point_size / 10; + else if (avgwidth > 0) + *size = avgwidth / 10; + } + if (*size == 0) + *size = kDefaultFontSize; *style = normal; if (strcmp (weight, "bold") == 0) @@ -6982,32 +7004,31 @@ x_font_name_to_mac_font_name (xf, mf, mf_decoded, style, cs) if (*slant == 'i') *style |= italic; - charset_info = Fassoc (build_string (cs), Vmac_charset_info_alist); - if (!NILP (charset_info)) + if (NILP (Fassoc (build_string (charset), Vmac_charset_info_alist))) { - strcpy (mf_decoded, family); - coding_system = Fcar (Fcdr (Fcdr (charset_info))); + int foundry_len = strlen (foundry), family_len = strlen (family); + + if (foundry_len + family_len + strlen (charset) + 2 < sizeof (Str255)) + { + /* Like sprintf (family, "%s-%s-%s", foundry, family, charset), + but take overlap into account. */ + memmove (family + foundry_len + 1, family, family_len); + memcpy (family, foundry, foundry_len); + family[foundry_len] = '-'; + family[foundry_len + 1 + family_len] = '-'; + strcpy (family + foundry_len + 1 + family_len + 1, charset); + } + else + return 0; } - else - sprintf (mf_decoded, "%s-%s-%s", foundry, family, cs); - for (p = mf_decoded; *p; p++) - if (!isascii (*p) || iscntrl (*p)) - break; + for (p = family; *p; p++) + /* On Mac OS X 10.3, tolower also converts non-ASCII characters + for some locales. */ + if (isascii (*p)) + *p = tolower (*p); - if (*p == '\0' - || NILP (coding_system) || NILP (Fcoding_system_p (coding_system))) - strcpy (mf, mf_decoded); - else - { - setup_coding_system (coding_system, &coding); - coding.src_multibyte = 1; - coding.dst_multibyte = 0; - coding.mode |= CODING_MODE_LAST_BLOCK; - encode_coding (&coding, mf_decoded, mf, - strlen (mf_decoded), sizeof (Str255) - 1); - mf[coding.produced] = '\0'; - } + return 1; } @@ -7084,6 +7105,8 @@ init_font_name_table () kFontMacintoshPlatform, kFontNoScript, kFontNoLanguage, name_len, name, NULL, NULL); + if (err == noErr) + decode_mac_font_name (name, name_len + 1, Qnil); if (err == noErr && *name != '.' && (prev_name == NULL @@ -7099,7 +7122,7 @@ init_font_name_table () bold, cs)); add_font_name_table_entry (mac_to_x_fontname (name, 0, italic | bold, cs)); - Fputhash (Fdowncase (make_unibyte_string (name, name_len)), + Fputhash (make_unibyte_string (name, name_len), long_to_cons (font_ids[i]), atsu_font_id_hash); xfree (prev_name); prev_name = name; @@ -7149,12 +7172,14 @@ init_font_name_table () sc = GetTextEncodingBase (encoding); text_encoding_info = assq_no_quit (make_number (sc), text_encoding_info_alist); - if (!NILP (text_encoding_info)) - decode_mac_font_name (name, sizeof (name), - XCAR (XCDR (text_encoding_info))); - else + if (NILP (text_encoding_info)) text_encoding_info = assq_no_quit (make_number (kTextEncodingMacRoman), text_encoding_info_alist); + decode_mac_font_name (name, sizeof (name), + XCAR (XCDR (text_encoding_info))); + fm_font_family_alist = Fcons (Fcons (build_string (name), + make_number (ff)), + fm_font_family_alist); /* Point the instance iterator at the current font family. */ if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) @@ -7233,12 +7258,14 @@ init_font_name_table () scriptcode = FontToScript (fontnum); text_encoding_info = assq_no_quit (make_number (scriptcode), text_encoding_info_alist); - if (!NILP (text_encoding_info)) - decode_mac_font_name (name, sizeof (name), - XCAR (XCDR (text_encoding_info))); - else + if (NILP (text_encoding_info)) text_encoding_info = assq_no_quit (make_number (smRoman), text_encoding_info_alist); + decode_mac_font_name (name, sizeof (name), + XCAR (XCDR (text_encoding_info))); + fm_font_family_alist = Fcons (Fcons (build_string (name), + make_number (fontnum)), + fm_font_family_alist); do { HLock (font_handle); @@ -7294,6 +7321,7 @@ mac_clear_font_name_table () xfree (font_name_table); font_name_table = NULL; font_name_table_size = font_name_count = 0; + fm_font_family_alist = Qnil; } @@ -7602,9 +7630,6 @@ is_fully_specified_xlfd (char *p) } -const int kDefaultFontSize = 12; - - /* XLoadQueryFont creates and returns an internal representation for a font in a MacFontStruct struct. There is really no concept corresponding to "loading" a font on the Mac. But we check its @@ -7614,12 +7639,9 @@ const int kDefaultFontSize = 12; static MacFontStruct * XLoadQueryFont (Display *dpy, char *fontname) { - int i, size, point_size, avgwidth, is_two_byte_font, char_width; + int i, size, char_width; char *name; - GrafPtr port; - SInt16 old_fontnum, old_fontsize; - Style old_fontface; - Str255 mfontname, mfontname_decoded; + Str255 family; Str31 charset; SInt16 fontnum; #if USE_ATSUI @@ -7633,10 +7655,6 @@ XLoadQueryFont (Display *dpy, char *fontname) short scriptcode; #endif MacFontStruct *font; - FontInfo the_fontinfo; -#ifdef MAC_OSX - UInt32 old_flags, new_flags; -#endif if (is_fully_specified_xlfd (fontname)) name = fontname; @@ -7650,32 +7668,9 @@ XLoadQueryFont (Display *dpy, char *fontname) name = SDATA (XCAR (matched_fonts)); } - GetPort (&port); /* save the current font number used */ -#if TARGET_API_MAC_CARBON - old_fontnum = GetPortTextFont (port); - old_fontsize = GetPortTextSize (port); - old_fontface = GetPortTextFace (port); -#else - old_fontnum = port->txFont; - old_fontsize = port->txSize; - old_fontface = port->txFace; -#endif - - if (sscanf (name, "-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]--%d-%d-%*[^-]-%*[^-]-%*c-%d-%*s", &size, &point_size, &avgwidth) != 3) - size = 0; - else - { - if (size == 0) - if (point_size > 0) - size = point_size / 10; - else if (avgwidth > 0) - size = avgwidth / 10; - } - if (size == 0) - size = kDefaultFontSize; + if (parse_x_font_name (name, family, &size, &fontface, charset) == 0) + return NULL; - x_font_name_to_mac_font_name (name, mfontname, mfontname_decoded, - &fontface, charset); #if USE_ATSUI if (strcmp (charset, "iso10646-1") == 0) /* XXX */ { @@ -7693,9 +7688,7 @@ XLoadQueryFont (Display *dpy, char *fontname) ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector}; Lisp_Object font_id_cons; - font_id_cons = Fgethash (Fdowncase - (make_unibyte_string (mfontname, - strlen (mfontname))), + font_id_cons = Fgethash (make_unibyte_string (family, strlen (family)), atsu_font_id_hash, Qnil); if (NILP (font_id_cons)) return NULL; @@ -7716,24 +7709,21 @@ XLoadQueryFont (Display *dpy, char *fontname) scriptcode = kTextEncodingMacUnicode; } else - { #endif - c2pstr (mfontname); + { + Lisp_Object tmp = Fassoc (build_string (family), fm_font_family_alist); + + if (NILP (tmp)) + return NULL; + fontnum = XINT (XCDR (tmp)); #if TARGET_API_MAC_CARBON - fontnum = FMGetFontFamilyFromName (mfontname); - if (fontnum == kInvalidFontFamily - || FMGetFontFamilyTextEncoding (fontnum, &encoding) != noErr) - return NULL; - scriptcode = GetTextEncodingBase (encoding); + if (FMGetFontFamilyTextEncoding (fontnum, &encoding) != noErr) + return NULL; + scriptcode = GetTextEncodingBase (encoding); #else - GetFNum (mfontname, &fontnum); - if (fontnum == 0) - return NULL; - scriptcode = FontToScript (fontnum); + scriptcode = FontToScript (fontnum); #endif -#if USE_ATSUI } -#endif font = (MacFontStruct *) xmalloc (sizeof (struct MacFontStruct)); @@ -7752,7 +7742,7 @@ XLoadQueryFont (Display *dpy, char *fontname) if (scriptcode == smJapanese && strcmp (charset, "jisx0201.1976-0") == 0) font->mac_scriptcode = smRoman; - font->full_name = mac_to_x_fontname (mfontname_decoded, size, fontface, charset); + font->full_name = mac_to_x_fontname (family, size, fontface, charset); #if USE_ATSUI if (font->mac_style) @@ -7837,130 +7827,149 @@ XLoadQueryFont (Display *dpy, char *fontname) font->max_char_or_byte2 = 0xff; } else +#endif { + GrafPtr port; + SInt16 old_fontnum, old_fontsize; + Style old_fontface; + FontInfo the_fontinfo; + int is_two_byte_font; + + /* Save the current font number used. */ + GetPort (&port); +#if TARGET_API_MAC_CARBON + old_fontnum = GetPortTextFont (port); + old_fontsize = GetPortTextSize (port); + old_fontface = GetPortTextFace (port); +#else + old_fontnum = port->txFont; + old_fontsize = port->txSize; + old_fontface = port->txFace; #endif - is_two_byte_font = font->mac_scriptcode == smJapanese || - font->mac_scriptcode == smTradChinese || - font->mac_scriptcode == smSimpChinese || - font->mac_scriptcode == smKorean; - TextFont (fontnum); - TextSize (size); - TextFace (fontface); + TextFont (fontnum); + TextSize (size); + TextFace (fontface); - GetFontInfo (&the_fontinfo); + GetFontInfo (&the_fontinfo); - font->ascent = the_fontinfo.ascent; - font->descent = the_fontinfo.descent; + font->ascent = the_fontinfo.ascent; + font->descent = the_fontinfo.descent; - if (is_two_byte_font) - { - font->min_byte1 = 0xa1; - font->max_byte1 = 0xfe; - font->min_char_or_byte2 = 0xa1; - font->max_char_or_byte2 = 0xfe; + is_two_byte_font = (font->mac_scriptcode == smJapanese + || font->mac_scriptcode == smTradChinese + || font->mac_scriptcode == smSimpChinese + || font->mac_scriptcode == smKorean); - /* Use the width of an "ideographic space" of that font because - the_fontinfo.widMax returns the wrong width for some fonts. */ - switch (font->mac_scriptcode) - { - case smJapanese: - font->min_byte1 = 0x81; - font->max_byte1 = 0xfc; - font->min_char_or_byte2 = 0x40; - font->max_char_or_byte2 = 0xfc; - char_width = StringWidth("\p\x81\x40"); - break; - case smTradChinese: - font->min_char_or_byte2 = 0x40; - char_width = StringWidth("\p\xa1\x40"); - break; - case smSimpChinese: - char_width = StringWidth("\p\xa1\xa1"); - break; - case smKorean: - char_width = StringWidth("\p\xa1\xa1"); - break; - } - } - else - { - font->min_byte1 = font->max_byte1 = 0; - font->min_char_or_byte2 = 0x20; - font->max_char_or_byte2 = 0xff; + if (is_two_byte_font) + { + font->min_byte1 = 0xa1; + font->max_byte1 = 0xfe; + font->min_char_or_byte2 = 0xa1; + font->max_char_or_byte2 = 0xfe; + + /* Use the width of an "ideographic space" of that font + because the_fontinfo.widMax returns the wrong width for + some fonts. */ + switch (font->mac_scriptcode) + { + case smJapanese: + font->min_byte1 = 0x81; + font->max_byte1 = 0xfc; + font->min_char_or_byte2 = 0x40; + font->max_char_or_byte2 = 0xfc; + char_width = StringWidth("\p\x81\x40"); + break; + case smTradChinese: + font->min_char_or_byte2 = 0x40; + char_width = StringWidth("\p\xa1\x40"); + break; + case smSimpChinese: + char_width = StringWidth("\p\xa1\xa1"); + break; + case smKorean: + char_width = StringWidth("\p\xa1\xa1"); + break; + } + } + else + { + font->min_byte1 = font->max_byte1 = 0; + font->min_char_or_byte2 = 0x20; + font->max_char_or_byte2 = 0xff; - /* Do this instead of use the_fontinfo.widMax, which incorrectly - returns 15 for 12-point Monaco! */ - char_width = CharWidth ('m'); - } + /* Do this instead of use the_fontinfo.widMax, which + incorrectly returns 15 for 12-point Monaco! */ + char_width = CharWidth ('m'); + } - if (is_two_byte_font) - { - font->per_char = NULL; + if (is_two_byte_font) + { + font->per_char = NULL; - if (fontface & italic) - font->max_bounds.rbearing = char_width + 1; - else - font->max_bounds.rbearing = char_width; - font->max_bounds.lbearing = 0; - font->max_bounds.width = char_width; - font->max_bounds.ascent = the_fontinfo.ascent; - font->max_bounds.descent = the_fontinfo.descent; + if (fontface & italic) + font->max_bounds.rbearing = char_width + 1; + else + font->max_bounds.rbearing = char_width; + font->max_bounds.lbearing = 0; + font->max_bounds.width = char_width; + font->max_bounds.ascent = the_fontinfo.ascent; + font->max_bounds.descent = the_fontinfo.descent; - font->min_bounds = font->max_bounds; - } - else - { - int c, min_width, max_width; - Rect char_bounds, min_bounds, max_bounds; - char ch; + font->min_bounds = font->max_bounds; + } + else + { + int c, min_width, max_width; + Rect char_bounds, min_bounds, max_bounds; + char ch; - font->per_char = xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); + font->per_char = xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); + bzero (font->per_char, sizeof (XCharStruct) * (0xff - 0x20 + 1)); - min_width = max_width = char_width; - SetRect (&min_bounds, -32767, -32767, 32767, 32767); - SetRect (&max_bounds, 0, 0, 0, 0); - for (c = 0x20; c <= 0xff; c++) - { - ch = c; - char_width = CharWidth (ch); - QDTextBounds (1, &ch, &char_bounds); - STORE_XCHARSTRUCT (font->per_char[c - 0x20], - char_width, char_bounds); - /* Some Japanese fonts (in SJIS encoding) return 0 as the - character width of 0x7f. */ - if (char_width > 0) + min_width = max_width = char_width; + SetRect (&min_bounds, -32767, -32767, 32767, 32767); + SetRect (&max_bounds, 0, 0, 0, 0); + for (c = 0x20; c <= 0xff; c++) { - min_width = min (min_width, char_width); - max_width = max (max_width, char_width); + ch = c; + char_width = CharWidth (ch); + QDTextBounds (1, &ch, &char_bounds); + STORE_XCHARSTRUCT (font->per_char[c - 0x20], + char_width, char_bounds); + /* Some Japanese fonts (in SJIS encoding) return 0 as + the character width of 0x7f. */ + if (char_width > 0) + { + min_width = min (min_width, char_width); + max_width = max (max_width, char_width); + } + if (!EmptyRect (&char_bounds)) + { + SetRect (&min_bounds, + max (min_bounds.left, char_bounds.left), + max (min_bounds.top, char_bounds.top), + min (min_bounds.right, char_bounds.right), + min (min_bounds.bottom, char_bounds.bottom)); + UnionRect (&max_bounds, &char_bounds, &max_bounds); + } } - if (!EmptyRect (&char_bounds)) + STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); + STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); + if (min_width == max_width + && max_bounds.left >= 0 && max_bounds.right <= max_width) { - SetRect (&min_bounds, - max (min_bounds.left, char_bounds.left), - max (min_bounds.top, char_bounds.top), - min (min_bounds.right, char_bounds.right), - min (min_bounds.bottom, char_bounds.bottom)); - UnionRect (&max_bounds, &char_bounds, &max_bounds); + /* Fixed width and no overhangs. */ + xfree (font->per_char); + font->per_char = NULL; } } - STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); - STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); - if (min_width == max_width - && max_bounds.left >= 0 && max_bounds.right <= max_width) - { - /* Fixed width and no overhangs. */ - xfree (font->per_char); - font->per_char = NULL; - } - } - TextFont (old_fontnum); /* restore previous font number, size and face */ - TextSize (old_fontsize); - TextFace (old_fontface); -#if USE_ATSUI - } -#endif + /* Restore previous font number, size and face. */ + TextFont (old_fontnum); + TextSize (old_fontsize); + TextFace (old_fontface); + } return font; } @@ -10988,14 +10997,17 @@ syms_of_macterm () staticpro (&Qreverse); Qreverse = intern ("reverse"); + staticpro (&Qmac_ready_for_drag_n_drop); + Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); + staticpro (&x_display_name_list); x_display_name_list = Qnil; staticpro (&last_mouse_scroll_bar); last_mouse_scroll_bar = Qnil; - Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); - staticpro (&Qmac_ready_for_drag_n_drop); + staticpro (&fm_font_family_alist); + fm_font_family_alist = Qnil; #if USE_ATSUI staticpro (&atsu_font_id_hash); -- cgit v1.2.1 From b25a72ab313708c70b4219916fe875fbfc20b59d Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 11 Oct 2005 08:25:27 +0000 Subject: (fn_jpeg_stdio_src): Don't define it. (init_jpeg_functions): Don't initialize `fn_jpeg_stdio_src'. (our_common_init_source): Rename from `our_init_source'. (our_common_term_source): Rename from `our_term_source'. (our_memory_fill_input_buffer): Rename from `our_fill_input_buffer'. (our_memory_skip_input_data): Rename from `our_skip_input_data'. (jpeg_memory_src): Use the new names. (struct jpeg_stdio_mgr): New struct. (JPEG_STDIO_BUFFER_SIZE): New constant. (our_stdio_fill_input_buffer, our_stdio_skip_input_data, jpeg_file_src): New functions. (jpeg_load): Use `jpeg_file_src' instead of `fn_jpeg_stdio_src'. --- src/image.c | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 132 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/image.c b/src/image.c index 3b6969b0c28..2463c24a33a 100644 --- a/src/image.c +++ b/src/image.c @@ -6358,7 +6358,6 @@ DEF_IMGLIB_FN (jpeg_finish_decompress); DEF_IMGLIB_FN (jpeg_destroy_decompress); DEF_IMGLIB_FN (jpeg_read_header); DEF_IMGLIB_FN (jpeg_read_scanlines); -DEF_IMGLIB_FN (jpeg_stdio_src); DEF_IMGLIB_FN (jpeg_std_error); DEF_IMGLIB_FN (jpeg_resync_to_restart); @@ -6374,7 +6373,6 @@ init_jpeg_functions (Lisp_Object libraries) LOAD_IMGLIB_FN (library, jpeg_read_scanlines); LOAD_IMGLIB_FN (library, jpeg_start_decompress); LOAD_IMGLIB_FN (library, jpeg_read_header); - LOAD_IMGLIB_FN (library, jpeg_stdio_src); LOAD_IMGLIB_FN (library, jpeg_CreateDecompress); LOAD_IMGLIB_FN (library, jpeg_destroy_decompress); LOAD_IMGLIB_FN (library, jpeg_std_error); @@ -6400,7 +6398,6 @@ jpeg_resync_to_restart_wrapper(cinfo, desired) #define fn_jpeg_destroy_decompress jpeg_destroy_decompress #define fn_jpeg_read_header jpeg_read_header #define fn_jpeg_read_scanlines jpeg_read_scanlines -#define fn_jpeg_stdio_src jpeg_stdio_src #define fn_jpeg_std_error jpeg_std_error #define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart @@ -6427,7 +6424,17 @@ my_error_exit (cinfo) libjpeg.doc from the JPEG lib distribution. */ static void -our_init_source (cinfo) +our_common_init_source (cinfo) + j_decompress_ptr cinfo; +{ +} + + +/* Method to terminate data source. Called by + jpeg_finish_decompress() after all data has been processed. */ + +static void +our_common_term_source (cinfo) j_decompress_ptr cinfo; { } @@ -6438,7 +6445,7 @@ our_init_source (cinfo) so this only adds a fake end of input marker at the end. */ static boolean -our_fill_input_buffer (cinfo) +our_memory_fill_input_buffer (cinfo) j_decompress_ptr cinfo; { /* Insert a fake EOI marker. */ @@ -6458,7 +6465,7 @@ our_fill_input_buffer (cinfo) is the JPEG data source manager. */ static void -our_skip_input_data (cinfo, num_bytes) +our_memory_skip_input_data (cinfo, num_bytes) j_decompress_ptr cinfo; long num_bytes; { @@ -6475,16 +6482,6 @@ our_skip_input_data (cinfo, num_bytes) } -/* Method to terminate data source. Called by - jpeg_finish_decompress() after all data has been processed. */ - -static void -our_term_source (cinfo) - j_decompress_ptr cinfo; -{ -} - - /* Set up the JPEG lib for reading an image from DATA which contains LEN bytes. CINFO is the decompression info structure created for reading the image. */ @@ -6508,16 +6505,130 @@ jpeg_memory_src (cinfo, data, len) } src = (struct jpeg_source_mgr *) cinfo->src; - src->init_source = our_init_source; - src->fill_input_buffer = our_fill_input_buffer; - src->skip_input_data = our_skip_input_data; + src->init_source = our_common_init_source; + src->fill_input_buffer = our_memory_fill_input_buffer; + src->skip_input_data = our_memory_skip_input_data; src->resync_to_restart = jpeg_resync_to_restart_wrapper; /* Use default method. */ - src->term_source = our_term_source; + src->term_source = our_common_term_source; src->bytes_in_buffer = len; src->next_input_byte = data; } +struct jpeg_stdio_mgr +{ + struct jpeg_source_mgr mgr; + boolean finished; + FILE *file; + JOCTET *buffer; +}; + + +/* Size of buffer to read JPEG from file. + Not too big, as we want to use alloc_small. */ +#define JPEG_STDIO_BUFFER_SIZE 8192 + + +/* Fill input buffer method for JPEG data source manager. Called + whenever more data is needed. The data is read from a FILE *. */ + +static boolean +our_stdio_fill_input_buffer (cinfo) + j_decompress_ptr cinfo; +{ + struct jpeg_stdio_mgr *src; + + src = (struct jpeg_stdio_mgr *) cinfo->src; + if (!src->finished) + { + size_t bytes; + + bytes = fread (src->buffer, 1, JPEG_STDIO_BUFFER_SIZE, src->file); + if (bytes > 0) + src->mgr.bytes_in_buffer = bytes; + else + { + WARNMS (cinfo, JWRN_JPEG_EOF); + src->finished = 1; + src->buffer[0] = (JOCTET) 0xFF; + src->buffer[1] = (JOCTET) JPEG_EOI; + src->mgr.bytes_in_buffer = 2; + } + src->mgr.next_input_byte = src->buffer; + } + + return 1; +} + + +/* Method to skip over NUM_BYTES bytes in the image data. CINFO->src + is the JPEG data source manager. */ + +static void +our_stdio_skip_input_data (cinfo, num_bytes) + j_decompress_ptr cinfo; + long num_bytes; +{ + struct jpeg_stdio_mgr *src; + src = (struct jpeg_stdio_mgr *) cinfo->src; + + while (num_bytes > 0 && !src->finished) + { + if (num_bytes <= src->mgr.bytes_in_buffer) + { + src->mgr.bytes_in_buffer -= num_bytes; + src->mgr.next_input_byte += num_bytes; + break; + } + else + { + num_bytes -= src->mgr.bytes_in_buffer; + src->mgr.bytes_in_buffer = 0; + src->mgr.next_input_byte = NULL; + + our_stdio_fill_input_buffer (cinfo); + } + } +} + + +/* Set up the JPEG lib for reading an image from a FILE *. + CINFO is the decompression info structure created for + reading the image. */ + +static void +jpeg_file_src (cinfo, fp) + j_decompress_ptr cinfo; + FILE *fp; +{ + struct jpeg_stdio_mgr *src; + + if (cinfo->src != NULL) + src = (struct jpeg_stdio_mgr *) cinfo->src; + else + { + /* First time for this JPEG object? */ + cinfo->src = (struct jpeg_source_mgr *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + sizeof (struct jpeg_stdio_mgr)); + src = (struct jpeg_stdio_mgr *) cinfo->src; + src->buffer = (JOCTET *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + JPEG_STDIO_BUFFER_SIZE); + } + + src->file = fp; + src->finished = 0; + src->mgr.init_source = our_common_init_source; + src->mgr.fill_input_buffer = our_stdio_fill_input_buffer; + src->mgr.skip_input_data = our_stdio_skip_input_data; + src->mgr.resync_to_restart = jpeg_resync_to_restart_wrapper; /* Use default method. */ + src->mgr.term_source = our_common_term_source; + src->mgr.bytes_in_buffer = 0; + src->mgr.next_input_byte = NULL; +} + + /* Load image IMG for use on frame F. Patterned after example.c from the JPEG lib. */ @@ -6601,7 +6712,7 @@ jpeg_load (f, img) fn_jpeg_CreateDecompress (&cinfo, JPEG_LIB_VERSION, sizeof (cinfo)); if (NILP (specified_data)) - fn_jpeg_stdio_src (&cinfo, (FILE *) fp); + jpeg_file_src (&cinfo, (FILE *) fp); else jpeg_memory_src (&cinfo, SDATA (specified_data), SBYTES (specified_data)); -- cgit v1.2.1 From 2d4713aa66331fd3067ce46409dcd3f8e9f10218 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 11 Oct 2005 08:32:08 +0000 Subject: *** empty log message *** --- src/ChangeLog | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c723c3ee9c1..ee79add8dba 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2005-10-11 Juanma Barranquero + + * image.c (fn_jpeg_stdio_src): Don't define it. + (init_jpeg_functions): Don't initialize `fn_jpeg_stdio_src'. + (our_common_init_source): Rename from `our_init_source'. + (our_common_term_source): Rename from `our_term_source'. + (our_memory_fill_input_buffer): Rename from + `our_fill_input_buffer'. + (our_memory_skip_input_data): Rename from `our_skip_input_data'. + (jpeg_memory_src): Use the new names. + (struct jpeg_stdio_mgr): New struct. + (JPEG_STDIO_BUFFER_SIZE): New constant. + (our_stdio_fill_input_buffer, our_stdio_skip_input_data) + (jpeg_file_src): New functions. + (jpeg_load): Use `jpeg_file_src' instead of `fn_jpeg_stdio_src'. + 2005-10-11 YAMAMOTO Mitsuharu * macterm.c (PER_CHAR_METRIC): Remove unused macro. @@ -1620,7 +1636,7 @@ 2005-06-04 Jan Dj,Ad(Brv * macmenu.c (cleanup_popup_menu): New function. - (Fx_popup_menu): unwind protect cleanup_popup_menu in case + (Fx_popup_menu): Unwind protect cleanup_popup_menu in case mac_menu_show Quit:s. (mac_menu_show): Quit on cancel if not popped up on click (i.e. a dialog). @@ -16922,7 +16938,7 @@ * w32.c (sys_getpeername, fcntl): New functions. (_sys_read_ahead): Temporarily block on non-blocking sockets. - * w32proc.c: include sys/file.h. + * w32proc.c: Include sys/file.h. 2002-05-03 Colin Walters -- cgit v1.2.1 From 55a4ac3e2001588ae0c48a7f48f76bfff1479dc8 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 15:06:48 +0000 Subject: *** empty log message *** --- src/ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ee79add8dba..5b089a24505 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2005-10-11 Kim F. Storm + + * window.c (coordinates_in_window): Fix returned y position when + ON_SCROLL_BAR. + + * keyboard.c (make_lispy_position): Fix buffer calculations for + mouse click or movement in right fringe and the margins. + 2005-10-11 Juanma Barranquero * image.c (fn_jpeg_stdio_src): Don't define it. -- cgit v1.2.1 From 4d1add72eb8cf8a01a13d087855545625e3205ec Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 15:07:07 +0000 Subject: (coordinates_in_window): Fix returned y position when ON_SCROLL_BAR. --- src/window.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/window.c b/src/window.c index ff01b2c902c..17c8f52c286 100644 --- a/src/window.c +++ b/src/window.c @@ -682,7 +682,10 @@ coordinates_in_window (w, x, y) /* Outside any interesting column? */ if (*x < left_x || *x > right_x) - return ON_SCROLL_BAR; + { + *y -= top_y; + return ON_SCROLL_BAR; + } lmargin_width = window_box_width (w, LEFT_MARGIN_AREA); rmargin_width = window_box_width (w, RIGHT_MARGIN_AREA); -- cgit v1.2.1 From a65fc2c39764e81adc7359ce18e95f1990285b81 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 15:07:28 +0000 Subject: (make_lispy_position): Fix buffer calculations for mouse click or movement in right fringe and the margins. --- src/keyboard.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/keyboard.c b/src/keyboard.c index 1d118c7a57b..56419ef5679 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5090,21 +5090,37 @@ make_lispy_position (f, x, y, time) &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); + if (part == ON_LEFT_MARGIN) + wx = 0; + else + wx = window_box_right_offset (w, TEXT_AREA) - 1; + } + else if (part == ON_LEFT_FRINGE) + { + posn = Qleft_fringe; + rx = 0; + dx = wx; + wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? 0 + : window_box_width (w, LEFT_MARGIN_AREA)); + dx -= wx; } - else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE) + else if (part == ON_RIGHT_FRINGE) { - posn = (part == ON_LEFT_FRINGE) ? Qleft_fringe : Qright_fringe; + posn = Qright_fringe; rx = 0; dx = wx; - wx = (part == ON_LEFT_FRINGE) ? 0 : window_box_width (w, TEXT_AREA); - if (part == ON_RIGHT_FRINGE) - dx -= (window_box_width (w, LEFT_MARGIN_AREA) - + window_box_width (w, TEXT_AREA) - + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? window_box_width (w, RIGHT_MARGIN_AREA) - : 0)); - else if (!WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - dx -= window_box_width (w, LEFT_MARGIN_AREA); + wx = (window_box_width (w, LEFT_MARGIN_AREA) + + window_box_width (w, TEXT_AREA) + + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? window_box_width (w, RIGHT_MARGIN_AREA) + : 0)); + dx -= wx; + } + else + { + /* Note: We have no special posn for part == ON_SCROLL_BAR. */ + wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); } if (textpos < 0) @@ -5113,7 +5129,6 @@ make_lispy_position (f, x, y, time) struct display_pos p; int dx2, dy2; int width2, height2; - wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); string2 = buffer_posn_from_coords (w, &wx, &wy, &p, &object2, &dx2, &dy2, &width2, &height2); -- cgit v1.2.1 From f727012811582df647c0221f7a43d710e0998137 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Tue, 11 Oct 2005 15:18:36 +0000 Subject: *** empty log message *** --- src/ChangeLog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5b089a24505..0f8adef5759 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -110,7 +110,7 @@ * macterm.h (mac_term_init): Add types to extern. (struct mac_output): Remove members mWP and pending_menu_activation. - Put members scroll_bar_foreground_pixel and + Put members scroll_bar_foreground_pixel and scroll_bar_background_pixel in #if 0. (FRAME_MAC_WINDOW, FRAME_X_WINDOW): Use window_desc. @@ -149,11 +149,11 @@ (get_glyph_string_clip_rect): Use get_glyph_string_clip_rects. (fill_composite_glyph_string, fill_glyph_string, draw_glyphs): Rename argument OVERLAPS_P to OVERLAPS. All uses in macros changed. - (x_fix_overlapping_area): Add OVERLAPS arg. Pass it to draw_glyphs. + (x_fix_overlapping_area): Add OVERLAPS arg. Pass it to draw_glyphs. (draw_phys_cursor_glyph): Set width of erased cursor to use it for calculating clipping rectangles later. Call x_fix_overlapping_area with new OVERLAPS arg to draw only erased cursor area. - (expose_overlaps): Call x_fix_overlapping_area with new OVERLAPS arg + (expose_overlaps): Call x_fix_overlapping_area with new OVERLAPS arg to draw overlaps in both preceding and succeeding rows. * xterm.c, w32term.c, macterm.c: Rename member for_overlaps_p in -- cgit v1.2.1 From d76432f581bd62ff107336cbbb57b884d0cd891c Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 22:21:36 +0000 Subject: *** empty log message *** --- src/ChangeLog | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0f8adef5759..ed10e9e17d3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,11 @@ +2005-10-12 Kim F. Storm + + * window.c (coordinates_in_window): Fix x position for ON_RIGHT_MARGIN. + Fix x position for ON_TEXT when left margin width > 0. + 2005-10-11 Kim F. Storm - * window.c (coordinates_in_window): Fix returned y position when - ON_SCROLL_BAR. + * window.c (coordinates_in_window): Fix y position for ON_SCROLL_BAR. * keyboard.c (make_lispy_position): Fix buffer calculations for mouse click or movement in right fringe and the margins. -- cgit v1.2.1 From 66d41723c56b69b7358f22c485e079384b6fade9 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 22:21:50 +0000 Subject: (coordinates_in_window): Fix x position for ON_RIGHT_MARGIN. Fix x position for ON_TEXT when left margin width > 0. --- src/window.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/window.c b/src/window.c index 17c8f52c286..a9e2569cbf1 100644 --- a/src/window.c +++ b/src/window.c @@ -742,9 +742,9 @@ coordinates_in_window (w, x, y) ? (*x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) : (*x >= right_x - rmargin_width))) { - *x -= right_x; - if (!WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - *x -= WINDOW_RIGHT_FRINGE_WIDTH (w); + *x -= right_x - rmargin_width; + if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) + *x += WINDOW_RIGHT_FRINGE_WIDTH (w); *y -= top_y; return ON_RIGHT_MARGIN; } @@ -756,7 +756,7 @@ coordinates_in_window (w, x, y) } /* Everything special ruled out - must be on text area */ - *x -= left_x + WINDOW_LEFT_FRINGE_WIDTH (w); + *x -= text_left; *y -= top_y; return ON_TEXT; } -- cgit v1.2.1 From 7a1277840dddc133eb1160e133daaaa76a0766f3 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 22:35:06 +0000 Subject: *** empty log message *** --- src/ChangeLog | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ed10e9e17d3..d8c93e96754 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,25 @@ 2005-10-12 Kim F. Storm + * xdisp.c (remember_mouse_glyph): New generic version based on + glyph_rect and remember_mouse_glyph from xterm.c enhanced to + properly handle all different window areas. + + * dispextern.h (remember_mouse_glyph): Add prototype. + + * xterm.c (glyph_rect, remember_mouse_glyph): Remove X versions. + (note_mouse_movement, XTmouse_position): Use generic + remember_mouse_glyph, add last_mouse_glyph arg. + + * w32term.c (note_mouse_movement): Fix last_mouse_glyph check. + (glyph_rect, remember_mouse_glyph): Remove w32 specific versions. + (note_mouse_movement, w32_mouse_position): Use generic + remember_mouse_glyph, add last_mouse_glyph arg. + + * macterm.c (note_mouse_movement): Add call to remember_mouse_glyph. + (glyph_rect, remember_mouse_glyph): Remove mac specific versions. + (XTmouse_position): Adapt to use generic remember_mouse_glyph + instead of pixel_to_glyph_coords. + * window.c (coordinates_in_window): Fix x position for ON_RIGHT_MARGIN. Fix x position for ON_TEXT when left margin width > 0. -- cgit v1.2.1 From d7f18f68ff720399e4a8a48ba27b218f93992203 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 22:35:22 +0000 Subject: (remember_mouse_glyph): Add prototype. --- src/dispextern.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/dispextern.h b/src/dispextern.h index 63922183a0b..5700a958cd3 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2615,6 +2615,8 @@ int estimate_mode_line_height P_ ((struct frame *, enum face_id)); void pixel_to_glyph_coords P_ ((struct frame *, int, int, int *, int *, NativeRectangle *, int)); int glyph_to_pixel_coords P_ ((struct window *, int, int, int *, int *)); +void remember_mouse_glyph P_ ((struct frame *, int, int, NativeRectangle *)); + void mark_window_display_accurate P_ ((Lisp_Object, int)); void redisplay_preserve_echo_area P_ ((int)); void set_cursor_from_row P_ ((struct window *, struct glyph_row *, -- cgit v1.2.1 From e2570d37b26c728ac4b5d90c7f6e362b880ba243 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 22:35:40 +0000 Subject: (note_mouse_movement): Add call to remember_mouse_glyph. (glyph_rect, remember_mouse_glyph): Remove mac specific versions. (XTmouse_position): Adapt to use generic remember_mouse_glyph instead of pixel_to_glyph_coords. --- src/macterm.c | 173 ++++++++++++++-------------------------------------------- 1 file changed, 41 insertions(+), 132 deletions(-) (limited to 'src') diff --git a/src/macterm.c b/src/macterm.c index 2142698bbf4..e18f3ee48a0 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -4190,6 +4190,8 @@ note_mouse_movement (frame, pos) frame->mouse_moved = 1; last_mouse_scroll_bar = Qnil; note_mouse_highlight (frame, pos->h, pos->v); + /* Remember which glyph we're now on. */ + remember_mouse_glyph (frame, pos->h, pos->v, &last_mouse_glyph); } } @@ -4198,9 +4200,6 @@ note_mouse_movement (frame, pos) Mouse Face ************************************************************************/ -static int glyph_rect P_ ((struct frame *f, int, int, Rect *)); - - /* MAC TODO: This should be called from somewhere (or removed) ++KFS */ static void @@ -4214,110 +4213,6 @@ redo_mouse_highlight () } -/* Try to determine frame pixel position and size of the glyph under - frame pixel coordinates X/Y on frame F . Return the position and - size in *RECT. Value is non-zero if we could compute these - values. */ - -static int -glyph_rect (f, x, y, rect) - struct frame *f; - int x, y; - Rect *rect; -{ - Lisp_Object window; - - window = window_from_coordinates (f, x, y, 0, &x, &y, 0); - - if (!NILP (window)) - { - struct window *w = XWINDOW (window); - struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); - struct glyph_row *end = r + w->current_matrix->nrows - 1; - - for (; r < end && r->enabled_p; ++r) - if (r->y <= y && r->y + r->height > y) - { - /* Found the row at y. */ - struct glyph *g = r->glyphs[TEXT_AREA]; - struct glyph *end = g + r->used[TEXT_AREA]; - int gx; - - rect->top = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); - rect->bottom = rect->top + r->height; - - if (x < r->x) - { - /* x is to the left of the first glyph in the row. */ - /* Shouldn't this be a pixel value? - WINDOW_LEFT_EDGE_X (w) seems to be the right value. - ++KFS */ - rect->left = WINDOW_LEFT_EDGE_COL (w); - rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x); - return 1; - } - - for (gx = r->x; g < end; gx += g->pixel_width, ++g) - if (gx <= x && gx + g->pixel_width > x) - { - /* x is on a glyph. */ - rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); - rect->right = rect->left + g->pixel_width; - return 1; - } - - /* x is to the right of the last glyph in the row. */ - rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); - /* Shouldn't this be a pixel value? - WINDOW_RIGHT_EDGE_X (w) seems to be the right value. - ++KFS */ - rect->right = WINDOW_RIGHT_EDGE_COL (w); - return 1; - } - } - - /* The y is not on any row. */ - return 0; -} - -/* MAC TODO: This should be called from somewhere (or removed) ++KFS */ - -/* Record the position of the mouse in last_mouse_glyph. */ -static void -remember_mouse_glyph (f1, gx, gy) - struct frame * f1; - int gx, gy; -{ - if (!glyph_rect (f1, gx, gy, &last_mouse_glyph)) - { - int width = FRAME_SMALLEST_CHAR_WIDTH (f1); - int height = FRAME_SMALLEST_FONT_HEIGHT (f1); - - /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to - round down even for negative values. */ - if (gx < 0) - gx -= width - 1; - if (gy < 0) - gy -= height - 1; -#if 0 - /* This was the original code from XTmouse_position, but it seems - to give the position of the glyph diagonally next to the one - the mouse is over. */ - gx = (gx + width - 1) / width * width; - gy = (gy + height - 1) / height * height; -#else - gx = gx / width * width; - gy = gy / height * height; -#endif - - last_mouse_glyph.left = gx; - last_mouse_glyph.top = gy; - last_mouse_glyph.right = gx + width; - last_mouse_glyph.bottom = gy + height; - } -} - - static struct frame * mac_focus_frame (dpyinfo) struct mac_display_info *dpyinfo; @@ -4333,18 +4228,18 @@ mac_focus_frame (dpyinfo) /* Return the current position of the mouse. - *fp should be a frame which indicates which display to ask about. + *FP should be a frame which indicates which display to ask about. - If the mouse movement started in a scroll bar, set *fp, *bar_window, - and *part to the frame, window, and scroll bar part that the mouse - is over. Set *x and *y to the portion and whole of the mouse's + If the mouse movement started in a scroll bar, set *FP, *BAR_WINDOW, + and *PART to the frame, window, and scroll bar part that the mouse + is over. Set *X and *Y to the portion and whole of the mouse's position on the scroll bar. - If the mouse movement started elsewhere, set *fp to the frame the - mouse is on, *bar_window to nil, and *x and *y to the character cell + If the mouse movement started elsewhere, set *FP to the frame the + mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell the mouse is over. - Set *time to the server time-stamp for the time at which the mouse + Set *TIME to the server time-stamp for the time at which the mouse was at this position. Don't store anything if we don't have a valid set of values to report. @@ -4361,11 +4256,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) Lisp_Object *x, *y; unsigned long *time; { - Point mouse_pos; - int ignore1, ignore2; - struct frame *f = mac_focus_frame (FRAME_MAC_DISPLAY_INFO (*fp)); - WindowPtr wp = FRAME_MAC_WINDOW (f); - Lisp_Object frame, tail; + FRAME_PTR f1; BLOCK_INPUT; @@ -4373,25 +4264,43 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); else { + Lisp_Object frame, tail; + /* Clear the mouse-moved flag for every frame on this display. */ FOR_EACH_FRAME (tail, frame) - XFRAME (frame)->mouse_moved = 0; + XFRAME (frame)->mouse_moved = 0; last_mouse_scroll_bar = Qnil; - SetPortWindowPort (wp); - - GetMouse (&mouse_pos); - - pixel_to_glyph_coords (f, mouse_pos.h, mouse_pos.v, &ignore1, &ignore2, - &last_mouse_glyph, insist); + if (FRAME_MAC_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame + && FRAME_LIVE_P (last_mouse_frame)) + f1 = last_mouse_frame; + else + f1 = mac_focus_frame (FRAME_MAC_DISPLAY_INFO (*fp)); - *bar_window = Qnil; - *part = scroll_bar_handle; - *fp = f; - XSETINT (*x, mouse_pos.h); - XSETINT (*y, mouse_pos.v); - *time = last_mouse_movement_time; + if (f1) + { + /* Ok, we found a frame. Store all the values. + last_mouse_glyph is a rectangle used to reduce the + generation of mouse events. To not miss any motion + events, we must divide the frame into rectangles of the + size of the smallest character that could be displayed + on it, i.e. into the same rectangles that matrices on + the frame are divided into. */ + Point mouse_pos; + + SetPortWindowPort (FRAME_MAC_WINDOW (f1)); + GetMouse (&mouse_pos); + remember_mouse_glyph (f1, mouse_pos.h, mouse_pos.v, + &last_mouse_glyph); + + *bar_window = Qnil; + *part = 0; + *fp = f1; + XSETINT (*x, mouse_pos.h); + XSETINT (*y, mouse_pos.v); + *time = last_mouse_movement_time; + } } UNBLOCK_INPUT; -- cgit v1.2.1 From 1bb92ecaf315a4327bbdd9a98f0b9504d6ede91f Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 22:36:35 +0000 Subject: (note_mouse_movement): Fix last_mouse_glyph check. (glyph_rect, remember_mouse_glyph): Remove w32 specific versions. (note_mouse_movement, w32_mouse_position): Use generic remember_mouse_glyph, add last_mouse_glyph arg. --- src/w32term.c | 114 +++------------------------------------------------------- 1 file changed, 4 insertions(+), 110 deletions(-) (limited to 'src') diff --git a/src/w32term.c b/src/w32term.c index 7e352bfd50d..96d26344b53 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -3204,8 +3204,6 @@ construct_drag_n_drop (result, msg, f) static MSG last_mouse_motion_event; static Lisp_Object last_mouse_motion_frame; -static void remember_mouse_glyph P_ ((struct frame *, int, int)); - static void note_mouse_movement (frame, msg) FRAME_PTR frame; @@ -3227,9 +3225,9 @@ note_mouse_movement (frame, msg) /* Has the mouse moved off the glyph it was on at the last sighting? */ else if (mouse_x < last_mouse_glyph.left - || mouse_x > last_mouse_glyph.right + || mouse_x >= last_mouse_glyph.right || mouse_y < last_mouse_glyph.top - || mouse_y > last_mouse_glyph.bottom) + || mouse_y >= last_mouse_glyph.bottom) { frame->mouse_moved = 1; last_mouse_scroll_bar = Qnil; @@ -3238,7 +3236,7 @@ note_mouse_movement (frame, msg) gets called when mouse tracking is enabled but we also need to keep track of the mouse for help_echo and highlighting at other times. */ - remember_mouse_glyph (frame, mouse_x, mouse_y); + remember_mouse_glyph (frame, mouse_x, mouse_y, &last_mouse_glyph); } } @@ -3250,8 +3248,6 @@ note_mouse_movement (frame, msg) static struct scroll_bar *x_window_to_scroll_bar (); static void x_scroll_bar_report_motion (); static void x_check_fullscreen P_ ((struct frame *)); -static int glyph_rect P_ ((struct frame *f, int, int, RECT *)); - static void redo_mouse_highlight () @@ -3270,108 +3266,6 @@ w32_define_cursor (window, cursor) { PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); } - -/* Try to determine frame pixel position and size of the glyph under - frame pixel coordinates X/Y on frame F . Return the position and - size in *RECT. Value is non-zero if we could compute these - values. */ - -static int -glyph_rect (f, x, y, rect) - struct frame *f; - int x, y; - RECT *rect; -{ - Lisp_Object window; - - window = window_from_coordinates (f, x, y, 0, &x, &y, 0); - - if (!NILP (window)) - { - struct window *w = XWINDOW (window); - struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); - struct glyph_row *end = r + w->current_matrix->nrows - 1; - - for (; r < end && r->enabled_p; ++r) - if (r->y <= y && r->y + r->height > y) - { - /* Found the row at y. */ - struct glyph *g = r->glyphs[TEXT_AREA]; - struct glyph *end = g + r->used[TEXT_AREA]; - int gx; - - rect->top = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); - rect->bottom = rect->top + r->height; - - if (x < r->x) - { - /* x is to the left of the first glyph in the row. */ - /* Shouldn't this be a pixel value? - WINDOW_LEFT_EDGE_X (w) seems to be the right value. - ++KFS */ - rect->left = WINDOW_LEFT_EDGE_COL (w); - rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x); - return 1; - } - - for (gx = r->x; g < end; gx += g->pixel_width, ++g) - if (gx <= x && gx + g->pixel_width > x) - { - /* x is on a glyph. */ - rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); - rect->right = rect->left + g->pixel_width; - return 1; - } - - /* x is to the right of the last glyph in the row. */ - rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); - /* Shouldn't this be a pixel value? - WINDOW_RIGHT_EDGE_X (w) seems to be the right value. - ++KFS */ - rect->right = WINDOW_RIGHT_EDGE_COL (w); - return 1; - } - } - - /* The y is not on any row. */ - return 0; -} - -/* Record the position of the mouse in last_mouse_glyph. */ -static void -remember_mouse_glyph (f1, gx, gy) - struct frame * f1; - int gx, gy; -{ - if (!glyph_rect (f1, gx, gy, &last_mouse_glyph)) - { - int width = FRAME_SMALLEST_CHAR_WIDTH (f1); - int height = FRAME_SMALLEST_FONT_HEIGHT (f1); - - /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to - round down even for negative values. */ - if (gx < 0) - gx -= width - 1; - if (gy < 0) - gy -= height - 1; -#if 0 - /* This was the original code from XTmouse_position, but it seems - to give the position of the glyph diagonally next to the one - the mouse is over. */ - gx = (gx + width - 1) / width * width; - gy = (gy + height - 1) / height * height; -#else - gx = gx / width * width; - gy = gy / height * height; -#endif - - last_mouse_glyph.left = gx; - last_mouse_glyph.top = gy; - last_mouse_glyph.right = gx + width; - last_mouse_glyph.bottom = gy + height; - } -} - /* Return the current position of the mouse. *fp should be a frame which indicates which display to ask about. @@ -3474,7 +3368,7 @@ w32_mouse_position (fp, insist, bar_window, part, x, y, time) || insist); #else ScreenToClient (FRAME_W32_WINDOW (f1), &pt); - remember_mouse_glyph (f1, pt.x, pt.y); + remember_mouse_glyph (f1, pt.x, pt.y, &last_mouse_glyph); #endif *bar_window = Qnil; -- cgit v1.2.1 From 984c107d5e0904a8446faf575f12305f7422ad70 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 22:36:46 +0000 Subject: (remember_mouse_glyph): New generic version based on glyph_rect and remember_mouse_glyph from xterm.c enhanced to properly handle all different window areas. --- src/xdisp.c | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) (limited to 'src') diff --git a/src/xdisp.c b/src/xdisp.c index 9e29bfa0e46..14757b92c59 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2027,6 +2027,181 @@ get_phys_cursor_geometry (w, row, glyph, heightp) return WINDOW_TO_FRAME_PIXEL_Y (w, y); } +/* + * Remember which glyph the mouse is over. + */ + +void +remember_mouse_glyph (f, gx, gy, rect) + struct frame *f; + int gx, gy; + NativeRectangle *rect; +{ + Lisp_Object window; + struct window *w; + struct glyph_row *r, *gr, *end_row; + enum window_part part; + enum glyph_row_area area; + int x, y, width, height; + + /* Try to determine frame pixel position and size of the glyph under + frame pixel coordinates X/Y on frame F. */ + + window = window_from_coordinates (f, gx, gy, &part, &x, &y, 0); + if (NILP (window)) + { + width = FRAME_SMALLEST_CHAR_WIDTH (f); + height = FRAME_SMALLEST_FONT_HEIGHT (f); + goto virtual_glyph; + } + + w = XWINDOW (window); + width = WINDOW_FRAME_COLUMN_WIDTH (w); + height = WINDOW_FRAME_LINE_HEIGHT (w); + + r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); + end_row = r + w->current_matrix->nrows - 1; + + if (w->pseudo_window_p) + { + area = TEXT_AREA; + part = ON_MODE_LINE; /* Don't adjust margin. */ + goto text_glyph; + } + + switch (part) + { + case ON_LEFT_MARGIN: + area = LEFT_MARGIN_AREA; + goto text_glyph; + + case ON_RIGHT_MARGIN: + area = RIGHT_MARGIN_AREA; + goto text_glyph; + + case ON_TEXT: + case ON_MODE_LINE: + case ON_HEADER_LINE: + area = TEXT_AREA; + + text_glyph: + gr = 0; gy = 0; + for (; r < end_row && r->enabled_p; ++r) + if (r->y + r->height > y) + { + gr = r; gy = r->y; + break; + } + + if (gr && gy <= y) + { + struct glyph *g = gr->glyphs[area]; + struct glyph *end = g + gr->used[area]; + + height = gr->height; + for (gx = gr->x; g < end; gx += g->pixel_width, ++g) + if (gx + g->pixel_width > x) + break; + + if (g < end) + width = g->pixel_width; + else + { + /* Use nominal char spacing at end of line. */ + x -= gx; + gx += (x / width) * width; + } + + if (part != ON_MODE_LINE && part != ON_HEADER_LINE) + gx += window_box_left_offset (w, area); + } + else + { + /* Use nominal line height at end of window. */ + gx = (x / width) * width; + y -= gy; + gy += (y / height) * height; + } + break; + + case ON_LEFT_FRINGE: + gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w) + : window_box_right_offset (w, LEFT_MARGIN_AREA)); + width = WINDOW_LEFT_FRINGE_WIDTH (w); + goto row_glyph; + + case ON_RIGHT_FRINGE: + gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? window_box_right_offset (w, RIGHT_MARGIN_AREA) + : window_box_right_offset (w, TEXT_AREA)); + width = WINDOW_RIGHT_FRINGE_WIDTH (w); + goto row_glyph; + + case ON_SCROLL_BAR: + gx = (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) + ? 0 + : (window_box_right_offset (w, RIGHT_MARGIN_AREA) + + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? WINDOW_RIGHT_FRINGE_WIDTH (w) + : 0))); + width = WINDOW_SCROLL_BAR_AREA_WIDTH (w); + + row_glyph: + gr = 0, gy = 0; + for (; r < end_row && r->enabled_p; ++r) + if (r->y + r->height > y) + { + gr = r; gy = r->y; + break; + } + + if (gr && gy <= y) + height = gr->height; + else + { + /* Use nominal line height at end of window. */ + y -= gy; + gy += (y / height) * height; + } + break; + + default: + ; + virtual_glyph: + /* If there is no glyph under the mouse, then we divide the screen + into a grid of the smallest glyph in the frame, and use that + as our "glyph". */ + + /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to + round down even for negative values. */ + if (gx < 0) + gx -= width - 1; + if (gy < 0) + gy -= height - 1; + + gx = (gx / width) * width; + gy = (gy / height) * height; + + goto store_rect; + } + + gx += WINDOW_LEFT_EDGE_X (w); + gy += WINDOW_TOP_EDGE_Y (w); + + store_rect: + STORE_NATIVE_RECT (*rect, gx, gy, width, height); + + /* Visible feedback for debugging. */ +#if 0 +#if HAVE_X_WINDOWS + XDrawRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + f->output_data.x->normal_gc, + gx, gy, width, height); +#endif +#endif +} + #endif /* HAVE_WINDOW_SYSTEM */ -- cgit v1.2.1 From cc9e7d9176843a243ca4217229302c1b396dbb6e Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 11 Oct 2005 22:37:01 +0000 Subject: (glyph_rect, remember_mouse_glyph): Remove X versions. (note_mouse_movement, XTmouse_position): Use generic remember_mouse_glyph, add last_mouse_glyph arg. --- src/xterm.c | 98 ++----------------------------------------------------------- 1 file changed, 2 insertions(+), 96 deletions(-) (limited to 'src') diff --git a/src/xterm.c b/src/xterm.c index a4ad061e8db..743247771d4 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3582,8 +3582,6 @@ construct_mouse_click (result, event, f) static XMotionEvent last_mouse_motion_event; static Lisp_Object last_mouse_motion_frame; -static void remember_mouse_glyph P_ ((struct frame *, int, int)); - static void note_mouse_movement (frame, event) FRAME_PTR frame; @@ -3610,7 +3608,7 @@ note_mouse_movement (frame, event) last_mouse_scroll_bar = Qnil; note_mouse_highlight (frame, event->x, event->y); /* Remember which glyph we're now on. */ - remember_mouse_glyph (frame, event->x, event->y); + remember_mouse_glyph (frame, event->x, event->y, &last_mouse_glyph); } } @@ -3630,98 +3628,6 @@ redo_mouse_highlight () } -static int glyph_rect P_ ((struct frame *f, int, int, XRectangle *)); - - -/* Try to determine frame pixel position and size of the glyph under - frame pixel coordinates X/Y on frame F . Return the position and - size in *RECT. Value is non-zero if we could compute these - values. */ - -static int -glyph_rect (f, x, y, rect) - struct frame *f; - int x, y; - XRectangle *rect; -{ - Lisp_Object window; - struct window *w; - struct glyph_row *r, *end_row; - enum window_part part; - - window = window_from_coordinates (f, x, y, &part, &x, &y, 0); - if (NILP (window)) - return 0; - - w = XWINDOW (window); - r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); - end_row = r + w->current_matrix->nrows - 1; - - if (part != ON_TEXT) - return 0; - - for (; r < end_row && r->enabled_p; ++r) - { - if (r->y >= y) - { - struct glyph *g = r->glyphs[TEXT_AREA]; - struct glyph *end = g + r->used[TEXT_AREA]; - int gx = r->x; - while (g < end && gx < x) - gx += g->pixel_width, ++g; - if (g < end) - { - rect->width = g->pixel_width; - rect->height = r->height; - rect->x = WINDOW_TO_FRAME_PIXEL_X (w, gx); - rect->y = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); - return 1; - } - break; - } - } - - return 0; -} - - -/* Remember which glyph the mouse is over. - */ -static void -remember_mouse_glyph (f1, win_x, win_y) - FRAME_PTR f1; - int win_x, win_y; -{ - int width, height, gx, gy; - - /* Try getting the rectangle of the actual glyph. */ - if (!glyph_rect (f1, win_x, win_y, &last_mouse_glyph)) - { - /* If there is no glyph under the mouse, then we divide the screen - into a grid of the smallest glyph in the frame, and use that - as our "glyph". */ - width = FRAME_SMALLEST_CHAR_WIDTH (f1); - height = FRAME_SMALLEST_FONT_HEIGHT (f1); - gx = win_x; - gy = win_y; - - /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to - round down even for negative values. */ - if (gx < 0) - gx -= width - 1; - if (gy < 0) - gy -= height - 1; - - gx = gx / width * width; - gy = gy / width * width; - - last_mouse_glyph.width = width; - last_mouse_glyph.height = height; - last_mouse_glyph.x = gx; - last_mouse_glyph.y = gy; - } -} - /* Return the current position of the mouse. *FP should be a frame which indicates which display to ask about. @@ -3909,7 +3815,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) on it, i.e. into the same rectangles that matrices on the frame are divided into. */ - remember_mouse_glyph (f1, win_x, win_y); + remember_mouse_glyph (f1, win_x, win_y, &last_mouse_glyph); *bar_window = Qnil; *part = 0; -- cgit v1.2.1 From 76d8f04c6d9974b985be86694026feaa7f29e965 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Wed, 12 Oct 2005 09:50:50 +0000 Subject: (remember_mouse_glyph): Use MATRIX_BOTTOM_TEXT_ROW to get end of text rows. Obtain header-line/mode-line rows directly. --- src/ChangeLog | 5 +++++ src/xdisp.c | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d8c93e96754..fef8efe2c12 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-10-12 YAMAMOTO Mitsuharu + + * xdisp.c (remember_mouse_glyph): Use MATRIX_BOTTOM_TEXT_ROW to + get end of text rows. Obtain header-line/mode-line rows directly. + 2005-10-12 Kim F. Storm * xdisp.c (remember_mouse_glyph): New generic version based on diff --git a/src/xdisp.c b/src/xdisp.c index 14757b92c59..de24049d830 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2060,7 +2060,7 @@ remember_mouse_glyph (f, gx, gy, rect) height = WINDOW_FRAME_LINE_HEIGHT (w); r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); - end_row = r + w->current_matrix->nrows - 1; + end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); if (w->pseudo_window_p) { @@ -2079,20 +2079,28 @@ remember_mouse_glyph (f, gx, gy, rect) area = RIGHT_MARGIN_AREA; goto text_glyph; - case ON_TEXT: - case ON_MODE_LINE: case ON_HEADER_LINE: + case ON_MODE_LINE: + gr = (part == ON_HEADER_LINE + ? MATRIX_HEADER_LINE_ROW (w->current_matrix) + : MATRIX_MODE_LINE_ROW (w->current_matrix)); + gy = gr->y; + area = TEXT_AREA; + goto text_glyph_row_found; + + case ON_TEXT: area = TEXT_AREA; text_glyph: gr = 0; gy = 0; - for (; r < end_row && r->enabled_p; ++r) + for (; r <= end_row && r->enabled_p; ++r) if (r->y + r->height > y) { gr = r; gy = r->y; break; } + text_glyph_row_found: if (gr && gy <= y) { struct glyph *g = gr->glyphs[area]; @@ -2149,7 +2157,7 @@ remember_mouse_glyph (f, gx, gy, rect) row_glyph: gr = 0, gy = 0; - for (; r < end_row && r->enabled_p; ++r) + for (; r <= end_row && r->enabled_p; ++r) if (r->y + r->height > y) { gr = r; gy = r->y; -- cgit v1.2.1 From b639c9be359e158b50835af475af4365fdcbe932 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Wed, 12 Oct 2005 10:14:41 +0000 Subject: (init_buffer): Rename `rc' to `len' for clarity. --- src/ChangeLog | 4 ++++ src/buffer.c | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index fef8efe2c12..340f8e1089f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-10-12 Romain Francoise + + * buffer.c (init_buffer): Rename `rc' to `len' for clarity. + 2005-10-12 YAMAMOTO Mitsuharu * xdisp.c (remember_mouse_glyph): Use MATRIX_BOTTOM_TEXT_ROW to diff --git a/src/buffer.c b/src/buffer.c index fb1ff1c22e9..c173136961e 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5114,7 +5114,7 @@ init_buffer () char *pwd; struct stat dotstat, pwdstat; Lisp_Object temp; - int rc; + int len; #ifdef USE_MMAP_FOR_BUFFERS { @@ -5141,13 +5141,13 @@ init_buffer () #ifndef VMS /* Maybe this should really use some standard subroutine whose definition is filename syntax dependent. */ - rc = strlen (pwd); - if (!(IS_DIRECTORY_SEP (pwd[rc - 1]))) + len = strlen (pwd); + if (!(IS_DIRECTORY_SEP (pwd[len - 1]))) { /* Grow buffer to add directory separator and '\0'. */ - pwd = (char *) xrealloc (pwd, rc + 2); - pwd[rc] = DIRECTORY_SEP; - pwd[rc + 1] = '\0'; + pwd = (char *) xrealloc (pwd, len + 2); + pwd[len] = DIRECTORY_SEP; + pwd[len + 1] = '\0'; } #endif /* not VMS */ -- cgit v1.2.1 From 47b40faff44bc6a9b32daab56c791bcd96eb8c57 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Wed, 12 Oct 2005 11:18:01 +0000 Subject: (note_mouse_movement): Restore help_echo_string if mouse is moved inside last_mouse_glyph. --- src/macterm.c | 2 ++ src/w32term.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/macterm.c b/src/macterm.c index e18f3ee48a0..c41e1f0ffed 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -4193,6 +4193,8 @@ note_mouse_movement (frame, pos) /* Remember which glyph we're now on. */ remember_mouse_glyph (frame, pos->h, pos->v, &last_mouse_glyph); } + else + help_echo_string = previous_help_echo_string; } diff --git a/src/w32term.c b/src/w32term.c index 96d26344b53..b6349eb63a1 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -3238,6 +3238,8 @@ note_mouse_movement (frame, msg) other times. */ remember_mouse_glyph (frame, mouse_x, mouse_y, &last_mouse_glyph); } + else + help_echo_string = previous_help_echo_string; } -- cgit v1.2.1 From 621036f968d0a33ce5ca260cfc88e51a7f18c118 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Wed, 12 Oct 2005 11:19:29 +0000 Subject: *** empty log message *** --- src/ChangeLog | 3 +++ src/xterm.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 340f8e1089f..c06400ab1a4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,9 @@ * xdisp.c (remember_mouse_glyph): Use MATRIX_BOTTOM_TEXT_ROW to get end of text rows. Obtain header-line/mode-line rows directly. + * xterm.c, w32term.c, macterm.c (note_mouse_movement): Restore + help_echo_string if mouse is moved inside last_mouse_glyph. + 2005-10-12 Kim F. Storm * xdisp.c (remember_mouse_glyph): New generic version based on diff --git a/src/xterm.c b/src/xterm.c index 743247771d4..370a35fe6e6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3610,6 +3610,8 @@ note_mouse_movement (frame, event) /* Remember which glyph we're now on. */ remember_mouse_glyph (frame, event->x, event->y, &last_mouse_glyph); } + else + help_echo_string = previous_help_echo_string; } -- cgit v1.2.1 From 78f3b91f6882c6aac85cc7bb9981b0fdd0e4b07b Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Wed, 12 Oct 2005 11:43:26 +0000 Subject: *** empty log message *** --- src/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c06400ab1a4..0708c45faf4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-10-12 Kim F. Storm + + * xterm.c (handle_one_xevent): Clear last_mouse_glyph on mouse up/down. + 2005-10-12 Romain Francoise * buffer.c (init_buffer): Rename `rc' to `len' for clarity. -- cgit v1.2.1 From ce728a0c84a71c8b075a350ec1160d0710748e05 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Wed, 12 Oct 2005 11:43:57 +0000 Subject: (handle_one_xevent): Clear last_mouse_glyph on mouse up/down. --- src/xterm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/xterm.c b/src/xterm.c index 370a35fe6e6..f6c15c1cdeb 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6634,6 +6634,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) int tool_bar_p = 0; bzero (&compose_status, sizeof (compose_status)); + bzero (&last_mouse_glyph, sizeof (last_mouse_glyph)); if (dpyinfo->grabbed && last_mouse_frame -- cgit v1.2.1 From 6de0e1a2931f6b91a0fc8de1960e86dfb714def2 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Wed, 12 Oct 2005 12:19:15 +0000 Subject: (note_mouse_movement): Undo last change. --- src/ChangeLog | 4 ++++ src/macterm.c | 2 -- src/w32term.c | 2 -- src/xterm.c | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0708c45faf4..c6de7000e88 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-10-12 YAMAMOTO Mitsuharu + + * xterm.c, w32term.c, macterm.c (note_mouse_movement): Undo last change. + 2005-10-12 Kim F. Storm * xterm.c (handle_one_xevent): Clear last_mouse_glyph on mouse up/down. diff --git a/src/macterm.c b/src/macterm.c index c41e1f0ffed..e18f3ee48a0 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -4193,8 +4193,6 @@ note_mouse_movement (frame, pos) /* Remember which glyph we're now on. */ remember_mouse_glyph (frame, pos->h, pos->v, &last_mouse_glyph); } - else - help_echo_string = previous_help_echo_string; } diff --git a/src/w32term.c b/src/w32term.c index b6349eb63a1..96d26344b53 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -3238,8 +3238,6 @@ note_mouse_movement (frame, msg) other times. */ remember_mouse_glyph (frame, mouse_x, mouse_y, &last_mouse_glyph); } - else - help_echo_string = previous_help_echo_string; } diff --git a/src/xterm.c b/src/xterm.c index f6c15c1cdeb..d9a4f9d68f6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3610,8 +3610,6 @@ note_mouse_movement (frame, event) /* Remember which glyph we're now on. */ remember_mouse_glyph (frame, event->x, event->y, &last_mouse_glyph); } - else - help_echo_string = previous_help_echo_string; } -- cgit v1.2.1 From 6e5b2385802f15d7e5cf476561bc1cd3dc1ebf8e Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 13 Oct 2005 09:29:18 +0000 Subject: (request_sigio, unrequest_sigio): Do nothing in non-interactive mode. --- src/ChangeLog | 5 +++++ src/sysdep.c | 24 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c6de7000e88..a6d056f579d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-10-13 Andreas Schwab + + * sysdep.c (request_sigio, unrequest_sigio): Do nothing in + non-interactive mode. + 2005-10-12 YAMAMOTO Mitsuharu * xterm.c, w32term.c, macterm.c (note_mouse_movement): Undo last change. diff --git a/src/sysdep.c b/src/sysdep.c index f70d4b18cff..3bc72c51193 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1012,7 +1012,7 @@ reset_sigio () void request_sigio () { - if (read_socket_hook) + if (noninteractive || read_socket_hook) return; #ifdef SIGWINCH @@ -1026,7 +1026,7 @@ request_sigio () void unrequest_sigio () { - if (read_socket_hook) + if (noninteractive || read_socket_hook) return; #ifdef SIGWINCH @@ -1044,7 +1044,7 @@ request_sigio () { int on = 1; - if (read_socket_hook) + if (noninteractive || read_socket_hook) return; ioctl (input_fd, FIOASYNC, &on); @@ -1056,7 +1056,7 @@ unrequest_sigio () { int off = 0; - if (read_socket_hook) + if (noninteractive || read_socket_hook) return; ioctl (input_fd, FIOASYNC, &off); @@ -1075,7 +1075,7 @@ request_sigio () int on = 1; sigset_t st; - if (read_socket_hook) + if (noninteractive || read_socket_hook) return; sigemptyset (&st); @@ -1090,7 +1090,7 @@ unrequest_sigio () { int off = 0; - if (read_socket_hook) + if (noninteractive || read_socket_hook) return; ioctl (input_fd, FIOASYNC, &off); @@ -1103,7 +1103,7 @@ unrequest_sigio () void request_sigio () { - if (read_socket_hook) + if (noninteractive || read_socket_hook) return; croak ("request_sigio"); @@ -1112,7 +1112,7 @@ request_sigio () void unrequest_sigio () { - if (read_socket_hook) + if (noninteractive || read_socket_hook) return; croak ("unrequest_sigio"); @@ -2235,12 +2235,16 @@ reset_sigio () void request_sigio () { + if (noninteractive) + return; croak ("request sigio"); } void unrequest_sigio () { + if (noninteractive) + return; croak ("unrequest sigio"); } @@ -2775,6 +2779,8 @@ reset_sigio () void request_sigio () { + if (noninteractive) + return; sigrelse (SIGTINT); interrupts_deferred = 0; @@ -2783,6 +2789,8 @@ request_sigio () void unrequest_sigio () { + if (noninteractive) + return; sighold (SIGTINT); interrupts_deferred = 1; -- cgit v1.2.1 From 0ea1a8afa4524e244008a7d88c3f03d2ff16a6ed Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Thu, 13 Oct 2005 22:39:06 +0000 Subject: *** empty log message *** --- src/ChangeLog | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a6d056f579d..30db0548172 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2005-10-14 Kim F. Storm + + * xterm.c (note_mouse_movement): Return 1 if mouse moved; 0 otherwise. + (handle_one_xevent): Only clear help_echo_string; restore it if + note_mouse_movement didn't record any mouse movement. + + * xdisp.c (pos_visible_p): Convert w->hscroll to pixels before use. + (remember_mouse_glyph): Clear RECT if mouse is over an image glyph. + + * keyboard.c (make_lispy_position): Adjust wx for left margin if ON_TEXT. + (Fposn_at_x_y): Fix calculation of x coordinate. + (Fposn_at_point): Return nil if point is hscrolled out of view. + 2005-10-13 Andreas Schwab * sysdep.c (request_sigio, unrequest_sigio): Do nothing in -- cgit v1.2.1 From bb339c57aaed49ad5e9dddcab8f70ac35a94d7ed Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Thu, 13 Oct 2005 22:41:21 +0000 Subject: (note_mouse_movement): Return 1 if mouse moved; 0 otherwise. (handle_one_xevent): Only clear help_echo_string; restore it if note_mouse_movement didn't record any mouse movement. --- src/xterm.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/xterm.c b/src/xterm.c index d9a4f9d68f6..0f18a3ae9fc 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3582,7 +3582,7 @@ construct_mouse_click (result, event, f) static XMotionEvent last_mouse_motion_event; static Lisp_Object last_mouse_motion_frame; -static void +static int note_mouse_movement (frame, event) FRAME_PTR frame; XMotionEvent *event; @@ -3596,10 +3596,11 @@ note_mouse_movement (frame, event) frame->mouse_moved = 1; last_mouse_scroll_bar = Qnil; note_mouse_highlight (frame, -1, -1); + return 1; } /* Has the mouse moved off the glyph it was on at the last sighting? */ - else if (event->x < last_mouse_glyph.x + if (event->x < last_mouse_glyph.x || event->x >= last_mouse_glyph.x + last_mouse_glyph.width || event->y < last_mouse_glyph.y || event->y >= last_mouse_glyph.y + last_mouse_glyph.height) @@ -3609,7 +3610,10 @@ note_mouse_movement (frame, event) note_mouse_highlight (frame, event->x, event->y); /* Remember which glyph we're now on. */ remember_mouse_glyph (frame, event->x, event->y, &last_mouse_glyph); + return 1; } + + return 0; } @@ -6483,8 +6487,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) case MotionNotify: { previous_help_echo_string = help_echo_string; - help_echo_string = help_echo_object = help_echo_window = Qnil; - help_echo_pos = -1; + help_echo_string = Qnil; if (dpyinfo->grabbed && last_mouse_frame && FRAME_LIVE_P (last_mouse_frame)) @@ -6523,7 +6526,8 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) last_window=window; } - note_mouse_movement (f, &event.xmotion); + if (!note_mouse_movement (f, &event.xmotion)) + help_echo_string = previous_help_echo_string; } else { -- cgit v1.2.1 From 8460eb1eb5129fa1b162cc92098f58bd1ad52841 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Thu, 13 Oct 2005 22:41:40 +0000 Subject: (pos_visible_p): Convert w->hscroll to pixels before use. (remember_mouse_glyph): Clear RECT if mouse is over an image glyph. --- src/xdisp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xdisp.c b/src/xdisp.c index de24049d830..f7f7898b476 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1348,7 +1348,7 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) current_header_line_height = current_mode_line_height = -1; if (visible_p && XFASTINT (w->hscroll) > 0) - *x -= XFASTINT (w->hscroll); + *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w); return visible_p; } @@ -2112,7 +2112,16 @@ remember_mouse_glyph (f, gx, gy, rect) break; if (g < end) - width = g->pixel_width; + { + if (g->type == IMAGE_GLYPH) + { + /* Don't remember when mouse is over image, as + image may have hot-spots. */ + STORE_NATIVE_RECT (*rect, 0, 0, 0, 0); + return; + } + width = g->pixel_width; + } else { /* Use nominal char spacing at end of line. */ -- cgit v1.2.1 From 6507c4c73dad972eb4f6bc224c8c22de6cbeec97 Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Thu, 13 Oct 2005 22:42:01 +0000 Subject: (make_lispy_position): Adjust wx for left margin if ON_TEXT. (Fposn_at_x_y): Fix calculation of x coordinate. (Fposn_at_point): Return nil if point is hscrolled out of view. --- src/keyboard.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/keyboard.c b/src/keyboard.c index 56419ef5679..96bc115412e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5054,7 +5054,11 @@ make_lispy_position (f, x, y, time) XSETINT (*x, wx); XSETINT (*y, wy); - if (part == ON_MODE_LINE || part == ON_HEADER_LINE) + if (part == ON_TEXT) + { + wx += WINDOW_LEFT_MARGIN_WIDTH (w); + } + else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) { /* Mode line or header line. Look for a string under the mouse that may have a `local-map' property. */ @@ -10592,11 +10596,11 @@ The `posn-' functions access elements of such lists. */) CHECK_LIVE_WINDOW (frame_or_window); w = XWINDOW (frame_or_window); - XSETINT (x, (WINDOW_TO_FRAME_PIXEL_X (w, XINT (x)) + XSETINT (x, (XINT (x) + + WINDOW_LEFT_EDGE_X (w) + (NILP (whole) ? window_box_left_offset (w, TEXT_AREA) - : - (WINDOW_LEFT_SCROLL_BAR_COLS (w) - * WINDOW_FRAME_COLUMN_WIDTH (w))))); + : 0))); XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y))); frame_or_window = w->frame; } @@ -10622,9 +10626,21 @@ The `posn-' functions access elements of such lists. */) { Lisp_Object tem; + if (NILP (window)) + window = selected_window; + tem = Fpos_visible_in_window_p (pos, window, Qt); if (!NILP (tem)) - tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window, Qnil); + { + Lisp_Object x = XCAR (tem); + Lisp_Object y = XCAR (XCDR (tem)); + + /* Point invisible due to hscrolling? */ + if (XINT (x) < 0) + return Qnil; + tem = Fposn_at_x_y (x, y, window, Qnil); + } + return tem; } -- cgit v1.2.1 From cac3d6206bd12b1c9c81a0f5411bcaf66eeb49dd Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 14 Oct 2005 07:51:51 +0000 Subject: (casify_object): Fix for the case that case conversion change the byte length. --- src/casefiddle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/casefiddle.c b/src/casefiddle.c index 454d184b99b..dee68fcf8c0 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -92,7 +92,8 @@ casify_object (flag, obj) else if (!UPPERCASEP (c) && (!inword || flag != CASE_CAPITALIZE_UP)) c = UPCASE1 (c); - if (ASCII_BYTE_P (c) || (! multibyte && SINGLE_BYTE_CHAR_P (c))) + if ((ASCII_BYTE_P (c) && from_len == 1) + || (! multibyte && SINGLE_BYTE_CHAR_P (c))) SSET (obj, i, c); else { @@ -100,7 +101,10 @@ casify_object (flag, obj) if (from_len == to_len) CHAR_STRING (c, SDATA (obj) + i); else - Faset (obj, make_number (n), make_number (c)); + { + Faset (obj, make_number (n), make_number (c)); + len += to_len - from_len; + } } if ((int) flag >= (int) CASE_CAPITALIZE) inword = SYNTAX (c) == Sword; -- cgit v1.2.1 From fed91c3814f41f8adc5a9a1c32e5c5580cea8510 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 14 Oct 2005 07:55:05 +0000 Subject: (search_buffer): Give up BM search on case-fold-search if one of a target character has a case-equivalence of different charset even if that target charcter is an ASCII. --- src/ChangeLog | 9 +++++++++ src/search.c | 40 ++++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 30db0548172..6c63a3cd20b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2005-10-14 Kenichi Handa + + * search.c (search_buffer): Give up BM search on case-fold-search + if one of a target character has a case-equivalence of different + charset even if that target charcter is an ASCII. + + * casefiddle.c (casify_object): Fix for the case that case + conversion change the byte length. + 2005-10-14 Kim F. Storm * xterm.c (note_mouse_movement): Return 1 if mouse moved; 0 otherwise. diff --git a/src/search.c b/src/search.c index aa7f6fda699..f60e6d0cfe2 100644 --- a/src/search.c +++ b/src/search.c @@ -1175,9 +1175,9 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, unsigned char *patbuf; int multibyte = !NILP (current_buffer->enable_multibyte_characters); unsigned char *base_pat = SDATA (string); - /* Set to nozero if we find a non-ASCII char that need - translation. */ - int charset_base = 0; + /* Set to positive if we find a non-ASCII char that need + translation. Otherwise set to zero later. */ + int charset_base = -1; int boyer_moore_ok = 1; /* MULTIBYTE says whether the text to be searched is multibyte. @@ -1275,24 +1275,30 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, always handle their translation. */ while (1) { - if (! ASCII_BYTE_P (inverse)) + if (ASCII_BYTE_P (inverse)) { - if (SINGLE_BYTE_CHAR_P (inverse)) - { - /* Boyer-moore search can't handle a - translation of an eight-bit - character. */ - boyer_moore_ok = 0; - break; - } - else if (charset_base == 0) - charset_base = inverse & ~CHAR_FIELD3_MASK; - else if ((inverse & ~CHAR_FIELD3_MASK) - != charset_base) + if (charset_base > 0) { boyer_moore_ok = 0; break; } + charset_base = 0; + } + else if (SINGLE_BYTE_CHAR_P (inverse)) + { + /* Boyer-moore search can't handle a + translation of an eight-bit + character. */ + boyer_moore_ok = 0; + break; + } + else if (charset_base < 0) + charset_base = inverse & ~CHAR_FIELD3_MASK; + else if ((inverse & ~CHAR_FIELD3_MASK) + != charset_base) + { + boyer_moore_ok = 0; + break; } if (c == inverse) break; @@ -1300,6 +1306,8 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, } } } + if (charset_base < 0) + charset_base = 0; /* Store this character into the translated pattern. */ bcopy (str, pat, charlen); -- cgit v1.2.1 From af1229d96a42d9b12b588e05da3410a3c2b93ec1 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Fri, 14 Oct 2005 08:08:37 +0000 Subject: (note_mouse_movement, XTread_socket): Apply 2005-10-14 changes for xterm.c. --- src/macterm.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/macterm.c b/src/macterm.c index e18f3ee48a0..20218b1954a 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -4149,7 +4149,7 @@ x_get_keysym_name (keysym) static Point last_mouse_motion_position; static Lisp_Object last_mouse_motion_frame; -static void +static int note_mouse_movement (frame, pos) FRAME_PTR frame; Point *pos; @@ -4180,19 +4180,23 @@ note_mouse_movement (frame, pos) rif->define_frame_cursor (frame, frame->output_data.mac->nontext_cursor); } + return 1; } /* Has the mouse moved off the glyph it was on at the last sighting? */ - else if (pos->h < last_mouse_glyph.left - || pos->h >= last_mouse_glyph.right - || pos->v < last_mouse_glyph.top - || pos->v >= last_mouse_glyph.bottom) + if (pos->h < last_mouse_glyph.left + || pos->h >= last_mouse_glyph.right + || pos->v < last_mouse_glyph.top + || pos->v >= last_mouse_glyph.bottom) { frame->mouse_moved = 1; last_mouse_scroll_bar = Qnil; note_mouse_highlight (frame, pos->h, pos->v); /* Remember which glyph we're now on. */ remember_mouse_glyph (frame, pos->h, pos->v, &last_mouse_glyph); + return 1; } + + return 0; } @@ -10031,8 +10035,7 @@ XTread_socket (sd, expected, hold_quit) er.where.h + 1, er.where.v + 1); #endif previous_help_echo_string = help_echo_string; - help_echo_string = help_echo_object = help_echo_window = Qnil; - help_echo_pos = -1; + help_echo_string = Qnil; if (dpyinfo->grabbed && last_mouse_frame && FRAME_LIVE_P (last_mouse_frame)) @@ -10091,7 +10094,8 @@ XTread_socket (sd, expected, hold_quit) last_window=window; } - note_mouse_movement (f, &mouse_pos); + if (!note_mouse_movement (f, &mouse_pos)) + help_echo_string = previous_help_echo_string; } } -- cgit v1.2.1 From fc5c75503bfc9f04b32be4cfe2400ec24f29ca7b Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Fri, 14 Oct 2005 08:10:05 +0000 Subject: (note_mouse_movement, w32_read_socket): Apply 2005-10-14 changes for xterm.c. --- src/ChangeLog | 7 +++++++ src/w32term.c | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6c63a3cd20b..3bc5ca526f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2005-10-14 YAMAMOTO Mitsuharu + + * macterm.c (note_mouse_movement, XTread_socket): Apply 2005-10-14 + changes for xterm.c. + + * w32term.c (note_mouse_movement, w32_read_socket): Likewise. + 2005-10-14 Kenichi Handa * search.c (search_buffer): Give up BM search on case-fold-search diff --git a/src/w32term.c b/src/w32term.c index 96d26344b53..dcb56de911f 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -3204,7 +3204,7 @@ construct_drag_n_drop (result, msg, f) static MSG last_mouse_motion_event; static Lisp_Object last_mouse_motion_frame; -static void +static int note_mouse_movement (frame, msg) FRAME_PTR frame; MSG *msg; @@ -3221,13 +3221,14 @@ note_mouse_movement (frame, msg) frame->mouse_moved = 1; last_mouse_scroll_bar = Qnil; note_mouse_highlight (frame, -1, -1); + return 1; } /* Has the mouse moved off the glyph it was on at the last sighting? */ - else if (mouse_x < last_mouse_glyph.left - || mouse_x >= last_mouse_glyph.right - || mouse_y < last_mouse_glyph.top - || mouse_y >= last_mouse_glyph.bottom) + if (mouse_x < last_mouse_glyph.left + || mouse_x >= last_mouse_glyph.right + || mouse_y < last_mouse_glyph.top + || mouse_y >= last_mouse_glyph.bottom) { frame->mouse_moved = 1; last_mouse_scroll_bar = Qnil; @@ -3237,7 +3238,10 @@ note_mouse_movement (frame, msg) to keep track of the mouse for help_echo and highlighting at other times. */ remember_mouse_glyph (frame, mouse_x, mouse_y, &last_mouse_glyph); + return 1; } + + return 0; } @@ -4314,6 +4318,7 @@ w32_read_socket (sd, expected, hold_quit) } previous_help_echo_string = help_echo_string; + help_echo_string = Qnil; if (dpyinfo->grabbed && last_mouse_frame && FRAME_LIVE_P (last_mouse_frame)) @@ -4352,7 +4357,8 @@ w32_read_socket (sd, expected, hold_quit) last_window=window; } - note_mouse_movement (f, &msg.msg); + if (!note_mouse_movement (f, &msg.msg)) + help_echo_string = previous_help_echo_string; } else { -- cgit v1.2.1