Mercurial > emacs
comparison src/frame.c @ 16051:ccf489f8596e
Removed support for !MULTI_FRAME.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sun, 01 Sep 1996 21:04:32 +0000 |
parents | ca2455cb0b9d |
children | 049d6b31cd42 |
comparison
equal
deleted
inserted
replaced
16050:c2805a244171 | 16051:ccf489f8596e |
---|---|
60 (subst-char-in-region start (point) ?_ ?-)) | 60 (subst-char-in-region start (point) ?_ ?-)) |
61 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list))) | 61 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list))) |
62 (setq symbol-list (cdr symbol-list))))) | 62 (setq symbol-list (cdr symbol-list))))) |
63 */ | 63 */ |
64 | 64 |
65 /* We need most of these symbols even if not MULTI_FRAME; | |
66 easiest to define them all, all of the time. */ | |
67 /*&&& symbols declared here &&&*/ | 65 /*&&& symbols declared here &&&*/ |
68 Lisp_Object Qframep; | 66 Lisp_Object Qframep; |
69 Lisp_Object Qframe_live_p; | 67 Lisp_Object Qframe_live_p; |
70 Lisp_Object Qheight; | 68 Lisp_Object Qheight; |
71 Lisp_Object Qicon; | 69 Lisp_Object Qicon; |
170 int nlines; | 168 int nlines; |
171 int olines = FRAME_MENU_BAR_LINES (f); | 169 int olines = FRAME_MENU_BAR_LINES (f); |
172 | 170 |
173 /* Right now, menu bars don't work properly in minibuf-only frames; | 171 /* Right now, menu bars don't work properly in minibuf-only frames; |
174 most of the commands try to apply themselves to the minibuffer | 172 most of the commands try to apply themselves to the minibuffer |
175 frame itslef, and get an error because you can't switch buffers | 173 frame itself, and get an error because you can't switch buffers |
176 in or split the minibuffer window. */ | 174 in or split the minibuffer window. */ |
177 if (FRAME_MINIBUF_ONLY_P (f)) | 175 if (FRAME_MINIBUF_ONLY_P (f)) |
178 return; | 176 return; |
179 | 177 |
180 if (INTEGERP (value)) | 178 if (INTEGERP (value)) |
189 FRAME_MENU_BAR_LINES (f) = nlines; | 187 FRAME_MENU_BAR_LINES (f) = nlines; |
190 set_menu_bar_lines_1 (f->root_window, nlines - olines); | 188 set_menu_bar_lines_1 (f->root_window, nlines - olines); |
191 } | 189 } |
192 } | 190 } |
193 | 191 |
194 #ifdef MULTI_FRAME | |
195 | |
196 #include "buffer.h" | 192 #include "buffer.h" |
197 | 193 |
198 /* These help us bind and responding to switch-frame events. */ | 194 /* These help us bind and responding to switch-frame events. */ |
199 #include "commands.h" | 195 #include "commands.h" |
200 #include "keyboard.h" | 196 #include "keyboard.h" |
2131 initial_define_lispy_key (global_map, "switch-frame", "handle-switch-frame"); | 2127 initial_define_lispy_key (global_map, "switch-frame", "handle-switch-frame"); |
2132 initial_define_lispy_key (global_map, "delete-frame", "handle-delete-frame"); | 2128 initial_define_lispy_key (global_map, "delete-frame", "handle-delete-frame"); |
2133 initial_define_lispy_key (global_map, "iconify-frame", "ignore-event"); | 2129 initial_define_lispy_key (global_map, "iconify-frame", "ignore-event"); |
2134 initial_define_lispy_key (global_map, "make-frame-visible", "ignore-event"); | 2130 initial_define_lispy_key (global_map, "make-frame-visible", "ignore-event"); |
2135 } | 2131 } |
2136 | |
2137 #else /* not MULTI_FRAME */ | |
2138 | |
2139 /* If we're not using multi-frame stuff, we still need to provide some | |
2140 support functions. */ | |
2141 | |
2142 /* Unless this function is defined, providing set-frame-height and | |
2143 set-frame-width doesn't help compatibility any, since they both | |
2144 want this as their first argument. */ | |
2145 DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0, | |
2146 /* Don't confuse make-docfile by having two doc strings for this function. | |
2147 make-docfile does not pay attention to #if, for good reason! */ | |
2148 0) | |
2149 () | |
2150 { | |
2151 /* For your possible information, this code is unfolded into the | |
2152 second WINDOW_FRAME in frame.h. */ | |
2153 Lisp_Object tem; | |
2154 XSETFASTINT (tem, 0); | |
2155 return tem; | |
2156 } | |
2157 | |
2158 DEFUN ("active-minibuffer-window", Factive_minibuffer_window, | |
2159 Sactive_minibuffer_window, 0, 0, 0, | |
2160 /* Don't confuse make-docfile by having two doc strings for this function. | |
2161 make-docfile does not pay attention to #if, for good reason! */ | |
2162 0) | |
2163 () | |
2164 { | |
2165 return minibuf_level ? minibuf_window : Qnil; | |
2166 } | |
2167 | |
2168 DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, | |
2169 /* Don't confuse make-docfile by having two doc strings for this function. | |
2170 make-docfile does not pay attention to #if, for good reason! */ | |
2171 0) | |
2172 (window) | |
2173 Lisp_Object window; | |
2174 { | |
2175 /* For your possible information, this code is unfolded into the | |
2176 second WINDOW_FRAME in frame.h. */ | |
2177 Lisp_Object tem; | |
2178 XSETFASTINT (tem, 0); | |
2179 return tem; | |
2180 } | |
2181 | |
2182 DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0, | |
2183 0) | |
2184 (frame) | |
2185 Lisp_Object frame; | |
2186 { | |
2187 Lisp_Object w; | |
2188 | |
2189 w = FRAME_ROOT_WINDOW (selected_frame); | |
2190 | |
2191 while (NILP (XWINDOW (w)->buffer)) | |
2192 { | |
2193 if (! NILP (XWINDOW (w)->hchild)) | |
2194 w = XWINDOW (w)->hchild; | |
2195 else if (! NILP (XWINDOW (w)->vchild)) | |
2196 w = XWINDOW (w)->vchild; | |
2197 else | |
2198 abort (); | |
2199 } | |
2200 return w; | |
2201 } | |
2202 | |
2203 DEFUN ("framep", Fframep, Sframep, 1, 1, 0, | |
2204 /* Don't confuse make-docfile by having two doc strings for this function. | |
2205 make-docfile does not pay attention to #if, for good reason! */ | |
2206 0) | |
2207 (object) | |
2208 Lisp_Object object; | |
2209 { | |
2210 #ifdef MSDOS | |
2211 if (FRAME_X_P (object)) | |
2212 return intern ("pc"); | |
2213 #endif | |
2214 return Qnil; | |
2215 } | |
2216 | |
2217 DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0, | |
2218 /* Don't confuse make-docfile by having two doc strings for this function. | |
2219 make-docfile does not pay attention to #if, for good reason! */ | |
2220 0) | |
2221 (frame, rows, pretend) | |
2222 Lisp_Object frame, rows, pretend; | |
2223 { | |
2224 CHECK_NUMBER (rows, 0); | |
2225 | |
2226 change_frame_size (0, XINT (rows), 0, !NILP (pretend), 0); | |
2227 return Qnil; | |
2228 } | |
2229 | |
2230 DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0, | |
2231 /* Don't confuse make-docfile by having two doc strings for this function. | |
2232 make-docfile does not pay attention to #if, for good reason! */ | |
2233 0) | |
2234 (frame, cols, pretend) | |
2235 Lisp_Object frame, cols, pretend; | |
2236 { | |
2237 CHECK_NUMBER (cols, 0); | |
2238 | |
2239 change_frame_size (0, 0, XINT (cols), !NILP (pretend), 0); | |
2240 return Qnil; | |
2241 } | |
2242 | |
2243 DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0, | |
2244 /* Don't confuse make-docfile by having two doc strings for this function. | |
2245 make-docfile does not pay attention to #if, for good reason! */ | |
2246 0) | |
2247 (frame, cols, rows) | |
2248 Lisp_Object frame, cols, rows; | |
2249 { | |
2250 CHECK_NUMBER (cols, 2); | |
2251 CHECK_NUMBER (rows, 1); | |
2252 | |
2253 change_frame_size (0, XINT (rows), XINT (cols), 0, 0); | |
2254 | |
2255 return Qnil; | |
2256 } | |
2257 | |
2258 DEFUN ("frame-height", Fframe_height, Sframe_height, 0, 1, 0, | |
2259 /* Don't confuse make-docfile by having two doc strings for this function. | |
2260 make-docfile does not pay attention to #if, for good reason! */ | |
2261 0) | |
2262 (frame) | |
2263 Lisp_Object frame; | |
2264 { | |
2265 return make_number (FRAME_HEIGHT (selected_frame)); | |
2266 } | |
2267 | |
2268 DEFUN ("frame-width", Fframe_width, Sframe_width, 0, 1, 0, | |
2269 /* Don't confuse make-docfile by having two doc strings for this function. | |
2270 make-docfile does not pay attention to #if, for good reason! */ | |
2271 0) | |
2272 (frame) | |
2273 Lisp_Object frame; | |
2274 { | |
2275 return make_number (FRAME_WIDTH (selected_frame)); | |
2276 } | |
2277 | |
2278 DEFUN ("frame-char-height", Fframe_char_height, Sframe_char_height, | |
2279 0, 1, 0, | |
2280 /* Don't confuse make-docfile by having two doc strings for this function. | |
2281 make-docfile does not pay attention to #if, for good reason! */ | |
2282 0) | |
2283 (frame) | |
2284 Lisp_Object frame; | |
2285 { | |
2286 return make_number (1); | |
2287 } | |
2288 | |
2289 | |
2290 DEFUN ("frame-char-width", Fframe_char_width, Sframe_char_width, | |
2291 0, 1, 0, | |
2292 /* Don't confuse make-docfile by having two doc strings for this function. | |
2293 make-docfile does not pay attention to #if, for good reason! */ | |
2294 0) | |
2295 (frame) | |
2296 Lisp_Object frame; | |
2297 { | |
2298 return make_number (1); | |
2299 } | |
2300 | |
2301 DEFUN ("frame-pixel-height", Fframe_pixel_height, | |
2302 Sframe_pixel_height, 0, 1, 0, | |
2303 /* Don't confuse make-docfile by having two doc strings for this function. | |
2304 make-docfile does not pay attention to #if, for good reason! */ | |
2305 0) | |
2306 (frame) | |
2307 Lisp_Object frame; | |
2308 { | |
2309 return make_number (FRAME_HEIGHT (f)); | |
2310 } | |
2311 | |
2312 DEFUN ("frame-pixel-width", Fframe_pixel_width, | |
2313 Sframe_pixel_width, 0, 1, 0, | |
2314 /* Don't confuse make-docfile by having two doc strings for this function. | |
2315 make-docfile does not pay attention to #if, for good reason! */ | |
2316 0) | |
2317 (frame) | |
2318 Lisp_Object frame; | |
2319 { | |
2320 return make_number (FRAME_WIDTH (f)); | |
2321 } | |
2322 | |
2323 /* These are for backward compatibility with Emacs 18. */ | |
2324 | |
2325 DEFUN ("set-screen-height", Fset_screen_height, Sset_screen_height, 1, 2, 0, | |
2326 /* Don't confuse make-docfile by having two doc strings for this function. | |
2327 make-docfile does not pay attention to #if, for good reason! */ | |
2328 0) | |
2329 (lines, pretend) | |
2330 Lisp_Object lines, pretend; | |
2331 { | |
2332 CHECK_NUMBER (lines, 0); | |
2333 | |
2334 change_frame_size (0, XINT (lines), 0, !NILP (pretend), 0); | |
2335 return Qnil; | |
2336 } | |
2337 | |
2338 DEFUN ("set-screen-width", Fset_screen_width, Sset_screen_width, 1, 2, 0, | |
2339 /* Don't confuse make-docfile by having two doc strings for this function. | |
2340 make-docfile does not pay attention to #if, for good reason! */ | |
2341 0) | |
2342 (cols, pretend) | |
2343 Lisp_Object cols, pretend; | |
2344 { | |
2345 CHECK_NUMBER (cols, 0); | |
2346 | |
2347 change_frame_size (0, 0, XINT (cols), !NILP (pretend), 0); | |
2348 return Qnil; | |
2349 } | |
2350 | |
2351 DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0, | |
2352 /* Don't confuse make-docfile by having two doc strings for this function. | |
2353 make-docfile does not pay attention to #if, for good reason! */ | |
2354 0) | |
2355 () | |
2356 { | |
2357 #ifdef HAVE_MOUSE | |
2358 if (mouse_position_hook) | |
2359 { | |
2360 FRAME_PTR f; | |
2361 Lisp_Object lispy_dummy; | |
2362 enum scroll_bar_part party_dummy; | |
2363 Lisp_Object x, y; | |
2364 unsigned long long_dummy; | |
2365 | |
2366 (*mouse_position_hook) (&f, 0, | |
2367 &lispy_dummy, &party_dummy, | |
2368 &x, &y, | |
2369 &long_dummy); | |
2370 return Fcons (Fselected_frame (), Fcons (x, y)); | |
2371 } | |
2372 #endif | |
2373 return Fcons (Qnil, Fcons (Qnil, Qnil)); | |
2374 } | |
2375 | |
2376 void | |
2377 store_in_alist (alistptr, prop, val) | |
2378 Lisp_Object *alistptr, val; | |
2379 Lisp_Object prop; | |
2380 { | |
2381 register Lisp_Object tem; | |
2382 | |
2383 tem = Fassq (prop, *alistptr); | |
2384 if (EQ (tem, Qnil)) | |
2385 *alistptr = Fcons (Fcons (prop, val), *alistptr); | |
2386 else | |
2387 Fsetcdr (tem, val); | |
2388 } | |
2389 | |
2390 DEFUN ("frame-parameters", Fframe_parameters, Sframe_parameters, 0, 1, 0, | |
2391 /* Don't confuse make-docfile by having two doc strings for this function. | |
2392 make-docfile does not pay attention to #if, for good reason! */ | |
2393 0) | |
2394 (frame) | |
2395 Lisp_Object frame; | |
2396 { | |
2397 Lisp_Object alist; | |
2398 FRAME_PTR f; | |
2399 int height, width; | |
2400 | |
2401 if (EQ (frame, Qnil)) | |
2402 f = selected_frame; | |
2403 else | |
2404 { | |
2405 CHECK_FRAME (frame, 0); | |
2406 f = XFRAME (frame); | |
2407 } | |
2408 | |
2409 if (!FRAME_LIVE_P (f)) | |
2410 return Qnil; | |
2411 | |
2412 alist = Qnil; | |
2413 #ifdef MSDOS | |
2414 if (FRAME_X_P (f)) | |
2415 { | |
2416 static char *colornames[16] = | |
2417 { | |
2418 "black", "blue", "green", "cyan", "red", "magenta", "brown", | |
2419 "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan", | |
2420 "lightred", "lightmagenta", "yellow", "white" | |
2421 }; | |
2422 store_in_alist (&alist, intern ("foreground-color"), | |
2423 build_string (colornames[FRAME_FOREGROUND_PIXEL (f)])); | |
2424 store_in_alist (&alist, intern ("background-color"), | |
2425 build_string (colornames[FRAME_BACKGROUND_PIXEL (f)])); | |
2426 } | |
2427 #endif | |
2428 store_in_alist (&alist, intern ("font"), build_string ("default")); | |
2429 store_in_alist (&alist, Qname, build_string ("emacs")); | |
2430 height = (FRAME_NEW_HEIGHT (f) ? FRAME_NEW_HEIGHT (f) : FRAME_HEIGHT (f)); | |
2431 store_in_alist (&alist, Qheight, make_number (height)); | |
2432 width = (FRAME_NEW_WIDTH (f) ? FRAME_NEW_WIDTH (f) : FRAME_WIDTH (f)); | |
2433 store_in_alist (&alist, Qwidth, make_number (width)); | |
2434 store_in_alist (&alist, Qmodeline, (FRAME_WANTS_MODELINE_P (f) ? Qt : Qnil)); | |
2435 store_in_alist (&alist, Qminibuffer, FRAME_MINIBUF_WINDOW (f)); | |
2436 store_in_alist (&alist, Qunsplittable, (FRAME_NO_SPLIT_P (f) ? Qt : Qnil)); | |
2437 store_in_alist (&alist, Qmenu_bar_lines, (FRAME_MENU_BAR_LINES (f))); | |
2438 | |
2439 return alist; | |
2440 } | |
2441 | |
2442 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters, | |
2443 Smodify_frame_parameters, 2, 2, 0, | |
2444 /* Don't confuse make-docfile by having two doc strings for this function. | |
2445 make-docfile does not pay attention to #if, for good reason! */ | |
2446 0) | |
2447 (frame, alist) | |
2448 Lisp_Object frame, alist; | |
2449 { | |
2450 Lisp_Object tail, elt, prop, val; | |
2451 FRAME_PTR f; | |
2452 | |
2453 if (NILP (frame)) | |
2454 f = selected_frame; | |
2455 else | |
2456 { | |
2457 CHECK_LIVE_FRAME (frame, 0); | |
2458 f = XFRAME (frame); | |
2459 } | |
2460 | |
2461 #ifdef MSDOS | |
2462 if (FRAME_X_P (frame)) | |
2463 IT_set_frame_parameters (XFRAME (frame), alist); | |
2464 else | |
2465 #endif | |
2466 for (tail = alist; !EQ (tail, Qnil); tail = Fcdr (tail)) | |
2467 { | |
2468 elt = Fcar (tail); | |
2469 prop = Fcar (elt); | |
2470 val = Fcdr (elt); | |
2471 if (EQ (prop, Qmenu_bar_lines)) | |
2472 set_menu_bar_lines (f, val, make_number (FRAME_MENU_BAR_LINES (f))); | |
2473 } | |
2474 | |
2475 return Qnil; | |
2476 } | |
2477 | |
2478 DEFUN ("frame-live-p", Fframe_live_p, Sframe_live_p, 1, 1, 0, | |
2479 /* Don't confuse make-docfile by having two doc strings for this function. | |
2480 make-docfile does not pay attention to #if, for good reason! */ | |
2481 0) | |
2482 (frame) | |
2483 Lisp_Object frame; | |
2484 { | |
2485 return Qt; | |
2486 } | |
2487 | |
2488 DEFUN ("frame-visible-p", Fframe_visible_p, Sframe_visible_p, 1, 1, 0, | |
2489 /* Don't confuse make-docfile by having two doc strings for this function. | |
2490 make-docfile does not pay attention to #if, for good reason! */ | |
2491 0) | |
2492 (frame) | |
2493 Lisp_Object frame; | |
2494 { | |
2495 return Qt; | |
2496 } | |
2497 | |
2498 DEFUN ("frame-list", Fframe_list, Sframe_list, 0, 0, 0, | |
2499 /* Don't confuse make-docfile by having two doc strings for this function. | |
2500 make-docfile does not pay attention to #if, for good reason! */ | |
2501 0) | |
2502 () | |
2503 { | |
2504 return Fcons (Fselected_frame (), Qnil); | |
2505 } | |
2506 | |
2507 syms_of_frame () | |
2508 { | |
2509 syms_of_frame_1 (); | |
2510 | |
2511 DEFVAR_LISP ("terminal-frame", &Vterminal_frame, | |
2512 /* Don't confuse make-docfile by having two doc strings for this variable. | |
2513 make-docfile does not pay attention to #if, for good reason! */ | |
2514 0); | |
2515 XSETFASTINT (Vterminal_frame, 0); | |
2516 | |
2517 defsubr (&Sselected_frame); | |
2518 defsubr (&Sactive_minibuffer_window); | |
2519 defsubr (&Swindow_frame); | |
2520 defsubr (&Sframe_first_window); | |
2521 defsubr (&Sframep); | |
2522 defsubr (&Sframe_char_height); | |
2523 defsubr (&Sframe_char_width); | |
2524 defsubr (&Sframe_pixel_height); | |
2525 defsubr (&Sframe_pixel_width); | |
2526 defsubr (&Sset_frame_height); | |
2527 defsubr (&Sset_frame_width); | |
2528 defsubr (&Sset_frame_size); | |
2529 defsubr (&Sset_screen_height); | |
2530 defsubr (&Sset_screen_width); | |
2531 defsubr (&Sframe_height); | |
2532 Ffset (intern ("screen-height"), intern ("frame-height")); | |
2533 defsubr (&Sframe_width); | |
2534 Ffset (intern ("screen-width"), intern ("frame-width")); | |
2535 defsubr (&Smouse_position); | |
2536 Ffset (intern ("mouse-pixel-position"), intern ("mouse-position")); | |
2537 defsubr (&Sframe_parameters); | |
2538 defsubr (&Smodify_frame_parameters); | |
2539 defsubr (&Sframe_live_p); | |
2540 defsubr (&Sframe_visible_p); | |
2541 defsubr (&Sframe_list); | |
2542 | |
2543 #ifdef MSDOS | |
2544 /* A comment in dispnew.c says the_only_frame is not protected. */ | |
2545 the_only_frame.face_alist = Qnil; | |
2546 staticpro (&the_only_frame.face_alist); | |
2547 the_only_frame.menu_bar_items = Qnil; | |
2548 staticpro (&the_only_frame.menu_bar_items); | |
2549 the_only_frame.menu_bar_vector = Qnil; | |
2550 staticpro (&the_only_frame.menu_bar_vector); | |
2551 the_only_frame.menu_bar_items = menu_bar_items (Qnil); | |
2552 #endif | |
2553 } | |
2554 | |
2555 keys_of_frame () | |
2556 { | |
2557 } | |
2558 | |
2559 #endif /* not MULTI_FRAME */ |