comparison src/frame-x.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents b2472a1930f2
children ca9a9ec9c1c1
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
58 58
59 /* Default properties to use when creating frames. */ 59 /* Default properties to use when creating frames. */
60 Lisp_Object Vdefault_x_frame_plist; 60 Lisp_Object Vdefault_x_frame_plist;
61 61
62 Lisp_Object Qwindow_id; 62 Lisp_Object Qwindow_id;
63 Lisp_Object Qpopup;
64 Lisp_Object Qx_resource_name; 63 Lisp_Object Qx_resource_name;
64
65 EXFUN (Fx_window_id, 1);
65 66
66 67
67 /************************************************************************/ 68 /************************************************************************/
68 /* helper functions */ 69 /* helper functions */
69 /************************************************************************/ 70 /************************************************************************/
199 #endif 200 #endif
200 201
201 void 202 void
202 x_wm_set_shell_iconic_p (Widget shell, int iconic_p) 203 x_wm_set_shell_iconic_p (Widget shell, int iconic_p)
203 { 204 {
204 Arg al [1];
205 if (! XtIsWMShell (shell)) abort (); 205 if (! XtIsWMShell (shell)) abort ();
206 206
207 /* Because of questionable logic in Shell.c, this sequence can't work: 207 /* Because of questionable logic in Shell.c, this sequence can't work:
208 208
209 w = XtCreatePopupShell (...); 209 w = XtCreatePopupShell (...);
210 XtSetArg (al, XtNiconic, True); 210 Xt_SET_VALUE (w, XtNiconic, True);
211 XtSetValues (w, al, 1);
212 XtRealizeWidget (w); 211 XtRealizeWidget (w);
213 212
214 The iconic resource is only consulted at initialization time (when 213 The iconic resource is only consulted at initialization time (when
215 XtCreatePopupShell is called) instead of at realization time (just 214 XtCreatePopupShell is called) instead of at realization time (just
216 before the window gets created, which would be more sensible) or 215 before the window gets created, which would be more sensible) or
221 w->wm.wm_hints.initial_state until after the widget has been realized. 220 w->wm.wm_hints.initial_state until after the widget has been realized.
222 Calls to XtSetValues are ignored in the window between creation and 221 Calls to XtSetValues are ignored in the window between creation and
223 realization. This is true of MIT X11R5 patch level 25, at least. 222 realization. This is true of MIT X11R5 patch level 25, at least.
224 (Apparently some other versions of Xt don't have this bug?) 223 (Apparently some other versions of Xt don't have this bug?)
225 */ 224 */
226 XtSetArg(al [0], XtNiconic, iconic_p); 225 Xt_SET_VALUE (shell, XtNiconic, iconic_p);
227 XtSetValues (shell, al, 1);
228 EmacsShellSmashIconicHint (shell, iconic_p); 226 EmacsShellSmashIconicHint (shell, iconic_p);
229 } 227 }
230 228
231 void 229 void
232 x_wm_set_cell_size (Widget wmshell, int cw, int ch) 230 x_wm_set_cell_size (Widget wmshell, int cw, int ch)
524 { 522 {
525 Widget shell = FRAME_X_SHELL_WIDGET (f); 523 Widget shell = FRAME_X_SHELL_WIDGET (f);
526 EmacsFrame w = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); 524 EmacsFrame w = (EmacsFrame) FRAME_X_TEXT_WIDGET (f);
527 Widget gw = (Widget) w; 525 Widget gw = (Widget) w;
528 526
529 #define FROB(propprop, value) \ 527 if (EQ (Qleft, property) || EQ (Qtop, property))
530 do { \
531 if (EQ (property, propprop)) \
532 return (value); \
533 } while (0)
534
535 #if 0
536 if (EQ (property, Qleft) || EQ (property, Qtop))
537 x_smash_bastardly_shell_position (shell);
538 #endif
539 if (EQ (property, Qleft) || EQ (property, Qtop))
540 { 528 {
541 Position x, y; 529 Position x, y;
542 if (!XtWindow(shell)) 530 if (!XtWindow(shell))
543 return Qzero; 531 return Qzero;
544 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), &x, &y); 532 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), &x, &y);
545 FROB (Qleft, make_int (x)); 533 if (EQ (Qleft, property)) return make_int (x);
546 FROB (Qtop, make_int (y)); 534 if (EQ (Qtop, property)) return make_int (y);
547 } 535 }
548 #if 0 536 if (EQ (Qborder_width, property))
549 FROB (Qleft, make_int (shell->core.x)); 537 return make_int (w->core.border_width);
550 FROB (Qtop, make_int (shell->core.y)); 538 if (EQ (Qinternal_border_width, property))
551 #endif 539 return make_int (w->emacs_frame.internal_border_width);
552 FROB (Qborder_width, make_int (w->core.border_width)); 540 if (EQ (Qborder_color, property))
553 FROB (Qinternal_border_width, 541 return color_to_string (gw, w->core.border_pixel);
554 make_int (w->emacs_frame.internal_border_width));
555 FROB (Qborder_color, color_to_string (gw, w->core.border_pixel));
556 #ifdef HAVE_TOOLBARS 542 #ifdef HAVE_TOOLBARS
557 FROB (Qtop_toolbar_shadow_color, 543 if (EQ (Qtop_toolbar_shadow_color, property))
558 color_to_string (gw, w->emacs_frame.top_toolbar_shadow_pixel)); 544 return color_to_string (gw, w->emacs_frame.top_toolbar_shadow_pixel);
559 FROB (Qbottom_toolbar_shadow_color, 545 if (EQ (Qbottom_toolbar_shadow_color, property))
560 color_to_string (gw, w->emacs_frame.bottom_toolbar_shadow_pixel)); 546 return color_to_string (gw, w->emacs_frame.bottom_toolbar_shadow_pixel);
561 FROB (Qbackground_toolbar_color, 547 if (EQ (Qbackground_toolbar_color, property))
562 color_to_string (gw, w->emacs_frame.background_toolbar_pixel)); 548 return color_to_string (gw, w->emacs_frame.background_toolbar_pixel);
563 FROB (Qtoolbar_shadow_thickness, 549 if (EQ (Qtoolbar_shadow_thickness, property))
564 make_int (w->emacs_frame.toolbar_shadow_thickness)); 550 return make_int (w->emacs_frame.toolbar_shadow_thickness);
565 #endif /* HAVE_TOOLBARS */ 551 #endif /* HAVE_TOOLBARS */
566 FROB (Qinter_line_space, make_int (w->emacs_frame.interline)); 552 if (EQ (Qinter_line_space, property))
567 FROB (Qwindow_id, Fx_window_id (make_frame (f))); 553 return make_int (w->emacs_frame.interline);
568 554 if (EQ (Qwindow_id, property))
569 #undef FROB 555 return Fx_window_id (make_frame (f));
570 556
571 return Qunbound; 557 return Qunbound;
572 } 558 }
573 559
574 static int 560 static int
591 } 577 }
592 578
593 static Lisp_Object 579 static Lisp_Object
594 x_frame_properties (struct frame *f) 580 x_frame_properties (struct frame *f)
595 { 581 {
596 Lisp_Object result = Qnil; 582 Lisp_Object props = Qnil;
597 Widget shell = FRAME_X_SHELL_WIDGET (f); 583 Widget shell = FRAME_X_SHELL_WIDGET (f);
598 EmacsFrame w = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); 584 EmacsFrame w = (EmacsFrame) FRAME_X_TEXT_WIDGET (f);
599 Widget gw = (Widget) w; 585 Widget gw = (Widget) w;
600 Position x, y; 586 Position x, y;
601 587
602 #define FROB(propprop, value) \ 588 props = cons3 (Qwindow_id, Fx_window_id (make_frame (f)), props);
603 do { \ 589 props = cons3 (Qinter_line_space, make_int (w->emacs_frame.interline), props);
604 Lisp_Object temtem = (value); \ 590
605 if (!NILP (temtem)) \ 591 #ifdef HAVE_TOOLBARS
606 /* backwards order; we reverse it below */ \ 592 props = cons3 (Qtoolbar_shadow_thickness,
607 result = Fcons (temtem, Fcons (propprop, result)); \ 593 make_int (w->emacs_frame.toolbar_shadow_thickness),
608 } while (0) 594 props);
609 595 props = cons3 (Qbackground_toolbar_color,
610 #if 0 596 color_to_string (gw, w->emacs_frame.background_toolbar_pixel),
611 x_smash_bastardly_shell_position (shell); 597 props);
612 FROB (Qleft, make_int (shell->core.x)); 598 props = cons3 (Qbottom_toolbar_shadow_color,
613 FROB (Qtop, make_int (shell->core.y)); 599 color_to_string (gw, w->emacs_frame.bottom_toolbar_shadow_pixel),
614 #endif 600 props);
601 props = cons3 (Qtop_toolbar_shadow_color,
602 color_to_string (gw, w->emacs_frame.top_toolbar_shadow_pixel),
603 props);
604 #endif /* HAVE_TOOLBARS */
605
606 props = cons3 (Qborder_color,
607 color_to_string (gw, w->core.border_pixel), props);
608 props = cons3 (Qinternal_border_width,
609 make_int (w->emacs_frame.internal_border_width), props);
610 props = cons3 (Qborder_width, make_int (w->core.border_width), props);
611
615 if (!XtWindow(shell)) 612 if (!XtWindow(shell))
616 x = y = 0; 613 x = y = 0;
617 else 614 else
618 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), &x, &y); 615 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), &x, &y);
619 616
620 FROB (Qleft, make_int (x)); 617 props = cons3 (Qtop, make_int (y), props);
621 FROB (Qtop, make_int (y)); 618 props = cons3 (Qleft, make_int (x), props);
622 619
623 FROB (Qborder_width, make_int (w->core.border_width)); 620 return props;
624 FROB (Qinternal_border_width,
625 make_int (w->emacs_frame.internal_border_width));
626 FROB (Qborder_color, color_to_string (gw, w->core.border_pixel));
627 #ifdef HAVE_TOOLBARS
628 FROB (Qtop_toolbar_shadow_color,
629 color_to_string (gw, w->emacs_frame.top_toolbar_shadow_pixel));
630 FROB (Qbottom_toolbar_shadow_color,
631 color_to_string (gw, w->emacs_frame.bottom_toolbar_shadow_pixel));
632 FROB (Qbackground_toolbar_color,
633 color_to_string (gw, w->emacs_frame.background_toolbar_pixel));
634 FROB (Qtoolbar_shadow_thickness,
635 make_int (w->emacs_frame.toolbar_shadow_thickness));
636 #endif /* HAVE_TOOLBARS */
637 FROB (Qinter_line_space, make_int (w->emacs_frame.interline));
638 FROB (Qwindow_id, Fx_window_id (make_frame (f)));
639
640 #undef FROB
641
642 return result;
643 } 621 }
644 622
645 623
646 /* Functions called only from `x_set_frame_properties' to set 624 /* Functions called only from `x_set_frame_properties' to set
647 individual properties. */ 625 individual properties. */
652 String Xt_resource_encoding_name) 630 String Xt_resource_encoding_name)
653 { 631 {
654 Atom encoding = XA_STRING; 632 Atom encoding = XA_STRING;
655 String new_XtValue = (String) value; 633 String new_XtValue = (String) value;
656 String old_XtValue = NULL; 634 String old_XtValue = NULL;
657 Arg al[2];
658 635
659 #ifdef MULE 636 #ifdef MULE
660 Bufbyte *ptr; 637 Bufbyte *ptr;
661 /* Optimize for common ASCII case */ 638 /* Optimize for common ASCII case */
662 for (ptr = value; *ptr; ptr++) 639 for (ptr = value; *ptr; ptr++)
669 break; 646 break;
670 } 647 }
671 #endif /* MULE */ 648 #endif /* MULE */
672 649
673 /* ### Caching is device-independent - belongs in update_frame_title. */ 650 /* ### Caching is device-independent - belongs in update_frame_title. */
674 XtSetArg (al[0], Xt_resource_name, &old_XtValue); 651 Xt_GET_VALUE (FRAME_X_SHELL_WIDGET (f), Xt_resource_name, &old_XtValue);
675 XtGetValues (FRAME_X_SHELL_WIDGET (f), al, 1);
676 if (!old_XtValue || strcmp (new_XtValue, old_XtValue)) 652 if (!old_XtValue || strcmp (new_XtValue, old_XtValue))
677 { 653 {
654 Arg al[2];
678 XtSetArg (al[0], Xt_resource_name, new_XtValue); 655 XtSetArg (al[0], Xt_resource_name, new_XtValue);
679 XtSetArg (al[1], Xt_resource_encoding_name, encoding); 656 XtSetArg (al[1], Xt_resource_encoding_name, encoding);
680 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2); 657 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2);
681 } 658 }
682 } 659 }
708 int xval, yval; 685 int xval, yval;
709 char xsign, ysign; 686 char xsign, ysign;
710 char uspos = !!(flags & (XValue | YValue)); 687 char uspos = !!(flags & (XValue | YValue));
711 char ussize = !!(flags & (WidthValue | HeightValue)); 688 char ussize = !!(flags & (WidthValue | HeightValue));
712 char *temp; 689 char *temp;
713 Arg al [1];
714 690
715 /* assign the correct size to the EmacsFrame widget ... */ 691 /* assign the correct size to the EmacsFrame widget ... */
716 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), w, h); 692 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), w, h);
717 693
718 /* and also set the WMShell's geometry */ 694 /* and also set the WMShell's geometry */
733 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp; 709 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp;
734 } 710 }
735 else 711 else
736 temp = NULL; 712 temp = NULL;
737 713
738 XtSetArg (al [0], XtNgeometry, temp); 714 Xt_SET_VALUE (FRAME_X_SHELL_WIDGET (f), XtNgeometry, temp);
739 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 1);
740 } 715 }
741 716
742 /* Report to X that a frame property of frame S is being set or changed. 717 /* Report to X that a frame property of frame S is being set or changed.
743 If the property is not specially recognized, do nothing. 718 If the property is not specially recognized, do nothing.
744 */ 719 */
753 Bool x_position_specified_p = False; 728 Bool x_position_specified_p = False;
754 Bool y_position_specified_p = False; 729 Bool y_position_specified_p = False;
755 Bool internal_border_width_specified = False; 730 Bool internal_border_width_specified = False;
756 Lisp_Object tail; 731 Lisp_Object tail;
757 Widget w = FRAME_X_TEXT_WIDGET (f); 732 Widget w = FRAME_X_TEXT_WIDGET (f);
758 Arg al [10];
759 733
760 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) 734 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail)))
761 { 735 {
762 Lisp_Object prop = Fcar (tail); 736 Lisp_Object prop = Fcar (tail);
763 Lisp_Object val = Fcar (Fcdr (tail)); 737 Lisp_Object val = Fcar (Fcdr (tail));
770 continue; 744 continue;
771 745
772 GET_C_STRING_CTEXT_DATA_ALLOCA (prop, extprop); 746 GET_C_STRING_CTEXT_DATA_ALLOCA (prop, extprop);
773 if (STRINGP (val)) 747 if (STRINGP (val))
774 { 748 {
775 Extbyte *extval; 749 CONST Extbyte *extval;
776 Extcount extvallen; 750 Extcount extvallen;
777 751
778 GET_STRING_CTEXT_DATA_ALLOCA (val, extval, extvallen); 752 GET_STRING_CTEXT_DATA_ALLOCA (val, extval, extvallen);
779 XtVaSetValues (w, XtVaTypedArg, extprop, 753 XtVaSetValues (w, XtVaTypedArg, extprop,
780 XtRString, extval, extvallen + 1, 754 XtRString, extval, extvallen + 1,
854 } 828 }
855 829
856 if (int_p) 830 if (int_p)
857 { 831 {
858 CHECK_INT (val); 832 CHECK_INT (val);
859 XtSetArg (al [0], (char *) XSTRING_DATA (str), XINT (val)); 833 Xt_SET_VALUE (w, (char *) XSTRING_DATA (str), XINT (val));
860 XtSetValues (w, al, 1);
861 } 834 }
862 else if (EQ (val, Qt)) 835 else if (EQ (val, Qt))
863 { 836 {
864 XtSetArg (al [0], (char *) XSTRING_DATA (str), True); /* XtN...*/ 837 Xt_SET_VALUE (w, (char *) XSTRING_DATA (str), True); /* XtN...*/
865 XtSetValues (w, al, 1);
866 } 838 }
867 else if (EQ (val, Qnil)) 839 else if (EQ (val, Qnil))
868 { 840 {
869 XtSetArg (al [0], (char *) XSTRING_DATA (str), False); /* XtN...*/ 841 Xt_SET_VALUE (w, (char *) XSTRING_DATA (str), False); /* XtN...*/
870 XtSetValues (w, al, 1);
871 } 842 }
872 else 843 else
873 { 844 {
874 CHECK_STRING (val); 845 CHECK_STRING (val);
875 XtVaSetValues (w, XtVaTypedArg, 846 XtVaSetValues (w, XtVaTypedArg,
1221 { 1192 {
1222 xfree (dnd_data); 1193 xfree (dnd_data);
1223 return Qnil; 1194 return Qnil;
1224 } 1195 }
1225 len = XSTRING_LENGTH (XCAR (run)) + 1; 1196 len = XSTRING_LENGTH (XCAR (run)) + 1;
1226 dnd_data = xrealloc (dnd_data, dnd_len + len); 1197 dnd_data = (char *) xrealloc (dnd_data, dnd_len + len);
1227 strcpy (dnd_data + dnd_len - 1, (CONST char *)XSTRING_DATA (XCAR (run))); 1198 strcpy (dnd_data + dnd_len - 1, (CONST char *)XSTRING_DATA (XCAR (run)));
1228 dnd_len += len; 1199 dnd_len += len;
1229 run = XCDR (run); 1200 run = XCDR (run);
1230 } 1201 }
1231 1202
1232 dnd_data[dnd_len - 1] = 0; /* the list-ending zero */ 1203 dnd_data[dnd_len - 1] = 0; /* the list-ending zero */
1233 dnd_dealloc = 1; 1204 dnd_dealloc = 1;
1234 1205
1235 } 1206 }
1236 else 1207 else
1353 Lisp_Object rest = DEVICE_FRAME_LIST (XDEVICE (f->device)); 1324 Lisp_Object rest = DEVICE_FRAME_LIST (XDEVICE (f->device));
1354 while (!NILP (rest) && 1325 while (!NILP (rest) &&
1355 (f == XFRAME (XCAR (rest)) || 1326 (f == XFRAME (XCAR (rest)) ||
1356 !FRAME_X_P (XFRAME (XCAR (rest))))) 1327 !FRAME_X_P (XFRAME (XCAR (rest)))))
1357 rest = XCDR (rest); 1328 rest = XCDR (rest);
1358 return (NILP (rest)); 1329 return NILP (rest);
1359 } 1330 }
1360 1331
1361 /* Figure out what size the EmacsFrame widget should initially be, 1332 /* Figure out what size the EmacsFrame widget should initially be,
1362 and set it. Should be called after the default font has been 1333 and set it. Should be called after the default font has been
1363 determined but before the widget has been realized. */ 1334 determined but before the widget has been realized. */
1386 unsigned int h = 40; 1357 unsigned int h = 40;
1387 int flags = 0; 1358 int flags = 0;
1388 1359
1389 char *geom = 0, *ew_geom = 0; 1360 char *geom = 0, *ew_geom = 0;
1390 Boolean iconic_p = False, ew_iconic_p = False; 1361 Boolean iconic_p = False, ew_iconic_p = False;
1391 Arg al [2];
1392 1362
1393 Widget wmshell = FRAME_X_SHELL_WIDGET (f); 1363 Widget wmshell = FRAME_X_SHELL_WIDGET (f);
1394 /* #### This may not be an ApplicationShell any more, with the 'popup 1364 /* #### This may not be an ApplicationShell any more, with the 'popup
1395 frame property. */ 1365 frame property. */
1396 Widget app_shell = XtParent (wmshell); 1366 Widget app_shell = XtParent (wmshell);
1441 is. (Assume it is smart and pays attention to our values.) 1411 is. (Assume it is smart and pays attention to our values.)
1442 */ 1412 */
1443 1413
1444 if (!FRAME_X_TOP_LEVEL_FRAME_P (f)) 1414 if (!FRAME_X_TOP_LEVEL_FRAME_P (f))
1445 { 1415 {
1446 XtSetArg (al [0], XtNgeometry, &ew_geom); 1416 Xt_GET_VALUE (ew, XtNgeometry, &ew_geom);
1447 XtGetValues (ew, al, 1);
1448 if (ew_geom) 1417 if (ew_geom)
1449 frame_flags = XParseGeometry (ew_geom, 1418 frame_flags = XParseGeometry (ew_geom,
1450 &frame_x, &frame_y, 1419 &frame_x, &frame_y,
1451 &frame_w, &frame_h); 1420 &frame_w, &frame_h);
1452 if (! (frame_flags & (WidthValue | HeightValue))) 1421 if (! (frame_flags & (WidthValue | HeightValue)))
1453 { 1422 {
1423 Arg al[2];
1454 XtSetArg (al [0], XtNwidth, &frame_w); 1424 XtSetArg (al [0], XtNwidth, &frame_w);
1455 XtSetArg (al [1], XtNheight, &frame_h); 1425 XtSetArg (al [1], XtNheight, &frame_h);
1456 XtGetValues (ew, al, 2); 1426 XtGetValues (ew, al, 2);
1457 if (!frame_w && !frame_h) 1427 if (!frame_w && !frame_h)
1458 { 1428 {
1463 } 1433 }
1464 if (frame_flags & (WidthValue | HeightValue)) 1434 if (frame_flags & (WidthValue | HeightValue))
1465 EmacsFrameSetCharSize (ew, frame_w, frame_h); 1435 EmacsFrameSetCharSize (ew, frame_w, frame_h);
1466 if (frame_flags & (XValue | YValue)) 1436 if (frame_flags & (XValue | YValue))
1467 { 1437 {
1438 Arg al[2];
1468 XtSetArg (al [0], XtNwidth, &frame_w); 1439 XtSetArg (al [0], XtNwidth, &frame_w);
1469 XtSetArg (al [1], XtNheight, &frame_h); 1440 XtSetArg (al [1], XtNheight, &frame_h);
1470 XtGetValues (ew, al, 2); 1441 XtGetValues (ew, al, 2);
1471 1442
1472 if (frame_flags & XNegative) 1443 if (frame_flags & XNegative)
1489 1460
1490 /* If the EmacsFrame doesn't have a geometry but the shell does, 1461 /* If the EmacsFrame doesn't have a geometry but the shell does,
1491 treat that as the geometry of the frame. 1462 treat that as the geometry of the frame.
1492 (Is this bogus? I'm not sure.) */ 1463 (Is this bogus? I'm not sure.) */
1493 1464
1494 XtSetArg (al [0], XtNgeometry, &ew_geom); 1465 Xt_GET_VALUE (ew, XtNgeometry, &ew_geom);
1495 XtGetValues (ew, al, 1);
1496 if (!ew_geom) 1466 if (!ew_geom)
1497 { 1467 {
1498 XtSetArg (al [0], XtNgeometry, &geom); 1468 Xt_GET_VALUE (wmshell, XtNgeometry, &geom);
1499 XtGetValues (wmshell, al, 1);
1500 if (geom) 1469 if (geom)
1501 { 1470 {
1502 ew_geom = geom; 1471 ew_geom = geom;
1503 XtSetArg (al [0], XtNgeometry, ew_geom); 1472 Xt_SET_VALUE (ew, XtNgeometry, ew_geom);
1504 XtSetValues (ew, al, 1);
1505 } 1473 }
1506 } 1474 }
1507 1475
1508 /* If the Shell is iconic, then the EmacsFrame is iconic. 1476 /* If the Shell is iconic, then the EmacsFrame is iconic.
1509 (Is this bogus? I'm not sure.) */ 1477 (Is this bogus? I'm not sure.) */
1510 XtSetArg (al [0], XtNiconic, &ew_iconic_p); 1478 Xt_GET_VALUE (ew, XtNiconic, &ew_iconic_p);
1511 XtGetValues (ew, al, 1);
1512 if (!ew_iconic_p) 1479 if (!ew_iconic_p)
1513 { 1480 {
1514 XtSetArg (al [0], XtNiconic, &iconic_p); 1481 Xt_GET_VALUE (wmshell, XtNiconic, &iconic_p);
1515 XtGetValues (wmshell, al, 1);
1516 if (iconic_p) 1482 if (iconic_p)
1517 { 1483 {
1518 ew_iconic_p = iconic_p; 1484 ew_iconic_p = iconic_p;
1519 XtSetArg (al [0], XtNiconic, iconic_p); 1485 Xt_SET_VALUE (ew, XtNiconic, iconic_p);
1520 XtSetValues (ew, al, 1);
1521 } 1486 }
1522 } 1487 }
1523 1488
1524 XtSetArg (al [0], XtNgeometry, &geom); 1489 Xt_GET_VALUE (app_shell, XtNgeometry, &geom);
1525 XtGetValues (app_shell, al, 1);
1526 if (geom) 1490 if (geom)
1527 app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h); 1491 app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h);
1528 1492
1529 if (ew_geom) 1493 if (ew_geom)
1530 frame_flags = XParseGeometry (ew_geom, 1494 frame_flags = XParseGeometry (ew_geom,
1570 } 1534 }
1571 1535
1572 /* If the AppShell is iconic, then the EmacsFrame is iconic. */ 1536 /* If the AppShell is iconic, then the EmacsFrame is iconic. */
1573 if (!ew_iconic_p) 1537 if (!ew_iconic_p)
1574 { 1538 {
1575 XtSetArg (al [0], XtNiconic, &iconic_p); 1539 Xt_GET_VALUE (app_shell, XtNiconic, &iconic_p);
1576 XtGetValues (app_shell, al, 1);
1577 if (iconic_p) 1540 if (iconic_p)
1578 { 1541 {
1579 ew_iconic_p = iconic_p; 1542 ew_iconic_p = iconic_p;
1580 XtSetArg (al [0], XtNiconic, iconic_p); 1543 Xt_SET_VALUE (ew, XtNiconic, iconic_p);
1581 XtSetValues (ew, al, 1);
1582 } 1544 }
1583 } 1545 }
1584 } 1546 }
1585 else 1547 else
1586 { 1548 {
1666 #ifdef HAVE_SCROLLBARS 1628 #ifdef HAVE_SCROLLBARS
1667 { 1629 {
1668 /* The scrollbar positioning is completely handled by redisplay. We 1630 /* The scrollbar positioning is completely handled by redisplay. We
1669 just need to know which sides they are supposed to go on. */ 1631 just need to know which sides they are supposed to go on. */
1670 unsigned char scrollbar_placement; 1632 unsigned char scrollbar_placement;
1671 Arg al [1]; 1633
1672 1634 Xt_GET_VALUE (text, XtNscrollBarPlacement, &scrollbar_placement);
1673 XtSetArg (al [0], XtNscrollBarPlacement, &scrollbar_placement); 1635 switch (scrollbar_placement)
1674 XtGetValues (text, al, 1); 1636 {
1675 f->scrollbar_on_left = (scrollbar_placement == XtTOP_LEFT || 1637 case XtTOP_LEFT:
1676 scrollbar_placement == XtBOTTOM_LEFT); 1638 f->scrollbar_on_left = 1, f->scrollbar_on_top = 1; break;
1677 f->scrollbar_on_top = (scrollbar_placement == XtTOP_LEFT || 1639 case XtBOTTOM_LEFT:
1678 scrollbar_placement == XtTOP_RIGHT); 1640 f->scrollbar_on_left = 1, f->scrollbar_on_top = 0; break;
1641 case XtTOP_RIGHT:
1642 f->scrollbar_on_left = 0, f->scrollbar_on_top = 1; break;
1643 case XtBOTTOM_RIGHT:
1644 f->scrollbar_on_left = 0, f->scrollbar_on_top = 0; break;
1645 }
1679 f->scrollbar_y_offset = topbreadth + textbord; 1646 f->scrollbar_y_offset = topbreadth + textbord;
1680 } 1647 }
1681 #endif /* HAVE_SCROLLBARS */ 1648 #endif /* HAVE_SCROLLBARS */
1682 1649
1683 /* finally the text area */ 1650 /* finally the text area */
1841 /* Create the manager widget */ 1808 /* Create the manager widget */
1842 ac = 0; 1809 ac = 0;
1843 XtSetArg (al[ac], XtNvisual, visual); ac++; 1810 XtSetArg (al[ac], XtNvisual, visual); ac++;
1844 XtSetArg (al[ac], XtNdepth, depth); ac++; 1811 XtSetArg (al[ac], XtNdepth, depth); ac++;
1845 XtSetArg (al[ac], XtNcolormap, cmap); ac++; 1812 XtSetArg (al[ac], XtNcolormap, cmap); ac++;
1846 1813
1847 container = XtCreateWidget ("container", 1814 container = XtCreateWidget ("container",
1848 emacsManagerWidgetClass, shell, al, ac); 1815 emacsManagerWidgetClass, shell, al, ac);
1849 FRAME_X_CONTAINER_WIDGET (f) = container; 1816 FRAME_X_CONTAINER_WIDGET (f) = container;
1850 XtAddCallback (container, XtNresizeCallback, x_layout_widgets, 1817 XtAddCallback (container, XtNresizeCallback, x_layout_widgets,
1851 (XtPointer) f); 1818 (XtPointer) f);
1892 static void 1859 static void
1893 xemacs_XtPopup (Widget widget) 1860 xemacs_XtPopup (Widget widget)
1894 { 1861 {
1895 ShellWidget shell_widget = (ShellWidget) widget; 1862 ShellWidget shell_widget = (ShellWidget) widget;
1896 XtGrabKind call_data = XtGrabNone; 1863 XtGrabKind call_data = XtGrabNone;
1897 Arg al [1];
1898 1864
1899 XtCallCallbacks (widget, XtNpopupCallback, (XtPointer)&call_data); 1865 XtCallCallbacks (widget, XtNpopupCallback, (XtPointer)&call_data);
1900 1866
1901 shell_widget->shell.popped_up = TRUE; 1867 shell_widget->shell.popped_up = TRUE;
1902 shell_widget->shell.grab_kind = XtGrabNone; 1868 shell_widget->shell.grab_kind = XtGrabNone;
1905 if (shell_widget->shell.create_popup_child_proc != NULL) 1871 if (shell_widget->shell.create_popup_child_proc != NULL)
1906 (*(shell_widget->shell.create_popup_child_proc))(widget); 1872 (*(shell_widget->shell.create_popup_child_proc))(widget);
1907 1873
1908 /* The XtSetValues below are not in XtPopup menu. We just want to 1874 /* The XtSetValues below are not in XtPopup menu. We just want to
1909 make absolutely sure... */ 1875 make absolutely sure... */
1910 XtSetArg (al [0], XtNmappedWhenManaged, False); 1876 Xt_SET_VALUE (widget, XtNmappedWhenManaged, False);
1911 XtSetValues (widget, al, 1);
1912 XtRealizeWidget (widget); 1877 XtRealizeWidget (widget);
1913 XtSetArg (al [0], XtNmappedWhenManaged, True); 1878 Xt_SET_VALUE (widget, XtNmappedWhenManaged, True);
1914 XtSetValues (widget, al, 1);
1915 } 1879 }
1916 1880
1917 #ifdef HAVE_CDE 1881 #ifdef HAVE_CDE
1918 /* Does this have to be non-automatic? */ 1882 /* Does this have to be non-automatic? */
1919 /* hack frame to respond to dnd messages */ 1883 /* hack frame to respond to dnd messages */
2131 2095
2132 static Lisp_Object 2096 static Lisp_Object
2133 x_get_frame_parent (struct frame *f) 2097 x_get_frame_parent (struct frame *f)
2134 { 2098 {
2135 Widget parentwid = 0; 2099 Widget parentwid = 0;
2136 Arg al[1]; 2100
2137 2101 Xt_GET_VALUE (FRAME_X_SHELL_WIDGET (f), XtNtransientFor, &parentwid);
2138 XtSetArg (al[0], XtNtransientFor, &parentwid);
2139 XtGetValues (FRAME_X_SHELL_WIDGET (f), al, 1);
2140 /* find the frame whose wid is parentwid */ 2102 /* find the frame whose wid is parentwid */
2141 if (parentwid) 2103 if (parentwid)
2142 { 2104 {
2143 Lisp_Object frmcons; 2105 Lisp_Object frmcons;
2144 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f))) 2106 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f)))
2524 /* Destroy the X window of frame S. */ 2486 /* Destroy the X window of frame S. */
2525 static void 2487 static void
2526 x_delete_frame (struct frame *f) 2488 x_delete_frame (struct frame *f)
2527 { 2489 {
2528 Widget w = FRAME_X_SHELL_WIDGET (f); 2490 Widget w = FRAME_X_SHELL_WIDGET (f);
2529 Lisp_Object frame;
2530 2491
2531 #ifndef HAVE_SESSION 2492 #ifndef HAVE_SESSION
2532 if (FRAME_X_TOP_LEVEL_FRAME_P (f)) 2493 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
2533 x_wm_maybe_move_wm_command (f); 2494 x_wm_maybe_move_wm_command (f);
2534 #endif /* HAVE_SESSION */ 2495 #endif /* HAVE_SESSION */
2535
2536 XSETFRAME (frame, f);
2537 2496
2538 #ifdef EXTERNAL_WIDGET 2497 #ifdef EXTERNAL_WIDGET
2539 { 2498 {
2540 Display *dpy = XtDisplay (w); 2499 Display *dpy = XtDisplay (w);
2541 expect_x_error (dpy); 2500 expect_x_error (dpy);
2638 2597
2639 void 2598 void
2640 syms_of_frame_x (void) 2599 syms_of_frame_x (void)
2641 { 2600 {
2642 defsymbol (&Qwindow_id, "window-id"); 2601 defsymbol (&Qwindow_id, "window-id");
2643 defsymbol (&Qpopup, "popup");
2644 defsymbol (&Qx_resource_name, "x-resource-name"); 2602 defsymbol (&Qx_resource_name, "x-resource-name");
2645 2603
2646 DEFSUBR (Fx_window_id); 2604 DEFSUBR (Fx_window_id);
2647 #ifdef HAVE_CDE 2605 #ifdef HAVE_CDE
2648 DEFSUBR (Fcde_start_drag_internal); 2606 DEFSUBR (Fcde_start_drag_internal);