aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2010-12-02 08:12:54 +0100
committerJan Djärv2010-12-02 08:12:54 +0100
commit2a91a0b5c0d208696fc327373bc4d37fd376c59c (patch)
treee4cb00d760684cc2ce344c80570bb83d8bbb0226 /src
parent9e0ecdabca1627cec85a38dc48a30b6386036199 (diff)
downloademacs-2a91a0b5c0d208696fc327373bc4d37fd376c59c.tar.gz
emacs-2a91a0b5c0d208696fc327373bc4d37fd376c59c.zip
Handle negative top/left in frame parameters (Bug#7510).
* src/nsterm.h (FRAME_NS_TOOLBAR_HEIGHT): Rename to FRAME_TOOLBAR_HEIGHT. * src/nsterm.m (x_set_window_size, windowWillResize, initFrameFromEmacs): Use FRAME_TOOLBAR_HEIGHT. (x_set_offset): Handle XNegative and YNegative in f->size_hint_flags.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/nsterm.h2
-rw-r--r--src/nsterm.m43
3 files changed, 39 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 45aed177ef2..025161cc395 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12010-12-02 Jan Djärv <jhd@zeplinf.localdomain>
2
3 * nsterm.h (FRAME_NS_TOOLBAR_HEIGHT): Rename to FRAME_TOOLBAR_HEIGHT.
4
5 * nsterm.m (x_set_window_size, windowWillResize, initFrameFromEmacs):
6 Use FRAME_TOOLBAR_HEIGHT.
7 (x_set_offset): Handle XNegative and YNegative in
8 f->size_hint_flags (Bug#7510).
9
12010-11-25 Kenichi Handa <handa@m17n.org> 102010-11-25 Kenichi Handa <handa@m17n.org>
2 11
3 * charset.c (emacs_mule_charset): Make it an array of charset ID; 12 * charset.c (emacs_mule_charset): Make it an array of charset ID;
diff --git a/src/nsterm.h b/src/nsterm.h
index 01086e63b69..5b24eb6f289 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -606,7 +606,7 @@ struct x_output
606#define NS_FACE_FOREGROUND(f) ((f)->foreground) 606#define NS_FACE_FOREGROUND(f) ((f)->foreground)
607#define NS_FACE_BACKGROUND(f) ((f)->background) 607#define NS_FACE_BACKGROUND(f) ((f)->background)
608#define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height) 608#define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height)
609#define FRAME_NS_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height) 609#define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height)
610 610
611#define FONT_WIDTH(f) ((f)->max_width) 611#define FONT_WIDTH(f) ((f)->max_width)
612#define FONT_HEIGHT(f) ((f)->height) 612#define FONT_HEIGHT(f) ((f)->height)
diff --git a/src/nsterm.m b/src/nsterm.m
index d1b984d5382..43e53cb30e7 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1082,16 +1082,31 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_grav)
1082 1082
1083 f->left_pos = xoff; 1083 f->left_pos = xoff;
1084 f->top_pos = yoff; 1084 f->top_pos = yoff;
1085
1086 if (view != nil && (screen = [[view window] screen]))
1087 {
1088 f->left_pos = f->size_hint_flags & XNegative
1089 ? [screen visibleFrame].size.width + f->left_pos - FRAME_PIXEL_WIDTH (f)
1090 : f->left_pos;
1091 /* We use visibleFrame here to take menu bar into account.
1092 Ideally we should also adjust left/top with visibleFrame.offset. */
1093
1094 f->top_pos = f->size_hint_flags & YNegative
1095 ? ([screen visibleFrame].size.height + f->top_pos
1096 - FRAME_PIXEL_HEIGHT (f) - FRAME_NS_TITLEBAR_HEIGHT (f)
1097 - FRAME_TOOLBAR_HEIGHT (f))
1098 : f->top_pos;
1085#ifdef NS_IMPL_GNUSTEP 1099#ifdef NS_IMPL_GNUSTEP
1086 if (xoff < 100) 1100 if (f->left_pos < 100)
1087 f->left_pos = 100; /* don't overlap menu */ 1101 f->left_pos = 100; /* don't overlap menu */
1088#endif 1102#endif
1103 [[view window] setFrameTopLeftPoint:
1104 NSMakePoint (SCREENMAXBOUND (f->left_pos),
1105 SCREENMAXBOUND ([screen frame].size.height
1106 - NS_TOP_POS (f)))];
1107 f->size_hint_flags &= ~(XNegative|YNegative);
1108 }
1089 1109
1090 if (view != nil && (screen = [[view window] screen]))
1091 [[view window] setFrameTopLeftPoint:
1092 NSMakePoint (SCREENMAXBOUND (f->left_pos),
1093 SCREENMAXBOUND ([screen frame].size.height
1094 - NS_TOP_POS (f)))];
1095 UNBLOCK_INPUT; 1110 UNBLOCK_INPUT;
1096} 1111}
1097 1112
@@ -1148,15 +1163,15 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
1148 /* NOTE: previously this would generate wrong result if toolbar not 1163 /* NOTE: previously this would generate wrong result if toolbar not
1149 yet displayed and fixing toolbar_height=32 helped, but 1164 yet displayed and fixing toolbar_height=32 helped, but
1150 now (200903) seems no longer needed */ 1165 now (200903) seems no longer needed */
1151 FRAME_NS_TOOLBAR_HEIGHT (f) = 1166 FRAME_TOOLBAR_HEIGHT (f) =
1152 NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) 1167 NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)])
1153 - FRAME_NS_TITLEBAR_HEIGHT (f); 1168 - FRAME_NS_TITLEBAR_HEIGHT (f);
1154 else 1169 else
1155 FRAME_NS_TOOLBAR_HEIGHT (f) = 0; 1170 FRAME_TOOLBAR_HEIGHT (f) = 0;
1156 1171
1157 wr.size.width = pixelwidth + f->border_width; 1172 wr.size.width = pixelwidth + f->border_width;
1158 wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f) 1173 wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f)
1159 + FRAME_NS_TOOLBAR_HEIGHT (f); 1174 + FRAME_TOOLBAR_HEIGHT (f);
1160 1175
1161 /* constrain to screen if we can */ 1176 /* constrain to screen if we can */
1162 if (screen) 1177 if (screen)
@@ -4897,16 +4912,16 @@ ns_term_shutdown (int sig)
4897 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, frameSize.height 4912 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, frameSize.height
4898#ifdef NS_IMPL_GNUSTEP 4913#ifdef NS_IMPL_GNUSTEP
4899 - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + 3 4914 - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + 3
4900 - FRAME_NS_TOOLBAR_HEIGHT (emacsframe)); 4915 - FRAME_TOOLBAR_HEIGHT (emacsframe));
4901#else 4916#else
4902 - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) 4917 - FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
4903 - FRAME_NS_TOOLBAR_HEIGHT (emacsframe)); 4918 - FRAME_TOOLBAR_HEIGHT (emacsframe));
4904#endif 4919#endif
4905 if (rows < MINHEIGHT) 4920 if (rows < MINHEIGHT)
4906 rows = MINHEIGHT; 4921 rows = MINHEIGHT;
4907 frameSize.height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (emacsframe, rows) 4922 frameSize.height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (emacsframe, rows)
4908 + FRAME_NS_TITLEBAR_HEIGHT (emacsframe) 4923 + FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
4909 + FRAME_NS_TOOLBAR_HEIGHT (emacsframe); 4924 + FRAME_TOOLBAR_HEIGHT (emacsframe);
4910#ifdef NS_IMPL_COCOA 4925#ifdef NS_IMPL_COCOA
4911 { 4926 {
4912 /* this sets window title to have size in it; the wm does this under GS */ 4927 /* this sets window title to have size in it; the wm does this under GS */
@@ -5117,7 +5132,7 @@ ns_term_shutdown (int sig)
5117 [toggleButton setTarget: self]; 5132 [toggleButton setTarget: self];
5118 [toggleButton setAction: @selector (toggleToolbar: )]; 5133 [toggleButton setAction: @selector (toggleToolbar: )];
5119#endif 5134#endif
5120 FRAME_NS_TOOLBAR_HEIGHT (f) = 0; 5135 FRAME_TOOLBAR_HEIGHT (f) = 0;
5121 5136
5122 tem = f->icon_name; 5137 tem = f->icon_name;
5123 if (!NILP (tem)) 5138 if (!NILP (tem))