comparison src/device.c @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 3ecd8885ac67
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
66 Qcolor_menu_button, Qcolor_menu_disabled, Qcolor_toolbar, 66 Qcolor_menu_button, Qcolor_menu_disabled, Qcolor_toolbar,
67 Qcolor_scrollbar, Qcolor_desktop, Qcolor_workspace, Qfont_default, 67 Qcolor_scrollbar, Qcolor_desktop, Qcolor_workspace, Qfont_default,
68 Qfont_menubar, Qfont_dialog, Qsize_cursor, Qsize_scrollbar, 68 Qfont_menubar, Qfont_dialog, Qsize_cursor, Qsize_scrollbar,
69 Qsize_menu, Qsize_toolbar, Qsize_toolbar_button, 69 Qsize_menu, Qsize_toolbar, Qsize_toolbar_button,
70 Qsize_toolbar_border, Qsize_icon, Qsize_icon_small, Qsize_device, 70 Qsize_toolbar_border, Qsize_icon, Qsize_icon_small, Qsize_device,
71 Qsize_workspace, Qsize_device_mm, Qdevice_dpi, Qnum_bit_planes, 71 Qsize_workspace, Qoffset_workspace, Qsize_device_mm, Qdevice_dpi,
72 Qnum_color_cells, Qmouse_buttons, Qswap_buttons, Qshow_sounds, 72 Qnum_bit_planes, Qnum_color_cells, Qmouse_buttons, Qswap_buttons,
73 Qslow_device, Qsecurity; 73 Qshow_sounds, Qslow_device, Qsecurity;
74 74
75 Lisp_Object Qdevicep, Qdevice_live_p; 75 Lisp_Object Qdevicep, Qdevice_live_p;
76 Lisp_Object Qcreate_device_hook; 76 Lisp_Object Qcreate_device_hook;
77 Lisp_Object Qdelete_device_hook; 77 Lisp_Object Qdelete_device_hook;
78 Lisp_Object Vdevice_class_list; 78 Lisp_Object Vdevice_class_list;
123 XSTRING_DATA (d->name), d->header.uid); 123 XSTRING_DATA (d->name), d->header.uid);
124 124
125 sprintf (buf, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" : 125 sprintf (buf, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" :
126 DEVICE_TYPE_NAME (d)); 126 DEVICE_TYPE_NAME (d));
127 write_c_string (buf, printcharfun); 127 write_c_string (buf, printcharfun);
128 if (DEVICE_LIVE_P (d)) 128 if (DEVICE_LIVE_P (d) && !NILP (DEVICE_CONNECTION (d)))
129 { 129 {
130 write_c_string (" on ", printcharfun); 130 write_c_string (" on ", printcharfun);
131 print_internal (DEVICE_CONNECTION (d), printcharfun, 1); 131 print_internal (DEVICE_CONNECTION (d), printcharfun, 1);
132 } 132 }
133 sprintf (buf, " 0x%x>", d->header.uid); 133 sprintf (buf, " 0x%x>", d->header.uid);
384 384
385 static Lisp_Object 385 static Lisp_Object
386 semi_canonicalize_device_connection (struct console_methods *meths, 386 semi_canonicalize_device_connection (struct console_methods *meths,
387 Lisp_Object name, Error_behavior errb) 387 Lisp_Object name, Error_behavior errb)
388 { 388 {
389 return CONTYPE_METH_OR_GIVEN (meths, semi_canonicalize_device_connection, 389 if (HAS_CONTYPE_METH_P (meths, semi_canonicalize_device_connection))
390 (name, errb), name); 390 return CONTYPE_METH (meths, semi_canonicalize_device_connection,
391 (name, errb));
392 else
393 return CONTYPE_METH_OR_GIVEN (meths, canonicalize_device_connection,
394 (name, errb), name);
391 } 395 }
392 396
393 static Lisp_Object 397 static Lisp_Object
394 canonicalize_device_connection (struct console_methods *meths, 398 canonicalize_device_connection (struct console_methods *meths,
395 Lisp_Object name, Error_behavior errb) 399 Lisp_Object name, Error_behavior errb)
396 { 400 {
397 return CONTYPE_METH_OR_GIVEN (meths, canonicalize_device_connection, 401 if (HAS_CONTYPE_METH_P (meths, canonicalize_device_connection))
398 (name, errb), name); 402 return CONTYPE_METH (meths, canonicalize_device_connection,
403 (name, errb));
404 else
405 return CONTYPE_METH_OR_GIVEN (meths, semi_canonicalize_device_connection,
406 (name, errb), name);
399 } 407 }
400 408
401 static Lisp_Object 409 static Lisp_Object
402 find_device_of_type (struct console_methods *meths, Lisp_Object canon) 410 find_device_of_type (struct console_methods *meths, Lisp_Object canon)
403 { 411 {
907 Return the output baud rate of DEVICE. 915 Return the output baud rate of DEVICE.
908 */ 916 */
909 (device)) 917 (device))
910 { 918 {
911 return make_int (DEVICE_BAUD_RATE (decode_device (device))); 919 return make_int (DEVICE_BAUD_RATE (decode_device (device)));
920 }
921
922 DEFUN ("device-printer-p", Fdevice_printer_p, 0, 1, 0, /*
923 Return t if DEVICE is a printer, nil if it is a display. DEVICE defaults
924 to selected device if omitted, and must be live if specified.
925 */
926 (device))
927 {
928 return (MAYBE_INT_DEVMETH (decode_device (device),
929 device_implementation_flags, ())
930 & XDEVIMPF_IS_A_PRINTER) ? Qt : Qnil;
912 } 931 }
913 932
914 DEFUN ("device-system-metric", Fdevice_system_metric, 1, 3, 0, /* 933 DEFUN ("device-system-metric", Fdevice_system_metric, 1, 3, 0, /*
915 Get a metric for DEVICE as provided by the system. 934 Get a metric for DEVICE as provided by the system.
916 935
964 size-toolbar Toolbar width and height. 983 size-toolbar Toolbar width and height.
965 size-toolbar-button Toolbar button size. 984 size-toolbar-button Toolbar button size.
966 size-toolbar-border Toolbar border width and height. 985 size-toolbar-border Toolbar border width and height.
967 size-icon Icon dimensions. 986 size-icon Icon dimensions.
968 size-icon-small Small icon dimensions. 987 size-icon-small Small icon dimensions.
969 size-device Device screen size in pixels. 988 size-device Device screen or paper size in pixels.
970 size-workspace Workspace size in pixels. This can be less than the 989 size-workspace Workspace size in pixels. This can be less than or
971 above if window manager has decorations which 990 equal to the above. For diplays, this is the area
972 effectively shrink the area remaining for application 991 available to applications less window manager
973 windows. 992 decorations. For printers, this is the size of
993 printable area.
994 offset-workspace Offset of workspace area from the top left corner
995 of screen or paper.
974 size-device-mm Device screen size in millimeters. 996 size-device-mm Device screen size in millimeters.
975 device-dpi Device resolution, in dots per inch. 997 device-dpi Device resolution, in dots per inch.
976 num-bit-planes Integer, number of device bit planes. 998 num-bit-planes Integer, number of device bit planes.
977 num-color-cells Integer, number of device color cells. 999 num-color-cells Integer, number of device color cells.
978 1000
1025 FROB (size_toolbar_border); 1047 FROB (size_toolbar_border);
1026 FROB (size_icon); 1048 FROB (size_icon);
1027 FROB (size_icon_small); 1049 FROB (size_icon_small);
1028 FROB (size_device); 1050 FROB (size_device);
1029 FROB (size_workspace); 1051 FROB (size_workspace);
1052 FROB (offset_workspace);
1030 FROB (size_device_mm); 1053 FROB (size_device_mm);
1031 FROB (device_dpi); 1054 FROB (device_dpi);
1032 FROB (num_bit_planes); 1055 FROB (num_bit_planes);
1033 FROB (num_color_cells); 1056 FROB (num_color_cells);
1034 FROB (mouse_buttons); 1057 FROB (mouse_buttons);
1087 FROB (size_toolbar_border); 1110 FROB (size_toolbar_border);
1088 FROB (size_icon); 1111 FROB (size_icon);
1089 FROB (size_icon_small); 1112 FROB (size_icon_small);
1090 FROB (size_device); 1113 FROB (size_device);
1091 FROB (size_workspace); 1114 FROB (size_workspace);
1115 FROB (offset_workspace);
1092 FROB (size_device_mm); 1116 FROB (size_device_mm);
1093 FROB (device_dpi); 1117 FROB (device_dpi);
1094 FROB (num_bit_planes); 1118 FROB (num_bit_planes);
1095 FROB (num_color_cells); 1119 FROB (num_color_cells);
1096 FROB (mouse_buttons); 1120 FROB (mouse_buttons);
1244 DEFSUBR (Fdevice_system_metrics); 1268 DEFSUBR (Fdevice_system_metrics);
1245 DEFSUBR (Fdevice_system_metric); 1269 DEFSUBR (Fdevice_system_metric);
1246 DEFSUBR (Fset_device_baud_rate); 1270 DEFSUBR (Fset_device_baud_rate);
1247 DEFSUBR (Fdevice_baud_rate); 1271 DEFSUBR (Fdevice_baud_rate);
1248 DEFSUBR (Fdomain_device_type); 1272 DEFSUBR (Fdomain_device_type);
1273 DEFSUBR (Fdevice_printer_p);
1249 1274
1250 defsymbol (&Qdevicep, "devicep"); 1275 defsymbol (&Qdevicep, "devicep");
1251 defsymbol (&Qdevice_live_p, "device-live-p"); 1276 defsymbol (&Qdevice_live_p, "device-live-p");
1252 1277
1253 defsymbol (&Qcreate_device_hook, "create-device-hook"); 1278 defsymbol (&Qcreate_device_hook, "create-device-hook");
1283 defsymbol (&Qsize_toolbar_border, "size-toolbar-border"); 1308 defsymbol (&Qsize_toolbar_border, "size-toolbar-border");
1284 defsymbol (&Qsize_icon, "size-icon"); 1309 defsymbol (&Qsize_icon, "size-icon");
1285 defsymbol (&Qsize_icon_small, "size-icon-small"); 1310 defsymbol (&Qsize_icon_small, "size-icon-small");
1286 defsymbol (&Qsize_device, "size-device"); 1311 defsymbol (&Qsize_device, "size-device");
1287 defsymbol (&Qsize_workspace, "size-workspace"); 1312 defsymbol (&Qsize_workspace, "size-workspace");
1313 defsymbol (&Qoffset_workspace, "offset-workspace");
1288 defsymbol (&Qsize_device_mm, "size-device-mm"); 1314 defsymbol (&Qsize_device_mm, "size-device-mm");
1289 defsymbol (&Qnum_bit_planes, "num-bit-planes"); 1315 defsymbol (&Qnum_bit_planes, "num-bit-planes");
1290 defsymbol (&Qnum_color_cells, "num-color-cells"); 1316 defsymbol (&Qnum_color_cells, "num-color-cells");
1291 defsymbol (&Qdevice_dpi, "device-dpi"); 1317 defsymbol (&Qdevice_dpi, "device-dpi");
1292 defsymbol (&Qmouse_buttons, "mouse-buttons"); 1318 defsymbol (&Qmouse_buttons, "mouse-buttons");