diff options
| author | Richard M. Stallman | 1994-09-23 18:20:31 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-09-23 18:20:31 +0000 |
| commit | e1d962d7af90fa5b8161c1746014987e41a54cad (patch) | |
| tree | e9f0afbcac193bf17e4b6799fb475643c771be0c /src | |
| parent | eb21e7ae84f306dacda799b4f87bc8d4c6e37e0d (diff) | |
| download | emacs-e1d962d7af90fa5b8161c1746014987e41a54cad.tar.gz emacs-e1d962d7af90fa5b8161c1746014987e41a54cad.zip | |
(Fx_create_frame): Rename menuBarLines resource to menuBar.
(x_figure_window_size): Decode (- N), (+ N) for position.
(x_set_frame_parameters): Handle (+ N) and (- N).
Preserve negative positions properly too.
[USE_X_TOOLKIT] (x_window): Let xneg, yneg specify whether to
negate left and top.
(Fx_parse_geometry): Handle [XY]Negative with positive number
or negative number without [XY]Negative.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 124 |
1 files changed, 105 insertions, 19 deletions
diff --git a/src/xfns.c b/src/xfns.c index 4770023fa4d..006a6fb2599 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -463,6 +463,7 @@ x_set_frame_parameters (f, alist) | |||
| 463 | Lisp_Object *parms; | 463 | Lisp_Object *parms; |
| 464 | Lisp_Object *values; | 464 | Lisp_Object *values; |
| 465 | int i; | 465 | int i; |
| 466 | int left_no_change = 0, top_no_change = 0; | ||
| 466 | 467 | ||
| 467 | i = 0; | 468 | i = 0; |
| 468 | for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | 469 | for (tail = alist; CONSP (tail); tail = Fcdr (tail)) |
| @@ -519,9 +520,21 @@ x_set_frame_parameters (f, alist) | |||
| 519 | 520 | ||
| 520 | /* Don't die if just one of these was set. */ | 521 | /* Don't die if just one of these was set. */ |
| 521 | if (EQ (left, Qunbound)) | 522 | if (EQ (left, Qunbound)) |
| 522 | XSET (left, Lisp_Int, f->display.x->left_pos); | 523 | { |
| 524 | left_no_change = 1; | ||
| 525 | if (f->display.x->left_pos < 0) | ||
| 526 | left = Fcons (Qplus, Fcons (make_number (f->display.x->left_pos), Qnil)); | ||
| 527 | else | ||
| 528 | XSET (left, Lisp_Int, f->display.x->left_pos); | ||
| 529 | } | ||
| 523 | if (EQ (top, Qunbound)) | 530 | if (EQ (top, Qunbound)) |
| 524 | XSET (top, Lisp_Int, f->display.x->top_pos); | 531 | { |
| 532 | top_no_change = 1; | ||
| 533 | if (f->display.x->top_pos < 0) | ||
| 534 | top = Fcons (Qplus, Fcons (make_number (f->display.x->top_pos), Qnil)); | ||
| 535 | else | ||
| 536 | XSET (top, Lisp_Int, f->display.x->top_pos); | ||
| 537 | } | ||
| 525 | 538 | ||
| 526 | /* Don't die if just one of these was set. */ | 539 | /* Don't die if just one of these was set. */ |
| 527 | if (EQ (width, Qunbound)) | 540 | if (EQ (width, Qunbound)) |
| @@ -549,22 +562,64 @@ x_set_frame_parameters (f, alist) | |||
| 549 | Fset_frame_size (frame, width, height); | 562 | Fset_frame_size (frame, width, height); |
| 550 | 563 | ||
| 551 | if ((!NILP (left) || !NILP (top)) | 564 | if ((!NILP (left) || !NILP (top)) |
| 565 | && ! (left_no_change && top_no_change) | ||
| 552 | && ! (NUMBERP (left) && XINT (left) == f->display.x->left_pos | 566 | && ! (NUMBERP (left) && XINT (left) == f->display.x->left_pos |
| 553 | && NUMBERP (top) && XINT (top) == f->display.x->top_pos)) | 567 | && NUMBERP (top) && XINT (top) == f->display.x->top_pos)) |
| 554 | { | 568 | { |
| 555 | int leftpos = (NUMBERP (left) ? XINT (left) : 0); | 569 | int leftpos = 0; |
| 556 | int toppos = (NUMBERP (top) ? XINT (top) : 0); | 570 | int toppos = 0; |
| 557 | |||
| 558 | /* Store the numeric value of the position. */ | ||
| 559 | f->display.x->top_pos = toppos; | ||
| 560 | f->display.x->left_pos = leftpos; | ||
| 561 | 571 | ||
| 562 | /* Record the signs. */ | 572 | /* Record the signs. */ |
| 563 | f->display.x->size_hint_flags &= ~ (XNegative | YNegative); | 573 | f->display.x->size_hint_flags &= ~ (XNegative | YNegative); |
| 564 | if (EQ (left, Qminus) || (NUMBERP (left) && XINT (left) < 0)) | 574 | if (EQ (left, Qminus)) |
| 565 | f->display.x->size_hint_flags |= XNegative; | 575 | f->display.x->size_hint_flags |= XNegative; |
| 566 | if (EQ (top, Qminus) || (NUMBERP (top) && XINT (top) < 0)) | 576 | else if (INTEGERP (left)) |
| 577 | { | ||
| 578 | leftpos = XINT (left); | ||
| 579 | if (leftpos < 0) | ||
| 580 | f->display.x->size_hint_flags |= XNegative; | ||
| 581 | } | ||
| 582 | else if (CONSP (left) && EQ (XCONS (left)->car, Qminus) | ||
| 583 | && CONSP (XCONS (left)->cdr) | ||
| 584 | && INTEGERP (XCONS (XCONS (left)->cdr)->car)) | ||
| 585 | { | ||
| 586 | leftpos = - XINT (XCONS (XCONS (left)->cdr)->car); | ||
| 587 | f->display.x->size_hint_flags |= XNegative; | ||
| 588 | } | ||
| 589 | else if (CONSP (left) && EQ (XCONS (left)->car, Qplus) | ||
| 590 | && CONSP (XCONS (left)->cdr) | ||
| 591 | && INTEGERP (XCONS (XCONS (left)->cdr)->car)) | ||
| 592 | { | ||
| 593 | leftpos = XINT (XCONS (XCONS (left)->cdr)->car); | ||
| 594 | } | ||
| 595 | |||
| 596 | if (EQ (top, Qminus)) | ||
| 567 | f->display.x->size_hint_flags |= YNegative; | 597 | f->display.x->size_hint_flags |= YNegative; |
| 598 | else if (INTEGERP (top)) | ||
| 599 | { | ||
| 600 | toppos = XINT (top); | ||
| 601 | if (toppos < 0) | ||
| 602 | f->display.x->size_hint_flags |= YNegative; | ||
| 603 | } | ||
| 604 | else if (CONSP (top) && EQ (XCONS (top)->car, Qminus) | ||
| 605 | && CONSP (XCONS (top)->cdr) | ||
| 606 | && INTEGERP (XCONS (XCONS (top)->cdr)->car)) | ||
| 607 | { | ||
| 608 | toppos = - XINT (XCONS (XCONS (top)->cdr)->car); | ||
| 609 | f->display.x->size_hint_flags |= YNegative; | ||
| 610 | } | ||
| 611 | else if (CONSP (top) && EQ (XCONS (top)->car, Qplus) | ||
| 612 | && CONSP (XCONS (top)->cdr) | ||
| 613 | && INTEGERP (XCONS (XCONS (top)->cdr)->car)) | ||
| 614 | { | ||
| 615 | toppos = XINT (XCONS (XCONS (top)->cdr)->car); | ||
| 616 | } | ||
| 617 | |||
| 618 | |||
| 619 | /* Store the numeric value of the position. */ | ||
| 620 | f->display.x->top_pos = toppos; | ||
| 621 | f->display.x->left_pos = leftpos; | ||
| 622 | |||
| 568 | f->display.x->win_gravity = NorthWestGravity; | 623 | f->display.x->win_gravity = NorthWestGravity; |
| 569 | 624 | ||
| 570 | /* Actually set that position, and convert to absolute. */ | 625 | /* Actually set that position, and convert to absolute. */ |
| @@ -1594,8 +1649,9 @@ DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0, | |||
| 1594 | "Parse an X-style geometry string STRING.\n\ | 1649 | "Parse an X-style geometry string STRING.\n\ |
| 1595 | Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\ | 1650 | Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\ |
| 1596 | The properties returned may include `top', `left', `height', and `width'.\n\ | 1651 | The properties returned may include `top', `left', `height', and `width'.\n\ |
| 1597 | The value of `left' or `top' may be an integer or `-'.\n\ | 1652 | The value of `left' or `top' may be an integer,\n\ |
| 1598 | `-' means \"minus zero\".") | 1653 | or a list (+ N) meaning N pixels relative to top/left corner,\n\ |
| 1654 | or a list (- N) meaning -N pixels relative to bottom/right corner.") | ||
| 1599 | (string) | 1655 | (string) |
| 1600 | Lisp_Object string; | 1656 | Lisp_Object string; |
| 1601 | { | 1657 | { |
| @@ -1618,8 +1674,10 @@ The value of `left' or `top' may be an integer or `-'.\n\ | |||
| 1618 | { | 1674 | { |
| 1619 | Lisp_Object element; | 1675 | Lisp_Object element; |
| 1620 | 1676 | ||
| 1621 | if (x == 0 && (geometry & XNegative)) | 1677 | if (x >= 0 && (geometry & XNegative)) |
| 1622 | element = Fcons (Qleft, Qminus); | 1678 | element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil))); |
| 1679 | else if (x < 0 && ! (geometry & XNegative)) | ||
| 1680 | element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil))); | ||
| 1623 | else | 1681 | else |
| 1624 | element = Fcons (Qleft, make_number (x)); | 1682 | element = Fcons (Qleft, make_number (x)); |
| 1625 | result = Fcons (element, result); | 1683 | result = Fcons (element, result); |
| @@ -1629,8 +1687,10 @@ The value of `left' or `top' may be an integer or `-'.\n\ | |||
| 1629 | { | 1687 | { |
| 1630 | Lisp_Object element; | 1688 | Lisp_Object element; |
| 1631 | 1689 | ||
| 1632 | if (y == 0 && (geometry & YNegative)) | 1690 | if (y >= 0 && (geometry & YNegative)) |
| 1633 | element = Fcons (Qtop, Qminus); | 1691 | element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil))); |
| 1692 | else if (y < 0 && ! (geometry & YNegative)) | ||
| 1693 | element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil))); | ||
| 1634 | else | 1694 | else |
| 1635 | element = Fcons (Qtop, make_number (y)); | 1695 | element = Fcons (Qtop, make_number (y)); |
| 1636 | result = Fcons (element, result); | 1696 | result = Fcons (element, result); |
| @@ -1710,6 +1770,19 @@ x_figure_window_size (f, parms) | |||
| 1710 | f->display.x->top_pos = 0; | 1770 | f->display.x->top_pos = 0; |
| 1711 | window_prompting |= YNegative; | 1771 | window_prompting |= YNegative; |
| 1712 | } | 1772 | } |
| 1773 | else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qminus) | ||
| 1774 | && CONSP (XCONS (tem0)->cdr) | ||
| 1775 | && INTEGERP (XCONS (XCONS (tem0)->cdr)->car)) | ||
| 1776 | { | ||
| 1777 | f->display.x->top_pos = - XINT (XCONS (XCONS (tem0)->cdr)->car); | ||
| 1778 | window_prompting |= YNegative; | ||
| 1779 | } | ||
| 1780 | else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qplus) | ||
| 1781 | && CONSP (XCONS (tem0)->cdr) | ||
| 1782 | && INTEGERP (XCONS (XCONS (tem0)->cdr)->car)) | ||
| 1783 | { | ||
| 1784 | f->display.x->top_pos = XINT (XCONS (XCONS (tem0)->cdr)->car); | ||
| 1785 | } | ||
| 1713 | else if (EQ (tem0, Qunbound)) | 1786 | else if (EQ (tem0, Qunbound)) |
| 1714 | f->display.x->top_pos = 0; | 1787 | f->display.x->top_pos = 0; |
| 1715 | else | 1788 | else |
| @@ -1725,6 +1798,19 @@ x_figure_window_size (f, parms) | |||
| 1725 | f->display.x->left_pos = 0; | 1798 | f->display.x->left_pos = 0; |
| 1726 | window_prompting |= XNegative; | 1799 | window_prompting |= XNegative; |
| 1727 | } | 1800 | } |
| 1801 | else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qminus) | ||
| 1802 | && CONSP (XCONS (tem1)->cdr) | ||
| 1803 | && INTEGERP (XCONS (XCONS (tem1)->cdr)->car)) | ||
| 1804 | { | ||
| 1805 | f->display.x->left_pos = - XINT (XCONS (XCONS (tem1)->cdr)->car); | ||
| 1806 | window_prompting |= XNegative; | ||
| 1807 | } | ||
| 1808 | else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qplus) | ||
| 1809 | && CONSP (XCONS (tem1)->cdr) | ||
| 1810 | && INTEGERP (XCONS (XCONS (tem1)->cdr)->car)) | ||
| 1811 | { | ||
| 1812 | f->display.x->left_pos = XINT (XCONS (XCONS (tem1)->cdr)->car); | ||
| 1813 | } | ||
| 1728 | else if (EQ (tem1, Qunbound)) | 1814 | else if (EQ (tem1, Qunbound)) |
| 1729 | f->display.x->left_pos = 0; | 1815 | f->display.x->left_pos = 0; |
| 1730 | else | 1816 | else |
| @@ -1907,9 +1993,9 @@ x_window (f, window_prompting, minibuffer_only) | |||
| 1907 | int xneg = window_prompting & XNegative; | 1993 | int xneg = window_prompting & XNegative; |
| 1908 | int top = f->display.x->top_pos; | 1994 | int top = f->display.x->top_pos; |
| 1909 | int yneg = window_prompting & YNegative; | 1995 | int yneg = window_prompting & YNegative; |
| 1910 | if (left < 0) | 1996 | if (xneg) |
| 1911 | left = -left; | 1997 | left = -left; |
| 1912 | if (top < 0) | 1998 | if (yneg) |
| 1913 | top = -top; | 1999 | top = -top; |
| 1914 | sprintf (shell_position, "=%dx%d%c%d%c%d", PIXEL_WIDTH (f), | 2000 | sprintf (shell_position, "=%dx%d%c%d%c%d", PIXEL_WIDTH (f), |
| 1915 | PIXEL_HEIGHT (f) + menubar_size, | 2001 | PIXEL_HEIGHT (f) + menubar_size, |
| @@ -2308,7 +2394,7 @@ be shared by the new frame.") | |||
| 2308 | "borderColor", "BorderColor", string); | 2394 | "borderColor", "BorderColor", string); |
| 2309 | 2395 | ||
| 2310 | x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), | 2396 | x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), |
| 2311 | "menuBarLines", "MenuBarLines", number); | 2397 | "menuBar", "MenuBar", number); |
| 2312 | x_default_parameter (f, parms, Qscroll_bar_width, make_number (12), | 2398 | x_default_parameter (f, parms, Qscroll_bar_width, make_number (12), |
| 2313 | "scrollBarWidth", "ScrollBarWidth", number); | 2399 | "scrollBarWidth", "ScrollBarWidth", number); |
| 2314 | 2400 | ||