comparison src/device.c @ 269:b2472a1930f2 r20-5b33

Import from CVS: tag r20-5b33
author cvs
date Mon, 13 Aug 2007 10:27:19 +0200
parents 727739f917cb
children c5d627a313b1
comparison
equal deleted inserted replaced
268:6ced69ccd85f 269:b2472a1930f2
961 Return the output baud rate of DEVICE. 961 Return the output baud rate of DEVICE.
962 */ 962 */
963 (device)) 963 (device))
964 { 964 {
965 return make_int (DEVICE_BAUD_RATE (decode_device (device))); 965 return make_int (DEVICE_BAUD_RATE (decode_device (device)));
966 }
967
968 Lisp_Object
969 domain_device_type (Lisp_Object domain)
970 {
971 /* This cannot GC */
972 assert (WINDOWP (domain) || FRAMEP (domain)
973 || DEVICEP (domain) || CONSOLEP (domain));
974
975 if (WINDOWP (domain))
976 {
977 if (!WINDOW_LIVE_P (XWINDOW (domain)))
978 return Qdead;
979 domain = WINDOW_FRAME (XWINDOW (domain));
980 }
981 if (FRAMEP (domain))
982 {
983 if (!FRAME_LIVE_P (XFRAME (domain)))
984 return Qdead;
985 domain = FRAME_DEVICE (XFRAME (domain));
986 }
987 if (DEVICEP (domain))
988 {
989 if (!DEVICE_LIVE_P (XDEVICE (domain)))
990 return Qdead;
991 domain = DEVICE_CONSOLE (XDEVICE (domain));
992 }
993 return CONSOLE_TYPE (XCONSOLE (domain));
994 }
995
996 /*
997 * Determine whether window system bases window geometry on character
998 * or pixel counts.
999 * Return non-zero for pixel-based geometry, zero for character-based.
1000 */
1001 int
1002 window_system_pixelated_geometry (Lisp_Object domain)
1003 {
1004 /* This cannot GC */
1005 Lisp_Object winsy = domain_device_type (domain);
1006 struct console_methods *meth = decode_console_type (winsy, ERROR_ME_NOT);
1007 assert (meth);
1008 return (MAYBE_INT_CONTYPE_METH (meth, device_implementation_flags, ())
1009 & XDEVIMPF_PIXEL_GEOMETRY);
1010 }
1011
1012 DEFUN ("domain-device-type", Fdomain_device_type, 0, 1, 0, /*
1013 Return the device type symbol for a DOMAIN, e.g. 'x or 'tty.
1014 DOMAIN can be either a window, frame, device or console.
1015 */
1016 (domain))
1017 {
1018 if (!WINDOWP (domain) && !FRAMEP (domain)
1019 && !DEVICEP (domain) && !CONSOLEP (domain))
1020 signal_simple_error
1021 ("Domain must be either a window, frame, device or console", domain);
1022
1023 return domain_device_type (domain);
966 } 1024 }
967 1025
968 void 1026 void
969 handle_asynch_device_change (void) 1027 handle_asynch_device_change (void)
970 { 1028 {
1050 DEFSUBR (Fdevice_mm_height); 1108 DEFSUBR (Fdevice_mm_height);
1051 DEFSUBR (Fdevice_bitplanes); 1109 DEFSUBR (Fdevice_bitplanes);
1052 DEFSUBR (Fdevice_color_cells); 1110 DEFSUBR (Fdevice_color_cells);
1053 DEFSUBR (Fset_device_baud_rate); 1111 DEFSUBR (Fset_device_baud_rate);
1054 DEFSUBR (Fdevice_baud_rate); 1112 DEFSUBR (Fdevice_baud_rate);
1113 DEFSUBR (Fdomain_device_type);
1055 1114
1056 defsymbol (&Qdevicep, "devicep"); 1115 defsymbol (&Qdevicep, "devicep");
1057 defsymbol (&Qdevice_live_p, "device-live-p"); 1116 defsymbol (&Qdevice_live_p, "device-live-p");
1058 defsymbol (&Qdelete_device, "delete-device"); 1117 defsymbol (&Qdelete_device, "delete-device");
1059 1118