comparison src/xfns.c @ 10222:617bee0c64f6

(x_set_frame_parameters): Handle icon-left, icon-top parms. (Fx_color_values): Doc fix. (Fx_create_frame): Check for parent-id parameter. Set explicit_parent and parent fields. Don't set visibility if explicit_parent. [! USE_X_TOOLKIT] (x_window): Specify parent window.
author Richard M. Stallman <rms@gnu.org>
date Fri, 23 Dec 1994 05:11:11 +0000
parents 2e1987a4de30
children 92dcc001aa20
comparison
equal deleted inserted replaced
10221:34b66bff7aec 10222:617bee0c64f6
664 Lisp_Object width, height; 664 Lisp_Object width, height;
665 665
666 /* Same here. */ 666 /* Same here. */
667 Lisp_Object left, top; 667 Lisp_Object left, top;
668 668
669 /* Same with these. */
670 Lisp_Object icon_left, icon_top;
671
669 /* Record in these vectors all the parms specified. */ 672 /* Record in these vectors all the parms specified. */
670 Lisp_Object *parms; 673 Lisp_Object *parms;
671 Lisp_Object *values; 674 Lisp_Object *values;
672 int i; 675 int i;
673 int left_no_change = 0, top_no_change = 0; 676 int left_no_change = 0, top_no_change = 0;
677 int icon_left_no_change = 0, icon_top_no_change = 0;
674 678
675 i = 0; 679 i = 0;
676 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) 680 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
677 i++; 681 i++;
678 682
691 values[i] = Fcdr (elt); 695 values[i] = Fcdr (elt);
692 i++; 696 i++;
693 } 697 }
694 698
695 width = height = top = left = Qunbound; 699 width = height = top = left = Qunbound;
700 icon_left = icon_top = Qunbound;
696 701
697 /* Now process them in reverse of specified order. */ 702 /* Now process them in reverse of specified order. */
698 for (i--; i >= 0; i--) 703 for (i--; i >= 0; i--)
699 { 704 {
700 Lisp_Object prop, val; 705 Lisp_Object prop, val;
708 height = val; 713 height = val;
709 else if (EQ (prop, Qtop)) 714 else if (EQ (prop, Qtop))
710 top = val; 715 top = val;
711 else if (EQ (prop, Qleft)) 716 else if (EQ (prop, Qleft))
712 left = val; 717 left = val;
718 else if (EQ (prop, Qicon_top))
719 icon_top = val;
720 else if (EQ (prop, Qicon_left))
721 icon_left = val;
713 else 722 else
714 { 723 {
715 register Lisp_Object param_index, old_value; 724 register Lisp_Object param_index, old_value;
716 725
717 param_index = Fget (prop, Qx_frame_parameter); 726 param_index = Fget (prop, Qx_frame_parameter);
738 top_no_change = 1; 747 top_no_change = 1;
739 if (f->display.x->top_pos < 0) 748 if (f->display.x->top_pos < 0)
740 top = Fcons (Qplus, Fcons (make_number (f->display.x->top_pos), Qnil)); 749 top = Fcons (Qplus, Fcons (make_number (f->display.x->top_pos), Qnil));
741 else 750 else
742 XSETINT (top, f->display.x->top_pos); 751 XSETINT (top, f->display.x->top_pos);
752 }
753
754 /* If one of the icon positions was not set, preserve or default it. */
755 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
756 {
757 icon_left_no_change = 1;
758 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
759 if (NILP (icon_left))
760 XSETINT (icon_left, 0);
761 }
762 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
763 {
764 icon_top_no_change = 1;
765 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
766 if (NILP (icon_top))
767 XSETINT (icon_top, 0);
743 } 768 }
744 769
745 /* Don't die if just one of these was set. */ 770 /* Don't die if just one of these was set. */
746 if (EQ (width, Qunbound)) 771 if (EQ (width, Qunbound))
747 XSETINT (width, FRAME_WIDTH (f)); 772 XSETINT (width, FRAME_WIDTH (f));
829 f->display.x->win_gravity = NorthWestGravity; 854 f->display.x->win_gravity = NorthWestGravity;
830 855
831 /* Actually set that position, and convert to absolute. */ 856 /* Actually set that position, and convert to absolute. */
832 x_set_offset (f, leftpos, toppos, 0); 857 x_set_offset (f, leftpos, toppos, 0);
833 } 858 }
859
860 if ((!NILP (icon_left) || !NILP (icon_top))
861 && ! (icon_left_no_change && icon_top_no_change))
862 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
834 } 863 }
835 } 864 }
836 865
837 /* Store the screen positions of frame F into XPTR and YPTR. 866 /* Store the screen positions of frame F into XPTR and YPTR.
838 These are the positions of the containing window manager window, 867 These are the positions of the containing window manager window,
1817 1846
1818 Convert the resource to the type specified by desired_type. 1847 Convert the resource to the type specified by desired_type.
1819 1848
1820 If no default is specified, return Qunbound. If you call 1849 If no default is specified, return Qunbound. If you call
1821 x_get_arg, make sure you deal with Qunbound in a reasonable way, 1850 x_get_arg, make sure you deal with Qunbound in a reasonable way,
1822 and don't let it get stored in any lisp-visible variables! */ 1851 and don't let it get stored in any Lisp-visible variables! */
1823 1852
1824 static Lisp_Object 1853 static Lisp_Object
1825 x_get_arg (alist, param, attribute, class, type) 1854 x_get_arg (alist, param, attribute, class, type)
1826 Lisp_Object alist, param; 1855 Lisp_Object alist, param;
1827 char *attribute; 1856 char *attribute;
2380 | CWEventMask); 2409 | CWEventMask);
2381 2410
2382 BLOCK_INPUT; 2411 BLOCK_INPUT;
2383 FRAME_X_WINDOW (f) 2412 FRAME_X_WINDOW (f)
2384 = XCreateWindow (FRAME_X_DISPLAY (f), 2413 = XCreateWindow (FRAME_X_DISPLAY (f),
2385 FRAME_X_DISPLAY_INFO (f)->root_window, 2414 f->display.x->parent_desc,
2386 f->display.x->left_pos, 2415 f->display.x->left_pos,
2387 f->display.x->top_pos, 2416 f->display.x->top_pos,
2388 PIXEL_WIDTH (f), PIXEL_HEIGHT (f), 2417 PIXEL_WIDTH (f), PIXEL_HEIGHT (f),
2389 f->display.x->border_width, 2418 f->display.x->border_width,
2390 CopyFromParent, /* depth */ 2419 CopyFromParent, /* depth */
2573 int width, height; 2602 int width, height;
2574 int count = specpdl_ptr - specpdl; 2603 int count = specpdl_ptr - specpdl;
2575 struct gcpro gcpro1; 2604 struct gcpro gcpro1;
2576 Lisp_Object display; 2605 Lisp_Object display;
2577 struct x_display_info *dpyinfo; 2606 struct x_display_info *dpyinfo;
2607 Lisp_Object parent;
2578 2608
2579 check_x (); 2609 check_x ();
2580 2610
2581 display = x_get_arg (parms, Qdisplay, 0, 0, 0); 2611 display = x_get_arg (parms, Qdisplay, 0, 0, 0);
2582 if (EQ (display, Qunbound)) 2612 if (EQ (display, Qunbound))
2587 if (!STRINGP (name) 2617 if (!STRINGP (name)
2588 && ! EQ (name, Qunbound) 2618 && ! EQ (name, Qunbound)
2589 && ! NILP (name)) 2619 && ! NILP (name))
2590 error ("Invalid frame name--not a string or nil"); 2620 error ("Invalid frame name--not a string or nil");
2591 2621
2622 /* See if parent window is specified. */
2623 parent = x_get_arg (parms, Qparent_id, NULL, NULL, number);
2624 if (EQ (parent, Qunbound))
2625 parent = Qnil;
2626 if (! NILP (parent))
2627 CHECK_NUMBER (parent, 0);
2628
2592 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol); 2629 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol);
2593 if (EQ (tem, Qnone) || NILP (tem)) 2630 if (EQ (tem, Qnone) || NILP (tem))
2594 f = make_frame_without_minibuffer (Qnil); 2631 f = make_frame_without_minibuffer (Qnil);
2595 else if (EQ (tem, Qonly)) 2632 else if (EQ (tem, Qonly))
2596 { 2633 {
2612 f->display.x = (struct x_display *) xmalloc (sizeof (struct x_display)); 2649 f->display.x = (struct x_display *) xmalloc (sizeof (struct x_display));
2613 bzero (f->display.x, sizeof (struct x_display)); 2650 bzero (f->display.x, sizeof (struct x_display));
2614 f->display.x->icon_bitmap = -1; 2651 f->display.x->icon_bitmap = -1;
2615 2652
2616 FRAME_X_DISPLAY_INFO (f) = dpyinfo; 2653 FRAME_X_DISPLAY_INFO (f) = dpyinfo;
2654
2655 /* Specify the parent under which to make this X window. */
2656
2657 if (!NILP (parent))
2658 {
2659 f->display.x->parent_desc = parent;
2660 f->display.x->explicit_parent = 1;
2661 }
2662 else
2663 {
2664 f->display.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
2665 f->display.x->explicit_parent = 0;
2666 }
2617 2667
2618 /* Note that the frame has no physical cursor right now. */ 2668 /* Note that the frame has no physical cursor right now. */
2619 f->phys_cursor_x = -1; 2669 f->phys_cursor_x = -1;
2620 2670
2621 /* Set the name; the functions to which we pass f expect the name to 2671 /* Set the name; the functions to which we pass f expect the name to
2776 /* Now that the frame is official, it counts as a reference to 2826 /* Now that the frame is official, it counts as a reference to
2777 its display. */ 2827 its display. */
2778 FRAME_X_DISPLAY_INFO (f)->reference_count++; 2828 FRAME_X_DISPLAY_INFO (f)->reference_count++;
2779 2829
2780 /* Make the window appear on the frame and enable display, 2830 /* Make the window appear on the frame and enable display,
2781 unless the caller says not to. */ 2831 unless the caller says not to. However, with explicit parent,
2782 { 2832 Emacs cannot control visibility, so don't try. */
2783 Lisp_Object visibility; 2833 if (! f->display.x->explicit_parent)
2784 2834 {
2785 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol); 2835 Lisp_Object visibility;
2786 if (EQ (visibility, Qunbound)) 2836
2787 visibility = Qt; 2837 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol);
2788 2838 if (EQ (visibility, Qunbound))
2789 if (EQ (visibility, Qicon)) 2839 visibility = Qt;
2790 x_iconify_frame (f); 2840
2791 else if (! NILP (visibility)) 2841 if (EQ (visibility, Qicon))
2792 x_make_frame_visible (f); 2842 x_iconify_frame (f);
2793 else 2843 else if (! NILP (visibility))
2794 /* Must have been Qnil. */ 2844 x_make_frame_visible (f);
2795 ; 2845 else
2796 } 2846 /* Must have been Qnil. */
2847 ;
2848 }
2797 2849
2798 return unbind_to (count, frame); 2850 return unbind_to (count, frame);
2799 } 2851 }
2800 2852
2801 Lisp_Object 2853 Lisp_Object
3032 } 3084 }
3033 3085
3034 DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0, 3086 DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0,
3035 "Return a description of the color named COLOR on frame FRAME.\n\ 3087 "Return a description of the color named COLOR on frame FRAME.\n\
3036 The value is a list of integer RGB values--(RED GREEN BLUE).\n\ 3088 The value is a list of integer RGB values--(RED GREEN BLUE).\n\
3037 These values appear to range from 0 to 65280; white is (65280 65280 65280).\n\ 3089 These values appear to range from 0 to 65280 or 65535, depending\n\
3090 on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\
3038 If FRAME is omitted or nil, use the selected frame.") 3091 If FRAME is omitted or nil, use the selected frame.")
3039 (color, frame) 3092 (color, frame)
3040 Lisp_Object color, frame; 3093 Lisp_Object color, frame;
3041 { 3094 {
3042 XColor foo; 3095 XColor foo;