aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2009-05-06 03:09:11 +0000
committerStefan Monnier2009-05-06 03:09:11 +0000
commit5996e1b74c382855c5af0ccf737aeef3ad5f4626 (patch)
tree58bd12186cdaf743909c05a518b47e9377001073 /src
parentba98e3a0fffe915d4f3a94c1c3bf69f05cc812b9 (diff)
downloademacs-5996e1b74c382855c5af0ccf737aeef3ad5f4626.tar.gz
emacs-5996e1b74c382855c5af0ccf737aeef3ad5f4626.zip
(ns_get_screen): Rewrite.
Don't presume selected-frame is of type `ns'.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/nsfns.m62
2 files changed, 27 insertions, 38 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5f41bd894f4..47be6be45f0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12009-05-06 Stefan Monnier <monnier@iro.umontreal.ca> 12009-05-06 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * nsfns.m (ns_get_screen): Rewrite.
4 Don't presume selected-frame is of type `ns'.
5
3 * font.c (font_update_drivers): Sanity fallback to avoid disabling 6 * font.c (font_update_drivers): Sanity fallback to avoid disabling
4 all drivers. 7 all drivers.
5 8
diff --git a/src/nsfns.m b/src/nsfns.m
index b6d0d189cc5..13f9953554f 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -203,46 +203,32 @@ ns_get_window (Lisp_Object maybeFrame)
203 203
204 204
205static NSScreen * 205static NSScreen *
206ns_get_screen (Lisp_Object anythingUnderTheSun) 206ns_get_screen (Lisp_Object screen)
207{ 207{
208 id window =nil; 208 struct terminal *terminal = get_terminal (screen, 1);
209 NSScreen *screen = 0; 209 if (terminal->type != output_ns)
210 210 // Not sure if this special case for nil is needed. It does seem to be
211 struct terminal *terminal; 211 // important in xfns.c for the make-frame call in frame-initialize,
212 struct ns_display_info *dpyinfo; 212 // so let's keep it here for now.
213 struct frame *f = NULL; 213 return (NILP (screen) ? [NSScreen mainScreen] : NULL);
214 Lisp_Object frame; 214 else
215
216 if (INTEGERP (anythingUnderTheSun)) {
217 /* we got a terminal */
218 terminal = get_terminal (anythingUnderTheSun, 1);
219 dpyinfo = terminal->display_info.ns;
220 f = dpyinfo->x_focus_frame;
221 if (!f)
222 f = dpyinfo->x_highlight_frame;
223
224 } else if (FRAMEP (anythingUnderTheSun) &&
225 FRAME_NS_P (XFRAME (anythingUnderTheSun))) {
226 /* we got a frame */
227 f = XFRAME (anythingUnderTheSun);
228
229 } else if (STRINGP (anythingUnderTheSun)) { /* FIXME/cl for multi-display */
230 }
231
232 if (!f)
233 f = SELECTED_FRAME ();
234 if (f)
235 { 215 {
236 XSETFRAME (frame, f); 216 struct ns_display_info *dpyinfo = terminal->display_info.ns;
237 window = ns_get_window (frame); 217 struct frame *f = dpyinfo->x_focus_frame;
218 if (!f)
219 f = dpyinfo->x_highlight_frame;
220 if (!f)
221 return NULL;
222 else
223 {
224 id window = nil;
225 Lisp_Object frame;
226 eassert (FRAME_NS_P (f));
227 XSETFRAME (frame, f);
228 window = ns_get_window (frame);
229 return window ? [window screen] : NULL;
230 }
238 } 231 }
239
240 if (window)
241 screen = [window screen];
242 if (!screen)
243 screen = [NSScreen mainScreen];
244
245 return screen;
246} 232}
247 233
248 234