init_frame_faces (f);
+ /* Read comment about this code in corresponding place in xfns.c. */
+ width = FRAME_TEXT_WIDTH (f);
+ height = FRAME_TEXT_HEIGHT (f);
+ FRAME_TEXT_HEIGHT (f) = 0;
+ SET_FRAME_WIDTH (f, 0);
+ change_frame_size (f, width, height, 1, 0, 0, 1);
+
/* The resources controlling the menu-bar and tool-bar are
processed specially at startup, and reflected in the mode
variables; ignore them here. */
x_default_parameter (f, parms, Qfullscreen, Qnil,
"fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
- width = FRAME_COLS (f);
- height = FRAME_LINES (f);
-
- SET_FRAME_COLS (f, 0);
- FRAME_LINES (f) = 0;
- change_frame_size (f, width, height, 1, 0, 0, 0);
+ width = FRAME_TEXT_WIDTH (f);
+ height = FRAME_TEXT_HEIGHT (f);
+ FRAME_TEXT_HEIGHT (f) = 0;
+ SET_FRAME_WIDTH (f, 0);
+ change_frame_size (f, width, height, 1, 0, 0, 1);
if (! f->output_data.ns->explicit_parent)
{
void
-x_set_window_size (struct frame *f, int change_grav, int cols, int rows, bool pixelwise)
+x_set_window_size (struct frame *f,
+ int change_grav,
+ int width,
+ int height,
+ bool pixelwise)
/* --------------------------------------------------------------------------
Adjust window pixel size based on given character grid size
Impl is a bit more complex than other terms, need to do some
NSRect wr = [window frame];
int tb = FRAME_EXTERNAL_TOOL_BAR (f);
int pixelwidth, pixelheight;
+ int rows, cols;
NSTRACE (x_set_window_size);
if (view == nil)
return;
-/*fprintf (stderr, "\tsetWindowSize: %d x %d, pixelwise %d, font size %d x %d\n", cols, rows, pixelwise, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f));*/
+/*fprintf (stderr, "\tsetWindowSize: %d x %d, pixelwise %d, font size %d x %d\n", width, height, pixelwise, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f));*/
block_input ();
- check_frame_size (f, &cols, &rows, 0);
+ check_frame_size (f, &width, &height, pixelwise);
f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f);
compute_fringe_widths (f, 0);
if (pixelwise)
{
- pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, cols);
- pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, rows);
+ pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width);
+ pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height);
cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth);
rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight);
}
else
{
- pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
- pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
+ pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width);
+ pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height);
+ cols = width;
+ rows = height;
}
/* If we have a toolbar, take its height into account. */
[view setRows: rows andColumns: cols];
[window setFrame: wr display: YES];
-/*fprintf (stderr, "\tx_set_window_size %d, %d\t%d, %d\n", cols, rows, pixelwidth, pixelheight); */
+ fprintf (stderr, "\tx_set_window_size %d, %d\t%d, %d\n", cols, rows, pixelwidth, pixelheight);
/* This is a trick to compensate for Emacs' managing the scrollbar area
as a fixed number of standard character columns. Instead of leaving
[view setBoundsOrigin: origin];
}
- change_frame_size (f, cols, rows, 0, 1, 0, 0); /* pretend, delay, safe */
- FRAME_PIXEL_WIDTH (f) = pixelwidth;
- FRAME_PIXEL_HEIGHT (f) = pixelheight;
+ change_frame_size (f, width, height, 0, 1, 0, pixelwise);
/* SET_FRAME_GARBAGED (f); // this short-circuits expose call in drawRect */
mark_window_cursors_off (XWINDOW (f->root_window));
NSWindow *window = [self window];
NSRect wr = [window frame];
int extra = 0;
- int gsextra = 0;
-#ifdef NS_IMPL_GNUSTEP
- gsextra = 3;
-#endif
-
int oldc = cols, oldr = rows;
int oldw = FRAME_PIXEL_WIDTH (emacsframe),
oldh = FRAME_PIXEL_HEIGHT (emacsframe);
int neww, newh;
- cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, wr.size.width + gsextra);
-
- if (cols < MINWIDTH)
- cols = MINWIDTH;
-
if (! [self isFullscreen])
{
extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
- + FRAME_TOOLBAR_HEIGHT (emacsframe) - gsextra;
+ + FRAME_TOOLBAR_HEIGHT (emacsframe);
}
- rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, wr.size.height - extra);
+ neww = (int)wr.size.width - emacsframe->border_width;
+ newh = (int)wr.size.height - extra;
+
+ cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, neww);
+ rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, newh);
+
+ if (cols < MINWIDTH)
+ cols = MINWIDTH;
if (rows < MINHEIGHT)
rows = MINHEIGHT;
- neww = (int)wr.size.width - emacsframe->border_width;
- newh = (int)wr.size.height - extra;
-
if (oldr != rows || oldc != cols || neww != oldw || newh != oldh)
{
NSView *view = FRAME_NS_VIEW (emacsframe);
NSWindow *win = [view window];
NSSize sz = [win resizeIncrements];
- FRAME_PIXEL_WIDTH (emacsframe) = neww;
- FRAME_PIXEL_HEIGHT (emacsframe) = newh;
- change_frame_size (emacsframe, cols, rows, 0, delay, 0, 0);
+ change_frame_size (emacsframe,
+ FRAME_PIXEL_TO_TEXT_WIDTH (emacsframe, neww),
+ FRAME_PIXEL_TO_TEXT_HEIGHT (emacsframe, newh),
+ 0, delay, 0, 1);
SET_FRAME_GARBAGED (emacsframe);
cancel_mouse_face (emacsframe);
/* normalize frame to gridded text size */
{
int extra = 0;
- int gsextra = 0;
-#ifdef NS_IMPL_GNUSTEP
- gsextra = 3;
-#endif
NSTRACE (windowWillResize);
/*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */
if (fs_state == FULLSCREEN_NONE)
maximized_width = maximized_height = -1;
- cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe,
- frameSize.width + gsextra);
+ if (! [self isFullscreen])
+ {
+ extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
+ + FRAME_TOOLBAR_HEIGHT (emacsframe);
+ }
+
+ cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, frameSize.width);
if (cols < MINWIDTH)
cols = MINWIDTH;
x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
{
struct font *font = XFONT_OBJECT (font_object);
+ EmacsView *view = FRAME_NS_VIEW (f);
if (fontset < 0)
fontset = fontset_from_font (font_object);
}
/* Now make the frame display the given font. */
- if (FRAME_NS_WINDOW (f) != 0)
- x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f), 0);
+ if (FRAME_NS_WINDOW (f) != 0 && ! [view isFullscreen])
+ x_set_window_size (f, 0, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
+ FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 1);
return font_object;
}