static EmacsScroller *last_mouse_scroll_bar = nil;
static struct frame *ns_updating_frame;
static NSView *focus_view = NULL;
-static int ns_window_num =0;
+static int ns_window_num = 0;
static NSRect uRect;
static BOOL gsaved = NO;
BOOL ns_in_resize = NO;
[[view window] miniaturize: NSApp];
}
+/* Free X resources of frame F. */
void
-x_destroy_window (struct frame *f)
-/* --------------------------------------------------------------------------
- External: Delete the window
- -------------------------------------------------------------------------- */
+x_free_frame_resources (struct frame *f)
{
NSView *view = FRAME_NS_VIEW (f);
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
[[view window] close];
[view release];
- ns_window_num--;
UNBLOCK_INPUT;
}
+void
+x_destroy_window (struct frame *f)
+/* --------------------------------------------------------------------------
+ External: Delete the window
+ -------------------------------------------------------------------------- */
+{
+ NSTRACE (x_destroy_window);
+ check_ns ();
+ x_free_frame_resources (f);
+ ns_window_num--;
+}
+
void
x_set_offset (struct frame *f, int xoff, int yoff, int change_grav)
ns_index_color (NSColor *color, struct frame *f)
{
struct ns_color_table *color_table = FRAME_NS_DISPLAY_INFO (f)->color_table;
- int idx;
+ ptrdiff_t idx;
NSNumber *index;
if (!color_table->colors)
/* do we already have this color ? */
{
- int i;
+ ptrdiff_t i;
for (i = 1; i < color_table->avail; i++)
{
if (color_table->colors[i] && [color_table->colors[i] isEqual: color])
{
index = [color_table->empty_indices anyObject];
[color_table->empty_indices removeObject: index];
- idx = [index unsignedIntValue];
+ idx = [index unsignedLongValue];
}
else
{
if (color_table->avail == color_table->size)
- {
- color_table->size += NS_COLOR_CAPACITY;
- color_table->colors
- = (NSColor **)xrealloc (color_table->colors,
- color_table->size * sizeof (NSColor *));
- }
+ color_table->colors =
+ xpalloc (color_table->colors, &color_table->size, 1,
+ min (ULONG_MAX, PTRDIFF_MAX), sizeof *color_table->colors);
idx = color_table->avail++;
}
if (!img)
{
unsigned short *bits = p->bits + p->dh;
- int len = 8 * p->h/8;
+ int len = p->h;
int i;
unsigned char *cbits = xmalloc (len);
}
}
-
+
#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
/* if we get here we should send the key for input manager processing */
if (firstTime && [[NSInputManager currentInputManager]
strcpy (old_title, t);
}
size_title = xmalloc (strlen (old_title) + 40);
- sprintf (size_title, "%s — (%d x %d)", old_title, cols, rows);
+ esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows);
[window setTitle: [NSString stringWithUTF8String: size_title]];
[window display];
xfree (size_title);
a "windowDidResize" which calls x_set_window_size). */
#ifndef NS_IMPL_GNUSTEP
if (cols > 0 && rows > 0)
- x_set_window_size (emacsframe, 0, cols, rows);
+ {
+ if (ns_in_resize)
+ x_set_window_size (emacsframe, 0, cols, rows);
+ else
+ {
+ NSWindow *window = [self window];
+ NSRect wr = [window frame];
+ FRAME_PIXEL_WIDTH (emacsframe) = (int)wr.size.width
+ - emacsframe->border_width;
+ FRAME_PIXEL_HEIGHT (emacsframe) = (int)wr.size.height
+ - FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
+ - FRAME_TOOLBAR_HEIGHT (emacsframe);
+ change_frame_size (emacsframe, rows, cols, 0, 0, 1);
+ SET_FRAME_GARBAGED (emacsframe);
+ cancel_mouse_face (emacsframe);
+ }
+ }
#endif
ns_send_appdefined (-1);