[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115405: Handle pixelwise resize changes in NS port.
From: |
Jan D. |
Subject: |
[Emacs-diffs] trunk r115405: Handle pixelwise resize changes in NS port. |
Date: |
Sat, 07 Dec 2013 14:22:00 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115405
revision-id: address@hidden
parent: address@hidden
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sat 2013-12-07 15:21:53 +0100
message:
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.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/nsfns.m nsfns.m-20091113204419-o5vbwnq5f7feedwu-8741
src/nsterm.m nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-12-06 15:13:35 +0000
+++ b/src/ChangeLog 2013-12-07 14:21:53 +0000
@@ -1,3 +1,17 @@
+2013-12-07 Jan Djärv <address@hidden>
+
+ * 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.
+
+ * nsfns.m (Fx_create_frame): Call change_frame_size twice as per
+ comment in xfns.c. Change to pixelwise call.
+
2013-12-06 Eli Zaretskii <address@hidden>
* buffer.c (Fset_buffer_multibyte): Invalidate buffer caches.
=== modified file 'src/nsfns.m'
--- a/src/nsfns.m 2013-12-05 16:20:11 +0000
+++ b/src/nsfns.m 2013-12-07 14:21:53 +0000
@@ -1237,6 +1237,13 @@
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. */
@@ -1301,12 +1308,11 @@
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)
{
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2013-12-05 16:20:11 +0000
+++ b/src/nsterm.m 2013-12-07 14:21:53 +0000
@@ -1240,7 +1240,11 @@
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
@@ -1252,32 +1256,35 @@
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. */
@@ -1313,7 +1320,7 @@
[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
@@ -1331,9 +1338,7 @@
[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));
@@ -5658,44 +5663,39 @@
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);
-
- if (rows < MINHEIGHT)
- rows = MINHEIGHT;
-
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;
+
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);
@@ -5717,10 +5717,6 @@
/* 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); */
@@ -5738,8 +5734,13 @@
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;
@@ -7335,6 +7336,7 @@
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);
@@ -7367,8 +7369,9 @@
}
/* 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;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115405: Handle pixelwise resize changes in NS port.,
Jan D. <=