Mercurial > hg > xemacs-beta
comparison src/device.c @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | bbff43aa5eb7 |
children | a86b2b5e0111 |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
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 Qdelete_device; | |
77 Lisp_Object Qcreate_device_hook; | 76 Lisp_Object Qcreate_device_hook; |
78 Lisp_Object Qdelete_device_hook; | 77 Lisp_Object Qdelete_device_hook; |
79 Lisp_Object Vdevice_class_list; | 78 Lisp_Object Vdevice_class_list; |
80 | 79 |
81 | 80 |
82 static Lisp_Object | 81 static Lisp_Object |
83 mark_device (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 82 mark_device (Lisp_Object obj) |
84 { | 83 { |
85 struct device *d = XDEVICE (obj); | 84 struct device *d = XDEVICE (obj); |
86 | 85 |
87 markobj (d->name); | 86 mark_object (d->name); |
88 markobj (d->connection); | 87 mark_object (d->connection); |
89 markobj (d->canon_connection); | 88 mark_object (d->canon_connection); |
90 markobj (d->console); | 89 mark_object (d->console); |
91 markobj (d->selected_frame); | 90 mark_object (d->selected_frame); |
92 markobj (d->frame_with_focus_real); | 91 mark_object (d->frame_with_focus_real); |
93 markobj (d->frame_with_focus_for_hooks); | 92 mark_object (d->frame_with_focus_for_hooks); |
94 markobj (d->frame_that_ought_to_have_focus); | 93 mark_object (d->frame_that_ought_to_have_focus); |
95 markobj (d->device_class); | 94 mark_object (d->device_class); |
96 markobj (d->user_defined_tags); | 95 mark_object (d->user_defined_tags); |
97 markobj (d->pixel_to_glyph_cache.obj1); | 96 mark_object (d->pixel_to_glyph_cache.obj1); |
98 markobj (d->pixel_to_glyph_cache.obj2); | 97 mark_object (d->pixel_to_glyph_cache.obj2); |
99 | 98 |
100 markobj (d->color_instance_cache); | 99 mark_object (d->color_instance_cache); |
101 markobj (d->font_instance_cache); | 100 mark_object (d->font_instance_cache); |
102 #ifdef MULE | 101 #ifdef MULE |
103 markobj (d->charset_font_cache); | 102 mark_object (d->charset_font_cache); |
104 #endif | 103 #endif |
105 markobj (d->image_instance_cache); | 104 mark_object (d->image_instance_cache); |
106 | 105 |
107 if (d->devmeths) | 106 if (d->devmeths) |
108 { | 107 { |
109 markobj (d->devmeths->symbol); | 108 mark_object (d->devmeths->symbol); |
110 MAYBE_DEVMETH (d, mark_device, (d, markobj)); | 109 MAYBE_DEVMETH (d, mark_device, (d)); |
111 } | 110 } |
112 | 111 |
113 return (d->frame_list); | 112 return (d->frame_list); |
114 } | 113 } |
115 | 114 |
124 XSTRING_DATA (d->name), d->header.uid); | 123 XSTRING_DATA (d->name), d->header.uid); |
125 | 124 |
126 sprintf (buf, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" : | 125 sprintf (buf, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" : |
127 DEVICE_TYPE_NAME (d)); | 126 DEVICE_TYPE_NAME (d)); |
128 write_c_string (buf, printcharfun); | 127 write_c_string (buf, printcharfun); |
129 if (DEVICE_LIVE_P (d)) | 128 if (DEVICE_LIVE_P (d) && !NILP (DEVICE_CONNECTION (d))) |
130 { | 129 { |
131 write_c_string (" on ", printcharfun); | 130 write_c_string (" on ", printcharfun); |
132 print_internal (DEVICE_CONNECTION (d), printcharfun, 1); | 131 print_internal (DEVICE_CONNECTION (d), printcharfun, 1); |
133 } | 132 } |
134 sprintf (buf, " 0x%x>", d->header.uid); | 133 sprintf (buf, " 0x%x>", d->header.uid); |
135 write_c_string (buf, printcharfun); | 134 write_c_string (buf, printcharfun); |
136 } | 135 } |
137 | 136 |
138 DEFINE_LRECORD_IMPLEMENTATION ("device", device, | 137 DEFINE_LRECORD_IMPLEMENTATION ("device", device, |
139 mark_device, print_device, 0, 0, 0, | 138 mark_device, print_device, 0, 0, 0, 0, |
140 struct device); | 139 struct device); |
141 | 140 |
142 int | 141 int |
143 valid_device_class_p (Lisp_Object class) | 142 valid_device_class_p (Lisp_Object class) |
144 { | 143 { |
164 | 163 |
165 static struct device * | 164 static struct device * |
166 allocate_device (Lisp_Object console) | 165 allocate_device (Lisp_Object console) |
167 { | 166 { |
168 Lisp_Object device; | 167 Lisp_Object device; |
169 struct device *d = alloc_lcrecord_type (struct device, lrecord_device); | 168 struct device *d = alloc_lcrecord_type (struct device, &lrecord_device); |
170 struct gcpro gcpro1; | 169 struct gcpro gcpro1; |
171 | 170 |
172 zero_lcrecord (d); | 171 zero_lcrecord (d); |
173 | 172 |
174 XSETDEVICE (device, d); | 173 XSETDEVICE (device, d); |
385 | 384 |
386 static Lisp_Object | 385 static Lisp_Object |
387 semi_canonicalize_device_connection (struct console_methods *meths, | 386 semi_canonicalize_device_connection (struct console_methods *meths, |
388 Lisp_Object name, Error_behavior errb) | 387 Lisp_Object name, Error_behavior errb) |
389 { | 388 { |
390 return CONTYPE_METH_OR_GIVEN (meths, semi_canonicalize_device_connection, | 389 if (HAS_CONTYPE_METH_P (meths, semi_canonicalize_device_connection)) |
391 (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); | |
392 } | 395 } |
393 | 396 |
394 static Lisp_Object | 397 static Lisp_Object |
395 canonicalize_device_connection (struct console_methods *meths, | 398 canonicalize_device_connection (struct console_methods *meths, |
396 Lisp_Object name, Error_behavior errb) | 399 Lisp_Object name, Error_behavior errb) |
397 { | 400 { |
398 return CONTYPE_METH_OR_GIVEN (meths, canonicalize_device_connection, | 401 if (HAS_CONTYPE_METH_P (meths, canonicalize_device_connection)) |
399 (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); | |
400 } | 407 } |
401 | 408 |
402 static Lisp_Object | 409 static Lisp_Object |
403 find_device_of_type (struct console_methods *meths, Lisp_Object canon) | 410 find_device_of_type (struct console_methods *meths, Lisp_Object canon) |
404 { | 411 { |
908 Return the output baud rate of DEVICE. | 915 Return the output baud rate of DEVICE. |
909 */ | 916 */ |
910 (device)) | 917 (device)) |
911 { | 918 { |
912 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 DEVICE_PRINTER_P (decode_device (device)) ? Qt : Qnil; | |
913 } | 929 } |
914 | 930 |
915 DEFUN ("device-system-metric", Fdevice_system_metric, 1, 3, 0, /* | 931 DEFUN ("device-system-metric", Fdevice_system_metric, 1, 3, 0, /* |
916 Get a metric for DEVICE as provided by the system. | 932 Get a metric for DEVICE as provided by the system. |
917 | 933 |
965 size-toolbar Toolbar width and height. | 981 size-toolbar Toolbar width and height. |
966 size-toolbar-button Toolbar button size. | 982 size-toolbar-button Toolbar button size. |
967 size-toolbar-border Toolbar border width and height. | 983 size-toolbar-border Toolbar border width and height. |
968 size-icon Icon dimensions. | 984 size-icon Icon dimensions. |
969 size-icon-small Small icon dimensions. | 985 size-icon-small Small icon dimensions. |
970 size-device Device screen size in pixels. | 986 size-device Device screen or paper size in pixels. |
971 size-workspace Workspace size in pixels. This can be less than the | 987 size-workspace Workspace size in pixels. This can be less than or |
972 above if window manager has decorations which | 988 equal to the above. For diplays, this is the area |
973 effectively shrink the area remaining for application | 989 available to applications less window manager |
974 windows. | 990 decorations. For printers, this is the size of |
991 printable area. | |
992 offset-workspace Offset of workspace area from the top left corner | |
993 of screen or paper. | |
975 size-device-mm Device screen size in millimeters. | 994 size-device-mm Device screen size in millimeters. |
976 device-dpi Device resolution, in dots per inch. | 995 device-dpi Device resolution, in dots per inch. |
977 num-bit-planes Integer, number of device bit planes. | 996 num-bit-planes Integer, number of device bit planes. |
978 num-color-cells Integer, number of device color cells. | 997 num-color-cells Integer, number of device color cells. |
979 | 998 |
1026 FROB (size_toolbar_border); | 1045 FROB (size_toolbar_border); |
1027 FROB (size_icon); | 1046 FROB (size_icon); |
1028 FROB (size_icon_small); | 1047 FROB (size_icon_small); |
1029 FROB (size_device); | 1048 FROB (size_device); |
1030 FROB (size_workspace); | 1049 FROB (size_workspace); |
1050 FROB (offset_workspace); | |
1031 FROB (size_device_mm); | 1051 FROB (size_device_mm); |
1032 FROB (device_dpi); | 1052 FROB (device_dpi); |
1033 FROB (num_bit_planes); | 1053 FROB (num_bit_planes); |
1034 FROB (num_color_cells); | 1054 FROB (num_color_cells); |
1035 FROB (mouse_buttons); | 1055 FROB (mouse_buttons); |
1088 FROB (size_toolbar_border); | 1108 FROB (size_toolbar_border); |
1089 FROB (size_icon); | 1109 FROB (size_icon); |
1090 FROB (size_icon_small); | 1110 FROB (size_icon_small); |
1091 FROB (size_device); | 1111 FROB (size_device); |
1092 FROB (size_workspace); | 1112 FROB (size_workspace); |
1113 FROB (offset_workspace); | |
1093 FROB (size_device_mm); | 1114 FROB (size_device_mm); |
1094 FROB (device_dpi); | 1115 FROB (device_dpi); |
1095 FROB (num_bit_planes); | 1116 FROB (num_bit_planes); |
1096 FROB (num_color_cells); | 1117 FROB (num_color_cells); |
1097 FROB (mouse_buttons); | 1118 FROB (mouse_buttons); |
1245 DEFSUBR (Fdevice_system_metrics); | 1266 DEFSUBR (Fdevice_system_metrics); |
1246 DEFSUBR (Fdevice_system_metric); | 1267 DEFSUBR (Fdevice_system_metric); |
1247 DEFSUBR (Fset_device_baud_rate); | 1268 DEFSUBR (Fset_device_baud_rate); |
1248 DEFSUBR (Fdevice_baud_rate); | 1269 DEFSUBR (Fdevice_baud_rate); |
1249 DEFSUBR (Fdomain_device_type); | 1270 DEFSUBR (Fdomain_device_type); |
1271 DEFSUBR (Fdevice_printer_p); | |
1250 | 1272 |
1251 defsymbol (&Qdevicep, "devicep"); | 1273 defsymbol (&Qdevicep, "devicep"); |
1252 defsymbol (&Qdevice_live_p, "device-live-p"); | 1274 defsymbol (&Qdevice_live_p, "device-live-p"); |
1253 defsymbol (&Qdelete_device, "delete-device"); | |
1254 | 1275 |
1255 defsymbol (&Qcreate_device_hook, "create-device-hook"); | 1276 defsymbol (&Qcreate_device_hook, "create-device-hook"); |
1256 defsymbol (&Qdelete_device_hook, "delete-device-hook"); | 1277 defsymbol (&Qdelete_device_hook, "delete-device-hook"); |
1257 | 1278 |
1258 /* Qcolor defined in general.c */ | 1279 /* Qcolor defined in general.c */ |
1285 defsymbol (&Qsize_toolbar_border, "size-toolbar-border"); | 1306 defsymbol (&Qsize_toolbar_border, "size-toolbar-border"); |
1286 defsymbol (&Qsize_icon, "size-icon"); | 1307 defsymbol (&Qsize_icon, "size-icon"); |
1287 defsymbol (&Qsize_icon_small, "size-icon-small"); | 1308 defsymbol (&Qsize_icon_small, "size-icon-small"); |
1288 defsymbol (&Qsize_device, "size-device"); | 1309 defsymbol (&Qsize_device, "size-device"); |
1289 defsymbol (&Qsize_workspace, "size-workspace"); | 1310 defsymbol (&Qsize_workspace, "size-workspace"); |
1311 defsymbol (&Qoffset_workspace, "offset-workspace"); | |
1290 defsymbol (&Qsize_device_mm, "size-device-mm"); | 1312 defsymbol (&Qsize_device_mm, "size-device-mm"); |
1291 defsymbol (&Qnum_bit_planes, "num-bit-planes"); | 1313 defsymbol (&Qnum_bit_planes, "num-bit-planes"); |
1292 defsymbol (&Qnum_color_cells, "num-color-cells"); | 1314 defsymbol (&Qnum_color_cells, "num-color-cells"); |
1293 defsymbol (&Qdevice_dpi, "device-dpi"); | 1315 defsymbol (&Qdevice_dpi, "device-dpi"); |
1294 defsymbol (&Qmouse_buttons, "mouse-buttons"); | 1316 defsymbol (&Qmouse_buttons, "mouse-buttons"); |
1297 defsymbol (&Qslow_device, "slow-device"); | 1319 defsymbol (&Qslow_device, "slow-device"); |
1298 defsymbol (&Qsecurity, "security"); | 1320 defsymbol (&Qsecurity, "security"); |
1299 } | 1321 } |
1300 | 1322 |
1301 void | 1323 void |
1324 reinit_vars_of_device (void) | |
1325 { | |
1326 staticpro_nodump (&Vdefault_device); | |
1327 Vdefault_device = Qnil; | |
1328 asynch_device_change_pending = 0; | |
1329 } | |
1330 | |
1331 void | |
1302 vars_of_device (void) | 1332 vars_of_device (void) |
1303 { | 1333 { |
1334 reinit_vars_of_device (); | |
1335 | |
1304 DEFVAR_LISP ("create-device-hook", &Vcreate_device_hook /* | 1336 DEFVAR_LISP ("create-device-hook", &Vcreate_device_hook /* |
1305 Function or functions to call when a device is created. | 1337 Function or functions to call when a device is created. |
1306 One argument, the newly-created device. | 1338 One argument, the newly-created device. |
1307 This is called after the first frame has been created, but before | 1339 This is called after the first frame has been created, but before |
1308 calling the `create-frame-hook'. | 1340 calling the `create-frame-hook'. |
1314 Function or functions to call when a device is deleted. | 1346 Function or functions to call when a device is deleted. |
1315 One argument, the to-be-deleted device. | 1347 One argument, the to-be-deleted device. |
1316 */ ); | 1348 */ ); |
1317 Vdelete_device_hook = Qnil; | 1349 Vdelete_device_hook = Qnil; |
1318 | 1350 |
1319 staticpro (&Vdefault_device); | |
1320 Vdefault_device = Qnil; | |
1321 | |
1322 asynch_device_change_pending = 0; | |
1323 | |
1324 Vdevice_class_list = list3 (Qcolor, Qgrayscale, Qmono); | 1351 Vdevice_class_list = list3 (Qcolor, Qgrayscale, Qmono); |
1325 staticpro (&Vdevice_class_list); | 1352 staticpro (&Vdevice_class_list); |
1326 | 1353 |
1327 /* Death to devices.el !!! */ | 1354 /* Death to devices.el !!! */ |
1328 Fprovide(intern("devices")); | 1355 Fprovide(intern("devices")); |