Mercurial > hg > xemacs-beta
comparison src/frame-msw.c @ 771:943eaba38521
[xemacs-hg @ 2002-03-13 08:51:24 by ben]
The big ben-mule-21-5 check-in!
Various files were added and deleted. See CHANGES-ben-mule.
There are still some test suite failures. No crashes, though.
Many of the failures have to do with problems in the test suite itself
rather than in the actual code. I'll be addressing these in the next
day or so -- none of the test suite failures are at all critical.
Meanwhile I'll be trying to address the biggest issues -- i.e. build
or run failures, which will almost certainly happen on various platforms.
All comments should be sent to ben@xemacs.org -- use a Cc: if necessary
when sending to mailing lists. There will be pre- and post- tags,
something like
pre-ben-mule-21-5-merge-in, and
post-ben-mule-21-5-merge-in.
author | ben |
---|---|
date | Wed, 13 Mar 2002 08:54:06 +0000 |
parents | fdefd0186b75 |
children | e38acbeb1cae |
comparison
equal
deleted
inserted
replaced
770:336a418893b5 | 771:943eaba38521 |
---|---|
1 /* Functions for the mswindows window system. | 1 /* Functions for the mswindows window system. |
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | 2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. |
3 Copyright (C) 1995, 1996 Ben Wing. | 3 Copyright (C) 1995, 1996, 2001, 2002 Ben Wing. |
4 | 4 |
5 This file is part of XEmacs. | 5 This file is part of XEmacs. |
6 | 6 |
7 XEmacs is free software; you can redistribute it and/or modify it | 7 XEmacs is free software; you can redistribute it and/or modify it |
8 under the terms of the GNU General Public License as published by the | 8 under the terms of the GNU General Public License as published by the |
18 along with XEmacs; see the file COPYING. If not, write to | 18 along with XEmacs; see the file COPYING. If not, write to |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 Boston, MA 02111-1307, USA. */ | 20 Boston, MA 02111-1307, USA. */ |
21 | 21 |
22 /* Synched up with: Not synched with FSF. */ | 22 /* Synched up with: Not synched with FSF. */ |
23 | |
24 /* This file Mule-ized, 8-14-2000. */ | |
23 | 25 |
24 /* Authorship: | 26 /* Authorship: |
25 | 27 |
26 Ultimately based on FSF. | 28 Ultimately based on FSF. |
27 Substantially rewritten for XEmacs by Ben Wing. | 29 Substantially rewritten for XEmacs by Ben Wing. |
95 | 97 |
96 return FRAME_MSWINDOWS_HANDLE (XFRAME (frame)); | 98 return FRAME_MSWINDOWS_HANDLE (XFRAME (frame)); |
97 } | 99 } |
98 | 100 |
99 static void | 101 static void |
100 mswindows_init_frame_1 (struct frame *f, Lisp_Object props) | 102 mswindows_init_frame_1 (struct frame *f, Lisp_Object props, |
103 int frame_name_is_defaulted) | |
101 { | 104 { |
102 Lisp_Object initially_unmapped; | 105 Lisp_Object initially_unmapped; |
103 Lisp_Object name, height, width, popup, top, left; | 106 Lisp_Object name, height, width, popup, top, left; |
104 Lisp_Object frame_obj = Qnil; | 107 Lisp_Object frame_obj = Qnil; |
105 RECT rect; | 108 RECT rect; |
140 abs (XINT (width)); | 143 abs (XINT (width)); |
141 FRAME_MSWINDOWS_TARGET_RECT (f)->height = NILP (height) ? -1 : | 144 FRAME_MSWINDOWS_TARGET_RECT (f)->height = NILP (height) ? -1 : |
142 abs (XINT (height)); | 145 abs (XINT (height)); |
143 | 146 |
144 /* Misc frame stuff */ | 147 /* Misc frame stuff */ |
145 FRAME_MSWINDOWS_MENU_HASH_TABLE(f) = Qnil; | 148 FRAME_MSWINDOWS_MENU_HASH_TABLE (f) = Qnil; |
146 #ifdef HAVE_TOOLBARS | 149 #ifdef HAVE_TOOLBARS |
147 FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE(f) = | 150 FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE (f) = |
148 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL); | 151 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL); |
149 #endif | 152 #endif |
150 /* hashtable of instantiated glyphs on the frame. */ | 153 /* hashtable of instantiated glyphs on the frame. */ |
151 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f) = | 154 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f) = |
152 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQUAL); | 155 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQUAL); |
189 char_to_real_pixel_size (f, POPUP_WIDTH, POPUP_HEIGHT, | 192 char_to_real_pixel_size (f, POPUP_WIDTH, POPUP_HEIGHT, |
190 &rect_default.width, &rect_default.height); | 193 &rect_default.width, &rect_default.height); |
191 FRAME_MSWINDOWS_POPUP (f) = 1; | 194 FRAME_MSWINDOWS_POPUP (f) = 1; |
192 } | 195 } |
193 | 196 |
194 AdjustWindowRectEx(&rect, style, ADJR_MENUFLAG, exstyle); | 197 AdjustWindowRectEx (&rect, style, ADJR_MENUFLAG, exstyle); |
195 | 198 |
196 XSETFRAME (frame_obj, f); | 199 XSETFRAME (frame_obj, f); |
197 | 200 |
198 Vmswindows_frame_being_created = frame_obj; | 201 Vmswindows_frame_being_created = frame_obj; |
199 | 202 { |
200 hwnd = CreateWindowEx (exstyle, | 203 const Extbyte *nameext = 0; |
201 XEMACS_CLASS, | 204 |
202 STRINGP (f->name) ? (LPCTSTR) XSTRING_DATA (f->name) : | 205 if (STRINGP (f->name)) |
203 (STRINGP (name) ? (LPCTSTR) XSTRING_DATA (name) : | 206 LISP_STRING_TO_TSTR (f->name, nameext); |
204 XEMACS_CLASS), | 207 else if (STRINGP (name)) |
205 style, | 208 LISP_STRING_TO_TSTR (name, nameext); |
206 rect_default.left, rect_default.top, | 209 else |
207 rect_default.width, rect_default.height, | 210 nameext = XETEXT (XEMACS_CLASS); |
208 hwnd_parent, NULL, NULL, NULL); | 211 hwnd = qxeCreateWindowEx (exstyle, |
212 XETEXT (XEMACS_CLASS), | |
213 nameext, | |
214 style, | |
215 rect_default.left, rect_default.top, | |
216 rect_default.width, rect_default.height, | |
217 hwnd_parent, NULL, NULL, NULL); | |
218 } | |
209 | 219 |
210 Vmswindows_frame_being_created = Qnil; | 220 Vmswindows_frame_being_created = Qnil; |
211 | 221 |
212 if (hwnd == NULL) | 222 if (hwnd == NULL) |
213 invalid_operation ("System call to create frame failed", | 223 invalid_operation ("System call to create frame failed", |
214 STRINGP (f->name) ? f->name : | 224 STRINGP (f->name) ? f->name : |
215 STRINGP (name) ? name : | 225 STRINGP (name) ? name : |
216 Qunbound); | 226 Qunbound); |
217 | 227 |
218 FRAME_MSWINDOWS_HANDLE(f) = hwnd; | 228 FRAME_MSWINDOWS_HANDLE (f) = hwnd; |
219 | 229 |
220 SetWindowLong (hwnd, XWL_FRAMEOBJ, (LONG)LISP_TO_VOID(frame_obj)); | 230 qxeSetWindowLong (hwnd, XWL_FRAMEOBJ, (LONG)LISP_TO_VOID (frame_obj)); |
221 FRAME_MSWINDOWS_DC(f) = GetDC (hwnd); | 231 FRAME_MSWINDOWS_DC (f) = GetDC (hwnd); |
222 SetTextAlign (FRAME_MSWINDOWS_DC(f), TA_BASELINE | TA_LEFT | TA_NOUPDATECP); | 232 SetTextAlign (FRAME_MSWINDOWS_DC (f), TA_BASELINE | TA_LEFT | TA_NOUPDATECP); |
223 | 233 |
234 #ifdef HAVE_DIALOGS | |
224 if (FRAME_MSWINDOWS_POPUP (f)) | 235 if (FRAME_MSWINDOWS_POPUP (f)) |
225 mswindows_register_popup_frame (frame_obj); | 236 mswindows_register_popup_frame (frame_obj); |
237 #endif /* HAVE_DIALOGS */ | |
226 } | 238 } |
227 | 239 |
228 static void | 240 static void |
229 mswindows_init_frame_2 (struct frame *f, Lisp_Object props) | 241 mswindows_init_frame_2 (struct frame *f, Lisp_Object props) |
230 { | 242 { |
247 /* Don't do this earlier or we get a WM_PAINT before the frame is ready. | 259 /* Don't do this earlier or we get a WM_PAINT before the frame is ready. |
248 * The SW_x parameter in the first call that an app makes to ShowWindow is | 260 * The SW_x parameter in the first call that an app makes to ShowWindow is |
249 * ignored, and the parameter specified in the caller's STARTUPINFO is | 261 * ignored, and the parameter specified in the caller's STARTUPINFO is |
250 * substituted instead. That parameter is SW_HIDE if we were started by | 262 * substituted instead. That parameter is SW_HIDE if we were started by |
251 * runemacs, so call this twice. #### runemacs is evil */ | 263 * runemacs, so call this twice. #### runemacs is evil */ |
252 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_SHOWNORMAL); | 264 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_SHOWNORMAL); |
253 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_SHOWNORMAL); | 265 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_SHOWNORMAL); |
254 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE(f)); | 266 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE (f)); |
255 DragAcceptFiles (FRAME_MSWINDOWS_HANDLE(f), TRUE); | 267 DragAcceptFiles (FRAME_MSWINDOWS_HANDLE (f), TRUE); |
256 } | 268 } |
257 | 269 |
258 static void | 270 static void |
259 mswindows_after_init_frame (struct frame *f, int first_on_device, | 271 mswindows_after_init_frame (struct frame *f, int first_on_device, |
260 int first_on_console) | 272 int first_on_console) |
283 } | 295 } |
284 | 296 |
285 static void | 297 static void |
286 mswindows_focus_on_frame (struct frame *f) | 298 mswindows_focus_on_frame (struct frame *f) |
287 { | 299 { |
288 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE(f)); | 300 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE (f)); |
289 } | 301 } |
290 | 302 |
291 static void | 303 static void |
292 mswindows_delete_frame (struct frame *f) | 304 mswindows_delete_frame (struct frame *f) |
293 { | 305 { |
294 if (f->frame_data) | 306 if (f->frame_data) |
295 { | 307 { |
296 Lisp_Object frame; | 308 #ifdef HAVE_DIALOGS |
297 XSETFRAME (frame, f); | 309 mswindows_unregister_popup_frame (wrap_frame (f)); |
298 mswindows_unregister_popup_frame (frame); | 310 #endif |
299 ReleaseDC(FRAME_MSWINDOWS_HANDLE(f), FRAME_MSWINDOWS_DC(f)); | 311 ReleaseDC (FRAME_MSWINDOWS_HANDLE (f), FRAME_MSWINDOWS_DC (f)); |
300 DestroyWindow(FRAME_MSWINDOWS_HANDLE(f)); | 312 DestroyWindow (FRAME_MSWINDOWS_HANDLE (f)); |
301 xfree (f->frame_data); | 313 xfree (f->frame_data); |
302 } | 314 } |
303 f->frame_data = 0; | 315 f->frame_data = 0; |
304 } | 316 } |
305 | 317 |
310 rect.left = rect.top = 0; | 322 rect.left = rect.top = 0; |
311 rect.right = width; | 323 rect.right = width; |
312 rect.bottom = height; | 324 rect.bottom = height; |
313 | 325 |
314 AdjustWindowRectEx (&rect, | 326 AdjustWindowRectEx (&rect, |
315 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE), | 327 qxeGetWindowLong (FRAME_MSWINDOWS_HANDLE (f), GWL_STYLE), |
316 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL, | 328 GetMenu (FRAME_MSWINDOWS_HANDLE (f)) != NULL, |
317 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE)); | 329 qxeGetWindowLong (FRAME_MSWINDOWS_HANDLE (f), GWL_EXSTYLE)); |
318 | 330 |
319 if (IsIconic (FRAME_MSWINDOWS_HANDLE(f)) || IsZoomed (FRAME_MSWINDOWS_HANDLE(f))) | 331 if (IsIconic (FRAME_MSWINDOWS_HANDLE (f)) || IsZoomed (FRAME_MSWINDOWS_HANDLE (f))) |
320 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE); | 332 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_RESTORE); |
321 | 333 |
322 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL, | 334 SetWindowPos (FRAME_MSWINDOWS_HANDLE (f), NULL, |
323 0, 0, rect.right-rect.left, rect.bottom-rect.top, | 335 0, 0, rect.right-rect.left, rect.bottom-rect.top, |
324 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | SWP_NOMOVE); | 336 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | SWP_NOMOVE); |
325 } | 337 } |
326 | 338 |
327 static void | 339 static void |
328 mswindows_set_frame_position (struct frame *f, int xoff, int yoff) | 340 mswindows_set_frame_position (struct frame *f, int xoff, int yoff) |
329 { | 341 { |
330 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL, | 342 SetWindowPos (FRAME_MSWINDOWS_HANDLE (f), NULL, |
331 xoff, yoff, 0, 0, | 343 xoff, yoff, 0, 0, |
332 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | SWP_NOSIZE); | 344 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | SWP_NOSIZE); |
333 } | 345 } |
334 | 346 |
335 static void | 347 static void |
336 mswindows_make_frame_visible (struct frame *f) | 348 mswindows_make_frame_visible (struct frame *f) |
337 { | 349 { |
338 if (!FRAME_VISIBLE_P(f)) | 350 if (!FRAME_VISIBLE_P (f)) |
339 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE); | 351 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_RESTORE); |
340 else | 352 else |
341 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_SHOW); | 353 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_SHOW); |
342 SetActiveWindow (FRAME_MSWINDOWS_HANDLE(f)); | 354 SetActiveWindow (FRAME_MSWINDOWS_HANDLE (f)); |
343 f->visible = 1; | 355 f->visible = 1; |
344 f->iconified = 0; | 356 f->iconified = 0; |
345 } | 357 } |
346 | 358 |
347 static void | 359 static void |
348 mswindows_make_frame_invisible (struct frame *f) | 360 mswindows_make_frame_invisible (struct frame *f) |
349 { | 361 { |
350 if (!FRAME_VISIBLE_P(f)) | 362 if (!FRAME_VISIBLE_P (f)) |
351 return; | 363 return; |
352 | 364 |
353 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_HIDE); | 365 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_HIDE); |
354 f->visible = 0; | 366 f->visible = 0; |
355 } | 367 } |
356 | 368 |
357 static int | 369 static int |
358 mswindows_frame_totally_visible_p (struct frame *f) | 370 mswindows_frame_totally_visible_p (struct frame *f) |
359 { | 371 { |
360 RECT rc_me, rc_other, rc_temp; | 372 RECT rc_me, rc_other, rc_temp; |
361 HWND hwnd = FRAME_MSWINDOWS_HANDLE(f); | 373 HWND hwnd = FRAME_MSWINDOWS_HANDLE (f); |
362 | 374 |
363 /* We test against not a whole window rectangle, only against its | 375 /* We test against not a whole window rectangle, only against its |
364 client part. So, if non-client are is covered and client area is | 376 client part. So, if non-client are is covered and client area is |
365 not, we return true. */ | 377 not, we return true. */ |
366 GetClientRect (hwnd, &rc_me); | 378 GetClientRect (hwnd, &rc_me); |
367 MapWindowPoints (hwnd, HWND_DESKTOP, (LPPOINT)&rc_me, 2); | 379 MapWindowPoints (hwnd, HWND_DESKTOP, (LPPOINT)&rc_me, 2); |
368 | 380 |
369 /* First see if we're off the desktop */ | 381 /* First see if we're off the desktop */ |
370 GetWindowRect (GetDesktopWindow(), &rc_other); | 382 GetWindowRect (GetDesktopWindow (), &rc_other); |
371 UnionRect(&rc_temp, &rc_me, &rc_other); | 383 UnionRect (&rc_temp, &rc_me, &rc_other); |
372 if (!EqualRect (&rc_temp, &rc_other)) | 384 if (!EqualRect (&rc_temp, &rc_other)) |
373 return 0; | 385 return 0; |
374 | 386 |
375 /* Then see if any window above us obscures us */ | 387 /* Then see if any window above us obscures us */ |
376 while ((hwnd = GetWindow (hwnd, GW_HWNDPREV)) != NULL) | 388 while ((hwnd = GetWindow (hwnd, GW_HWNDPREV)) != NULL) |
377 if (IsWindowVisible (hwnd)) | 389 if (IsWindowVisible (hwnd)) |
378 { | 390 { |
379 GetWindowRect (hwnd, &rc_other); | 391 GetWindowRect (hwnd, &rc_other); |
380 if (IntersectRect(&rc_temp, &rc_me, &rc_other)) | 392 if (IntersectRect (&rc_temp, &rc_me, &rc_other)) |
381 return 0; | 393 return 0; |
382 } | 394 } |
383 | 395 |
384 return 1; | 396 return 1; |
385 } | 397 } |
386 | 398 |
387 static int | 399 static int |
388 mswindows_frame_visible_p (struct frame *f) | 400 mswindows_frame_visible_p (struct frame *f) |
389 { | 401 { |
390 return IsWindowVisible (FRAME_MSWINDOWS_HANDLE(f)) | 402 return IsWindowVisible (FRAME_MSWINDOWS_HANDLE (f)) |
391 && !IsIconic (FRAME_MSWINDOWS_HANDLE(f)); | 403 && !IsIconic (FRAME_MSWINDOWS_HANDLE (f)); |
392 } | 404 } |
393 | 405 |
394 | 406 |
395 static void | 407 static void |
396 mswindows_iconify_frame (struct frame *f) | 408 mswindows_iconify_frame (struct frame *f) |
397 { | 409 { |
398 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_MINIMIZE); | 410 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_MINIMIZE); |
399 f->visible = 0; | 411 f->visible = 0; |
400 f->iconified = 1; | 412 f->iconified = 1; |
401 } | 413 } |
402 | 414 |
403 static int | 415 static int |
404 mswindows_frame_iconified_p (struct frame *f) | 416 mswindows_frame_iconified_p (struct frame *f) |
405 { | 417 { |
406 return IsIconic (FRAME_MSWINDOWS_HANDLE(f)); | 418 return IsIconic (FRAME_MSWINDOWS_HANDLE (f)); |
407 } | 419 } |
408 | 420 |
409 static void | 421 static void |
410 mswindows_set_frame_icon (struct frame *f) | 422 mswindows_set_frame_icon (struct frame *f) |
411 { | 423 { |
416 { | 428 { |
417 mswindows_initialize_image_instance_icon (XIMAGE_INSTANCE (f->icon), | 429 mswindows_initialize_image_instance_icon (XIMAGE_INSTANCE (f->icon), |
418 FALSE); | 430 FALSE); |
419 } | 431 } |
420 | 432 |
421 SetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HICON, | 433 qxeSetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HICON, |
422 (LONG) XIMAGE_INSTANCE_MSWINDOWS_ICON (f->icon)); | 434 (LONG) XIMAGE_INSTANCE_MSWINDOWS_ICON (f->icon)); |
423 } | 435 } |
424 } | 436 } |
425 | 437 |
426 static void | 438 static void |
427 mswindows_set_frame_pointer (struct frame *f) | 439 mswindows_set_frame_pointer (struct frame *f) |
428 { | 440 { |
429 if (IMAGE_INSTANCEP (f->pointer) | 441 if (IMAGE_INSTANCEP (f->pointer) |
430 && IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (f->pointer)) == IMAGE_POINTER) | 442 && IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (f->pointer)) == IMAGE_POINTER) |
431 { | 443 { |
432 SetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HCURSOR, | 444 qxeSetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HCURSOR, |
433 (LONG) XIMAGE_INSTANCE_MSWINDOWS_ICON (f->pointer)); | 445 (LONG) XIMAGE_INSTANCE_MSWINDOWS_ICON (f->pointer)); |
434 /* we only have to do this because GC doesn't cause a mouse | 446 /* we only have to do this because GC doesn't cause a mouse |
435 event and doesn't give time to event processing even if it | 447 event and doesn't give time to event processing even if it |
436 did. */ | 448 did. */ |
437 SetCursor (XIMAGE_INSTANCE_MSWINDOWS_ICON (f->pointer)); | 449 SetCursor (XIMAGE_INSTANCE_MSWINDOWS_ICON (f->pointer)); |
438 } | 450 } |
444 struct frame *f = XFRAME (w->frame); | 456 struct frame *f = XFRAME (w->frame); |
445 POINT pt; | 457 POINT pt; |
446 | 458 |
447 pt.x = w->pixel_left + x; | 459 pt.x = w->pixel_left + x; |
448 pt.y = w->pixel_top + y; | 460 pt.y = w->pixel_top + y; |
449 ClientToScreen (FRAME_MSWINDOWS_HANDLE(f), &pt); | 461 ClientToScreen (FRAME_MSWINDOWS_HANDLE (f), &pt); |
450 SetCursorPos (pt.x, pt.y); | 462 SetCursorPos (pt.x, pt.y); |
451 } | 463 } |
452 | 464 |
453 static int | 465 static int |
454 mswindows_get_mouse_position (struct device *d, Lisp_Object *frame, int *x, int *y) | 466 mswindows_get_mouse_position (struct device *d, Lisp_Object *frame, int *x, int *y) |
473 /* Make sure it belongs to us */ | 485 /* Make sure it belongs to us */ |
474 if (GetWindowThreadProcessId (hwnd, NULL) != GetCurrentThreadId ()) | 486 if (GetWindowThreadProcessId (hwnd, NULL) != GetCurrentThreadId ()) |
475 return 0; | 487 return 0; |
476 | 488 |
477 /* And that the window is an XEmacs frame */ | 489 /* And that the window is an XEmacs frame */ |
478 { | 490 if (!mswindows_window_is_xemacs (hwnd)) |
479 char class_name [sizeof(XEMACS_CLASS) + 1]; | 491 return 0; |
480 if (!GetClassName (hwnd, class_name, sizeof(XEMACS_CLASS)) | |
481 || strcmp (class_name, XEMACS_CLASS) != 0) | |
482 return 0; | |
483 } | |
484 | 492 |
485 /* Yippie! */ | 493 /* Yippie! */ |
486 ScreenToClient (hwnd, &pt); | 494 ScreenToClient (hwnd, &pt); |
487 VOID_TO_LISP (*frame, GetWindowLong (hwnd, XWL_FRAMEOBJ)); | 495 VOID_TO_LISP (*frame, qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); |
488 *x = pt.x; | 496 *x = pt.x; |
489 *y = pt.y; | 497 *y = pt.y; |
490 return 1; | 498 return 1; |
491 } | 499 } |
492 | 500 |
493 static void | 501 static void |
494 mswindows_raise_frame (struct frame *f) | 502 mswindows_raise_frame (struct frame *f) |
495 { | 503 { |
496 BringWindowToTop (FRAME_MSWINDOWS_HANDLE(f)); | 504 BringWindowToTop (FRAME_MSWINDOWS_HANDLE (f)); |
497 } | 505 } |
498 | 506 |
499 static void | 507 static void |
500 mswindows_lower_frame (struct frame *f) | 508 mswindows_lower_frame (struct frame *f) |
501 { | 509 { |
502 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), HWND_BOTTOM, 0, 0, 0, 0, | 510 SetWindowPos (FRAME_MSWINDOWS_HANDLE (f), HWND_BOTTOM, 0, 0, 0, 0, |
503 SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING); | 511 SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING); |
504 } | 512 } |
505 | 513 |
506 static void | 514 static void |
507 mswindows_enable_frame (struct frame *f) | 515 mswindows_enable_frame (struct frame *f) |
516 } | 524 } |
517 | 525 |
518 static void | 526 static void |
519 mswindows_set_title_from_intbyte (struct frame *f, Intbyte *title) | 527 mswindows_set_title_from_intbyte (struct frame *f, Intbyte *title) |
520 { | 528 { |
521 unsigned int new_checksum = hash_string (title, strlen ((char *) title)); | 529 unsigned int new_checksum = hash_string (title, qxestrlen (title)); |
522 if (new_checksum != FRAME_MSWINDOWS_TITLE_CHECKSUM (f)) | 530 if (new_checksum != FRAME_MSWINDOWS_TITLE_CHECKSUM (f)) |
523 { | 531 { |
524 Extbyte *title_ext; | 532 Extbyte *title_ext; |
525 | 533 |
526 FRAME_MSWINDOWS_TITLE_CHECKSUM (f) = new_checksum; | 534 FRAME_MSWINDOWS_TITLE_CHECKSUM (f) = new_checksum; |
527 C_STRING_TO_EXTERNAL (title, title_ext, Qmswindows_tstr); | 535 C_STRING_TO_TSTR (title, title_ext); |
528 SetWindowText (FRAME_MSWINDOWS_HANDLE (f), title_ext); | 536 qxeSetWindowText (FRAME_MSWINDOWS_HANDLE (f), title_ext); |
529 } | 537 } |
530 } | 538 } |
531 | 539 |
532 static Lisp_Object | 540 static Lisp_Object |
533 mswindows_frame_property (struct frame *f, Lisp_Object property) | 541 mswindows_frame_property (struct frame *f, Lisp_Object property) |
534 { | 542 { |
535 if (EQ (Qleft, property) || EQ (Qtop, property)) | 543 if (EQ (Qleft, property) || EQ (Qtop, property)) |
536 { | 544 { |
537 RECT rc; | 545 RECT rc; |
538 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rc); | 546 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rc); |
539 return make_int (EQ (Qtop, property) ? rc.top : rc.left); | 547 return make_int (EQ (Qtop, property) ? rc.top : rc.left); |
540 } | 548 } |
541 return Qunbound; | 549 return Qunbound; |
542 } | 550 } |
543 | 551 |
554 static Lisp_Object | 562 static Lisp_Object |
555 mswindows_frame_properties (struct frame *f) | 563 mswindows_frame_properties (struct frame *f) |
556 { | 564 { |
557 Lisp_Object props = Qnil; | 565 Lisp_Object props = Qnil; |
558 RECT rc; | 566 RECT rc; |
559 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rc); | 567 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rc); |
560 | 568 |
561 props = cons3 (Qtop, make_int (rc.top), props); | 569 props = cons3 (Qtop, make_int (rc.top), props); |
562 props = cons3 (Qleft, make_int (rc.left), props); | 570 props = cons3 (Qleft, make_int (rc.left), props); |
563 | 571 |
564 return props; | 572 return props; |
645 mswindows_size_frame_internal (f, &dest); | 653 mswindows_size_frame_internal (f, &dest); |
646 } | 654 } |
647 } | 655 } |
648 | 656 |
649 void | 657 void |
650 mswindows_size_frame_internal (struct frame* f, XEMACS_RECT_WH* dest) | 658 mswindows_size_frame_internal (struct frame *f, XEMACS_RECT_WH *dest) |
651 { | 659 { |
652 RECT rect, ws_rect; | 660 RECT rect, ws_rect; |
653 int pixel_width, pixel_height; | 661 int pixel_width, pixel_height; |
654 int size_p = (dest->width >=0 || dest->height >=0); | 662 int size_p = (dest->width >=0 || dest->height >=0); |
655 int move_p = (dest->top >=0 || dest->left >=0); | 663 int move_p = (dest->top >=0 || dest->left >=0); |
659 if (dest->width < 0) | 667 if (dest->width < 0) |
660 pixel_width = FRAME_PIXWIDTH (f); | 668 pixel_width = FRAME_PIXWIDTH (f); |
661 if (dest->height < 0) | 669 if (dest->height < 0) |
662 pixel_height = FRAME_PIXHEIGHT (f); | 670 pixel_height = FRAME_PIXHEIGHT (f); |
663 | 671 |
664 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect); | 672 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rect); |
665 if (dest->left < 0) | 673 if (dest->left < 0) |
666 dest->left = rect.left; | 674 dest->left = rect.left; |
667 if (dest->top < 0) | 675 if (dest->top < 0) |
668 dest->top = rect.top; | 676 dest->top = rect.top; |
669 | 677 |
670 rect.left = rect.top = 0; | 678 rect.left = rect.top = 0; |
671 rect.right = pixel_width; | 679 rect.right = pixel_width; |
672 rect.bottom = pixel_height; | 680 rect.bottom = pixel_height; |
673 | 681 |
674 AdjustWindowRectEx (&rect, | 682 AdjustWindowRectEx (&rect, |
675 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE), | 683 qxeGetWindowLong (FRAME_MSWINDOWS_HANDLE (f), GWL_STYLE), |
676 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL, | 684 GetMenu (FRAME_MSWINDOWS_HANDLE (f)) != NULL, |
677 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE)); | 685 qxeGetWindowLong (FRAME_MSWINDOWS_HANDLE (f), GWL_EXSTYLE)); |
678 | 686 |
679 /* resize and move the window so that it fits in the workspace. This is | 687 /* resize and move the window so that it fits in the workspace. This is |
680 not restrictive since this will happen later anyway in WM_SIZE. We | 688 not restrictive since this will happen later anyway in WM_SIZE. We |
681 have to do this after adjusting the rect to account for menubar | 689 have to do this after adjusting the rect to account for menubar |
682 etc. */ | 690 etc. */ |
715 { | 723 { |
716 dest->top = ws_rect.top; | 724 dest->top = ws_rect.top; |
717 move_p=1; | 725 move_p=1; |
718 } | 726 } |
719 | 727 |
720 if (IsIconic (FRAME_MSWINDOWS_HANDLE(f)) | 728 if (IsIconic (FRAME_MSWINDOWS_HANDLE (f)) |
721 || IsZoomed (FRAME_MSWINDOWS_HANDLE(f))) | 729 || IsZoomed (FRAME_MSWINDOWS_HANDLE (f))) |
722 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE); | 730 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_RESTORE); |
723 | 731 |
724 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL, | 732 SetWindowPos (FRAME_MSWINDOWS_HANDLE (f), NULL, |
725 dest->left, dest->top, pixel_width, pixel_height, | 733 dest->left, dest->top, pixel_width, pixel_height, |
726 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | 734 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING |
727 | (size_p ? 0 : SWP_NOSIZE) | 735 | (size_p ? 0 : SWP_NOSIZE) |
728 | (move_p ? 0 : SWP_NOMOVE)); | 736 | (move_p ? 0 : SWP_NOMOVE)); |
729 } | 737 } |
730 | 738 |
731 static Lisp_Object | 739 static Lisp_Object |
732 mswindows_get_frame_parent (struct frame *f) | 740 mswindows_get_frame_parent (struct frame *f) |
733 { | 741 { |
734 HWND hwnd = FRAME_MSWINDOWS_HANDLE(f); | 742 HWND hwnd = FRAME_MSWINDOWS_HANDLE (f); |
735 hwnd = GetParent (hwnd); | 743 hwnd = GetParent (hwnd); |
736 if (hwnd) | 744 if (hwnd) |
737 { | 745 { |
738 Lisp_Object parent; | 746 Lisp_Object parent; |
739 VOID_TO_LISP (parent, GetWindowLong (hwnd, XWL_FRAMEOBJ)); | 747 VOID_TO_LISP (parent, qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); |
740 assert (FRAME_MSWINDOWS_P (XFRAME (parent))); | 748 assert (FRAME_MSWINDOWS_P (XFRAME (parent))); |
741 return parent; | 749 return parent; |
742 } | 750 } |
743 else | 751 else |
744 return Qnil; | 752 return Qnil; |
745 } | 753 } |
746 | 754 |
747 static void | 755 static void |
748 mswindows_update_frame_external_traits (struct frame* frm, Lisp_Object name) | 756 mswindows_update_frame_external_traits (struct frame *frm, Lisp_Object name) |
749 { | 757 { |
750 } | 758 } |
751 | 759 |
752 static int | 760 static int |
753 mswindows_frame_size_fixed_p (struct frame *f) | 761 mswindows_frame_size_fixed_p (struct frame *f) |
800 if (FRAME_MSPRINTER_JOB_STARTED (f)) | 808 if (FRAME_MSPRINTER_JOB_STARTED (f)) |
801 error_frame_unsizable (f); | 809 error_frame_unsizable (f); |
802 } | 810 } |
803 | 811 |
804 static void | 812 static void |
805 msprinter_init_frame_1 (struct frame *f, Lisp_Object props) | 813 msprinter_init_frame_1 (struct frame *f, Lisp_Object props, |
814 int frame_name_is_defaulted) | |
806 { | 815 { |
807 /* Make sure this is the only frame on device. Windows printer can | 816 /* Make sure this is the only frame on device. Windows printer can |
808 handle only one job at a time. */ | 817 handle only one job at a time. */ |
809 if (!NILP (DEVICE_FRAME_LIST (XDEVICE (FRAME_DEVICE (f))))) | 818 if (!NILP (DEVICE_FRAME_LIST (XDEVICE (FRAME_DEVICE (f))))) |
810 invalid_operation ("Only one frame (print job) at a time is allowed on " | 819 invalid_operation ("Only one frame (print job) at a time is allowed on " |
827 } | 836 } |
828 | 837 |
829 static void | 838 static void |
830 msprinter_init_frame_3 (struct frame *f) | 839 msprinter_init_frame_3 (struct frame *f) |
831 { | 840 { |
832 DOCINFO di; | 841 DOCINFOW di; |
833 struct device *device = XDEVICE (FRAME_DEVICE (f)); | 842 struct device *device = XDEVICE (FRAME_DEVICE (f)); |
834 HDC hdc; | 843 HDC hdc; |
835 int frame_left, frame_top, frame_width, frame_height; | 844 int frame_left, frame_top, frame_width, frame_height; |
836 | 845 |
837 /* DC might be recreated in msprinter_apply_devmode, | 846 /* DC might be recreated in msprinter_apply_devmode, |
838 so do not initialize until now */ | 847 so do not initialize until now */ |
839 hdc = DEVICE_MSPRINTER_HDC (device); | 848 hdc = DEVICE_MSPRINTER_HDC (device); |
840 | 849 |
841 /* Compute geometry properties */ | 850 /* Compute geometry properties */ |
842 frame_left = (MulDiv (GetDeviceCaps (hdc, LOGPIXELSX), | 851 frame_left = (MulDiv (GetDeviceCaps (hdc, LOGPIXELSX), |
843 FRAME_MSPRINTER_LEFT_MARGIN(f), 1440) | 852 FRAME_MSPRINTER_LEFT_MARGIN (f), 1440) |
844 - GetDeviceCaps (hdc, PHYSICALOFFSETX)); | 853 - GetDeviceCaps (hdc, PHYSICALOFFSETX)); |
845 | 854 |
846 if (FRAME_MSPRINTER_CHARWIDTH(f) > 0) | 855 if (FRAME_MSPRINTER_CHARWIDTH (f) > 0) |
847 { | 856 { |
848 char_to_real_pixel_size (f, FRAME_MSPRINTER_CHARWIDTH(f), 0, | 857 char_to_real_pixel_size (f, FRAME_MSPRINTER_CHARWIDTH (f), 0, |
849 &frame_width, NULL); | 858 &frame_width, NULL); |
850 FRAME_MSPRINTER_RIGHT_MARGIN(f) = | 859 FRAME_MSPRINTER_RIGHT_MARGIN (f) = |
851 MulDiv (GetDeviceCaps (hdc, PHYSICALWIDTH) | 860 MulDiv (GetDeviceCaps (hdc, PHYSICALWIDTH) |
852 - (frame_left + frame_width), 1440, | 861 - (frame_left + frame_width), 1440, |
853 GetDeviceCaps (hdc, LOGPIXELSX)); | 862 GetDeviceCaps (hdc, LOGPIXELSX)); |
854 } | 863 } |
855 else | 864 else |
856 frame_width = (GetDeviceCaps (hdc, PHYSICALWIDTH) | 865 frame_width = (GetDeviceCaps (hdc, PHYSICALWIDTH) |
857 - frame_left | 866 - frame_left |
858 - MulDiv (GetDeviceCaps (hdc, LOGPIXELSX), | 867 - MulDiv (GetDeviceCaps (hdc, LOGPIXELSX), |
859 FRAME_MSPRINTER_RIGHT_MARGIN(f), 1440)); | 868 FRAME_MSPRINTER_RIGHT_MARGIN (f), 1440)); |
860 | 869 |
861 frame_top = (MulDiv (GetDeviceCaps (hdc, LOGPIXELSY), | 870 frame_top = (MulDiv (GetDeviceCaps (hdc, LOGPIXELSY), |
862 FRAME_MSPRINTER_TOP_MARGIN(f), 1440) | 871 FRAME_MSPRINTER_TOP_MARGIN (f), 1440) |
863 - GetDeviceCaps (hdc, PHYSICALOFFSETY)); | 872 - GetDeviceCaps (hdc, PHYSICALOFFSETY)); |
864 | 873 |
865 if (FRAME_MSPRINTER_CHARHEIGHT(f) > 0) | 874 if (FRAME_MSPRINTER_CHARHEIGHT (f) > 0) |
866 { | 875 { |
867 char_to_real_pixel_size (f, 0, FRAME_MSPRINTER_CHARHEIGHT(f), | 876 char_to_real_pixel_size (f, 0, FRAME_MSPRINTER_CHARHEIGHT (f), |
868 NULL, &frame_height); | 877 NULL, &frame_height); |
869 | 878 |
870 FRAME_MSPRINTER_BOTTOM_MARGIN(f) = | 879 FRAME_MSPRINTER_BOTTOM_MARGIN (f) = |
871 MulDiv (GetDeviceCaps (hdc, PHYSICALHEIGHT) | 880 MulDiv (GetDeviceCaps (hdc, PHYSICALHEIGHT) |
872 - (frame_top + frame_height), 1440, | 881 - (frame_top + frame_height), 1440, |
873 GetDeviceCaps (hdc, LOGPIXELSY)); | 882 GetDeviceCaps (hdc, LOGPIXELSY)); |
874 } | 883 } |
875 else | 884 else |
876 frame_height = (GetDeviceCaps (hdc, PHYSICALHEIGHT) | 885 frame_height = (GetDeviceCaps (hdc, PHYSICALHEIGHT) |
877 - frame_top | 886 - frame_top |
878 - MulDiv (GetDeviceCaps (hdc, LOGPIXELSY), | 887 - MulDiv (GetDeviceCaps (hdc, LOGPIXELSY), |
879 FRAME_MSPRINTER_BOTTOM_MARGIN(f), 1440)); | 888 FRAME_MSPRINTER_BOTTOM_MARGIN (f), 1440)); |
880 | 889 |
881 /* Geometry sanity checks */ | 890 /* Geometry sanity checks */ |
882 if (!frame_pixsize_valid_p (f, frame_width, frame_height)) | 891 if (!frame_pixsize_valid_p (f, frame_width, frame_height)) |
883 invalid_operation ("Area inside print margins has shrunk to naught", | 892 invalid_operation ("Area inside print margins has shrunk to naught", |
884 STRINGP (f->name) ? f->name : Qunbound); | 893 STRINGP (f->name) ? f->name : Qunbound); |
892 STRINGP (f->name) ? f->name : Qunbound); | 901 STRINGP (f->name) ? f->name : Qunbound); |
893 | 902 |
894 /* Apply XEmacs frame geometry and layout windows */ | 903 /* Apply XEmacs frame geometry and layout windows */ |
895 { | 904 { |
896 int rows, columns; | 905 int rows, columns; |
897 FRAME_PIXWIDTH(f) = frame_width; | 906 FRAME_PIXWIDTH (f) = frame_width; |
898 FRAME_PIXHEIGHT(f) = frame_height; | 907 FRAME_PIXHEIGHT (f) = frame_height; |
899 pixel_to_char_size (f, frame_width, frame_height, &columns, &rows); | 908 pixel_to_char_size (f, frame_width, frame_height, &columns, &rows); |
900 change_frame_size (f, rows, columns, 0); | 909 change_frame_size (f, rows, columns, 0); |
901 } | 910 } |
902 | 911 |
903 FRAME_MSPRINTER_PIXLEFT(f) = frame_left; | 912 FRAME_MSPRINTER_PIXLEFT(f) = frame_left; |
904 FRAME_MSPRINTER_PIXTOP(f) = frame_top; | 913 FRAME_MSPRINTER_PIXTOP(f) = frame_top; |
905 | 914 |
906 /* Start print job */ | 915 /* Start print job */ |
907 di.cbSize = sizeof (di); | 916 di.cbSize = sizeof (di); |
908 di.lpszDocName = (STRINGP(f->name) | 917 { |
909 ? (char*) XSTRING_DATA(f->name) | 918 const Extbyte *nameext; |
910 : "XEmacs print document"); | 919 |
920 if (STRINGP (f->name)) | |
921 LISP_STRING_TO_TSTR (f->name, nameext); | |
922 else | |
923 nameext = XETEXT ("XEmacs print document"); | |
924 di.lpszDocName = (XELPTSTR) nameext; | |
925 } | |
911 di.lpszOutput = NULL; | 926 di.lpszOutput = NULL; |
912 di.lpszDatatype = NULL; | 927 di.lpszDatatype = NULL; |
913 di.fwType = 0; | 928 di.fwType = 0; |
914 | 929 |
915 if (StartDoc (hdc, &di) <= 0) | 930 if (qxeStartDoc (hdc, &di) <= 0) |
916 invalid_operation ("Cannot start print job", | 931 invalid_operation ("Cannot start print job", |
917 STRINGP (f->name) ? f->name : Qunbound); | 932 STRINGP (f->name) ? f->name : Qunbound); |
918 | 933 |
919 apply_dc_geometry (f); | 934 apply_dc_geometry (f); |
920 | 935 |
921 /* Finish frame setup */ | 936 /* Finish frame setup */ |
922 FRAME_MSPRINTER_JOB_STARTED (f) = 1; | 937 FRAME_MSPRINTER_JOB_STARTED (f) = 1; |
923 FRAME_VISIBLE_P(f) = 0; | 938 FRAME_VISIBLE_P (f) = 0; |
924 } | 939 } |
925 | 940 |
926 static void | 941 static void |
927 msprinter_mark_frame (struct frame *f) | 942 msprinter_mark_frame (struct frame *f) |
928 { | 943 { |
946 | 961 |
947 static Lisp_Object | 962 static Lisp_Object |
948 msprinter_frame_property (struct frame *f, Lisp_Object property) | 963 msprinter_frame_property (struct frame *f, Lisp_Object property) |
949 { | 964 { |
950 if (EQ (Qleft_margin, property)) | 965 if (EQ (Qleft_margin, property)) |
951 return make_int (FRAME_MSPRINTER_LEFT_MARGIN(f)); | 966 return make_int (FRAME_MSPRINTER_LEFT_MARGIN (f)); |
952 else if (EQ (Qtop_margin, property)) | 967 else if (EQ (Qtop_margin, property)) |
953 return make_int (FRAME_MSPRINTER_TOP_MARGIN(f)); | 968 return make_int (FRAME_MSPRINTER_TOP_MARGIN (f)); |
954 if (EQ (Qright_margin, property)) | 969 if (EQ (Qright_margin, property)) |
955 return make_int (FRAME_MSPRINTER_RIGHT_MARGIN(f)); | 970 return make_int (FRAME_MSPRINTER_RIGHT_MARGIN (f)); |
956 else if (EQ (Qbottom_margin, property)) | 971 else if (EQ (Qbottom_margin, property)) |
957 return make_int (FRAME_MSPRINTER_BOTTOM_MARGIN(f)); | 972 return make_int (FRAME_MSPRINTER_BOTTOM_MARGIN (f)); |
958 else | 973 else |
959 return Qunbound; | 974 return Qunbound; |
960 } | 975 } |
961 | 976 |
962 static int | 977 static int |
969 static Lisp_Object | 984 static Lisp_Object |
970 msprinter_frame_properties (struct frame *f) | 985 msprinter_frame_properties (struct frame *f) |
971 { | 986 { |
972 Lisp_Object props = Qnil; | 987 Lisp_Object props = Qnil; |
973 props = cons3 (Qbottom_margin, | 988 props = cons3 (Qbottom_margin, |
974 make_int (FRAME_MSPRINTER_BOTTOM_MARGIN(f)), props); | 989 make_int (FRAME_MSPRINTER_BOTTOM_MARGIN (f)), props); |
975 props = cons3 (Qright_margin, | 990 props = cons3 (Qright_margin, |
976 make_int (FRAME_MSPRINTER_RIGHT_MARGIN(f)), props); | 991 make_int (FRAME_MSPRINTER_RIGHT_MARGIN (f)), props); |
977 props = cons3 (Qtop_margin, | 992 props = cons3 (Qtop_margin, |
978 make_int (FRAME_MSPRINTER_TOP_MARGIN(f)), props); | 993 make_int (FRAME_MSPRINTER_TOP_MARGIN (f)), props); |
979 props = cons3 (Qleft_margin, | 994 props = cons3 (Qleft_margin, |
980 make_int (FRAME_MSPRINTER_LEFT_MARGIN(f)), props); | 995 make_int (FRAME_MSPRINTER_LEFT_MARGIN (f)), props); |
981 return props; | 996 return props; |
982 } | 997 } |
983 | 998 |
984 static void | 999 static void |
985 msprinter_set_frame_properties (struct frame *f, Lisp_Object plist) | 1000 msprinter_set_frame_properties (struct frame *f, Lisp_Object plist) |
998 { | 1013 { |
999 maybe_error_if_job_active (f); | 1014 maybe_error_if_job_active (f); |
1000 if (!NILP (val)) | 1015 if (!NILP (val)) |
1001 { | 1016 { |
1002 CHECK_NATNUM (val); | 1017 CHECK_NATNUM (val); |
1003 FRAME_MSPRINTER_CHARWIDTH(f) = XINT (val); | 1018 FRAME_MSPRINTER_CHARWIDTH (f) = XINT (val); |
1004 } | 1019 } |
1005 } | 1020 } |
1006 if (EQ (prop, Qheight)) | 1021 if (EQ (prop, Qheight)) |
1007 { | 1022 { |
1008 maybe_error_if_job_active (f); | 1023 maybe_error_if_job_active (f); |
1009 if (!NILP (val)) | 1024 if (!NILP (val)) |
1010 { | 1025 { |
1011 CHECK_NATNUM (val); | 1026 CHECK_NATNUM (val); |
1012 FRAME_MSPRINTER_CHARHEIGHT(f) = XINT (val); | 1027 FRAME_MSPRINTER_CHARHEIGHT (f) = XINT (val); |
1013 } | 1028 } |
1014 } | 1029 } |
1015 else if (EQ (prop, Qleft_margin)) | 1030 else if (EQ (prop, Qleft_margin)) |
1016 { | 1031 { |
1017 maybe_error_if_job_active (f); | 1032 maybe_error_if_job_active (f); |
1018 CHECK_NATNUM (val); | 1033 CHECK_NATNUM (val); |
1019 FRAME_MSPRINTER_LEFT_MARGIN(f) = XINT (val); | 1034 FRAME_MSPRINTER_LEFT_MARGIN (f) = XINT (val); |
1020 } | 1035 } |
1021 else if (EQ (prop, Qtop_margin)) | 1036 else if (EQ (prop, Qtop_margin)) |
1022 { | 1037 { |
1023 maybe_error_if_job_active (f); | 1038 maybe_error_if_job_active (f); |
1024 CHECK_NATNUM (val); | 1039 CHECK_NATNUM (val); |
1025 FRAME_MSPRINTER_TOP_MARGIN(f) = XINT (val); | 1040 FRAME_MSPRINTER_TOP_MARGIN (f) = XINT (val); |
1026 } | 1041 } |
1027 else if (EQ (prop, Qright_margin)) | 1042 else if (EQ (prop, Qright_margin)) |
1028 { | 1043 { |
1029 maybe_error_if_job_active (f); | 1044 maybe_error_if_job_active (f); |
1030 CHECK_NATNUM (val); | 1045 CHECK_NATNUM (val); |
1031 FRAME_MSPRINTER_RIGHT_MARGIN(f) = XINT (val); | 1046 FRAME_MSPRINTER_RIGHT_MARGIN (f) = XINT (val); |
1032 } | 1047 } |
1033 else if (EQ (prop, Qbottom_margin)) | 1048 else if (EQ (prop, Qbottom_margin)) |
1034 { | 1049 { |
1035 maybe_error_if_job_active (f); | 1050 maybe_error_if_job_active (f); |
1036 CHECK_NATNUM (val); | 1051 CHECK_NATNUM (val); |
1037 FRAME_MSPRINTER_BOTTOM_MARGIN(f) = XINT (val); | 1052 FRAME_MSPRINTER_BOTTOM_MARGIN (f) = XINT (val); |
1038 } | 1053 } |
1039 } | 1054 } |
1040 } | 1055 } |
1041 } | 1056 } |
1042 | 1057 |