diff options
| author | Richard M. Stallman | 1993-05-24 00:04:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-24 00:04:18 +0000 |
| commit | 11ae94fe1a066129baef6b4acac2ce40a3d8f365 (patch) | |
| tree | a324a9c2fecb480db86ecfe51144fc9712fe4b6d /src | |
| parent | ebc64af3a0d7e4b0f05aa8a2f56d652495bed5aa (diff) | |
| download | emacs-11ae94fe1a066129baef6b4acac2ce40a3d8f365.tar.gz emacs-11ae94fe1a066129baef6b4acac2ce40a3d8f365.zip | |
(check_x): New function.
Call it in almost every Lisp function in this file.
(x_set_menu_bar_lines_1): Pass both args in recursive call.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/src/xfns.c b/src/xfns.c index 6905a67b6d5..df2426f1e97 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -195,6 +195,14 @@ extern Lisp_Object Vglobal_mouse_map; | |||
| 195 | /* Points to table of defined typefaces. */ | 195 | /* Points to table of defined typefaces. */ |
| 196 | struct face *x_face_table[MAX_FACES_AND_GLYPHS]; | 196 | struct face *x_face_table[MAX_FACES_AND_GLYPHS]; |
| 197 | 197 | ||
| 198 | /* Error if we are not connected to X. */ | ||
| 199 | static void | ||
| 200 | check_x () | ||
| 201 | { | ||
| 202 | if (x_current_display == 0) | ||
| 203 | error ("X windows are not in use or not initialized"); | ||
| 204 | } | ||
| 205 | |||
| 198 | /* Return the Emacs frame-object corresponding to an X window. | 206 | /* Return the Emacs frame-object corresponding to an X window. |
| 199 | It could be the frame's main window or an icon window. */ | 207 | It could be the frame's main window or an icon window. */ |
| 200 | 208 | ||
| @@ -880,13 +888,13 @@ x_set_menu_bar_lines_1 (window, n) | |||
| 880 | { | 888 | { |
| 881 | struct window *w = XWINDOW (window); | 889 | struct window *w = XWINDOW (window); |
| 882 | 890 | ||
| 883 | w->top += n; | 891 | XFASTINT (w->top) += n; |
| 884 | 892 | ||
| 885 | if (!NILP (w->vchild)) | 893 | if (!NILP (w->vchild)) |
| 886 | x_set_menu_bar_lines_1 (w->vchild); | 894 | x_set_menu_bar_lines_1 (w->vchild, n); |
| 887 | 895 | ||
| 888 | if (!NILP (w->hchild)) | 896 | if (!NILP (w->hchild)) |
| 889 | x_set_menu_bar_lines_1 (w->hchild); | 897 | x_set_menu_bar_lines_1 (w->hchild, n); |
| 890 | } | 898 | } |
| 891 | } | 899 | } |
| 892 | 900 | ||
| @@ -1296,6 +1304,8 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 1296 | char *name_key; | 1304 | char *name_key; |
| 1297 | char *class_key; | 1305 | char *class_key; |
| 1298 | 1306 | ||
| 1307 | check_x (); | ||
| 1308 | |||
| 1299 | CHECK_STRING (attribute, 0); | 1309 | CHECK_STRING (attribute, 0); |
| 1300 | CHECK_STRING (class, 0); | 1310 | CHECK_STRING (class, 0); |
| 1301 | 1311 | ||
| @@ -1503,6 +1513,7 @@ Returns an alist of the form ((top . TOP), (left . LEFT) ... ).") | |||
| 1503 | unsigned int width, height; | 1513 | unsigned int width, height; |
| 1504 | Lisp_Object values[4]; | 1514 | Lisp_Object values[4]; |
| 1505 | 1515 | ||
| 1516 | check_x (); | ||
| 1506 | CHECK_STRING (string, 0); | 1517 | CHECK_STRING (string, 0); |
| 1507 | 1518 | ||
| 1508 | geometry = XParseGeometry ((char *) XSTRING (string)->data, | 1519 | geometry = XParseGeometry ((char *) XSTRING (string)->data, |
| @@ -1833,8 +1844,7 @@ be shared by the new frame.") | |||
| 1833 | long window_prompting = 0; | 1844 | long window_prompting = 0; |
| 1834 | int width, height; | 1845 | int width, height; |
| 1835 | 1846 | ||
| 1836 | if (x_current_display == 0) | 1847 | check_x (); |
| 1837 | error ("X windows are not in use or not initialized"); | ||
| 1838 | 1848 | ||
| 1839 | name = x_get_arg (parms, Qname, "title", "Title", string); | 1849 | name = x_get_arg (parms, Qname, "title", "Title", string); |
| 1840 | if (XTYPE (name) != Lisp_String | 1850 | if (XTYPE (name) != Lisp_String |
| @@ -2321,6 +2331,7 @@ DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 1, 0, | |||
| 2321 | { | 2331 | { |
| 2322 | Color foo; | 2332 | Color foo; |
| 2323 | 2333 | ||
| 2334 | check_x (); | ||
| 2324 | CHECK_STRING (color, 0); | 2335 | CHECK_STRING (color, 0); |
| 2325 | 2336 | ||
| 2326 | if (defined_color (XSTRING (color)->data, &foo)) | 2337 | if (defined_color (XSTRING (color)->data, &foo)) |
| @@ -2333,6 +2344,8 @@ DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 0, 0, | |||
| 2333 | "Return t if the X screen currently in use supports color.") | 2344 | "Return t if the X screen currently in use supports color.") |
| 2334 | () | 2345 | () |
| 2335 | { | 2346 | { |
| 2347 | check_x (); | ||
| 2348 | |||
| 2336 | if (x_screen_planes <= 2) | 2349 | if (x_screen_planes <= 2) |
| 2337 | return Qnil; | 2350 | return Qnil; |
| 2338 | 2351 | ||
| @@ -2356,6 +2369,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, | |||
| 2356 | Lisp_Object frame; | 2369 | Lisp_Object frame; |
| 2357 | { | 2370 | { |
| 2358 | Display *dpy = x_current_display; | 2371 | Display *dpy = x_current_display; |
| 2372 | check_x (); | ||
| 2359 | return make_number (DisplayWidth (dpy, DefaultScreen (dpy))); | 2373 | return make_number (DisplayWidth (dpy, DefaultScreen (dpy))); |
| 2360 | } | 2374 | } |
| 2361 | 2375 | ||
| @@ -2366,6 +2380,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height, | |||
| 2366 | Lisp_Object frame; | 2380 | Lisp_Object frame; |
| 2367 | { | 2381 | { |
| 2368 | Display *dpy = x_current_display; | 2382 | Display *dpy = x_current_display; |
| 2383 | check_x (); | ||
| 2369 | return make_number (DisplayHeight (dpy, DefaultScreen (dpy))); | 2384 | return make_number (DisplayHeight (dpy, DefaultScreen (dpy))); |
| 2370 | } | 2385 | } |
| 2371 | 2386 | ||
| @@ -2376,6 +2391,7 @@ DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, | |||
| 2376 | Lisp_Object frame; | 2391 | Lisp_Object frame; |
| 2377 | { | 2392 | { |
| 2378 | Display *dpy = x_current_display; | 2393 | Display *dpy = x_current_display; |
| 2394 | check_x (); | ||
| 2379 | return make_number (DisplayPlanes (dpy, DefaultScreen (dpy))); | 2395 | return make_number (DisplayPlanes (dpy, DefaultScreen (dpy))); |
| 2380 | } | 2396 | } |
| 2381 | 2397 | ||
| @@ -2386,6 +2402,7 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, | |||
| 2386 | Lisp_Object frame; | 2402 | Lisp_Object frame; |
| 2387 | { | 2403 | { |
| 2388 | Display *dpy = x_current_display; | 2404 | Display *dpy = x_current_display; |
| 2405 | check_x (); | ||
| 2389 | return make_number (DisplayCells (dpy, DefaultScreen (dpy))); | 2406 | return make_number (DisplayCells (dpy, DefaultScreen (dpy))); |
| 2390 | } | 2407 | } |
| 2391 | 2408 | ||
| @@ -2396,6 +2413,7 @@ DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, | |||
| 2396 | { | 2413 | { |
| 2397 | Display *dpy = x_current_display; | 2414 | Display *dpy = x_current_display; |
| 2398 | char *vendor; | 2415 | char *vendor; |
| 2416 | check_x (); | ||
| 2399 | vendor = ServerVendor (dpy); | 2417 | vendor = ServerVendor (dpy); |
| 2400 | if (! vendor) vendor = ""; | 2418 | if (! vendor) vendor = ""; |
| 2401 | return build_string (vendor); | 2419 | return build_string (vendor); |
| @@ -2410,6 +2428,8 @@ number. See also the variable `x-server-vendor'.") | |||
| 2410 | Lisp_Object frame; | 2428 | Lisp_Object frame; |
| 2411 | { | 2429 | { |
| 2412 | Display *dpy = x_current_display; | 2430 | Display *dpy = x_current_display; |
| 2431 | |||
| 2432 | check_x (); | ||
| 2413 | return Fcons (make_number (ProtocolVersion (dpy)), | 2433 | return Fcons (make_number (ProtocolVersion (dpy)), |
| 2414 | Fcons (make_number (ProtocolRevision (dpy)), | 2434 | Fcons (make_number (ProtocolRevision (dpy)), |
| 2415 | Fcons (make_number (VendorRelease (dpy)), Qnil))); | 2435 | Fcons (make_number (VendorRelease (dpy)), Qnil))); |
| @@ -2420,6 +2440,7 @@ DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, | |||
| 2420 | (frame) | 2440 | (frame) |
| 2421 | Lisp_Object frame; | 2441 | Lisp_Object frame; |
| 2422 | { | 2442 | { |
| 2443 | check_x (); | ||
| 2423 | return make_number (ScreenCount (x_current_display)); | 2444 | return make_number (ScreenCount (x_current_display)); |
| 2424 | } | 2445 | } |
| 2425 | 2446 | ||
| @@ -2428,6 +2449,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, | |||
| 2428 | (frame) | 2449 | (frame) |
| 2429 | Lisp_Object frame; | 2450 | Lisp_Object frame; |
| 2430 | { | 2451 | { |
| 2452 | check_x (); | ||
| 2431 | return make_number (HeightMMOfScreen (x_screen)); | 2453 | return make_number (HeightMMOfScreen (x_screen)); |
| 2432 | } | 2454 | } |
| 2433 | 2455 | ||
| @@ -2436,6 +2458,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, | |||
| 2436 | (frame) | 2458 | (frame) |
| 2437 | Lisp_Object frame; | 2459 | Lisp_Object frame; |
| 2438 | { | 2460 | { |
| 2461 | check_x (); | ||
| 2439 | return make_number (WidthMMOfScreen (x_screen)); | 2462 | return make_number (WidthMMOfScreen (x_screen)); |
| 2440 | } | 2463 | } |
| 2441 | 2464 | ||
| @@ -2446,6 +2469,8 @@ The value may be `always', `when-mapped', or `not-useful'.") | |||
| 2446 | (frame) | 2469 | (frame) |
| 2447 | Lisp_Object frame; | 2470 | Lisp_Object frame; |
| 2448 | { | 2471 | { |
| 2472 | check_x (); | ||
| 2473 | |||
| 2449 | switch (DoesBackingStore (x_screen)) | 2474 | switch (DoesBackingStore (x_screen)) |
| 2450 | { | 2475 | { |
| 2451 | case Always: | 2476 | case Always: |
| @@ -2470,6 +2495,8 @@ The value is one of the symbols `static-gray', `gray-scale',\n\ | |||
| 2470 | (screen) | 2495 | (screen) |
| 2471 | Lisp_Object screen; | 2496 | Lisp_Object screen; |
| 2472 | { | 2497 | { |
| 2498 | check_x (); | ||
| 2499 | |||
| 2473 | switch (screen_visual->class) | 2500 | switch (screen_visual->class) |
| 2474 | { | 2501 | { |
| 2475 | case StaticGray: return (intern ("static-gray")); | 2502 | case StaticGray: return (intern ("static-gray")); |
| @@ -2489,6 +2516,8 @@ DEFUN ("x-display-save-under", Fx_display_save_under, | |||
| 2489 | (frame) | 2516 | (frame) |
| 2490 | Lisp_Object frame; | 2517 | Lisp_Object frame; |
| 2491 | { | 2518 | { |
| 2519 | check_x (); | ||
| 2520 | |||
| 2492 | if (DoesSaveUnders (x_screen) == True) | 2521 | if (DoesSaveUnders (x_screen) == True) |
| 2493 | return Qt; | 2522 | return Qt; |
| 2494 | else | 2523 | else |
| @@ -3374,6 +3403,7 @@ also be depressed for NEWSTRING to appear.") | |||
| 3374 | register KeySym keysym; | 3403 | register KeySym keysym; |
| 3375 | KeySym modifier_list[16]; | 3404 | KeySym modifier_list[16]; |
| 3376 | 3405 | ||
| 3406 | check_x (); | ||
| 3377 | CHECK_STRING (x_keysym, 1); | 3407 | CHECK_STRING (x_keysym, 1); |
| 3378 | CHECK_STRING (newstring, 3); | 3408 | CHECK_STRING (newstring, 3); |
| 3379 | 3409 | ||
| @@ -3425,6 +3455,7 @@ See the documentation of `x-rebind-key' for more information.") | |||
| 3425 | int strsize; | 3455 | int strsize; |
| 3426 | register unsigned i; | 3456 | register unsigned i; |
| 3427 | 3457 | ||
| 3458 | check_x (); | ||
| 3428 | CHECK_NUMBER (keycode, 1); | 3459 | CHECK_NUMBER (keycode, 1); |
| 3429 | CHECK_CONS (strings, 2); | 3460 | CHECK_CONS (strings, 2); |
| 3430 | rawkey = (KeySym) ((unsigned) (XINT (keycode))) & 255; | 3461 | rawkey = (KeySym) ((unsigned) (XINT (keycode))) & 255; |
| @@ -3665,6 +3696,8 @@ easier.") | |||
| 3665 | (on) | 3696 | (on) |
| 3666 | Lisp_Object on; | 3697 | Lisp_Object on; |
| 3667 | { | 3698 | { |
| 3699 | check_x (); | ||
| 3700 | |||
| 3668 | XSynchronize (x_current_display, !EQ (on, Qnil)); | 3701 | XSynchronize (x_current_display, !EQ (on, Qnil)); |
| 3669 | 3702 | ||
| 3670 | return Qnil; | 3703 | return Qnil; |