aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2013-12-07 15:21:53 +0100
committerJan Djärv2013-12-07 15:21:53 +0100
commit7def8cbd8b37773a1c45b05e79af38a5d5cb69a3 (patch)
treeeae073504b9ddcd29098e992c40d7f43b399619e /src
parent34a731f8d04e6f70bd93b82cd65b6de024460ea3 (diff)
downloademacs-7def8cbd8b37773a1c45b05e79af38a5d5cb69a3.tar.gz
emacs-7def8cbd8b37773a1c45b05e79af38a5d5cb69a3.zip
Handle pixelwise resize changes in NS port.
* src/nsfns.m (Fx_create_frame): Call change_frame_size twice as per comment in xfns.c. Change to pixelwise call. * src/nsterm.m (x_set_window_size): Change parameters rows/cols to height/width. row/cols are locals. Pass pixelwise to check_frame_size. Don't set FRAME_PIXEL_WIDTH/HEIGHT. (updateFrameSize:): Remove gsextra. Adjust for pixelwise resize. (windowWillResize): Remove gsextra. Calculate extra as in updateFrameSize. (x_new_font): Don't change frame size if fullscreen. Change size pixelwise.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/nsfns.m18
-rw-r--r--src/nsterm.m77
3 files changed, 66 insertions, 43 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 082102bc3d8..0f4d2f49ebf 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12013-12-07 Jan Djärv <jan.h.d@swipnet.se>
2
3 * nsterm.m (x_set_window_size): Change parameters rows/cols to
4 height/width. row/cols are locals.
5 Pass pixelwise to check_frame_size. Don't set FRAME_PIXEL_WIDTH/HEIGHT.
6 (updateFrameSize:): Remove gsextra. Adjust for pixelwise resize.
7 (windowWillResize): Remove gsextra. Calculate extra as in
8 updateFrameSize.
9 (x_new_font): Don't change frame size if fullscreen. Change
10 size pixelwise.
11
12 * nsfns.m (Fx_create_frame): Call change_frame_size twice as per
13 comment in xfns.c. Change to pixelwise call.
14
12013-12-06 Eli Zaretskii <eliz@gnu.org> 152013-12-06 Eli Zaretskii <eliz@gnu.org>
2 16
3 * buffer.c (Fset_buffer_multibyte): Invalidate buffer caches. 17 * buffer.c (Fset_buffer_multibyte): Invalidate buffer caches.
diff --git a/src/nsfns.m b/src/nsfns.m
index 13103582891..8f14915ea65 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1237,6 +1237,13 @@ This function is an internal primitive--use `make-frame' instead. */)
1237 1237
1238 init_frame_faces (f); 1238 init_frame_faces (f);
1239 1239
1240 /* Read comment about this code in corresponding place in xfns.c. */
1241 width = FRAME_TEXT_WIDTH (f);
1242 height = FRAME_TEXT_HEIGHT (f);
1243 FRAME_TEXT_HEIGHT (f) = 0;
1244 SET_FRAME_WIDTH (f, 0);
1245 change_frame_size (f, width, height, 1, 0, 0, 1);
1246
1240 /* The resources controlling the menu-bar and tool-bar are 1247 /* The resources controlling the menu-bar and tool-bar are
1241 processed specially at startup, and reflected in the mode 1248 processed specially at startup, and reflected in the mode
1242 variables; ignore them here. */ 1249 variables; ignore them here. */
@@ -1301,12 +1308,11 @@ This function is an internal primitive--use `make-frame' instead. */)
1301 x_default_parameter (f, parms, Qfullscreen, Qnil, 1308 x_default_parameter (f, parms, Qfullscreen, Qnil,
1302 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); 1309 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
1303 1310
1304 width = FRAME_COLS (f); 1311 width = FRAME_TEXT_WIDTH (f);
1305 height = FRAME_LINES (f); 1312 height = FRAME_TEXT_HEIGHT (f);
1306 1313 FRAME_TEXT_HEIGHT (f) = 0;
1307 SET_FRAME_COLS (f, 0); 1314 SET_FRAME_WIDTH (f, 0);
1308 FRAME_LINES (f) = 0; 1315 change_frame_size (f, width, height, 1, 0, 0, 1);
1309 change_frame_size (f, width, height, 1, 0, 0, 0);
1310 1316
1311 if (! f->output_data.ns->explicit_parent) 1317 if (! f->output_data.ns->explicit_parent)
1312 { 1318 {
diff --git a/src/nsterm.m b/src/nsterm.m
index 3e6ceae6580..37edfb238a9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1240,7 +1240,11 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_grav)
1240 1240
1241 1241
1242void 1242void
1243x_set_window_size (struct frame *f, int change_grav, int cols, int rows, bool pixelwise) 1243x_set_window_size (struct frame *f,
1244 int change_grav,
1245 int width,
1246 int height,
1247 bool pixelwise)
1244/* -------------------------------------------------------------------------- 1248/* --------------------------------------------------------------------------
1245 Adjust window pixel size based on given character grid size 1249 Adjust window pixel size based on given character grid size
1246 Impl is a bit more complex than other terms, need to do some 1250 Impl is a bit more complex than other terms, need to do some
@@ -1252,32 +1256,35 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows, bool pi
1252 NSRect wr = [window frame]; 1256 NSRect wr = [window frame];
1253 int tb = FRAME_EXTERNAL_TOOL_BAR (f); 1257 int tb = FRAME_EXTERNAL_TOOL_BAR (f);
1254 int pixelwidth, pixelheight; 1258 int pixelwidth, pixelheight;
1259 int rows, cols;
1255 1260
1256 NSTRACE (x_set_window_size); 1261 NSTRACE (x_set_window_size);
1257 1262
1258 if (view == nil) 1263 if (view == nil)
1259 return; 1264 return;
1260 1265
1261/*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));*/ 1266/*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));*/
1262 1267
1263 block_input (); 1268 block_input ();
1264 1269
1265 check_frame_size (f, &cols, &rows, 0); 1270 check_frame_size (f, &width, &height, pixelwise);
1266 1271
1267 f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f); 1272 f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f);
1268 compute_fringe_widths (f, 0); 1273 compute_fringe_widths (f, 0);
1269 1274
1270 if (pixelwise) 1275 if (pixelwise)
1271 { 1276 {
1272 pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, cols); 1277 pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width);
1273 pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, rows); 1278 pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height);
1274 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); 1279 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth);
1275 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); 1280 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight);
1276 } 1281 }
1277 else 1282 else
1278 { 1283 {
1279 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); 1284 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width);
1280 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); 1285 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height);
1286 cols = width;
1287 rows = height;
1281 } 1288 }
1282 1289
1283 /* If we have a toolbar, take its height into account. */ 1290 /* If we have a toolbar, take its height into account. */
@@ -1313,7 +1320,7 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows, bool pi
1313 [view setRows: rows andColumns: cols]; 1320 [view setRows: rows andColumns: cols];
1314 [window setFrame: wr display: YES]; 1321 [window setFrame: wr display: YES];
1315 1322
1316/*fprintf (stderr, "\tx_set_window_size %d, %d\t%d, %d\n", cols, rows, pixelwidth, pixelheight); */ 1323 fprintf (stderr, "\tx_set_window_size %d, %d\t%d, %d\n", cols, rows, pixelwidth, pixelheight);
1317 1324
1318 /* This is a trick to compensate for Emacs' managing the scrollbar area 1325 /* This is a trick to compensate for Emacs' managing the scrollbar area
1319 as a fixed number of standard character columns. Instead of leaving 1326 as a fixed number of standard character columns. Instead of leaving
@@ -1331,9 +1338,7 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows, bool pi
1331 [view setBoundsOrigin: origin]; 1338 [view setBoundsOrigin: origin];
1332 } 1339 }
1333 1340
1334 change_frame_size (f, cols, rows, 0, 1, 0, 0); /* pretend, delay, safe */ 1341 change_frame_size (f, width, height, 0, 1, 0, pixelwise);
1335 FRAME_PIXEL_WIDTH (f) = pixelwidth;
1336 FRAME_PIXEL_HEIGHT (f) = pixelheight;
1337/* SET_FRAME_GARBAGED (f); // this short-circuits expose call in drawRect */ 1342/* SET_FRAME_GARBAGED (f); // this short-circuits expose call in drawRect */
1338 1343
1339 mark_window_cursors_off (XWINDOW (f->root_window)); 1344 mark_window_cursors_off (XWINDOW (f->root_window));
@@ -5658,44 +5663,39 @@ not_in_argv (NSString *arg)
5658 NSWindow *window = [self window]; 5663 NSWindow *window = [self window];
5659 NSRect wr = [window frame]; 5664 NSRect wr = [window frame];
5660 int extra = 0; 5665 int extra = 0;
5661 int gsextra = 0;
5662#ifdef NS_IMPL_GNUSTEP
5663 gsextra = 3;
5664#endif
5665
5666 int oldc = cols, oldr = rows; 5666 int oldc = cols, oldr = rows;
5667 int oldw = FRAME_PIXEL_WIDTH (emacsframe), 5667 int oldw = FRAME_PIXEL_WIDTH (emacsframe),
5668 oldh = FRAME_PIXEL_HEIGHT (emacsframe); 5668 oldh = FRAME_PIXEL_HEIGHT (emacsframe);
5669 int neww, newh; 5669 int neww, newh;
5670 5670
5671 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, wr.size.width + gsextra);
5672
5673 if (cols < MINWIDTH)
5674 cols = MINWIDTH;
5675
5676 if (! [self isFullscreen]) 5671 if (! [self isFullscreen])
5677 { 5672 {
5678 extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe) 5673 extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
5679 + FRAME_TOOLBAR_HEIGHT (emacsframe) - gsextra; 5674 + FRAME_TOOLBAR_HEIGHT (emacsframe);
5680 } 5675 }
5681 5676
5682 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, wr.size.height - extra); 5677 neww = (int)wr.size.width - emacsframe->border_width;
5678 newh = (int)wr.size.height - extra;
5679
5680 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, neww);
5681 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, newh);
5682
5683 if (cols < MINWIDTH)
5684 cols = MINWIDTH;
5683 5685
5684 if (rows < MINHEIGHT) 5686 if (rows < MINHEIGHT)
5685 rows = MINHEIGHT; 5687 rows = MINHEIGHT;
5686 5688
5687 neww = (int)wr.size.width - emacsframe->border_width;
5688 newh = (int)wr.size.height - extra;
5689
5690 if (oldr != rows || oldc != cols || neww != oldw || newh != oldh) 5689 if (oldr != rows || oldc != cols || neww != oldw || newh != oldh)
5691 { 5690 {
5692 NSView *view = FRAME_NS_VIEW (emacsframe); 5691 NSView *view = FRAME_NS_VIEW (emacsframe);
5693 NSWindow *win = [view window]; 5692 NSWindow *win = [view window];
5694 NSSize sz = [win resizeIncrements]; 5693 NSSize sz = [win resizeIncrements];
5695 5694
5696 FRAME_PIXEL_WIDTH (emacsframe) = neww; 5695 change_frame_size (emacsframe,
5697 FRAME_PIXEL_HEIGHT (emacsframe) = newh; 5696 FRAME_PIXEL_TO_TEXT_WIDTH (emacsframe, neww),
5698 change_frame_size (emacsframe, cols, rows, 0, delay, 0, 0); 5697 FRAME_PIXEL_TO_TEXT_HEIGHT (emacsframe, newh),
5698 0, delay, 0, 1);
5699 SET_FRAME_GARBAGED (emacsframe); 5699 SET_FRAME_GARBAGED (emacsframe);
5700 cancel_mouse_face (emacsframe); 5700 cancel_mouse_face (emacsframe);
5701 5701
@@ -5717,10 +5717,6 @@ not_in_argv (NSString *arg)
5717/* normalize frame to gridded text size */ 5717/* normalize frame to gridded text size */
5718{ 5718{
5719 int extra = 0; 5719 int extra = 0;
5720 int gsextra = 0;
5721#ifdef NS_IMPL_GNUSTEP
5722 gsextra = 3;
5723#endif
5724 5720
5725 NSTRACE (windowWillResize); 5721 NSTRACE (windowWillResize);
5726/*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ 5722/*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */
@@ -5738,8 +5734,13 @@ not_in_argv (NSString *arg)
5738 if (fs_state == FULLSCREEN_NONE) 5734 if (fs_state == FULLSCREEN_NONE)
5739 maximized_width = maximized_height = -1; 5735 maximized_width = maximized_height = -1;
5740 5736
5741 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, 5737 if (! [self isFullscreen])
5742 frameSize.width + gsextra); 5738 {
5739 extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
5740 + FRAME_TOOLBAR_HEIGHT (emacsframe);
5741 }
5742
5743 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, frameSize.width);
5743 if (cols < MINWIDTH) 5744 if (cols < MINWIDTH)
5744 cols = MINWIDTH; 5745 cols = MINWIDTH;
5745 5746
@@ -7335,6 +7336,7 @@ Lisp_Object
7335x_new_font (struct frame *f, Lisp_Object font_object, int fontset) 7336x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
7336{ 7337{
7337 struct font *font = XFONT_OBJECT (font_object); 7338 struct font *font = XFONT_OBJECT (font_object);
7339 EmacsView *view = FRAME_NS_VIEW (f);
7338 7340
7339 if (fontset < 0) 7341 if (fontset < 0)
7340 fontset = fontset_from_font (font_object); 7342 fontset = fontset_from_font (font_object);
@@ -7367,8 +7369,9 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
7367 } 7369 }
7368 7370
7369 /* Now make the frame display the given font. */ 7371 /* Now make the frame display the given font. */
7370 if (FRAME_NS_WINDOW (f) != 0) 7372 if (FRAME_NS_WINDOW (f) != 0 && ! [view isFullscreen])
7371 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f), 0); 7373 x_set_window_size (f, 0, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
7374 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 1);
7372 7375
7373 return font_object; 7376 return font_object;
7374} 7377}