aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-03-20 06:25:55 +0000
committerRichard M. Stallman1993-03-20 06:25:55 +0000
commit41beb8fc1333547edab02966791f2d6bba55a778 (patch)
treef33ccd7f59116ff5c62a540d160db38d43b1b756 /src
parent5e15f62581252eec08b4f1ba8c660885959c9450 (diff)
downloademacs-41beb8fc1333547edab02966791f2d6bba55a778.tar.gz
emacs-41beb8fc1333547edab02966791f2d6bba55a778.zip
(x_screen): Make this var file scope.
(Fx_server_version): Use Fcons, not list3. (Fx_server_vendor, Fx_server_version, Fx_display_pixel_width) (Fx_display_pixel_height, Fx_display_mm_width, Fx_display_mm_height) (Fx_display_screens, Fx_display_planes, Fx_display_color_cells) (Fx_display_visual_class, Fx_display_backing_store) (Fx_display_save_under): New functions. (x_screen_count, Vx_vendor, x_release, x_screen_height_mm) (x_screen_width_mm, Vx_backing_store, x_save_under, Vx_screen_visual) (x_visual_strings): Vars deleted. (Fx_open_connection): Don't init those vars. (syms_of_xfns): Set up new functions. Don't set up those vars as Lisp vars. Nor x-screen-width and x-screen-height.
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c255
1 files changed, 163 insertions, 92 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 11948f3931c..0699f9b299a 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -60,55 +60,24 @@ Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
60/* Color of chars displayed in cursor box. */ 60/* Color of chars displayed in cursor box. */
61Lisp_Object Vx_cursor_fore_pixel; 61Lisp_Object Vx_cursor_fore_pixel;
62 62
63/* The screen being used. */
64static Screen *x_screen;
65
63/* The X Visual we are using for X windows (the default) */ 66/* The X Visual we are using for X windows (the default) */
64Visual *screen_visual; 67Visual *screen_visual;
65 68
66/* How many screens this X display has. */
67int x_screen_count;
68
69/* The vendor supporting this X server. */
70Lisp_Object Vx_vendor;
71
72/* The vendor's release number for this X server. */
73int x_release;
74
75/* Height of this X screen in pixels. */ 69/* Height of this X screen in pixels. */
76int x_screen_height; 70int x_screen_height;
77 71
78/* Height of this X screen in millimeters. */
79int x_screen_height_mm;
80
81/* Width of this X screen in pixels. */ 72/* Width of this X screen in pixels. */
82int x_screen_width; 73int x_screen_width;
83 74
84/* Width of this X screen in millimeters. */
85int x_screen_width_mm;
86
87/* Does this X screen do backing store? */
88Lisp_Object Vx_backing_store;
89
90/* Does this X screen do save-unders? */
91int x_save_under;
92
93/* Number of planes for this screen. */ 75/* Number of planes for this screen. */
94int x_screen_planes; 76int x_screen_planes;
95 77
96/* X Visual type of this screen. */
97Lisp_Object Vx_screen_visual;
98
99/* Non nil if no window manager is in use. */ 78/* Non nil if no window manager is in use. */
100Lisp_Object Vx_no_window_manager; 79Lisp_Object Vx_no_window_manager;
101 80
102static char *x_visual_strings[] =
103 {
104 "StaticGray",
105 "GrayScale",
106 "StaticColor",
107 "PseudoColor",
108 "TrueColor",
109 "DirectColor"
110 };
111
112/* `t' if a mouse button is depressed. */ 81/* `t' if a mouse button is depressed. */
113 82
114Lisp_Object Vmouse_depressed; 83Lisp_Object Vmouse_depressed;
@@ -2333,6 +2302,152 @@ DEFUN ("x-color-display-p", Fx_color_display_p, Sx_color_display_p, 0, 0, 0,
2333 } 2302 }
2334} 2303}
2335 2304
2305DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
2306 0, 1, 0,
2307 "Returns the width in pixels of the display FRAME is on.")
2308 (frame)
2309 Lisp_Object frame;
2310{
2311 Display *dpy = x_current_display;
2312 return make_number (DisplayWidth (dpy, DefaultScreen (dpy)));
2313}
2314
2315DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
2316 Sx_display_pixel_height, 0, 1, 0,
2317 "Returns the height in pixels of the display FRAME is on.")
2318 (frame)
2319 Lisp_Object frame;
2320{
2321 Display *dpy = x_current_display;
2322 return make_number (DisplayHeight (dpy, DefaultScreen (dpy)));
2323}
2324
2325DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
2326 0, 1, 0,
2327 "Returns the number of bitplanes of the display FRAME is on.")
2328 (frame)
2329 Lisp_Object frame;
2330{
2331 Display *dpy = x_current_display;
2332 return make_number (DisplayPlanes (dpy, DefaultScreen (dpy)));
2333}
2334
2335DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
2336 0, 1, 0,
2337 "Returns the number of color cells of the display FRAME is on.")
2338 (frame)
2339 Lisp_Object frame;
2340{
2341 Display *dpy = x_current_display;
2342 return make_number (DisplayCells (dpy, DefaultScreen (dpy)));
2343}
2344
2345DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
2346 "Returns the vendor ID string of the X server FRAME is on.")
2347 (frame)
2348 Lisp_Object frame;
2349{
2350 Display *dpy = x_current_display;
2351 char *vendor;
2352 vendor = ServerVendor (dpy);
2353 if (! vendor) vendor = "";
2354 return build_string (vendor);
2355}
2356
2357DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
2358 "Returns the version numbers of the X server in use.\n\
2359The value is a list of three integers: the major and minor\n\
2360version numbers of the X Protocol in use, and the vendor-specific release\n\
2361number. See also the variable `x-server-vendor'.")
2362 (frame)
2363 Lisp_Object frame;
2364{
2365 Display *dpy = x_current_display;
2366 return Fcons (make_number (ProtocolVersion (dpy)),
2367 Fcons (make_number (ProtocolRevision (dpy)),
2368 Fcons (make_number (VendorRelease (dpy)), Qnil)));
2369}
2370
2371DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
2372 "Returns the number of screens on the X server FRAME is on.")
2373 (frame)
2374 Lisp_Object frame;
2375{
2376 return make_number (ScreenCount (x_current_display));
2377}
2378
2379DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0,
2380 "Returns the height in millimeters of the X screen FRAME is on.")
2381 (frame)
2382 Lisp_Object frame;
2383{
2384 return make_number (HeightMMOfScreen (x_screen));
2385}
2386
2387DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
2388 "Returns the width in millimeters of the X screen FRAME is on.")
2389 (frame)
2390 Lisp_Object frame;
2391{
2392 return make_number (WidthMMOfScreen (x_screen));
2393}
2394
2395DEFUN ("x-display-backing-store", Fx_display_backing_store,
2396 Sx_display_backing_store, 0, 1, 0,
2397 "Returns an indication of whether the X screen FRAME is on does backing store.\n\
2398The value may be `always', `when-mapped', or `not-useful'.")
2399 (frame)
2400 Lisp_Object frame;
2401{
2402 switch (DoesBackingStore (x_screen))
2403 {
2404 case Always:
2405 return intern ("always");
2406
2407 case WhenMapped:
2408 return intern ("when-mapped");
2409
2410 case NotUseful:
2411 return intern ("not-useful");
2412
2413 default:
2414 error ("Strange value for BackingStore parameter of screen");
2415 }
2416}
2417
2418DEFUN ("x-display-visual-class", Fx_display_visual_class,
2419 Sx_display_visual_class, 0, 1, 0,
2420 "Returns the visual class of the display `screen' is on.\n\
2421The value is one of the symbols `static-gray', `gray-scale',\n\
2422`static-color', `pseudo-color', `true-color', or `direct-color'.")
2423 (screen)
2424 Lisp_Object screen;
2425{
2426 switch (screen_visual->class)
2427 {
2428 case StaticGray: return (intern ("static-gray"));
2429 case GrayScale: return (intern ("gray-scale"));
2430 case StaticColor: return (intern ("static-color"));
2431 case PseudoColor: return (intern ("pseudo-color"));
2432 case TrueColor: return (intern ("true-color"));
2433 case DirectColor: return (intern ("direct-color"));
2434 default:
2435 error ("Display has an unknown visual class");
2436 }
2437}
2438
2439DEFUN ("x-display-save-under", Fx_display_save_under,
2440 Sx_display_save_under, 0, 1, 0,
2441 "Returns t if the X screen FRAME is on supports the save-under feature.")
2442 (frame)
2443 Lisp_Object frame;
2444{
2445 if (DoesSaveUnders (x_screen) == True)
2446 return Qt;
2447 else
2448 return Qnil;
2449}
2450
2336x_pixel_width (f) 2451x_pixel_width (f)
2337 register struct frame *f; 2452 register struct frame *f;
2338{ 2453{
@@ -3621,7 +3736,6 @@ arg XRM_STRING is a string of resources in xrdb format.")
3621 Lisp_Object display, xrm_string; 3736 Lisp_Object display, xrm_string;
3622{ 3737{
3623 unsigned int n_planes; 3738 unsigned int n_planes;
3624 register Screen *x_screen;
3625 unsigned char *xrm_option; 3739 unsigned char *xrm_option;
3626 3740
3627 CHECK_STRING (display, 0); 3741 CHECK_STRING (display, 0);
@@ -3647,42 +3761,10 @@ arg XRM_STRING is a string of resources in xrdb format.")
3647 3761
3648 x_screen = DefaultScreenOfDisplay (x_current_display); 3762 x_screen = DefaultScreenOfDisplay (x_current_display);
3649 3763
3650 x_screen_count = ScreenCount (x_current_display);
3651 Vx_vendor = build_string (ServerVendor (x_current_display));
3652 x_release = VendorRelease (x_current_display);
3653
3654 x_screen_height = HeightOfScreen (x_screen);
3655 x_screen_height_mm = HeightMMOfScreen (x_screen);
3656 x_screen_width = WidthOfScreen (x_screen);
3657 x_screen_width_mm = WidthMMOfScreen (x_screen);
3658
3659 switch (DoesBackingStore (x_screen))
3660 {
3661 case Always:
3662 Vx_backing_store = intern ("Always");
3663 break;
3664
3665 case WhenMapped:
3666 Vx_backing_store = intern ("WhenMapped");
3667 break;
3668
3669 case NotUseful:
3670 Vx_backing_store = intern ("NotUseful");
3671 break;
3672
3673 default:
3674 error ("Strange value for BackingStore.");
3675 break;
3676 }
3677
3678 if (DoesSaveUnders (x_screen) == True)
3679 x_save_under = 1;
3680 else
3681 x_save_under = 0;
3682
3683 screen_visual = select_visual (x_screen, &n_planes); 3764 screen_visual = select_visual (x_screen, &n_planes);
3684 x_screen_planes = n_planes; 3765 x_screen_planes = n_planes;
3685 Vx_screen_visual = intern (x_visual_strings [screen_visual->class]); 3766 x_screen_height = HeightOfScreen (x_screen);
3767 x_screen_width = WidthOfScreen (x_screen);
3686 3768
3687 /* X Atoms used by emacs. */ 3769 /* X Atoms used by emacs. */
3688 Xatoms_of_xselect (); 3770 Xatoms_of_xselect ();
@@ -3843,29 +3925,6 @@ syms_of_xfns ()
3843 "Non-nil if a mouse button is currently depressed."); 3925 "Non-nil if a mouse button is currently depressed.");
3844 Vmouse_depressed = Qnil; 3926 Vmouse_depressed = Qnil;
3845 3927
3846 DEFVAR_INT ("x-screen-count", &x_screen_count,
3847 "The number of screens associated with the current display.");
3848 DEFVAR_INT ("x-release", &x_release,
3849 "The release number of the X server in use.");
3850 DEFVAR_LISP ("x-vendor", &Vx_vendor,
3851 "The vendor supporting the X server in use.");
3852 DEFVAR_INT ("x-screen-height", &x_screen_height,
3853 "The height of this X screen in pixels.");
3854 DEFVAR_INT ("x-screen-height-mm", &x_screen_height_mm,
3855 "The height of this X screen in millimeters.");
3856 DEFVAR_INT ("x-screen-width", &x_screen_width,
3857 "The width of this X screen in pixels.");
3858 DEFVAR_INT ("x-screen-width-mm", &x_screen_width_mm,
3859 "The width of this X screen in millimeters.");
3860 DEFVAR_LISP ("x-backing-store", &Vx_backing_store,
3861 "The backing store capability of this screen.\n\
3862Values can be the symbols Always, WhenMapped, or NotUseful.");
3863 DEFVAR_BOOL ("x-save-under", &x_save_under,
3864 "*Non-nil means this X screen supports the SaveUnder feature.");
3865 DEFVAR_INT ("x-screen-planes", &x_screen_planes,
3866 "The number of planes this monitor supports.");
3867 DEFVAR_LISP ("x-screen-visual", &Vx_screen_visual,
3868 "The default X visual for this X screen.");
3869 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, 3928 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
3870 "t if no X window manager is in use."); 3929 "t if no X window manager is in use.");
3871 3930
@@ -3879,6 +3938,18 @@ Values can be the symbols Always, WhenMapped, or NotUseful.");
3879#endif 3938#endif
3880 defsubr (&Sx_color_display_p); 3939 defsubr (&Sx_color_display_p);
3881 defsubr (&Sx_defined_color); 3940 defsubr (&Sx_defined_color);
3941 defsubr (&Sx_server_vendor);
3942 defsubr (&Sx_server_version);
3943 defsubr (&Sx_display_pixel_width);
3944 defsubr (&Sx_display_pixel_height);
3945 defsubr (&Sx_display_mm_width);
3946 defsubr (&Sx_display_mm_height);
3947 defsubr (&Sx_display_screens);
3948 defsubr (&Sx_display_planes);
3949 defsubr (&Sx_display_color_cells);
3950 defsubr (&Sx_display_visual_class);
3951 defsubr (&Sx_display_backing_store);
3952 defsubr (&Sx_display_save_under);
3882#if 0 3953#if 0
3883 defsubr (&Sx_track_pointer); 3954 defsubr (&Sx_track_pointer);
3884 defsubr (&Sx_grab_pointer); 3955 defsubr (&Sx_grab_pointer);