/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
-#include "config.h"
+#include <config.h>
#include <math.h>
#include <sys/types.h>
void
-ns_init_paths ()
+ns_init_paths (void)
/* --------------------------------------------------------------------------
Used to allow emacs to find its resources under Emacs.app
Called from emacs.c at startup.
void *
-ns_alloc_autorelease_pool ()
+ns_alloc_autorelease_pool (void)
/* --------------------------------------------------------------------------
Allocate a pool for temporary objects (callable from C)
-------------------------------------------------------------------------- */
static void
-ns_ring_bell ()
+ns_ring_bell (struct frame *f)
/* --------------------------------------------------------------------------
"Beep" routine
-------------------------------------------------------------------------- */
/* NOTE: previously this would generate wrong result if toolbar not
yet displayed and fixing toolbar_height=32 helped, but
now (200903) seems no longer needed */
- FRAME_NS_TOOLBAR_HEIGHT (f) =
+ FRAME_TOOLBAR_HEIGHT (f) =
NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)])
- FRAME_NS_TITLEBAR_HEIGHT (f);
else
- FRAME_NS_TOOLBAR_HEIGHT (f) = 0;
+ FRAME_TOOLBAR_HEIGHT (f) = 0;
wr.size.width = pixelwidth + f->border_width;
wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f)
- + FRAME_NS_TOOLBAR_HEIGHT (f);
+ + FRAME_TOOLBAR_HEIGHT (f);
/* constrain to screen if we can */
if (screen)
difference between the real width and Emacs' imagined one. For
right-hand bars, don't worry about it since the extra is never used.
(Obviously doesn't work for vertically split windows tho..) */
- NSPoint origin = FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)
- ? NSMakePoint (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)
- - NS_SCROLL_BAR_WIDTH (f), 0)
- : NSMakePoint (0, 0);
- [view setFrame: NSMakeRect (0, 0, pixelwidth, pixelheight)];
- [view setBoundsOrigin: origin];
+ {
+ NSPoint origin = FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)
+ ? NSMakePoint (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)
+ - NS_SCROLL_BAR_WIDTH (f), 0)
+ : NSMakePoint (0, 0);
+ [view setFrame: NSMakeRect (0, 0, pixelwidth, pixelheight)];
+ [view setBoundsOrigin: origin];
+ }
change_frame_size (f, rows, cols, 0, 1, 0); /* pretend, delay, safe */
FRAME_PIXEL_WIDTH (f) = pixelwidth;
int
-ns_defined_color (struct frame *f, char *name, XColor *color_def, int alloc,
+ns_defined_color (struct frame *f,
+ const char *name,
+ XColor *color_def,
+ int alloc,
char makeIndex)
/* --------------------------------------------------------------------------
Return 1 if named color found, and set color_def rgb accordingly.
EmacsView *view = FRAME_NS_VIEW (f);
FRAME_POINTER_TYPE (f) = cursor;
[[view window] invalidateCursorRectsForView: view];
+ /* Redisplay assumes this function also draws the changed frame
+ cursor, but this function doesn't, so do it explicitly. */
+ x_update_cursor (f, 1);
}
}
{
EmacsImage **newBimgs
= xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *));
- bzero (newBimgs, max_used_fringe_bitmap * sizeof (EmacsImage *));
+ memset (newBimgs, 0, max_used_fringe_bitmap * sizeof (EmacsImage *));
if (nBimgs)
{
- bcopy (bimgs, newBimgs, nBimgs * sizeof (EmacsImage *));
+ memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *));
xfree (bimgs);
}
int yAdjust = rowY - FRAME_INTERNAL_BORDER_WIDTH (f) < 5 ?
-FRAME_INTERNAL_BORDER_WIDTH (f) : 0;
int yIncr = FRAME_PIXEL_HEIGHT (f) - (p->by+yAdjust + p->ny) < 5 ?
- FRAME_INTERNAL_BORDER_WIDTH (f) : 0;
- if (yAdjust)
- yIncr += FRAME_INTERNAL_BORDER_WIDTH (f);
+ FRAME_INTERNAL_BORDER_WIDTH (f) : 0
+ + (yAdjust ? FRAME_INTERNAL_BORDER_WIDTH (f) : 0);
NSRect r = NSMakeRect (p->bx+xAdjust, p->by+yAdjust, p->nx, p->ny+yIncr);
NSRectClip (r);
[ns_lookup_indexed_color(face->background, f) set];
struct frame *f = WINDOW_XFRAME (w);
struct glyph *phys_cursor_glyph;
int overspill;
+ struct glyph *cursor_glyph;
+
+ /* If cursor is out of bounds, don't draw garbage. This can happen
+ in mini-buffer windows when switching between echo area glyphs
+ and mini-buffer. */
NSTRACE (dumpcursor);
//fprintf(stderr, "drawcursor (%d,%d) activep = %d\tonp = %d\tc_type = %d\twidth = %d\n",x,y, active_p,on_p,cursor_type,cursor_width);
case BAR_CURSOR:
s = r;
s.size.width = min (cursor_width, 2); //FIXME(see above)
+
+ /* If the character under cursor is R2L, draw the bar cursor
+ on the right of its glyph, rather than on the left. */
+ cursor_glyph = get_phys_cursor_glyph (w);
+ if ((cursor_glyph->resolved_level & 1) != 0)
+ s.origin.x += cursor_glyph->pixel_width - s.size.width;
+
NSRectFill (s);
break;
}
void
-hide_hourglass ()
+hide_hourglass (void)
{
if (!hourglass_shown_p)
return;
========================================================================== */
int
-x_display_pixel_height (dpyinfo)
- struct ns_display_info *dpyinfo;
+x_display_pixel_height (struct ns_display_info *dpyinfo)
{
NSScreen *screen = [NSScreen mainScreen];
return [screen frame].size.height;
}
int
-x_display_pixel_width (dpyinfo)
- struct ns_display_info *dpyinfo;
+x_display_pixel_width (struct ns_display_info *dpyinfo)
{
NSScreen *screen = [NSScreen mainScreen];
return [screen frame].size.width;
name: nil object: nil]; */
dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
- bzero (dpyinfo, sizeof (struct ns_display_info));
+ memset (dpyinfo, 0, sizeof (struct ns_display_info));
ns_initialize_display_info (dpyinfo);
terminal = ns_create_terminal (dpyinfo);
rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, frameSize.height
#ifdef NS_IMPL_GNUSTEP
- FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + 3
- - FRAME_NS_TOOLBAR_HEIGHT (emacsframe));
+ - FRAME_TOOLBAR_HEIGHT (emacsframe));
#else
- FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
- - FRAME_NS_TOOLBAR_HEIGHT (emacsframe));
+ - FRAME_TOOLBAR_HEIGHT (emacsframe));
#endif
if (rows < MINHEIGHT)
rows = MINHEIGHT;
frameSize.height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (emacsframe, rows)
+ FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
- + FRAME_NS_TOOLBAR_HEIGHT (emacsframe);
+ + FRAME_TOOLBAR_HEIGHT (emacsframe);
#ifdef NS_IMPL_COCOA
{
/* this sets window title to have size in it; the wm does this under GS */
[toggleButton setTarget: self];
[toggleButton setAction: @selector (toggleToolbar: )];
#endif
- FRAME_NS_TOOLBAR_HEIGHT (f) = 0;
+ FRAME_TOOLBAR_HEIGHT (f) = 0;
tem = f->icon_name;
if (!NILP (tem))
NSTRACE (judge);
if (condemned)
{
+ EmacsView *view;
BLOCK_INPUT;
/* ensure other scrollbar updates after deletion */
- EmacsView *view = (EmacsView *)FRAME_NS_VIEW (frame);
+ view = (EmacsView *)FRAME_NS_VIEW (frame);
if (view != nil)
view->scrollbarsNeedingUpdate++;
[self removeFromSuperview];
void
-syms_of_nsterm ()
+syms_of_nsterm (void)
{
NSTRACE (syms_of_nsterm);