comparison src/device-msw.c @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents 3742ea8250b5 e34711681f30
children d1247f3cc363
comparison
equal deleted inserted replaced
5117:3742ea8250b5 5118:e0db3c197671
58 HSZ mswindows_dde_topic_eval; 58 HSZ mswindows_dde_topic_eval;
59 HSZ mswindows_dde_item_result; 59 HSZ mswindows_dde_item_result;
60 HSZ mswindows_dde_item_open; 60 HSZ mswindows_dde_item_open;
61 #endif 61 #endif
62 62
63 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win; 63 Lisp_Object Qmake_device_early_mswindows_entry_point,
64 Qmake_device_late_mswindows_entry_point;
64 Lisp_Object Qdevmodep; 65 Lisp_Object Qdevmodep;
65 66
66 static Lisp_Object Q_allow_selection; 67 static Lisp_Object Q_allow_selection;
67 static Lisp_Object Q_allow_pages; 68 static Lisp_Object Q_allow_pages;
68 static Lisp_Object Q_selected_page_button; 69 static Lisp_Object Q_selected_page_button;
71 static const struct memory_description mswindows_device_data_description_1 [] = { 72 static const struct memory_description mswindows_device_data_description_1 [] = {
72 { XD_LISP_OBJECT, offsetof (struct mswindows_device, fontlist) }, 73 { XD_LISP_OBJECT, offsetof (struct mswindows_device, fontlist) },
73 { XD_END } 74 { XD_END }
74 }; 75 };
75 76
77 #ifdef NEW_GC
78 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("mswindows-device", mswindows_device,
79 0, mswindows_device_data_description_1,
80 Lisp_Mswindows_Device);
81 #else /* not NEW_GC */
76 extern const struct sized_memory_description mswindows_device_data_description; 82 extern const struct sized_memory_description mswindows_device_data_description;
77 83
78 const struct sized_memory_description mswindows_device_data_description = { 84 const struct sized_memory_description mswindows_device_data_description = {
79 sizeof (struct mswindows_device), mswindows_device_data_description_1 85 sizeof (struct mswindows_device), mswindows_device_data_description_1
80 }; 86 };
87 #endif /* not NEW_GC */
81 88
82 static const struct memory_description msprinter_device_data_description_1 [] = { 89 static const struct memory_description msprinter_device_data_description_1 [] = {
83 { XD_LISP_OBJECT, offsetof (struct msprinter_device, name) }, 90 { XD_LISP_OBJECT, offsetof (struct msprinter_device, name) },
84 { XD_LISP_OBJECT, offsetof (struct msprinter_device, devmode) }, 91 { XD_LISP_OBJECT, offsetof (struct msprinter_device, devmode) },
85 { XD_LISP_OBJECT, offsetof (struct msprinter_device, fontlist) }, 92 { XD_LISP_OBJECT, offsetof (struct msprinter_device, fontlist) },
86 { XD_END } 93 { XD_END }
87 }; 94 };
88 95
96 #ifdef NEW_GC
97 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("msprinter-device", msprinter_device,
98 0, msprinter_device_data_description_1,
99 Lisp_Msprinter_Device);
100 #else /* not NEW_GC */
89 extern const struct sized_memory_description msprinter_device_data_description; 101 extern const struct sized_memory_description msprinter_device_data_description;
90 102
91 const struct sized_memory_description msprinter_device_data_description = { 103 const struct sized_memory_description msprinter_device_data_description = {
92 sizeof (struct msprinter_device), msprinter_device_data_description_1 104 sizeof (struct msprinter_device), msprinter_device_data_description_1
93 }; 105 };
106 #endif /* not NEW_GC */
94 107
95 static Lisp_Object allocate_devmode (DEVMODEW *src_devmode, int do_copy, 108 static Lisp_Object allocate_devmode (DEVMODEW *src_devmode, int do_copy,
96 Lisp_Object src_name, struct device *d); 109 Lisp_Object src_name, struct device *d);
97 110
98 /************************************************************************/ 111 /************************************************************************/
139 mswindows_init_device (struct device *d, Lisp_Object UNUSED (props)) 152 mswindows_init_device (struct device *d, Lisp_Object UNUSED (props))
140 { 153 {
141 HDC hdc; 154 HDC hdc;
142 WNDCLASSEXW wc; 155 WNDCLASSEXW wc;
143 156
157 call0 (Qmake_device_early_mswindows_entry_point);
158
144 DEVICE_CLASS (d) = Qcolor; 159 DEVICE_CLASS (d) = Qcolor;
145 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1; 160 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
146 init_baud_rate (d); 161 init_baud_rate (d);
147 init_one_device (d); 162 init_one_device (d);
148 163
164 #ifdef NEW_GC
165 d->device_data = alloc_lrecord_type (struct mswindows_device,
166 &lrecord_mswindows_device);
167 #else /* not NEW_GC */
149 d->device_data = xnew_and_zero (struct mswindows_device); 168 d->device_data = xnew_and_zero (struct mswindows_device);
169 #endif /* not NEW_GC */
150 hdc = CreateCompatibleDC (NULL); 170 hdc = CreateCompatibleDC (NULL);
151 assert (hdc != NULL); 171 assert (hdc != NULL);
152 DEVICE_MSWINDOWS_HCDC (d) = hdc; 172 DEVICE_MSWINDOWS_HCDC (d) = hdc;
153 DEVICE_MSWINDOWS_FONTLIST (d) = mswindows_enumerate_fonts (hdc); 173 DEVICE_MSWINDOWS_FONTLIST (d) = mswindows_enumerate_fonts (hdc);
154 DEVICE_MSWINDOWS_UPDATE_TICK (d) = GetTickCount (); 174 DEVICE_MSWINDOWS_UPDATE_TICK (d) = GetTickCount ();
250 mswindows_init_dde (); 270 mswindows_init_dde ();
251 #endif 271 #endif
252 } 272 }
253 273
254 static void 274 static void
255 mswindows_finish_init_device (struct device *UNUSED (d), 275 mswindows_finish_init_device (struct device *d,
256 Lisp_Object UNUSED (props)) 276 Lisp_Object UNUSED (props))
257 { 277 {
258 #ifdef HAVE_DRAGNDROP 278 #ifdef HAVE_DRAGNDROP
259 /* Tell pending clients we are ready. */ 279 /* Tell pending clients we are ready. */
260 mswindows_dde_enable = 1; 280 mswindows_dde_enable = 1;
261 #endif 281 #endif
282 call1 (Qmake_device_late_mswindows_entry_point, wrap_device(d));
262 } 283 }
263 284
264 static void 285 static void
265 mswindows_delete_device (struct device *d) 286 mswindows_delete_device (struct device *d)
266 { 287 {
277 CoUninitialize (); 298 CoUninitialize ();
278 # endif 299 # endif
279 #endif 300 #endif
280 301
281 DeleteDC (DEVICE_MSWINDOWS_HCDC (d)); 302 DeleteDC (DEVICE_MSWINDOWS_HCDC (d));
303 #ifndef NEW_GC
282 xfree (d->device_data, void *); 304 xfree (d->device_data, void *);
305 #endif /* not NEW_GC */
283 } 306 }
284 307
285 void 308 void
286 mswindows_get_workspace_coords (RECT *rc) 309 mswindows_get_workspace_coords (RECT *rc)
287 { 310 {
493 { 516 {
494 DEVMODEW *pdm; 517 DEVMODEW *pdm;
495 LONG dm_size; 518 LONG dm_size;
496 Extbyte *printer_name; 519 Extbyte *printer_name;
497 520
521 #ifdef NEW_GC
522 d->device_data = alloc_lrecord_type (struct msprinter_device,
523 &lrecord_msprinter_device);
524 #else /* not NEW_GC */
498 d->device_data = xnew_and_zero (struct msprinter_device); 525 d->device_data = xnew_and_zero (struct msprinter_device);
526 #endif /* not NEW_GC */
499 527
500 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1; 528 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
501 DEVICE_MSPRINTER_DEVMODE (d) = Qnil; 529 DEVICE_MSPRINTER_DEVMODE (d) = Qnil;
502 DEVICE_MSPRINTER_NAME (d) = Qnil; 530 DEVICE_MSPRINTER_NAME (d) = Qnil;
503 531
544 { 572 {
545 XDEVMODE (DEVICE_MSPRINTER_DEVMODE (d))->device = Qnil; 573 XDEVMODE (DEVICE_MSPRINTER_DEVMODE (d))->device = Qnil;
546 DEVICE_MSPRINTER_DEVMODE (d) = Qnil; 574 DEVICE_MSPRINTER_DEVMODE (d) = Qnil;
547 } 575 }
548 576
577 #ifndef NEW_GC
549 xfree (d->device_data, void *); 578 xfree (d->device_data, void *);
579 #endif /* not NEW_GC */
550 } 580 }
551 } 581 }
552 582
553 static Lisp_Object 583 static Lisp_Object
554 msprinter_device_system_metrics (struct device *d, 584 msprinter_device_system_metrics (struct device *d,
1173 dm->devmode ? memory_hash (dm->devmode, XDEVMODE_SIZE (dm)) 1203 dm->devmode ? memory_hash (dm->devmode, XDEVMODE_SIZE (dm))
1174 : 0, 1204 : 0,
1175 internal_hash (dm->printer_name, depth + 1)); 1205 internal_hash (dm->printer_name, depth + 1));
1176 } 1206 }
1177 1207
1178 DEFINE_NONDUMPABLE_LISP_OBJECT ("msprinter-settings", devmode, 1208 DEFINE_NODUMP_LISP_OBJECT ("msprinter-settings", devmode,
1179 mark_devmode, print_devmode, 1209 mark_devmode, print_devmode,
1180 finalize_devmode, 1210 finalize_devmode,
1181 equal_devmode, hash_devmode, 1211 equal_devmode, hash_devmode,
1182 devmode_description, 1212 devmode_description,
1183 Lisp_Devmode); 1213 Lisp_Devmode);
1342 void 1372 void
1343 syms_of_device_mswindows (void) 1373 syms_of_device_mswindows (void)
1344 { 1374 {
1345 INIT_LISP_OBJECT (devmode); 1375 INIT_LISP_OBJECT (devmode);
1346 1376
1377 #ifdef NEW_GC
1378 INIT_LISP_OBJECT (mswindows_device);
1379 INIT_LISP_OBJECT (msprinter_device);
1380 #endif /* NEW_GC */
1381
1347 DEFSUBR (Fmsprinter_get_settings); 1382 DEFSUBR (Fmsprinter_get_settings);
1348 DEFSUBR (Fmsprinter_select_settings); 1383 DEFSUBR (Fmsprinter_select_settings);
1349 DEFSUBR (Fmsprinter_apply_settings); 1384 DEFSUBR (Fmsprinter_apply_settings);
1350 DEFSUBR (Fmsprinter_settings_copy); 1385 DEFSUBR (Fmsprinter_settings_copy);
1351 DEFSUBR (Fmsprinter_settings_despecialize); 1386 DEFSUBR (Fmsprinter_settings_despecialize);
1355 DEFKEYWORD (Q_allow_selection); 1390 DEFKEYWORD (Q_allow_selection);
1356 DEFKEYWORD (Q_allow_pages); 1391 DEFKEYWORD (Q_allow_pages);
1357 DEFKEYWORD (Q_selected_page_button); 1392 DEFKEYWORD (Q_selected_page_button);
1358 DEFSYMBOL (Qselected_page_button); 1393 DEFSYMBOL (Qselected_page_button);
1359 1394
1360 DEFSYMBOL (Qinit_pre_mswindows_win); 1395 DEFSYMBOL (Qmake_device_early_mswindows_entry_point);
1361 DEFSYMBOL (Qinit_post_mswindows_win); 1396 DEFSYMBOL ( Qmake_device_late_mswindows_entry_point);
1362 } 1397 }
1363 1398
1364 void 1399 void
1365 console_type_create_device_mswindows (void) 1400 console_type_create_device_mswindows (void)
1366 { 1401 {