Mercurial > emacs
comparison src/xfns.c @ 974:4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
resource, not nil. That way, we can tell the difference between a
false resource and an unspecified resource.
(x_default_error): Use DEFLT if x_get_arg returns Qunbound, not Qnil.
(x_figure_window_size, x_icon, Fx_create_frame): Deal with
Qunbound and Qnil properly.
* xfns.c (Fx_create_frame): Pass the correct number of arguments
to x_set_font.
* xfns.c [not HAVE_X11] (Fx_create_frame): Delete section that's
only included if we *do* have X11. Blind patching.
* xfns.c (x_icon): Rewritten to call x_wm_set_icon_position and
x_wm_set_window_state instead of calling XSetWMHints directly.
(x_wm_set_window_state, x_wm_set_icon_pixmap,
x_wm_set_icon_position): Use x_wm_hints.
(x_term_init): Set the `input' field of x_wm_hints, and its flag.
* xfns.c (x_default_parameter): Don't call store_frame_param here;
it's already taken care of by x_set_frame_parameters.
* xfns.c (Fx_create_frame): Check for the `icon-type',
`auto-raise', and `auto-lower' parameters. Have `icon-type'
default to t, indicating that we want the nifty gnu in our icons.
(Qauto_lower): New symbol.
* xfns.c (x_set_icon_type): UNBLOCK_INPUT before reporting the
error, not after. error doesn't return, sklitch-brain.
* xfns.c (x_set_frame_parameters): Properly recognize changes to
the height of the frame. Recognize changes of the frame's
position.
* xfns.c (x_set_frame_parameters): Iterate over ALIST while the
current element is cons, not while it's non-nil.
(syms_of_xfns): Call init_x_parm_symbols after interning all the
other atoms; init_x_parm_symbols expects Qx_frame_parameter to be
initialized.
* xfns.c (Qbackground_color, Qborder_color, Qborder_width,
Qcursor_color, Qfont, Qforeground_color, Qgeometry,
Qhorizontal_scroll_bar, Qicon_left, Qicon_top, Qiconic_startup,
Qinternal_border_width, Qleft, Qmouse_color, Qparent_id,
Qsuppress_icon, Qsuppress_initial_map, Qtop, Qundefined_color,
Qvertical_scroll_bar, Qwindow_id, Qx_frame_parameter): New
symbols, with lisp code to rebuild syms_of_xfns.
(syms_of_xfns): Initialize and staticpro them.
(Qheight, Qminibuffer, Qname, Qnone, Qonly, Qwidth,
Qunsplittable): Add extern declaration for these.
(x_init_parm_symbols): Don't initialize Qx_frame_parameter here;
it's done in syms_of_xfns.
(x_default_parameter): Change the argument char *PROPNAME into a
Lisp_Object PROP; let the caller take care of interning the atom.
(Fx_geometry, x_figure_window_size, x_icon, Fx_create_frame): Use
the new Q... variables, instead of interning things.
* xfns.c (x_set_frame_param): Replaced by x_set_frame_parameters.
(x_set_frame_parameters): Process the alist of parameters here.
Notice `width', `height', `top', and `left' parameters.
Hold off changing the frame size and position until the end, so we
can do both parameters at once when they are both specified.
(x_default_parameter): Call x_set_frame_parameters, not
x_set_frame_param.
* xfns.c (x_figure_window_size): Indicate that this function
returns an int, rather than just leaving it unstated.
* xfns.c (Fx_create_frame): Call change_frame_size with a DELAY of 0.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 12 Aug 1992 14:33:03 +0000 |
parents | 14748faa4f17 |
children | 5fd29acd3db7 |
comparison
equal
deleted
inserted
replaced
973:52267046b144 | 974:4f88a1b78a46 |
---|---|
36 #include "keyboard.h" | 36 #include "keyboard.h" |
37 | 37 |
38 #ifdef HAVE_X_WINDOWS | 38 #ifdef HAVE_X_WINDOWS |
39 extern void abort (); | 39 extern void abort (); |
40 | 40 |
41 void x_set_frame_param (); | |
42 | |
43 #define min(a,b) ((a) < (b) ? (a) : (b)) | 41 #define min(a,b) ((a) < (b) ? (a) : (b)) |
44 #define max(a,b) ((a) > (b) ? (a) : (b)) | 42 #define max(a,b) ((a) > (b) ? (a) : (b)) |
45 | 43 |
46 #ifdef HAVE_X11 | 44 #ifdef HAVE_X11 |
47 /* X Resource data base */ | 45 /* X Resource data base */ |
191 #endif /* X10 */ | 189 #endif /* X10 */ |
192 | 190 |
193 /* The last 23 bits of the timestamp of the last mouse button event. */ | 191 /* The last 23 bits of the timestamp of the last mouse button event. */ |
194 Time mouse_timestamp; | 192 Time mouse_timestamp; |
195 | 193 |
194 /* Evaluate this expression to rebuild the section of syms_of_xfns | |
195 that initializes and staticpros the symbols declared below. Note | |
196 that Emacs 18 has a bug that keeps C-x C-e from being able to | |
197 evaluate this expression. | |
198 | |
199 (progn | |
200 ;; Accumulate a list of the symbols we want to initialize from the | |
201 ;; declarations at the top of the file. | |
202 (goto-char (point-min)) | |
203 (search-forward "/\*&&& symbols declared here &&&*\/\n") | |
204 (let (symbol-list) | |
205 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)") | |
206 (setq symbol-list | |
207 (cons (buffer-substring (match-beginning 1) (match-end 1)) | |
208 symbol-list)) | |
209 (forward-line 1)) | |
210 (setq symbol-list (nreverse symbol-list)) | |
211 ;; Delete the section of syms_of_... where we initialize the symbols. | |
212 (search-forward "\n /\*&&& init symbols here &&&*\/\n") | |
213 (let ((start (point))) | |
214 (while (looking-at "^ Q") | |
215 (forward-line 2)) | |
216 (kill-region start (point))) | |
217 ;; Write a new symbol initialization section. | |
218 (while symbol-list | |
219 (insert (format " %s = intern (\"" (car symbol-list))) | |
220 (let ((start (point))) | |
221 (insert (substring (car symbol-list) 1)) | |
222 (subst-char-in-region start (point) ?_ ?-)) | |
223 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list))) | |
224 (setq symbol-list (cdr symbol-list))))) | |
225 | |
226 */ | |
227 | |
228 /*&&& symbols declared here &&&*/ | |
229 Lisp_Object Qauto_raise; | |
230 Lisp_Object Qauto_lower; | |
231 Lisp_Object Qbackground_color; | |
232 Lisp_Object Qborder_color; | |
233 Lisp_Object Qborder_width; | |
234 Lisp_Object Qcursor_color; | |
235 Lisp_Object Qfont; | |
236 Lisp_Object Qforeground_color; | |
237 Lisp_Object Qgeometry; | |
238 Lisp_Object Qhorizontal_scroll_bar; | |
239 Lisp_Object Qicon_left; | |
240 Lisp_Object Qicon_top; | |
241 Lisp_Object Qicon_type; | |
242 Lisp_Object Qiconic_startup; | |
243 Lisp_Object Qinternal_border_width; | |
244 Lisp_Object Qleft; | |
245 Lisp_Object Qmouse_color; | |
246 Lisp_Object Qparent_id; | |
247 Lisp_Object Qsuppress_icon; | |
248 Lisp_Object Qsuppress_initial_map; | |
249 Lisp_Object Qtop; | |
196 Lisp_Object Qundefined_color; | 250 Lisp_Object Qundefined_color; |
251 Lisp_Object Qvertical_scroll_bar; | |
252 Lisp_Object Qwindow_id; | |
197 Lisp_Object Qx_frame_parameter; | 253 Lisp_Object Qx_frame_parameter; |
254 | |
255 /* The below are defined in frame.c. */ | |
256 extern Lisp_Object Qheight, Qminibuffer, Qname, Qnone, Qonly, Qwidth; | |
257 extern Lisp_Object Qunsplittable; | |
198 | 258 |
199 extern Lisp_Object Vwindow_system_version; | 259 extern Lisp_Object Vwindow_system_version; |
200 | 260 |
201 /* Mouse map for clicks in windows. */ | 261 /* Mouse map for clicks in windows. */ |
202 extern Lisp_Object Vglobal_mouse_map; | 262 extern Lisp_Object Vglobal_mouse_map; |
372 | 432 |
373 init_x_parm_symbols () | 433 init_x_parm_symbols () |
374 { | 434 { |
375 int i; | 435 int i; |
376 | 436 |
377 Qx_frame_parameter = intern ("x-frame-parameter"); | |
378 | |
379 for (i = 0; i < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]); i++) | 437 for (i = 0; i < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]); i++) |
380 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, | 438 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, |
381 make_number (i)); | 439 make_number (i)); |
382 } | 440 } |
383 | 441 |
442 #if 1 | |
443 /* Change the parameters of FRAME as specified by ALIST. | |
444 If a parameter is not specially recognized, do nothing; | |
445 otherwise call the `x_set_...' function for that parameter. */ | |
446 void | |
447 x_set_frame_parameters (f, alist) | |
448 FRAME_PTR f; | |
449 Lisp_Object alist; | |
450 { | |
451 Lisp_Object tail; | |
452 | |
453 /* If both of these parameters are present, it's more efficient to | |
454 set them both at once. So we wait until we've looked at the | |
455 entire list before we set them. */ | |
456 Lisp_Object width, height; | |
457 | |
458 /* Same here. */ | |
459 Lisp_Object left, top; | |
460 | |
461 XSET (width, Lisp_Int, FRAME_WIDTH (f)); | |
462 XSET (height, Lisp_Int, FRAME_HEIGHT (f)); | |
463 | |
464 XSET (top, Lisp_Int, f->display.x->top_pos); | |
465 XSET (left, Lisp_Int, f->display.x->left_pos); | |
466 | |
467 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
468 { | |
469 Lisp_Object elt, prop, val; | |
470 | |
471 elt = Fcar (tail); | |
472 prop = Fcar (elt); | |
473 val = Fcdr (elt); | |
474 | |
475 if (EQ (prop, Qwidth)) | |
476 width = val; | |
477 else if (EQ (prop, Qheight)) | |
478 height = val; | |
479 else if (EQ (prop, Qtop)) | |
480 top = val; | |
481 else if (EQ (prop, Qleft)) | |
482 left = val; | |
483 else | |
484 { | |
485 register Lisp_Object tem; | |
486 tem = Fget (prop, Qx_frame_parameter); | |
487 if (XTYPE (tem) == Lisp_Int | |
488 && XINT (tem) >= 0 | |
489 && XINT (tem) < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])) | |
490 (*x_frame_parms[XINT (tem)].setter)(f, val, | |
491 get_frame_param (f, prop)); | |
492 store_frame_param (f, prop, val); | |
493 } | |
494 } | |
495 | |
496 /* Don't call these unless they've changed; the window may not actually | |
497 exist yet. */ | |
498 { | |
499 Lisp_Object frame; | |
500 | |
501 XSET (frame, Lisp_Frame, f); | |
502 if (XINT (width) != FRAME_WIDTH (f) | |
503 || XINT (height) != FRAME_HEIGHT (f)) | |
504 Fset_frame_size (frame, width, height); | |
505 if (XINT (left) != f->display.x->left_pos | |
506 || XINT (top) != f->display.x->top_pos) | |
507 Fset_frame_position (frame, left, top); | |
508 } | |
509 } | |
510 #else | |
384 /* Report to X that a frame parameter of frame F is being set or changed. | 511 /* Report to X that a frame parameter of frame F is being set or changed. |
385 PARAM is the symbol that says which parameter. | 512 PARAM is the symbol that says which parameter. |
386 VAL is the new value. | 513 VAL is the new value. |
387 OLDVAL is the old value. | 514 OLDVAL is the old value. |
388 If the parameter is not specially recognized, do nothing; | 515 If the parameter is not specially recognized, do nothing; |
400 if (XTYPE (tem) == Lisp_Int | 527 if (XTYPE (tem) == Lisp_Int |
401 && XINT (tem) >= 0 | 528 && XINT (tem) >= 0 |
402 && XINT (tem) < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])) | 529 && XINT (tem) < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])) |
403 (*x_frame_parms[XINT (tem)].setter)(f, val, oldval); | 530 (*x_frame_parms[XINT (tem)].setter)(f, val, oldval); |
404 } | 531 } |
405 | 532 #endif |
406 /* Insert a description of internally-recorded parameters of frame X | 533 /* Insert a description of internally-recorded parameters of frame X |
407 into the parameter alist *ALISTPTR that is to be given to the user. | 534 into the parameter alist *ALISTPTR that is to be given to the user. |
408 Only parameters that are specific to the X window system | 535 Only parameters that are specific to the X window system |
409 and whose values are not correctly recorded in the frame's | 536 and whose values are not correctly recorded in the frame's |
410 param_alist need to be considered here. */ | 537 param_alist need to be considered here. */ |
413 struct frame *f; | 540 struct frame *f; |
414 Lisp_Object *alistptr; | 541 Lisp_Object *alistptr; |
415 { | 542 { |
416 char buf[16]; | 543 char buf[16]; |
417 | 544 |
418 store_in_alist (alistptr, "left", make_number (f->display.x->left_pos)); | 545 store_in_alist (alistptr, Qleft, make_number (f->display.x->left_pos)); |
419 store_in_alist (alistptr, "top", make_number (f->display.x->top_pos)); | 546 store_in_alist (alistptr, Qtop, make_number (f->display.x->top_pos)); |
420 store_in_alist (alistptr, "border-width", | 547 store_in_alist (alistptr, Qborder_width, |
421 make_number (f->display.x->border_width)); | 548 make_number (f->display.x->border_width)); |
422 store_in_alist (alistptr, "internal-border-width", | 549 store_in_alist (alistptr, Qinternal_border_width, |
423 make_number (f->display.x->internal_border_width)); | 550 make_number (f->display.x->internal_border_width)); |
424 sprintf (buf, "%d", f->display.x->window_desc); | 551 sprintf (buf, "%d", f->display.x->window_desc); |
425 store_in_alist (alistptr, "window-id", | 552 store_in_alist (alistptr, Qwindow_id, |
426 build_string (buf)); | 553 build_string (buf)); |
427 } | 554 } |
428 | 555 |
429 /* Decide if color named COLOR is valid for the display | 556 /* Decide if color named COLOR is valid for the display |
430 associated with the selected frame. */ | 557 associated with the selected frame. */ |
836 if (!EQ (Vx_cursor_fore_pixel, Qnil)) | 963 if (!EQ (Vx_cursor_fore_pixel, Qnil)) |
837 fore_pixel = x_decode_color (Vx_cursor_fore_pixel, WHITE_PIX_DEFAULT); | 964 fore_pixel = x_decode_color (Vx_cursor_fore_pixel, WHITE_PIX_DEFAULT); |
838 else | 965 else |
839 fore_pixel = f->display.x->background_pixel; | 966 fore_pixel = f->display.x->background_pixel; |
840 f->display.x->cursor_pixel = x_decode_color (arg, BLACK_PIX_DEFAULT); | 967 f->display.x->cursor_pixel = x_decode_color (arg, BLACK_PIX_DEFAULT); |
841 /* No invisible cursors */ | 968 |
969 /* Make sure that the cursor color differs from the background color. */ | |
842 if (f->display.x->cursor_pixel == f->display.x->background_pixel) | 970 if (f->display.x->cursor_pixel == f->display.x->background_pixel) |
843 { | 971 { |
844 f->display.x->cursor_pixel == f->display.x->mouse_pixel; | 972 f->display.x->cursor_pixel == f->display.x->mouse_pixel; |
845 if (f->display.x->cursor_pixel == fore_pixel) | 973 if (f->display.x->cursor_pixel == fore_pixel) |
846 fore_pixel = f->display.x->background_pixel; | 974 fore_pixel = f->display.x->background_pixel; |
957 else | 1085 else |
958 result = x_bitmap_icon (f, 0); | 1086 result = x_bitmap_icon (f, 0); |
959 | 1087 |
960 if (result) | 1088 if (result) |
961 { | 1089 { |
1090 UNBLOCK_INPUT; | |
962 error ("No icon window available."); | 1091 error ("No icon window available."); |
963 UNBLOCK_INPUT; | |
964 } | 1092 } |
965 | 1093 |
966 /* If the window was unmapped (and its icon was mapped), | 1094 /* If the window was unmapped (and its icon was mapped), |
967 the new icon is not mapped, so map the window in its stead. */ | 1095 the new icon is not mapped, so map the window in its stead. */ |
968 if (f->visible) | 1096 if (f->visible) |
1388 } | 1516 } |
1389 | 1517 |
1390 #else /* X10 */ | 1518 #else /* X10 */ |
1391 | 1519 |
1392 DEFUN ("x-get-default", Fx_get_default, Sx_get_default, 1, 1, 0, | 1520 DEFUN ("x-get-default", Fx_get_default, Sx_get_default, 1, 1, 0, |
1393 "Get X default ATTRIBUTE from the system, or nil if no default.\n\ | 1521 "Get X default ATTRIBUTE from the system, or nil if no default.\n\ |
1394 Value is a string (when not nil) and ATTRIBUTE is also a string.\n\ | 1522 Value is a string (when not nil) and ATTRIBUTE is also a string.\n\ |
1395 The defaults are specified in the file `~/.Xdefaults'.") | 1523 The defaults are specified in the file `~/.Xdefaults'.") |
1396 (arg) | 1524 (arg) |
1397 Lisp_Object arg; | 1525 Lisp_Object arg; |
1398 { | 1526 { |
1429 First search ALIST, then Vdefault_frame_alist, then the X defaults | 1557 First search ALIST, then Vdefault_frame_alist, then the X defaults |
1430 database, using ATTRIBUTE as the attribute name. | 1558 database, using ATTRIBUTE as the attribute name. |
1431 | 1559 |
1432 Convert the resource to the type specified by desired_type. | 1560 Convert the resource to the type specified by desired_type. |
1433 | 1561 |
1434 If no default is specified, return nil. */ | 1562 If no default is specified, return Qunbound. If you call |
1563 x_get_arg, make sure you deal with Qunbound in a reasonable way, | |
1564 and don't let it get stored in any lisp-visible variables! */ | |
1435 | 1565 |
1436 static Lisp_Object | 1566 static Lisp_Object |
1437 x_get_arg (alist, param, attribute, type) | 1567 x_get_arg (alist, param, attribute, type) |
1438 Lisp_Object alist, param; | 1568 Lisp_Object alist, param; |
1439 char *attribute; | 1569 char *attribute; |
1442 register Lisp_Object tem; | 1572 register Lisp_Object tem; |
1443 | 1573 |
1444 tem = Fassq (param, alist); | 1574 tem = Fassq (param, alist); |
1445 if (EQ (tem, Qnil)) | 1575 if (EQ (tem, Qnil)) |
1446 tem = Fassq (param, Vdefault_frame_alist); | 1576 tem = Fassq (param, Vdefault_frame_alist); |
1447 if (EQ (tem, Qnil) && attribute) | 1577 if (EQ (tem, Qnil)) |
1448 { | 1578 { |
1449 tem = Fx_get_resource (build_string (attribute), Qnil, Qnil); | 1579 |
1450 | 1580 if (attribute) |
1451 if (NILP (tem)) | |
1452 return Qnil; | |
1453 | |
1454 switch (type) | |
1455 { | 1581 { |
1456 case number: | 1582 tem = Fx_get_resource (build_string (attribute), Qnil, Qnil); |
1457 return make_number (atoi (XSTRING (tem)->data)); | 1583 |
1458 | 1584 if (NILP (tem)) |
1459 case boolean: | 1585 return Qunbound; |
1460 tem = Fdowncase (tem); | 1586 |
1461 if (!strcmp (XSTRING (tem)->data, "on") | 1587 switch (type) |
1462 || !strcmp (XSTRING (tem)->data, "true")) | 1588 { |
1463 return Qt; | 1589 case number: |
1464 else | 1590 return make_number (atoi (XSTRING (tem)->data)); |
1465 return Qnil; | 1591 |
1466 | 1592 case boolean: |
1467 case string: | 1593 tem = Fdowncase (tem); |
1468 return tem; | 1594 if (!strcmp (XSTRING (tem)->data, "on") |
1469 | 1595 || !strcmp (XSTRING (tem)->data, "true")) |
1470 default: | 1596 return Qt; |
1471 abort (); | 1597 else |
1598 return Qnil; | |
1599 | |
1600 case string: | |
1601 return tem; | |
1602 | |
1603 default: | |
1604 abort (); | |
1605 } | |
1472 } | 1606 } |
1607 else | |
1608 return Qunbound; | |
1473 } | 1609 } |
1474 return Fcdr (tem); | 1610 return Fcdr (tem); |
1475 } | 1611 } |
1476 | 1612 |
1477 /* Record in frame F the specified or default value according to ALIST | 1613 /* Record in frame F the specified or default value according to ALIST |
1479 If no value is specified for PARAM, look for an X default for XPROP | 1615 If no value is specified for PARAM, look for an X default for XPROP |
1480 on the frame named NAME. | 1616 on the frame named NAME. |
1481 If that is not found either, use the value DEFLT. */ | 1617 If that is not found either, use the value DEFLT. */ |
1482 | 1618 |
1483 static Lisp_Object | 1619 static Lisp_Object |
1484 x_default_parameter (f, alist, propname, deflt, xprop, type) | 1620 x_default_parameter (f, alist, prop, deflt, xprop, type) |
1485 struct frame *f; | 1621 struct frame *f; |
1486 Lisp_Object alist; | 1622 Lisp_Object alist; |
1487 char *propname; | 1623 Lisp_Object prop; |
1488 Lisp_Object deflt; | 1624 Lisp_Object deflt; |
1489 char *xprop; | 1625 char *xprop; |
1490 enum resource_types type; | 1626 enum resource_types type; |
1491 { | 1627 { |
1492 Lisp_Object propsym = intern (propname); | |
1493 Lisp_Object tem; | 1628 Lisp_Object tem; |
1494 | 1629 |
1495 tem = x_get_arg (alist, propsym, xprop, type); | 1630 tem = x_get_arg (alist, prop, xprop, type); |
1496 if (EQ (tem, Qnil)) | 1631 if (EQ (tem, Qunbound)) |
1497 tem = deflt; | 1632 tem = deflt; |
1498 store_frame_param (f, propsym, tem); | 1633 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); |
1499 x_set_frame_param (f, propsym, tem, Qnil); | |
1500 return tem; | 1634 return tem; |
1501 } | 1635 } |
1502 | 1636 |
1503 DEFUN ("x-geometry", Fx_geometry, Sx_geometry, 1, 1, 0, | 1637 DEFUN ("x-geometry", Fx_geometry, Sx_geometry, 1, 1, 0, |
1504 "Parse an X-style geometry string STRING.\n\ | 1638 "Parse an X-style geometry string STRING.\n\ |
1521 Perhaps fix this some day by returning symbol `extreme-top'... */ | 1655 Perhaps fix this some day by returning symbol `extreme-top'... */ |
1522 if (x == 0 && (geometry & XNegative)) | 1656 if (x == 0 && (geometry & XNegative)) |
1523 x = -1; | 1657 x = -1; |
1524 if (y == 0 && (geometry & YNegative)) | 1658 if (y == 0 && (geometry & YNegative)) |
1525 y = -1; | 1659 y = -1; |
1526 values[0] = Fcons (intern ("left"), make_number (x)); | 1660 values[0] = Fcons (Qleft, make_number (x)); |
1527 values[1] = Fcons (intern ("top"), make_number (y)); | 1661 values[1] = Fcons (Qtop, make_number (y)); |
1528 return Flist (2, values); | 1662 return Flist (2, values); |
1529 break; | 1663 break; |
1530 | 1664 |
1531 case (WidthValue | HeightValue): | 1665 case (WidthValue | HeightValue): |
1532 values[0] = Fcons (intern ("width"), make_number (width)); | 1666 values[0] = Fcons (Qwidth, make_number (width)); |
1533 values[1] = Fcons (intern ("height"), make_number (height)); | 1667 values[1] = Fcons (Qheight, make_number (height)); |
1534 return Flist (2, values); | 1668 return Flist (2, values); |
1535 break; | 1669 break; |
1536 | 1670 |
1537 case (XValue | YValue | WidthValue | HeightValue): | 1671 case (XValue | YValue | WidthValue | HeightValue): |
1538 if (x == 0 && (geometry & XNegative)) | 1672 if (x == 0 && (geometry & XNegative)) |
1539 x = -1; | 1673 x = -1; |
1540 if (y == 0 && (geometry & YNegative)) | 1674 if (y == 0 && (geometry & YNegative)) |
1541 y = -1; | 1675 y = -1; |
1542 values[0] = Fcons (intern ("width"), make_number (width)); | 1676 values[0] = Fcons (Qwidth, make_number (width)); |
1543 values[1] = Fcons (intern ("height"), make_number (height)); | 1677 values[1] = Fcons (Qheight, make_number (height)); |
1544 values[2] = Fcons (intern ("left"), make_number (x)); | 1678 values[2] = Fcons (Qleft, make_number (x)); |
1545 values[3] = Fcons (intern ("top"), make_number (y)); | 1679 values[3] = Fcons (Qtop, make_number (y)); |
1546 return Flist (4, values); | 1680 return Flist (4, values); |
1547 break; | 1681 break; |
1548 | 1682 |
1549 case 0: | 1683 case 0: |
1550 return Qnil; | 1684 return Qnil; |
1559 or set rubber-band prompting if none. */ | 1693 or set rubber-band prompting if none. */ |
1560 | 1694 |
1561 #define DEFAULT_ROWS 40 | 1695 #define DEFAULT_ROWS 40 |
1562 #define DEFAULT_COLS 80 | 1696 #define DEFAULT_COLS 80 |
1563 | 1697 |
1564 static | 1698 static int |
1565 x_figure_window_size (f, parms) | 1699 x_figure_window_size (f, parms) |
1566 struct frame *f; | 1700 struct frame *f; |
1567 Lisp_Object parms; | 1701 Lisp_Object parms; |
1568 { | 1702 { |
1569 register Lisp_Object tem0, tem1; | 1703 register Lisp_Object tem0, tem1; |
1577 f->width = DEFAULT_COLS; | 1711 f->width = DEFAULT_COLS; |
1578 f->height = DEFAULT_ROWS; | 1712 f->height = DEFAULT_ROWS; |
1579 f->display.x->top_pos = 1; | 1713 f->display.x->top_pos = 1; |
1580 f->display.x->left_pos = 1; | 1714 f->display.x->left_pos = 1; |
1581 | 1715 |
1582 tem0 = x_get_arg (parms, intern ("height"), 0, 0); | 1716 tem0 = x_get_arg (parms, Qheight, 0, 0); |
1583 tem1 = x_get_arg (parms, intern ("width"), 0, 0); | 1717 tem1 = x_get_arg (parms, Qwidth, 0, 0); |
1584 if (! EQ (tem0, Qnil) && ! EQ (tem1, Qnil)) | 1718 if (! EQ (tem0, Qunbound) && ! EQ (tem1, Qunbound)) |
1585 { | 1719 { |
1586 CHECK_NUMBER (tem0, 0); | 1720 CHECK_NUMBER (tem0, 0); |
1587 CHECK_NUMBER (tem1, 0); | 1721 CHECK_NUMBER (tem1, 0); |
1588 f->height = XINT (tem0); | 1722 f->height = XINT (tem0); |
1589 f->width = XINT (tem1); | 1723 f->width = XINT (tem1); |
1590 window_prompting |= USSize; | 1724 window_prompting |= USSize; |
1591 } | 1725 } |
1592 else if (! EQ (tem0, Qnil) || ! EQ (tem1, Qnil)) | 1726 else if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
1593 error ("Must specify *both* height and width"); | 1727 error ("Must specify *both* height and width"); |
1594 | 1728 |
1595 f->display.x->pixel_width = (FONT_WIDTH (f->display.x->font) * f->width | 1729 f->display.x->pixel_width = (FONT_WIDTH (f->display.x->font) * f->width |
1596 + 2 * f->display.x->internal_border_width); | 1730 + 2 * f->display.x->internal_border_width); |
1597 f->display.x->pixel_height = (FONT_HEIGHT (f->display.x->font) * f->height | 1731 f->display.x->pixel_height = (FONT_HEIGHT (f->display.x->font) * f->height |
1598 + 2 * f->display.x->internal_border_width); | 1732 + 2 * f->display.x->internal_border_width); |
1599 | 1733 |
1600 tem0 = x_get_arg (parms, intern ("top"), 0, 0); | 1734 tem0 = x_get_arg (parms, Qtop, 0, 0); |
1601 tem1 = x_get_arg (parms, intern ("left"), 0, 0); | 1735 tem1 = x_get_arg (parms, Qleft, 0, 0); |
1602 if (! EQ (tem0, Qnil) && ! EQ (tem1, Qnil)) | 1736 if (! EQ (tem0, Qunbound) && ! EQ (tem1, Qunbound)) |
1603 { | 1737 { |
1604 CHECK_NUMBER (tem0, 0); | 1738 CHECK_NUMBER (tem0, 0); |
1605 CHECK_NUMBER (tem1, 0); | 1739 CHECK_NUMBER (tem1, 0); |
1606 f->display.x->top_pos = XINT (tem0); | 1740 f->display.x->top_pos = XINT (tem0); |
1607 f->display.x->left_pos = XINT (tem1); | 1741 f->display.x->left_pos = XINT (tem1); |
1608 x_calc_absolute_position (f); | 1742 x_calc_absolute_position (f); |
1609 window_prompting |= USPosition; | 1743 window_prompting |= USPosition; |
1610 } | 1744 } |
1611 else if (! EQ (tem0, Qnil) || ! EQ (tem1, Qnil)) | 1745 else if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
1612 error ("Must specify *both* top and left corners"); | 1746 error ("Must specify *both* top and left corners"); |
1613 | 1747 |
1614 switch (window_prompting) | 1748 switch (window_prompting) |
1615 { | 1749 { |
1616 case USSize | USPosition: | 1750 case USSize | USPosition: |
1701 static void | 1835 static void |
1702 x_icon (f, parms) | 1836 x_icon (f, parms) |
1703 struct frame *f; | 1837 struct frame *f; |
1704 Lisp_Object parms; | 1838 Lisp_Object parms; |
1705 { | 1839 { |
1706 register Lisp_Object tem0,tem1; | 1840 Lisp_Object icon_x, icon_y; |
1707 XWMHints hints; | |
1708 | 1841 |
1709 /* Set the position of the icon. Note that twm groups all | 1842 /* Set the position of the icon. Note that twm groups all |
1710 icons in an icon window. */ | 1843 icons in an icon window. */ |
1711 tem0 = x_get_arg (parms, intern ("icon-left"), 0, 0); | 1844 icon_x = x_get_arg (parms, Qicon_left, 0, 0); |
1712 tem1 = x_get_arg (parms, intern ("icon-top"), 0, 0); | 1845 icon_y = x_get_arg (parms, Qicon_top, 0, 0); |
1713 if (!EQ (tem0, Qnil) && !EQ (tem1, Qnil)) | 1846 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) |
1714 { | 1847 { |
1715 CHECK_NUMBER (tem0, 0); | 1848 CHECK_NUMBER (icon_x, 0); |
1716 CHECK_NUMBER (tem1, 0); | 1849 CHECK_NUMBER (icon_y, 0); |
1717 hints.icon_x = XINT (tem0); | 1850 } |
1718 hints.icon_x = XINT (tem0); | 1851 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) |
1719 } | |
1720 else if (!EQ (tem0, Qnil) || !EQ (tem1, Qnil)) | |
1721 error ("Both left and top icon corners of icon must be specified"); | 1852 error ("Both left and top icon corners of icon must be specified"); |
1722 else | 1853 else |
1723 { | 1854 { |
1724 hints.icon_x = f->display.x->left_pos; | 1855 XSET (icon_x, Lisp_Int, f->display.x->left_pos); |
1725 hints.icon_y = f->display.x->top_pos; | 1856 XSET (icon_y, Lisp_Int, f->display.x->top_pos); |
1726 } | 1857 } |
1858 | |
1859 BLOCK_INPUT; | |
1860 | |
1861 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); | |
1727 | 1862 |
1728 /* Start up iconic or window? */ | 1863 /* Start up iconic or window? */ |
1729 tem0 = x_get_arg (parms, intern ("iconic-startup"), 0, 0); | 1864 x_wm_set_window_state (f, (EQ (x_get_arg (parms, Qiconic_startup, 0, 0), Qt) |
1730 if (!EQ (tem0, Qnil)) | 1865 ? IconicState |
1731 hints.initial_state = IconicState; | 1866 : NormalState)); |
1732 else | 1867 |
1733 hints.initial_state = NormalState; /* the default, actually. */ | |
1734 hints.input = False; | |
1735 | |
1736 BLOCK_INPUT; | |
1737 hints.flags = StateHint | IconPositionHint | InputHint; | |
1738 XSetWMHints (x_current_display, f->display.x->window_desc, &hints); | |
1739 UNBLOCK_INPUT; | 1868 UNBLOCK_INPUT; |
1740 } | 1869 } |
1741 | 1870 |
1742 /* Make the GC's needed for this window, setting the | 1871 /* Make the GC's needed for this window, setting the |
1743 background, border and mouse colors; also create the | 1872 background, border and mouse colors; also create the |
1847 int width, height; | 1976 int width, height; |
1848 | 1977 |
1849 if (x_current_display == 0) | 1978 if (x_current_display == 0) |
1850 error ("X windows are not in use or not initialized"); | 1979 error ("X windows are not in use or not initialized"); |
1851 | 1980 |
1852 name = x_get_arg (parms, intern ("name"), "Title", string); | 1981 name = x_get_arg (parms, Qname, "Title", string); |
1853 if (NILP (name)) | 1982 if (EQ (name, Qunbound) || NILP (name)) |
1854 name = build_string (x_id_name); | 1983 name = build_string (x_id_name); |
1855 if (XTYPE (name) != Lisp_String) | 1984 if (XTYPE (name) != Lisp_String) |
1856 error ("x-create-frame: name parameter must be a string"); | 1985 error ("x-create-frame: name parameter must be a string"); |
1857 | 1986 |
1858 tem = x_get_arg (parms, intern ("minibuffer"), 0, 0); | 1987 tem = x_get_arg (parms, Qminibuffer, 0, 0); |
1859 if (EQ (tem, intern ("none"))) | 1988 if (EQ (tem, Qnone) || NILP (tem)) |
1860 f = make_frame_without_minibuffer (Qnil); | 1989 f = make_frame_without_minibuffer (Qnil); |
1861 else if (EQ (tem, intern ("only"))) | 1990 else if (EQ (tem, Qonly)) |
1862 { | 1991 { |
1863 f = make_minibuffer_frame (); | 1992 f = make_minibuffer_frame (); |
1864 minibuffer_only = 1; | 1993 minibuffer_only = 1; |
1865 } | 1994 } |
1866 else if (EQ (tem, Qnil) || EQ (tem, Qt)) | 1995 else if (XTYPE (tem) == Lisp_Window) |
1996 f = make_frame_without_minibuffer (tem); | |
1997 else | |
1867 f = make_frame (1); | 1998 f = make_frame (1); |
1868 else | |
1869 f = make_frame_without_minibuffer (tem); | |
1870 | 1999 |
1871 /* Set the name; the functions to which we pass f expect the | 2000 /* Set the name; the functions to which we pass f expect the |
1872 name to be set. */ | 2001 name to be set. */ |
1873 XSET (f->name, Lisp_String, name); | 2002 XSET (f->name, Lisp_String, name); |
1874 | 2003 |
1880 /* Note that the frame has no physical cursor right now. */ | 2009 /* Note that the frame has no physical cursor right now. */ |
1881 f->phys_cursor_x = -1; | 2010 f->phys_cursor_x = -1; |
1882 | 2011 |
1883 /* Extract the window parameters from the supplied values | 2012 /* Extract the window parameters from the supplied values |
1884 that are needed to determine window geometry. */ | 2013 that are needed to determine window geometry. */ |
1885 x_default_parameter (f, parms, "font", | 2014 x_default_parameter (f, parms, Qfont, |
1886 build_string ("9x15"), "font", string); | 2015 build_string ("9x15"), "font", string); |
1887 x_default_parameter (f, parms, "background-color", | 2016 x_default_parameter (f, parms, Qbackground_color, |
1888 build_string ("white"), "background", string); | 2017 build_string ("white"), "background", string); |
1889 x_default_parameter (f, parms, "border-width", | 2018 x_default_parameter (f, parms, Qborder_width, |
1890 make_number (2), "BorderWidth", number); | 2019 make_number (2), "BorderWidth", number); |
1891 /* This defaults to 2 in order to match XTerms. */ | 2020 /* This defaults to 2 in order to match XTerms. */ |
1892 x_default_parameter (f, parms, "internal-border-width", | 2021 x_default_parameter (f, parms, Qinternal_border_width, |
1893 make_number (2), "InternalBorderWidth", number); | 2022 make_number (2), "InternalBorderWidth", number); |
1894 | 2023 |
1895 /* Also do the stuff which must be set before the window exists. */ | 2024 /* Also do the stuff which must be set before the window exists. */ |
1896 x_default_parameter (f, parms, "foreground-color", | 2025 x_default_parameter (f, parms, Qforeground_color, |
1897 build_string ("black"), "foreground", string); | 2026 build_string ("black"), "foreground", string); |
1898 x_default_parameter (f, parms, "mouse-color", | 2027 x_default_parameter (f, parms, Qmouse_color, |
1899 build_string ("black"), "mouse", string); | 2028 build_string ("black"), "mouse", string); |
1900 x_default_parameter (f, parms, "cursor-color", | 2029 x_default_parameter (f, parms, Qcursor_color, |
1901 build_string ("black"), "cursor", string); | 2030 build_string ("black"), "cursor", string); |
1902 x_default_parameter (f, parms, "border-color", | 2031 x_default_parameter (f, parms, Qborder_color, |
1903 build_string ("black"), "border", string); | 2032 build_string ("black"), "border", string); |
1904 | |
1905 /* Need to do icon type, auto-raise, auto-lower. */ | |
1906 | 2033 |
1907 f->display.x->parent_desc = ROOT_WINDOW; | 2034 f->display.x->parent_desc = ROOT_WINDOW; |
1908 window_prompting = x_figure_window_size (f, parms); | 2035 window_prompting = x_figure_window_size (f, parms); |
1909 | 2036 |
1910 x_window (f); | 2037 x_window (f); |
1911 x_icon (f, parms); | 2038 x_icon (f, parms); |
1912 x_make_gc (f); | 2039 x_make_gc (f); |
2040 | |
2041 /* We need to do this after creating the X window, so that the | |
2042 icon-creation functions can say whose icon they're describing. */ | |
2043 x_default_parameter (f, parms, Qicon_type, Qt, "IconType", boolean); | |
2044 | |
2045 x_default_parameter (f, parms, Qauto_raise, Qnil, "AutoRaise", boolean); | |
2046 x_default_parameter (f, parms, Qauto_lower, Qnil, "AutoLower", boolean); | |
1913 | 2047 |
1914 /* Dimensions, especially f->height, must be done via change_frame_size. | 2048 /* Dimensions, especially f->height, must be done via change_frame_size. |
1915 Change will not be effected unless different from the current | 2049 Change will not be effected unless different from the current |
1916 f->height. */ | 2050 f->height. */ |
1917 width = f->width; | 2051 width = f->width; |
1918 height = f->height; | 2052 height = f->height; |
1919 f->height = f->width = 0; | 2053 f->height = f->width = 0; |
1920 change_frame_size (f, height, width, 1); | 2054 change_frame_size (f, height, width, 1, 0); |
1921 BLOCK_INPUT; | 2055 BLOCK_INPUT; |
1922 x_wm_set_size_hint (f, window_prompting); | 2056 x_wm_set_size_hint (f, window_prompting); |
1923 UNBLOCK_INPUT; | 2057 UNBLOCK_INPUT; |
1924 | 2058 |
1925 tem = x_get_arg (parms, intern ("unsplittable"), 0, 0); | 2059 tem = x_get_arg (parms, Qunsplittable, 0, 0); |
1926 f->no_split = minibuffer_only || EQ (tem, Qt); | 2060 f->no_split = minibuffer_only || EQ (tem, Qt); |
1927 | 2061 |
1928 /* Now handle the rest of the parameters. */ | 2062 /* Now handle the rest of the parameters. */ |
1929 x_default_parameter (f, parms, "horizontal-scroll-bar", | 2063 x_default_parameter (f, parms, Qhorizontal_scroll_bar, |
1930 Qnil, "?HScrollBar", string); | 2064 Qnil, "?HScrollBar", string); |
1931 x_default_parameter (f, parms, "vertical-scroll-bar", | 2065 x_default_parameter (f, parms, Qvertical_scroll_bar, |
1932 Qnil, "?VScrollBar", string); | 2066 Qnil, "?VScrollBar", string); |
1933 | 2067 |
1934 /* Make the window appear on the frame and enable display. */ | 2068 /* Make the window appear on the frame and enable display. */ |
1935 if (!EQ (x_get_arg (parms, intern ("suppress-initial-map"), 0, 0), Qt)) | 2069 if (!EQ (x_get_arg (parms, Qsuppress_initial_map, 0, 0), Qt)) |
1936 x_make_frame_visible (f); | 2070 x_make_frame_visible (f); |
1937 | 2071 |
1938 return frame; | 2072 return frame; |
1939 #else /* X10 */ | 2073 #else /* X10 */ |
1940 struct frame *f; | 2074 struct frame *f; |
1949 Lisp_Object vscroll, hscroll; | 2083 Lisp_Object vscroll, hscroll; |
1950 | 2084 |
1951 if (x_current_display == 0) | 2085 if (x_current_display == 0) |
1952 error ("X windows are not in use or not initialized"); | 2086 error ("X windows are not in use or not initialized"); |
1953 | 2087 |
1954 name = Fassq (intern ("name"), parms); | 2088 name = Fassq (Qname, parms); |
1955 | 2089 |
1956 tem = x_get_arg (parms, intern ("minibuffer"), 0, 0); | 2090 tem = x_get_arg (parms, Qminibuffer, 0, string); |
1957 if (EQ (tem, intern ("none"))) | 2091 if (XTYPE (tem) == Lisp_String) |
2092 tem = Fintern (tem, Qnil); | |
2093 if (EQ (tem, Qnone)) | |
1958 f = make_frame_without_minibuffer (Qnil); | 2094 f = make_frame_without_minibuffer (Qnil); |
1959 else if (EQ (tem, intern ("only"))) | 2095 else if (EQ (tem, Qonly)) |
1960 { | 2096 { |
1961 f = make_minibuffer_frame (); | 2097 f = make_minibuffer_frame (); |
1962 minibuffer_only = 1; | 2098 minibuffer_only = 1; |
1963 } | 2099 } |
1964 else if (! EQ (tem, Qnil)) | 2100 else if (EQ (tem, Qnil) || EQ (tem, Qunbound)) |
2101 f = make_frame (1); | |
2102 else | |
1965 f = make_frame_without_minibuffer (tem); | 2103 f = make_frame_without_minibuffer (tem); |
1966 else | |
1967 f = make_frame (1); | |
1968 | 2104 |
1969 parent = ROOT_WINDOW; | 2105 parent = ROOT_WINDOW; |
1970 | 2106 |
1971 XSET (frame, Lisp_Frame, f); | 2107 XSET (frame, Lisp_Frame, f); |
1972 f->output_method = output_x_window; | 2108 f->output_method = output_x_window; |
1988 f->name = build_string (iconidentity); | 2124 f->name = build_string (iconidentity); |
1989 | 2125 |
1990 /* Extract some window parameters from the supplied values. | 2126 /* Extract some window parameters from the supplied values. |
1991 These are the parameters that affect window geometry. */ | 2127 These are the parameters that affect window geometry. */ |
1992 | 2128 |
1993 tem = x_get_arg (parms, intern ("font"), "BodyFont", string); | 2129 tem = x_get_arg (parms, Qfont, "BodyFont", string); |
1994 if (EQ (tem, Qnil)) | 2130 if (EQ (tem, Qunbound)) |
1995 tem = build_string ("9x15"); | 2131 tem = build_string ("9x15"); |
1996 x_set_font (f, tem); | 2132 x_set_font (f, tem, Qnil); |
1997 x_default_parameter (f, parms, "border-color", | 2133 x_default_parameter (f, parms, Qborder_color, |
1998 build_string ("black"), "Border", string); | 2134 build_string ("black"), "Border", string); |
1999 x_default_parameter (f, parms, "background-color", | 2135 x_default_parameter (f, parms, Qbackground_color, |
2000 build_string ("white"), "Background", string); | 2136 build_string ("white"), "Background", string); |
2001 x_default_parameter (f, parms, "foreground-color", | 2137 x_default_parameter (f, parms, Qforeground_color, |
2002 build_string ("black"), "Foreground", string); | 2138 build_string ("black"), "Foreground", string); |
2003 x_default_parameter (f, parms, "mouse-color", | 2139 x_default_parameter (f, parms, Qmouse_color, |
2004 build_string ("black"), "Mouse", string); | 2140 build_string ("black"), "Mouse", string); |
2005 x_default_parameter (f, parms, "cursor-color", | 2141 x_default_parameter (f, parms, Qcursor_color, |
2006 build_string ("black"), "Cursor", string); | 2142 build_string ("black"), "Cursor", string); |
2007 x_default_parameter (f, parms, "border-width", | 2143 x_default_parameter (f, parms, Qborder_width, |
2008 make_number (2), "BorderWidth", number); | 2144 make_number (2), "BorderWidth", number); |
2009 x_default_parameter (f, parms, "internal-border-width", | 2145 x_default_parameter (f, parms, Qinternal_border_width, |
2010 make_number (4), "InternalBorderWidth", number); | 2146 make_number (4), "InternalBorderWidth", number); |
2011 x_default_parameter (f, parms, "auto-raise", | 2147 x_default_parameter (f, parms, Qauto_raise, |
2012 Qnil, "AutoRaise", boolean); | 2148 Qnil, "AutoRaise", boolean); |
2013 | 2149 |
2014 hscroll = x_get_arg (parms, intern ("horizontal-scroll-bar"), 0, 0); | 2150 hscroll = EQ (x_get_arg (parms, Qhorizontal_scroll_bar, 0, boolean), Qt); |
2015 vscroll = x_get_arg (parms, intern ("vertical-scroll-bar"), 0, 0); | 2151 vscroll = EQ (x_get_arg (parms, Qvertical_scroll_bar, 0, boolean), Qt); |
2016 | 2152 |
2017 if (f->display.x->internal_border_width < 0) | 2153 if (f->display.x->internal_border_width < 0) |
2018 f->display.x->internal_border_width = 0; | 2154 f->display.x->internal_border_width = 0; |
2019 | 2155 |
2020 tem = x_get_arg (parms, intern ("window-id"), 0, 0); | 2156 tem = x_get_arg (parms, Qwindow_id, 0, number); |
2021 if (!EQ (tem, Qnil)) | 2157 if (!EQ (tem, Qunbound)) |
2022 { | 2158 { |
2023 WINDOWINFO_TYPE wininfo; | 2159 WINDOWINFO_TYPE wininfo; |
2024 int nchildren; | 2160 int nchildren; |
2025 Window *children, root; | 2161 Window *children, root; |
2026 | 2162 |
2027 CHECK_STRING (tem, 0); | 2163 CHECK_NUMBER (tem, 0); |
2028 f->display.x->window_desc = (Window) atoi (XSTRING (tem)->data); | 2164 f->display.x->window_desc = (Window) XINT (tem); |
2029 | 2165 |
2030 BLOCK_INPUT; | 2166 BLOCK_INPUT; |
2031 XGetWindowInfo (f->display.x->window_desc, &wininfo); | 2167 XGetWindowInfo (f->display.x->window_desc, &wininfo); |
2032 XQueryTree (f->display.x->window_desc, &parent, &nchildren, &children); | 2168 XQueryTree (f->display.x->window_desc, &parent, &nchildren, &children); |
2033 free (children); | 2169 free (children); |
2043 f->display.x->border_width = wininfo.bdrwidth; | 2179 f->display.x->border_width = wininfo.bdrwidth; |
2044 f->display.x->parent_desc = parent; | 2180 f->display.x->parent_desc = parent; |
2045 } | 2181 } |
2046 else | 2182 else |
2047 { | 2183 { |
2048 tem = x_get_arg (parms, intern ("parent-id"), 0, 0); | 2184 tem = x_get_arg (parms, Qparent_id, 0, 0); |
2049 if (!EQ (tem, Qnil)) | 2185 if (!EQ (tem, Qunbound)) |
2050 { | 2186 { |
2051 CHECK_STRING (tem, 0); | 2187 CHECK_NUMBER (tem, 0); |
2052 parent = (Window) atoi (XSTRING (tem)->data); | 2188 parent = (Window) XINT (tem); |
2053 } | 2189 } |
2054 f->display.x->parent_desc = parent; | 2190 f->display.x->parent_desc = parent; |
2055 tem = x_get_arg (parms, intern ("height"), 0, 0); | 2191 tem = x_get_arg (parms, Qheight, 0, 0); |
2056 if (EQ (tem, Qnil)) | 2192 if (EQ (tem, Qunbound)) |
2057 { | 2193 { |
2058 tem = x_get_arg (parms, intern ("width"), 0, 0); | 2194 tem = x_get_arg (parms, Qwidth, 0, 0); |
2059 if (EQ (tem, Qnil)) | 2195 if (EQ (tem, Qunbound)) |
2060 { | 2196 { |
2061 tem = x_get_arg (parms, intern ("top"), 0, 0); | 2197 tem = x_get_arg (parms, Qtop, 0, 0); |
2062 if (EQ (tem, Qnil)) | 2198 if (EQ (tem, Qunbound)) |
2063 tem = x_get_arg (parms, intern ("left"), 0, 0); | 2199 tem = x_get_arg (parms, Qleft, 0, 0); |
2064 } | 2200 } |
2065 } | 2201 } |
2066 /* Now TEM is nil if no edge or size was specified. | 2202 /* Now TEM is Qunbound if no edge or size was specified. |
2067 In that case, we must do rubber-banding. */ | 2203 In that case, we must do rubber-banding. */ |
2068 if (EQ (tem, Qnil)) | 2204 if (EQ (tem, Qunbound)) |
2069 { | 2205 { |
2070 tem = x_get_arg (parms, intern ("geometry"), 0, 0); | 2206 tem = x_get_arg (parms, Qgeometry, 0, 0); |
2071 x_rubber_band (f, | 2207 x_rubber_band (f, |
2072 &f->display.x->left_pos, &f->display.x->top_pos, | 2208 &f->display.x->left_pos, &f->display.x->top_pos, |
2073 &width, &height, | 2209 &width, &height, |
2074 (XTYPE (tem) == Lisp_String | 2210 (XTYPE (tem) == Lisp_String |
2075 ? (char *) XSTRING (tem)->data : ""), | 2211 ? (char *) XSTRING (tem)->data : ""), |
2078 } | 2214 } |
2079 else | 2215 else |
2080 { | 2216 { |
2081 /* Here if at least one edge or size was specified. | 2217 /* Here if at least one edge or size was specified. |
2082 Demand that they all were specified, and use them. */ | 2218 Demand that they all were specified, and use them. */ |
2083 tem = x_get_arg (parms, intern ("height"), 0, 0); | 2219 tem = x_get_arg (parms, Qheight, 0, 0); |
2084 if (EQ (tem, Qnil)) | 2220 if (EQ (tem, Qunbound)) |
2085 error ("Height not specified"); | 2221 error ("Height not specified"); |
2086 CHECK_NUMBER (tem, 0); | 2222 CHECK_NUMBER (tem, 0); |
2087 height = XINT (tem); | 2223 height = XINT (tem); |
2088 | 2224 |
2089 tem = x_get_arg (parms, intern ("width"), 0, 0); | 2225 tem = x_get_arg (parms, Qwidth, 0, 0); |
2090 if (EQ (tem, Qnil)) | 2226 if (EQ (tem, Qunbound)) |
2091 error ("Width not specified"); | 2227 error ("Width not specified"); |
2092 CHECK_NUMBER (tem, 0); | 2228 CHECK_NUMBER (tem, 0); |
2093 width = XINT (tem); | 2229 width = XINT (tem); |
2094 | 2230 |
2095 tem = x_get_arg (parms, intern ("top"), 0, 0); | 2231 tem = x_get_arg (parms, Qtop, 0, 0); |
2096 if (EQ (tem, Qnil)) | 2232 if (EQ (tem, Qunbound)) |
2097 error ("Top position not specified"); | 2233 error ("Top position not specified"); |
2098 CHECK_NUMBER (tem, 0); | 2234 CHECK_NUMBER (tem, 0); |
2099 f->display.x->left_pos = XINT (tem); | 2235 f->display.x->left_pos = XINT (tem); |
2100 | 2236 |
2101 tem = x_get_arg (parms, intern ("left"), 0, 0); | 2237 tem = x_get_arg (parms, Qleft, 0, 0); |
2102 if (EQ (tem, Qnil)) | 2238 if (EQ (tem, Qunbound)) |
2103 error ("Left position not specified"); | 2239 error ("Left position not specified"); |
2104 CHECK_NUMBER (tem, 0); | 2240 CHECK_NUMBER (tem, 0); |
2105 f->display.x->top_pos = XINT (tem); | 2241 f->display.x->top_pos = XINT (tem); |
2106 } | 2242 } |
2107 | 2243 |
2125 error ("Unable to create window."); | 2261 error ("Unable to create window."); |
2126 } | 2262 } |
2127 | 2263 |
2128 /* Install the now determined height and width | 2264 /* Install the now determined height and width |
2129 in the windows and in phys_lines and desired_lines. */ | 2265 in the windows and in phys_lines and desired_lines. */ |
2130 /* ??? jla version had 1 here instead of 0. */ | 2266 change_frame_size (f, height, width, 1, 0); |
2131 change_frame_size (f, height, width, 1); | |
2132 XSelectInput (f->display.x->window_desc, KeyPressed | ExposeWindow | 2267 XSelectInput (f->display.x->window_desc, KeyPressed | ExposeWindow |
2133 | ButtonPressed | ButtonReleased | ExposeRegion | ExposeCopy | 2268 | ButtonPressed | ButtonReleased | ExposeRegion | ExposeCopy |
2134 | EnterWindow | LeaveWindow | UnmapWindow ); | 2269 | EnterWindow | LeaveWindow | UnmapWindow ); |
2135 x_set_resize_hint (f); | 2270 x_set_resize_hint (f); |
2136 | 2271 |
2137 /* Tell the server the window's default name. */ | 2272 /* Tell the server the window's default name. */ |
2138 #ifdef HAVE_X11 | |
2139 { | |
2140 XTextProperty prop; | |
2141 prop.value = XSTRING (f->name)->data; | |
2142 prop.encoding = XA_STRING; | |
2143 prop.format = 8; | |
2144 prop.nitems = XSTRING (f->name)->size; | |
2145 XSetWMName (XDISPLAY f->display.x->window_desc, &prop); | |
2146 } | |
2147 #else | |
2148 XStoreName (XDISPLAY f->display.x->window_desc, XSTRING (f->name)->data); | 2273 XStoreName (XDISPLAY f->display.x->window_desc, XSTRING (f->name)->data); |
2149 #endif | |
2150 | 2274 |
2151 /* Now override the defaults with all the rest of the specified | 2275 /* Now override the defaults with all the rest of the specified |
2152 parms. */ | 2276 parms. */ |
2153 tem = x_get_arg (parms, intern ("unsplittable"), 0, 0); | 2277 tem = x_get_arg (parms, Qunsplittable, 0, 0); |
2154 f->no_split = minibuffer_only || EQ (tem, Qt); | 2278 f->no_split = minibuffer_only || EQ (tem, Qt); |
2155 | 2279 |
2156 /* Do not create an icon window if the caller says not to */ | 2280 /* Do not create an icon window if the caller says not to */ |
2157 if (!EQ (x_get_arg (parms, intern ("suppress-icon"), 0, 0), Qt) | 2281 if (!EQ (x_get_arg (parms, Qsuppress_icon, 0, 0), Qt) |
2158 || f->display.x->parent_desc != ROOT_WINDOW) | 2282 || f->display.x->parent_desc != ROOT_WINDOW) |
2159 { | 2283 { |
2160 x_text_icon (f, iconidentity); | 2284 x_text_icon (f, iconidentity); |
2161 x_default_parameter (f, parms, "icon-type", Qnil, | 2285 x_default_parameter (f, parms, Qicon_type, Qnil, |
2162 "BitmapIcon", boolean); | 2286 "BitmapIcon", boolean); |
2163 } | 2287 } |
2164 | 2288 |
2165 /* Tell the X server the previously set values of the | 2289 /* Tell the X server the previously set values of the |
2166 background, border and mouse colors; also create the mouse cursor. */ | 2290 background, border and mouse colors; also create the mouse cursor. */ |
2182 if (!NILP (hscroll)) | 2306 if (!NILP (hscroll)) |
2183 install_horizontal_scrollbar (f, pixelwidth, pixelheight); | 2307 install_horizontal_scrollbar (f, pixelwidth, pixelheight); |
2184 | 2308 |
2185 /* Make the window appear on the frame and enable display. */ | 2309 /* Make the window appear on the frame and enable display. */ |
2186 | 2310 |
2187 if (!EQ (x_get_arg (parms, intern ("suppress-initial-map"), 0, 0), Qt)) | 2311 if (!EQ (x_get_arg (parms, Qsuppress_initial_map, 0, 0), Qt)) |
2188 x_make_window_visible (f); | 2312 x_make_window_visible (f); |
2189 FRAME_GARBAGED (f); | 2313 FRAME_GARBAGED (f); |
2190 | 2314 |
2191 return frame; | 2315 return frame; |
2192 #endif /* X10 */ | 2316 #endif /* X10 */ |
2197 (frame) | 2321 (frame) |
2198 Lisp_Object frame; | 2322 Lisp_Object frame; |
2199 { | 2323 { |
2200 CHECK_LIVE_FRAME (frame, 0); | 2324 CHECK_LIVE_FRAME (frame, 0); |
2201 | 2325 |
2202 if (FRAME_IS_X (XFRAME (frame))) | 2326 if (FRAME_X_P (XFRAME (frame))) |
2203 { | 2327 { |
2204 BLOCK_INPUT; | 2328 BLOCK_INPUT; |
2205 x_focus_on_frame (XFRAME (frame)); | 2329 x_focus_on_frame (XFRAME (frame)); |
2206 UNBLOCK_INPUT; | 2330 UNBLOCK_INPUT; |
2207 return frame; | 2331 return frame; |
2709 int pos; | 2833 int pos; |
2710 int first_char_in_window, char_beyond_window, chars_in_window; | 2834 int first_char_in_window, char_beyond_window, chars_in_window; |
2711 int chars_in_buffer, buffer_size; | 2835 int chars_in_buffer, buffer_size; |
2712 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | 2836 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); |
2713 | 2837 |
2714 if (! FRAME_IS_X (f)) | 2838 if (! FRAME_X_P (f)) |
2715 return; | 2839 return; |
2716 | 2840 |
2717 if (f->display.x->v_scrollbar != 0) | 2841 if (f->display.x->v_scrollbar != 0) |
2718 { | 2842 { |
2719 int h, height; | 2843 int h, height; |
3441 do | 3565 do |
3442 { | 3566 { |
3443 obj = read_char (-1); | 3567 obj = read_char (-1); |
3444 if ((XTYPE (obj) != Lisp_Cons) | 3568 if ((XTYPE (obj) != Lisp_Cons) |
3445 || (! EQ (Fcar (Fcdr (Fcdr (obj))), | 3569 || (! EQ (Fcar (Fcdr (Fcdr (obj))), |
3446 intern ("vertical-scroll-bar"))) | 3570 Qvertical_scroll_bar)) |
3447 || x_mouse_grabbed) | 3571 || x_mouse_grabbed) |
3448 { | 3572 { |
3449 BLOCK_INPUT; | 3573 BLOCK_INPUT; |
3450 XDrawLine (x_current_display, f->display.x->window_desc, | 3574 XDrawLine (x_current_display, f->display.x->window_desc, |
3451 erase_gc, left, line, right, line); | 3575 erase_gc, left, line, right, line); |
3925 register Lisp_Object string; | 4049 register Lisp_Object string; |
3926 { | 4050 { |
3927 int mask; | 4051 int mask; |
3928 | 4052 |
3929 CHECK_STRING (string, 1); | 4053 CHECK_STRING (string, 1); |
3930 if (! FRAME_IS_X (selected_frame)) | 4054 if (! FRAME_X_P (selected_frame)) |
3931 error ("Selected frame does not understand X protocol."); | 4055 error ("Selected frame does not understand X protocol."); |
3932 | 4056 |
3933 BLOCK_INPUT; | 4057 BLOCK_INPUT; |
3934 XStoreBytes ((char *) XSTRING (string)->data, XSTRING (string)->size); | 4058 XStoreBytes ((char *) XSTRING (string)->data, XSTRING (string)->size); |
3935 UNBLOCK_INPUT; | 4059 UNBLOCK_INPUT; |
4316 } | 4440 } |
4317 | 4441 |
4318 | 4442 |
4319 syms_of_xfns () | 4443 syms_of_xfns () |
4320 { | 4444 { |
4321 init_x_parm_symbols (); | |
4322 | |
4323 /* This is zero if not using X windows. */ | 4445 /* This is zero if not using X windows. */ |
4324 x_current_display = 0; | 4446 x_current_display = 0; |
4325 | 4447 |
4448 /* The section below is built by the lisp expression at the top of the file, | |
4449 just above where these variables are declared. */ | |
4450 /*&&& init symbols here &&&*/ | |
4451 Qauto_raise = intern ("auto-raise"); | |
4452 staticpro (&Qauto_raise); | |
4453 Qauto_lower = intern ("auto-lower"); | |
4454 staticpro (&Qauto_lower); | |
4455 Qbackground_color = intern ("background-color"); | |
4456 staticpro (&Qbackground_color); | |
4457 Qborder_color = intern ("border-color"); | |
4458 staticpro (&Qborder_color); | |
4459 Qborder_width = intern ("border-width"); | |
4460 staticpro (&Qborder_width); | |
4461 Qcursor_color = intern ("cursor-color"); | |
4462 staticpro (&Qcursor_color); | |
4463 Qfont = intern ("font"); | |
4464 staticpro (&Qfont); | |
4465 Qforeground_color = intern ("foreground-color"); | |
4466 staticpro (&Qforeground_color); | |
4467 Qgeometry = intern ("geometry"); | |
4468 staticpro (&Qgeometry); | |
4469 Qhorizontal_scroll_bar = intern ("horizontal-scroll-bar"); | |
4470 staticpro (&Qhorizontal_scroll_bar); | |
4471 Qicon_left = intern ("icon-left"); | |
4472 staticpro (&Qicon_left); | |
4473 Qicon_top = intern ("icon-top"); | |
4474 staticpro (&Qicon_top); | |
4475 Qicon_type = intern ("icon-type"); | |
4476 staticpro (&Qicon_type); | |
4477 Qiconic_startup = intern ("iconic-startup"); | |
4478 staticpro (&Qiconic_startup); | |
4479 Qinternal_border_width = intern ("internal-border-width"); | |
4480 staticpro (&Qinternal_border_width); | |
4481 Qleft = intern ("left"); | |
4482 staticpro (&Qleft); | |
4483 Qmouse_color = intern ("mouse-color"); | |
4484 staticpro (&Qmouse_color); | |
4485 Qparent_id = intern ("parent-id"); | |
4486 staticpro (&Qparent_id); | |
4487 Qsuppress_icon = intern ("suppress-icon"); | |
4488 staticpro (&Qsuppress_icon); | |
4489 Qsuppress_initial_map = intern ("suppress-initial-map"); | |
4490 staticpro (&Qsuppress_initial_map); | |
4491 Qtop = intern ("top"); | |
4492 staticpro (&Qtop); | |
4326 Qundefined_color = intern ("undefined-color"); | 4493 Qundefined_color = intern ("undefined-color"); |
4494 staticpro (&Qundefined_color); | |
4495 Qvertical_scroll_bar = intern ("vertical-scroll-bar"); | |
4496 staticpro (&Qvertical_scroll_bar); | |
4497 Qwindow_id = intern ("window-id"); | |
4498 staticpro (&Qwindow_id); | |
4499 Qx_frame_parameter = intern ("x-frame-parameter"); | |
4500 staticpro (&Qx_frame_parameter); | |
4501 /* This is the end of symbol initialization. */ | |
4502 | |
4327 Fput (Qundefined_color, Qerror_conditions, | 4503 Fput (Qundefined_color, Qerror_conditions, |
4328 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | 4504 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); |
4329 Fput (Qundefined_color, Qerror_message, | 4505 Fput (Qundefined_color, Qerror_message, |
4330 build_string ("Undefined color")); | 4506 build_string ("Undefined color")); |
4507 | |
4508 init_x_parm_symbols (); | |
4331 | 4509 |
4332 DEFVAR_INT ("mouse-x-position", &x_mouse_x, | 4510 DEFVAR_INT ("mouse-x-position", &x_mouse_x, |
4333 "The X coordinate of the mouse position, in characters."); | 4511 "The X coordinate of the mouse position, in characters."); |
4334 x_mouse_x = Qnil; | 4512 x_mouse_x = Qnil; |
4335 | 4513 |