[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115608: Redo size constraint for NS so frames can s
From: |
Jan D. |
Subject: |
[Emacs-diffs] trunk r115608: Redo size constraint for NS so frames can span screens. |
Date: |
Thu, 19 Dec 2013 08:40:15 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115608
revision-id: address@hidden
parent: address@hidden
committer: Jan Djärv <address@hidden>
branch nick: trunk
timestamp: Thu 2013-12-19 09:40:11 +0100
message:
Redo size constraint for NS so frames can span screens.
* nsterm.h (ns_output): Remove dont_constrain.
* nsterm.m (NSTRACE_SIZE, NSTRACE_RECT): New macros.
(ns_constrain_all_frames, x_set_offset): Remove assignment to
dont_constrain.
(updateFrameSize:, windowWillResize:toSize:): Add trace.
(constrainFrameRect): Remove special case nr_screens == 1.
Don't constrain size to size of view.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/nsterm.h nsterm.h-20091113204419-o5vbwnq5f7feedwu-8746
src/nsterm.m nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-12-19 07:38:08 +0000
+++ b/src/ChangeLog 2013-12-19 08:40:11 +0000
@@ -1,5 +1,16 @@
2013-12-19 Anders Lindgren <address@hidden>
+ * nsterm.m (NSTRACE_SIZE, NSTRACE_RECT): New macros.
+ (ns_constrain_all_frames, x_set_offset): Remove assignment to
+ dont_constrain.
+ (updateFrameSize:, windowWillResize:toSize:): Add trace.
+ (constrainFrameRect): Remove special case nr_screens == 1.
+ Don't constrain size to size of view.
+
+ * nsterm.h (ns_output): Remove dont_constrain.
+
+2013-12-19 Anders Lindgren <address@hidden>
+
* nsterm.m (mouseDown:): Generate HORIZ_WHEEL_EVENT.
2013-12-18 Paul Eggert <address@hidden>
=== modified file 'src/nsterm.h'
--- a/src/nsterm.h 2013-12-07 16:48:12 +0000
+++ b/src/nsterm.h 2013-12-19 08:40:11 +0000
@@ -687,9 +687,6 @@
/* This is the Emacs structure for the NS display this frame is on. */
struct ns_display_info *display_info;
- /* Non-zero if we want to constrain the frame to the screen. */
- int dont_constrain;
-
/* Non-zero if we are zooming (maximizing) the frame. */
int zooming;
};
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2013-12-19 07:38:08 +0000
+++ b/src/nsterm.m 2013-12-19 08:40:11 +0000
@@ -79,6 +79,28 @@
#define NSTRACE(x)
#endif
+/* Detailed tracing. "S" means "size" and "LL" stands for "lower left". */
+#if 1
+int term_trace_num = 0;
+#define NSTRACE_SIZE(str,size) fprintf (stderr, \
+ "%s:%d: [%d] " str \
+ " (S:%.0f x %.0f)\n", \
+ __FILE__, __LINE__, ++term_trace_num,\
+ size.height, \
+ size.width)
+#define NSTRACE_RECT(s,r) fprintf (stderr, \
+ "%s:%d: [%d] " s \
+ " (LL:%.0f x %.0f -> S:%.0f x %.0f)\n", \
+ __FILE__, __LINE__, ++term_trace_num,\
+ r.origin.x, \
+ r.origin.y, \
+ r.size.height, \
+ r.size.width)
+#else
+#define NSTRACE_SIZE(str,size)
+#define NSTRACE_RECT(s,r)
+#endif
+
extern NSString *NSMenuDidBeginTrackingNotification;
/* ==========================================================================
@@ -605,7 +627,6 @@
NSView *view = FRAME_NS_VIEW (f);
/* This no-op will trigger the default window placing
* constraint system. */
- f->output_data.ns->dont_constrain = 0;
[[view window] setFrameOrigin:[[view window] frame].origin];
}
}
@@ -1225,7 +1246,6 @@
#endif
/* Constrain the setFrameTopLeftPoint so we don't move behind the
menu bar. */
- f->output_data.ns->dont_constrain = 0;
[[view window] setFrameTopLeftPoint:
NSMakePoint (SCREENMAXBOUND (f->left_pos),
SCREENMAXBOUND ([fscreen frame].size.height
@@ -5684,10 +5704,13 @@
NSRect wr = [window frame];
int extra = 0;
int oldc = cols, oldr = rows;
- int oldw = FRAME_PIXEL_WIDTH (emacsframe),
- oldh = FRAME_PIXEL_HEIGHT (emacsframe);
+ int oldw = FRAME_PIXEL_WIDTH (emacsframe);
+ int oldh = FRAME_PIXEL_HEIGHT (emacsframe);
int neww, newh;
+ NSTRACE (updateFrameSize);
+ NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
+
if (! [self isFullscreen])
{
#ifdef NS_IMPL_GNUSTEP
@@ -5731,6 +5754,8 @@
sz.width = FRAME_COLUMN_WIDTH (emacsframe);
sz.height = FRAME_LINE_HEIGHT (emacsframe);
[win setResizeIncrements: sz];
+
+ NSTRACE_SIZE ("New size", NSMakeSize (neww, newh));
}
[view setFrame: NSMakeRect (0, 0, neww, newh)];
@@ -5744,6 +5769,7 @@
int extra = 0;
NSTRACE (windowWillResize);
+ NSTRACE_SIZE ("Original size", frameSize);
/*fprintf (stderr,"Window will resize: %.0f x
%.0f\n",frameSize.width,frameSize.height); */
if (fs_state == FULLSCREEN_MAXIMIZED
@@ -6903,19 +6929,39 @@
NSUInteger nr_screens = [[NSScreen screens] count];
struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
NSTRACE (constrainFrameRect);
-
- if (nr_screens == 1)
- {
- NSRect r = [super constrainFrameRect:frameRect toScreen:screen];
- return r;
- }
-
- if (f->output_data.ns->dont_constrain
- || ns_menu_bar_should_be_hidden ())
+ NSTRACE_RECT ("input", frameRect);
+
+ if (ns_menu_bar_should_be_hidden ())
return frameRect;
- f->output_data.ns->dont_constrain = 1;
- return [super constrainFrameRect:frameRect toScreen:screen];
+ /* The default implementation does two things 1) ensure that the top
+ of the rectangle is below the menu bar (or below the top of the
+ screen) and 2) resizes windows larger than the screen. As we
+ don't want the latter, a smaller rectangle is used. */
+#define FAKE_HEIGHT 64
+ float old_top = frameRect.origin.y + frameRect.size.height;
+ NSRect r;
+ r.size.height = FAKE_HEIGHT;
+ r.size.width = frameRect.size.width;
+ r.origin.x = frameRect.origin.x;
+ r.origin.y = old_top - FAKE_HEIGHT;
+
+ NSTRACE_RECT ("input to super", r);
+
+ r = [super constrainFrameRect:r toScreen:screen];
+
+ NSTRACE_RECT ("output from super", r);
+
+ float new_top = r.origin.y + FAKE_HEIGHT;
+ if (new_top < old_top)
+ {
+ frameRect.origin.y = new_top - frameRect.size.height;
+ }
+
+ NSTRACE_RECT ("output", frameRect);
+
+ return frameRect;
+#undef FAKE_HEIGHT
}
@end /* EmacsWindow */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115608: Redo size constraint for NS so frames can span screens.,
Jan D. <=