Mercurial > hg > xemacs-beta
comparison src/frame-x.c @ 165:5a88923fcbfe r20-3b9
Import from CVS: tag r20-3b9
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:44:42 +0200 |
parents | 0132846995bd |
children | 15872534500d |
comparison
equal
deleted
inserted
replaced
164:4e0740e5aab2 | 165:5a88923fcbfe |
---|---|
28 | 28 |
29 #include "console-x.h" | 29 #include "console-x.h" |
30 #include "xintrinsicp.h" /* CoreP.h needs this */ | 30 #include "xintrinsicp.h" /* CoreP.h needs this */ |
31 #include <X11/CoreP.h> /* Numerous places access the fields of | 31 #include <X11/CoreP.h> /* Numerous places access the fields of |
32 a core widget directly. We could | 32 a core widget directly. We could |
33 use XtVaGetValues(), but ... */ | 33 use XtGetValues(), but ... */ |
34 #include <X11/Shell.h> | 34 #include <X11/Shell.h> |
35 #include <X11/ShellP.h> | 35 #include <X11/ShellP.h> |
36 #include "xmu.h" | 36 #include "xmu.h" |
37 #include "EmacsManager.h" | 37 #include "EmacsManager.h" |
38 #include "EmacsFrameP.h" | 38 #include "EmacsFrameP.h" |
194 #endif | 194 #endif |
195 | 195 |
196 void | 196 void |
197 x_wm_set_shell_iconic_p (Widget shell, int iconic_p) | 197 x_wm_set_shell_iconic_p (Widget shell, int iconic_p) |
198 { | 198 { |
199 Arg al [1]; | |
199 if (! XtIsWMShell (shell)) abort (); | 200 if (! XtIsWMShell (shell)) abort (); |
200 | 201 |
201 /* Because of questionable logic in Shell.c, this sequence can't work: | 202 /* Because of questionable logic in Shell.c, this sequence can't work: |
202 | 203 |
203 w = XtCreatePopupShell (...); | 204 w = XtCreatePopupShell (...); |
204 XtVaSetValues (w, XtNiconic, True, NULL); | 205 XtSetArg (al, XtNiconic, True); |
206 XtSetValues (w, al, 1); | |
205 XtRealizeWidget (w); | 207 XtRealizeWidget (w); |
206 | 208 |
207 The iconic resource is only consulted at initialization time (when | 209 The iconic resource is only consulted at initialization time (when |
208 XtCreatePopupShell is called) instead of at realization time (just | 210 XtCreatePopupShell is called) instead of at realization time (just |
209 before the window gets created, which would be more sensible) or | 211 before the window gets created, which would be more sensible) or |
214 w->wm.wm_hints.initial_state until after the widget has been realized. | 216 w->wm.wm_hints.initial_state until after the widget has been realized. |
215 Calls to XtSetValues are ignored in the window between creation and | 217 Calls to XtSetValues are ignored in the window between creation and |
216 realization. This is true of MIT X11R5 patch level 25, at least. | 218 realization. This is true of MIT X11R5 patch level 25, at least. |
217 (Apparently some other versions of Xt don't have this bug?) | 219 (Apparently some other versions of Xt don't have this bug?) |
218 */ | 220 */ |
219 XtVaSetValues (shell, XtNiconic, iconic_p, NULL); | 221 XtSetArg(al [0], XtNiconic, iconic_p); |
222 XtSetValues (shell, al, 1); | |
220 EmacsShellSmashIconicHint (shell, iconic_p); | 223 EmacsShellSmashIconicHint (shell, iconic_p); |
221 } | 224 } |
222 | 225 |
223 void | 226 void |
224 x_wm_set_cell_size (Widget wmshell, int cw, int ch) | 227 x_wm_set_cell_size (Widget wmshell, int cw, int ch) |
225 { | 228 { |
229 Arg al [2]; | |
230 | |
226 if (!XtIsWMShell (wmshell)) | 231 if (!XtIsWMShell (wmshell)) |
227 abort (); | 232 abort (); |
228 if (cw <= 0 || ch <= 0) | 233 if (cw <= 0 || ch <= 0) |
229 abort (); | 234 abort (); |
230 | 235 |
231 XtVaSetValues (wmshell, | 236 XtSetArg (al [0], XtNwidthInc, cw); |
232 XtNwidthInc, cw, | 237 XtSetArg (al [1], XtNheightInc, ch); |
233 XtNheightInc, ch, | 238 XtSetValues (wmshell, al, 2); |
234 NULL); | |
235 } | 239 } |
236 | 240 |
237 void | 241 void |
238 x_wm_set_variable_size (Widget wmshell, int width, int height) | 242 x_wm_set_variable_size (Widget wmshell, int width, int height) |
239 { | 243 { |
244 Arg al [2]; | |
245 | |
240 if (!XtIsWMShell (wmshell)) | 246 if (!XtIsWMShell (wmshell)) |
241 abort (); | 247 abort (); |
242 #ifdef DEBUG_GEOMETRY_MANAGEMENT | 248 #ifdef DEBUG_GEOMETRY_MANAGEMENT |
243 /* See comment in EmacsShell.c */ | 249 /* See comment in EmacsShell.c */ |
244 printf ("x_wm_set_variable_size: %d %d\n", width, height); | 250 printf ("x_wm_set_variable_size: %d %d\n", width, height); |
245 fflush (stdout); | 251 fflush (stdout); |
246 #endif | 252 #endif |
247 XtVaSetValues (wmshell, | 253 |
248 XtNwidthCells, width, | 254 XtSetArg (al [0], XtNwidthCells, width); |
249 XtNheightCells, height, | 255 XtSetArg (al [1], XtNheightCells, height); |
250 NULL); | 256 XtSetValues (wmshell, al, 2); |
251 } | 257 } |
252 | 258 |
253 /* If the WM_PROTOCOLS property does not already contain WM_TAKE_FOCUS | 259 /* If the WM_PROTOCOLS property does not already contain WM_TAKE_FOCUS |
254 and WM_DELETE_WINDOW, then add them. (They may already be present | 260 and WM_DELETE_WINDOW, then add them. (They may already be present |
255 because of the toolkit (Motif adds them, for example, but Xt doesn't). | 261 because of the toolkit (Motif adds them, for example, but Xt doesn't). |
567 #ifdef HAVE_TOOLBARS | 573 #ifdef HAVE_TOOLBARS |
568 || EQ (property, Qtop_toolbar_shadow_color) | 574 || EQ (property, Qtop_toolbar_shadow_color) |
569 || EQ (property, Qbottom_toolbar_shadow_color) | 575 || EQ (property, Qbottom_toolbar_shadow_color) |
570 || EQ (property, Qbackground_toolbar_color) | 576 || EQ (property, Qbackground_toolbar_color) |
571 || EQ (property, Qtoolbar_shadow_thickness) | 577 || EQ (property, Qtoolbar_shadow_thickness) |
572 #endif | 578 #endif /* HAVE_TOOLBARS */ |
573 || EQ (property, Qinter_line_space) | 579 || EQ (property, Qinter_line_space) |
574 || EQ (property, Qwindow_id) | 580 || EQ (property, Qwindow_id) |
575 || STRINGP (property); | 581 || STRINGP (property); |
576 } | 582 } |
577 | 583 |
637 String Xt_resource_encoding_name) | 643 String Xt_resource_encoding_name) |
638 { | 644 { |
639 Atom encoding = XA_STRING; | 645 Atom encoding = XA_STRING; |
640 String new_XtValue = (String) value; | 646 String new_XtValue = (String) value; |
641 String old_XtValue = NULL; | 647 String old_XtValue = NULL; |
642 Arg av[2]; | 648 Arg al[2]; |
643 | 649 |
644 #ifdef MULE | 650 #ifdef MULE |
645 Bufbyte *ptr; | 651 Bufbyte *ptr; |
646 /* Optimize for common ASCII case */ | 652 /* Optimize for common ASCII case */ |
647 for (ptr = value; *ptr; ptr++) | 653 for (ptr = value; *ptr; ptr++) |
654 break; | 660 break; |
655 } | 661 } |
656 #endif /* MULE */ | 662 #endif /* MULE */ |
657 | 663 |
658 /* ### Caching is device-independent - belongs in update_frame_title. */ | 664 /* ### Caching is device-independent - belongs in update_frame_title. */ |
659 XtSetArg (av[0], Xt_resource_name, &old_XtValue); | 665 XtSetArg (al[0], Xt_resource_name, &old_XtValue); |
660 XtGetValues (FRAME_X_SHELL_WIDGET (f), av, 1); | 666 XtGetValues (FRAME_X_SHELL_WIDGET (f), al, 1); |
661 if (!old_XtValue || strcmp (new_XtValue, old_XtValue)) | 667 if (!old_XtValue || strcmp (new_XtValue, old_XtValue)) |
662 { | 668 { |
663 XtSetArg (av[0], Xt_resource_name, new_XtValue); | 669 XtSetArg (al[0], Xt_resource_name, new_XtValue); |
664 XtSetArg (av[1], Xt_resource_encoding_name, encoding); | 670 XtSetArg (al[1], Xt_resource_encoding_name, encoding); |
665 XtSetValues (FRAME_X_SHELL_WIDGET (f), av, 2); | 671 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2); |
666 } | 672 } |
667 } | 673 } |
668 | 674 |
669 static void | 675 static void |
670 x_set_title_from_bufbyte (struct frame *f, Bufbyte *name) | 676 x_set_title_from_bufbyte (struct frame *f, Bufbyte *name) |
693 int xval, yval; | 699 int xval, yval; |
694 char xsign, ysign; | 700 char xsign, ysign; |
695 char uspos = !!(flags & (XValue | YValue)); | 701 char uspos = !!(flags & (XValue | YValue)); |
696 char ussize = !!(flags & (WidthValue | HeightValue)); | 702 char ussize = !!(flags & (WidthValue | HeightValue)); |
697 char *temp; | 703 char *temp; |
704 Arg al [1]; | |
698 | 705 |
699 /* assign the correct size to the EmacsFrame widget ... */ | 706 /* assign the correct size to the EmacsFrame widget ... */ |
700 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), w, h); | 707 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), w, h); |
701 | 708 |
702 /* and also set the WMShell's geometry */ | 709 /* and also set the WMShell's geometry */ |
716 strcpy (temp, shell_geom); | 723 strcpy (temp, shell_geom); |
717 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp; | 724 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp; |
718 } | 725 } |
719 else | 726 else |
720 temp = NULL; | 727 temp = NULL; |
721 XtVaSetValues (FRAME_X_SHELL_WIDGET (f), XtNgeometry, temp, NULL); | 728 |
729 XtSetArg (al [0], XtNgeometry, temp); | |
730 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 1); | |
722 } | 731 } |
723 | 732 |
724 /* Report to X that a frame property of frame S is being set or changed. | 733 /* Report to X that a frame property of frame S is being set or changed. |
725 If the property is not specially recognized, do nothing. | 734 If the property is not specially recognized, do nothing. |
726 */ | 735 */ |
735 Bool x_position_specified_p = False; | 744 Bool x_position_specified_p = False; |
736 Bool y_position_specified_p = False; | 745 Bool y_position_specified_p = False; |
737 Bool internal_border_width_specified = False; | 746 Bool internal_border_width_specified = False; |
738 Lisp_Object tail; | 747 Lisp_Object tail; |
739 Widget w = FRAME_X_TEXT_WIDGET (f); | 748 Widget w = FRAME_X_TEXT_WIDGET (f); |
749 Arg al [10]; | |
740 | 750 |
741 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) | 751 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) |
742 { | 752 { |
743 Lisp_Object prop = Fcar (tail); | 753 Lisp_Object prop = Fcar (tail); |
744 Lisp_Object val = Fcar (Fcdr (tail)); | 754 Lisp_Object val = Fcar (Fcdr (tail)); |
756 Extbyte *extval; | 766 Extbyte *extval; |
757 Extcount extvallen; | 767 Extcount extvallen; |
758 | 768 |
759 GET_STRING_CTEXT_DATA_ALLOCA (val, extval, extvallen); | 769 GET_STRING_CTEXT_DATA_ALLOCA (val, extval, extvallen); |
760 XtVaSetValues (w, XtVaTypedArg, extprop, | 770 XtVaSetValues (w, XtVaTypedArg, extprop, |
761 XtRString, extval, extvallen + 1, NULL); | 771 XtRString, extval, extvallen + 1, |
772 (XtArgVal) NULL); | |
762 } | 773 } |
763 else | 774 else |
764 XtVaSetValues (w, XtVaTypedArg, | 775 XtVaSetValues (w, XtVaTypedArg, extprop, XtRInt, |
765 extprop, XtRInt, XINT (val), | 776 XINT (val), sizeof (int), |
766 sizeof (int), | 777 (XtArgVal) NULL); |
767 NULL); | |
768 } | 778 } |
769 else if (SYMBOLP (prop)) | 779 else if (SYMBOLP (prop)) |
770 { | 780 { |
771 Lisp_Object str = Fget (prop, Qx_resource_name, Qnil); | 781 Lisp_Object str = Fget (prop, Qx_resource_name, Qnil); |
772 int int_p = !NILP (Fget (prop, Qintegerp, Qnil)); | 782 int int_p = !NILP (Fget (prop, Qintegerp, Qnil)); |
835 } | 845 } |
836 | 846 |
837 if (int_p) | 847 if (int_p) |
838 { | 848 { |
839 CHECK_INT (val); | 849 CHECK_INT (val); |
840 XtVaSetValues (w, (char *) XSTRING_DATA (str), | 850 XtSetArg (al [0], (char *) XSTRING_DATA (str), XINT (val)); |
841 XINT (val), NULL); | 851 XtSetValues (w, al, 1); |
842 } | 852 } |
843 else if (EQ (val, Qt)) | 853 else if (EQ (val, Qt)) |
844 XtVaSetValues (w, | 854 { |
845 /* XtN... */ | 855 XtSetArg (al [0], (char *) XSTRING_DATA (str), True); /* XtN...*/ |
846 (char *) XSTRING_DATA (str), | 856 XtSetValues (w, al, 1); |
847 True, | 857 } |
848 NULL); | |
849 else if (EQ (val, Qnil)) | 858 else if (EQ (val, Qnil)) |
850 XtVaSetValues (w, | 859 { |
851 /* XtN... */ | 860 XtSetArg (al [0], (char *) XSTRING_DATA (str), False); /* XtN...*/ |
852 (char *) XSTRING_DATA (str), | 861 XtSetValues (w, al, 1); |
853 False, | 862 } |
854 NULL); | |
855 else | 863 else |
856 { | 864 { |
857 CHECK_STRING (val); | 865 CHECK_STRING (val); |
858 XtVaSetValues (w, XtVaTypedArg, | 866 XtVaSetValues (w, XtVaTypedArg, |
859 /* XtN... */ | 867 /* XtN... */ |
860 (char *) XSTRING_DATA (str), | 868 (char *) XSTRING_DATA (str), |
861 XtRString, | 869 XtRString, |
862 XSTRING_DATA (val), | 870 XSTRING_DATA (val), |
863 XSTRING_LENGTH (val) + 1, | 871 XSTRING_LENGTH (val) + 1, |
864 NULL); | 872 (XtArgVal) NULL); |
865 } | 873 } |
866 | 874 |
867 #ifdef HAVE_SCROLLBARS | 875 #ifdef HAVE_SCROLLBARS |
868 if (!strcmp ((char *) XSTRING_DATA (str), "scrollBarWidth") | 876 if (!strcmp ((char *) XSTRING_DATA (str), "scrollBarWidth") |
869 || !strcmp ((char *) XSTRING_DATA (str), | 877 || !strcmp ((char *) XSTRING_DATA (str), |
1298 unsigned int h = 40; | 1306 unsigned int h = 40; |
1299 int flags = 0; | 1307 int flags = 0; |
1300 | 1308 |
1301 char *geom = 0, *ew_geom = 0; | 1309 char *geom = 0, *ew_geom = 0; |
1302 Boolean iconic_p = False, ew_iconic_p = False; | 1310 Boolean iconic_p = False, ew_iconic_p = False; |
1311 Arg al [2]; | |
1303 | 1312 |
1304 Widget wmshell = FRAME_X_SHELL_WIDGET (f); | 1313 Widget wmshell = FRAME_X_SHELL_WIDGET (f); |
1305 /* #### This may not be an ApplicationShell any more, with the 'popup | 1314 /* #### This may not be an ApplicationShell any more, with the 'popup |
1306 frame property. */ | 1315 frame property. */ |
1307 Widget app_shell = XtParent (wmshell); | 1316 Widget app_shell = XtParent (wmshell); |
1352 is. (Assume it is smart and pays attention to our values.) | 1361 is. (Assume it is smart and pays attention to our values.) |
1353 */ | 1362 */ |
1354 | 1363 |
1355 if (!FRAME_X_TOP_LEVEL_FRAME_P (f)) | 1364 if (!FRAME_X_TOP_LEVEL_FRAME_P (f)) |
1356 { | 1365 { |
1357 XtVaGetValues (ew, XtNgeometry, &ew_geom, NULL); | 1366 XtSetArg (al [0], XtNgeometry, &ew_geom); |
1367 XtGetValues (ew, al, 1); | |
1358 if (ew_geom) | 1368 if (ew_geom) |
1359 frame_flags = XParseGeometry (ew_geom, &frame_x, &frame_y, | 1369 frame_flags = XParseGeometry (ew_geom, |
1360 &frame_w, &frame_h); | 1370 &frame_x, &frame_y, |
1371 &frame_w, &frame_h); | |
1361 if (! (frame_flags & (WidthValue | HeightValue))) | 1372 if (! (frame_flags & (WidthValue | HeightValue))) |
1362 { | 1373 { |
1363 XtVaGetValues (ew, XtNwidth, &frame_w, | 1374 XtSetArg (al [0], XtNwidth, &frame_w); |
1364 XtNheight, &frame_h, NULL); | 1375 XtSetArg (al [1], XtNheight, &frame_h); |
1376 XtGetValues (ew, al, 2); | |
1365 if (!frame_w && !frame_h) | 1377 if (!frame_w && !frame_h) |
1366 { | 1378 { |
1367 frame_w = 64; | 1379 frame_w = 64; |
1368 frame_h = 12; | 1380 frame_h = 12; |
1369 frame_flags |= WidthValue | HeightValue; | 1381 frame_flags |= WidthValue | HeightValue; |
1371 } | 1383 } |
1372 if (frame_flags & (WidthValue | HeightValue)) | 1384 if (frame_flags & (WidthValue | HeightValue)) |
1373 EmacsFrameSetCharSize (ew, frame_w, frame_h); | 1385 EmacsFrameSetCharSize (ew, frame_w, frame_h); |
1374 if (frame_flags & (XValue | YValue)) | 1386 if (frame_flags & (XValue | YValue)) |
1375 { | 1387 { |
1376 XtVaGetValues (ew, XtNwidth, &frame_w, | 1388 XtSetArg (al [0], XtNwidth, &frame_w); |
1377 XtNheight, &frame_h, NULL); | 1389 XtSetArg (al [1], XtNheight, &frame_h); |
1390 XtGetValues (ew, al, 2); | |
1391 | |
1378 if (frame_flags & XNegative) | 1392 if (frame_flags & XNegative) |
1379 frame_x += frame_w; | 1393 frame_x += frame_w; |
1380 if (frame_flags & YNegative) | 1394 if (frame_flags & YNegative) |
1381 frame_y += frame_h; | 1395 frame_y += frame_h; |
1382 XtVaSetValues (ew, XtNx, frame_x, XtNy, frame_y, NULL); | 1396 |
1397 XtSetArg (al [0], XtNx, frame_x); | |
1398 XtSetArg (al [1], XtNy, frame_y); | |
1399 XtSetValues (ew, al, 2); | |
1383 } | 1400 } |
1384 return; | 1401 return; |
1385 } | 1402 } |
1386 #endif | 1403 #endif |
1387 | 1404 |
1389 | 1406 |
1390 if (!XtIsWMShell (wmshell)) | 1407 if (!XtIsWMShell (wmshell)) |
1391 abort (); | 1408 abort (); |
1392 | 1409 |
1393 /* If the EmacsFrame doesn't have a geometry but the shell does, | 1410 /* If the EmacsFrame doesn't have a geometry but the shell does, |
1394 treat that as the geometry of the frame. (Is this bogus? | 1411 treat that as the geometry of the frame. |
1395 I'm not sure.) */ | 1412 (Is this bogus? I'm not sure.) */ |
1396 | 1413 |
1397 XtVaGetValues (ew, XtNgeometry, &ew_geom, NULL); | 1414 XtSetArg (al [0], XtNgeometry, &ew_geom); |
1415 XtGetValues (ew, al, 1); | |
1398 if (!ew_geom) | 1416 if (!ew_geom) |
1399 { | 1417 { |
1400 XtVaGetValues (wmshell, XtNgeometry, &geom, NULL); | 1418 XtSetArg (al [0], XtNgeometry, &geom); |
1419 XtGetValues (wmshell, al, 1); | |
1401 if (geom) | 1420 if (geom) |
1402 { | 1421 { |
1403 ew_geom = geom; | 1422 ew_geom = geom; |
1404 XtVaSetValues (ew, XtNgeometry, ew_geom, NULL); | 1423 XtSetArg (al [0], XtNgeometry, ew_geom); |
1424 XtSetValues (ew, al, 1); | |
1405 } | 1425 } |
1406 } | 1426 } |
1407 | 1427 |
1408 /* If the Shell is iconic, then the EmacsFrame is iconic. (Is | 1428 /* If the Shell is iconic, then the EmacsFrame is iconic. |
1409 this bogus? I'm not sure.) */ | 1429 (Is this bogus? I'm not sure.) */ |
1410 XtVaGetValues (ew, XtNiconic, &ew_iconic_p, NULL); | 1430 XtSetArg (al [0], XtNiconic, &ew_iconic_p); |
1431 XtGetValues (ew, al, 1); | |
1411 if (!ew_iconic_p) | 1432 if (!ew_iconic_p) |
1412 { | 1433 { |
1413 XtVaGetValues (wmshell, XtNiconic, &iconic_p, NULL); | 1434 XtSetArg (al [0], XtNiconic, &iconic_p); |
1435 XtGetValues (wmshell, al, 1); | |
1414 if (iconic_p) | 1436 if (iconic_p) |
1415 { | 1437 { |
1416 ew_iconic_p = iconic_p; | 1438 ew_iconic_p = iconic_p; |
1417 XtVaSetValues (ew, XtNiconic, iconic_p, NULL); | 1439 XtSetArg (al [0], XtNiconic, iconic_p); |
1440 XtSetValues (ew, al, 1); | |
1418 } | 1441 } |
1419 } | 1442 } |
1420 | 1443 |
1421 XtVaGetValues (app_shell, XtNgeometry, &geom, NULL); | 1444 XtSetArg (al [0], XtNgeometry, &geom); |
1445 XtGetValues (app_shell, al, 1); | |
1422 if (geom) | 1446 if (geom) |
1423 app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h); | 1447 app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h); |
1424 | 1448 |
1425 if (ew_geom) | 1449 if (ew_geom) |
1426 frame_flags = XParseGeometry (ew_geom, &frame_x, &frame_y, | 1450 frame_flags = XParseGeometry (ew_geom, |
1427 &frame_w, &frame_h); | 1451 &frame_x, &frame_y, |
1452 &frame_w, &frame_h); | |
1428 | 1453 |
1429 if (first_x_frame_p (f)) | 1454 if (first_x_frame_p (f)) |
1430 { | 1455 { |
1431 /* If this is the first frame created: | 1456 /* If this is the first frame created: |
1432 ==================================== | 1457 ==================================== |
1465 } | 1490 } |
1466 | 1491 |
1467 /* If the AppShell is iconic, then the EmacsFrame is iconic. */ | 1492 /* If the AppShell is iconic, then the EmacsFrame is iconic. */ |
1468 if (!ew_iconic_p) | 1493 if (!ew_iconic_p) |
1469 { | 1494 { |
1470 XtVaGetValues (app_shell, XtNiconic, &iconic_p, NULL); | 1495 XtSetArg (al [0], XtNiconic, &iconic_p); |
1496 XtGetValues (app_shell, al, 1); | |
1471 if (iconic_p) | 1497 if (iconic_p) |
1472 { | 1498 { |
1473 ew_iconic_p = iconic_p; | 1499 ew_iconic_p = iconic_p; |
1474 XtVaSetValues (ew, XtNiconic, iconic_p, NULL); | 1500 XtSetArg (al [0], XtNiconic, iconic_p); |
1501 XtSetValues (ew, al, 1); | |
1475 } | 1502 } |
1476 } | 1503 } |
1477 } | 1504 } |
1478 else | 1505 else |
1479 { | 1506 { |
1559 #ifdef HAVE_SCROLLBARS | 1586 #ifdef HAVE_SCROLLBARS |
1560 { | 1587 { |
1561 /* The scrollbar positioning is completely handled by redisplay. We | 1588 /* The scrollbar positioning is completely handled by redisplay. We |
1562 just need to know which sides they are supposed to go on. */ | 1589 just need to know which sides they are supposed to go on. */ |
1563 unsigned char scrollbar_placement; | 1590 unsigned char scrollbar_placement; |
1564 XtVaGetValues (text, XtNscrollBarPlacement, &scrollbar_placement, NULL); | 1591 Arg al [1]; |
1592 | |
1593 XtSetArg (al [0], XtNscrollBarPlacement, &scrollbar_placement); | |
1594 XtGetValues (text, al, 1); | |
1565 f->scrollbar_on_left = (scrollbar_placement == XtTOP_LEFT || | 1595 f->scrollbar_on_left = (scrollbar_placement == XtTOP_LEFT || |
1566 scrollbar_placement == XtBOTTOM_LEFT); | 1596 scrollbar_placement == XtBOTTOM_LEFT); |
1567 f->scrollbar_on_top = (scrollbar_placement == XtTOP_LEFT || | 1597 f->scrollbar_on_top = (scrollbar_placement == XtTOP_LEFT || |
1568 scrollbar_placement == XtTOP_RIGHT); | 1598 scrollbar_placement == XtTOP_RIGHT); |
1569 f->scrollbar_y_offset = topbreadth + textbord; | 1599 f->scrollbar_y_offset = topbreadth + textbord; |
1619 struct device *d = XDEVICE (f->device); | 1649 struct device *d = XDEVICE (f->device); |
1620 #ifdef EXTERNAL_WIDGET | 1650 #ifdef EXTERNAL_WIDGET |
1621 Window window_id = 0; | 1651 Window window_id = 0; |
1622 #endif | 1652 #endif |
1623 CONST char *name; | 1653 CONST char *name; |
1624 Arg av [25]; | 1654 Arg al [25]; |
1625 int ac = 0; | 1655 int ac = 0; |
1626 Widget text, container, shell; | 1656 Widget text, container, shell; |
1627 Widget parentwid = 0; | 1657 Widget parentwid = 0; |
1628 #ifdef HAVE_MENUBARS | 1658 #ifdef HAVE_MENUBARS |
1629 int menubar_visible; | 1659 int menubar_visible; |
1679 } else | 1709 } else |
1680 #endif /* EXTERNAL_WIDGET */ | 1710 #endif /* EXTERNAL_WIDGET */ |
1681 FRAME_X_TOP_LEVEL_FRAME_P (f) = 1; | 1711 FRAME_X_TOP_LEVEL_FRAME_P (f) = 1; |
1682 | 1712 |
1683 ac = 0; | 1713 ac = 0; |
1684 XtSetArg (av[ac], XtNallowShellResize, True); ac++; | 1714 XtSetArg (al[ac], XtNallowShellResize, True); ac++; |
1685 #ifdef LWLIB_USES_MOTIF | 1715 #ifdef LWLIB_USES_MOTIF |
1686 /* Motif sucks beans. Without this in here, it will delete the window | 1716 /* Motif sucks beans. Without this in here, it will delete the window |
1687 out from under us when it receives a WM_DESTROY_WINDOW message | 1717 out from under us when it receives a WM_DESTROY_WINDOW message |
1688 from the WM. */ | 1718 from the WM. */ |
1689 XtSetArg (av[ac], XmNdeleteResponse, XmDO_NOTHING); ac++; | 1719 XtSetArg (al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++; |
1690 #endif | 1720 #endif |
1691 | 1721 |
1692 #ifdef EXTERNAL_WIDGET | 1722 #ifdef EXTERNAL_WIDGET |
1693 if (window_id) | 1723 if (window_id) |
1694 { | 1724 { |
1695 XtSetArg (av[ac], XtNwindow, window_id); ac++; | 1725 XtSetArg (al[ac], XtNwindow, window_id); ac++; |
1696 } | 1726 } |
1697 else | 1727 else |
1698 #endif /* EXTERNAL_WIDGET */ | 1728 #endif /* EXTERNAL_WIDGET */ |
1699 { | 1729 { |
1700 XtSetArg (av[ac], XtNinput, True); ac++; | 1730 XtSetArg (al[ac], XtNinput, True); ac++; |
1701 XtSetArg (av[ac], (String) XtNminWidthCells, 10); ac++; | 1731 XtSetArg (al[ac], XtNminWidthCells, 10); ac++; |
1702 XtSetArg (av[ac], (String) XtNminHeightCells, 1); ac++; | 1732 XtSetArg (al[ac], XtNminHeightCells, 1); ac++; |
1703 } | 1733 } |
1704 | 1734 |
1705 if (!NILP (parent)) | 1735 if (!NILP (parent)) |
1706 { | 1736 { |
1707 parentwid = FRAME_X_SHELL_WIDGET (XFRAME (parent)); | 1737 parentwid = FRAME_X_SHELL_WIDGET (XFRAME (parent)); |
1708 XtSetArg (av[ac], XtNtransientFor, parentwid); ac++; | 1738 XtSetArg (al[ac], XtNtransientFor, parentwid); ac++; |
1709 } | 1739 } |
1710 | 1740 |
1711 shell = XtCreatePopupShell ("shell", | 1741 shell = XtCreatePopupShell ("shell", |
1712 ( | 1742 ( |
1713 #ifdef EXTERNAL_WIDGET | 1743 #ifdef EXTERNAL_WIDGET |
1716 parentwid ? transientEmacsShellWidgetClass : | 1746 parentwid ? transientEmacsShellWidgetClass : |
1717 topLevelEmacsShellWidgetClass | 1747 topLevelEmacsShellWidgetClass |
1718 ), | 1748 ), |
1719 parentwid ? parentwid : | 1749 parentwid ? parentwid : |
1720 DEVICE_XT_APP_SHELL (d), | 1750 DEVICE_XT_APP_SHELL (d), |
1721 av, ac); | 1751 al, ac); |
1722 FRAME_X_SHELL_WIDGET (f) = shell; | 1752 FRAME_X_SHELL_WIDGET (f) = shell; |
1723 maybe_set_frame_title_format (shell); | 1753 maybe_set_frame_title_format (shell); |
1724 | 1754 |
1725 /* Create the manager widget */ | 1755 /* Create the manager widget */ |
1726 container = XtVaCreateWidget ("container", | 1756 container = XtCreateWidget ("container", |
1727 emacsManagerWidgetClass, | 1757 emacsManagerWidgetClass, shell, NULL, 0); |
1728 shell, NULL); | |
1729 FRAME_X_CONTAINER_WIDGET (f) = container; | 1758 FRAME_X_CONTAINER_WIDGET (f) = container; |
1730 XtAddCallback (container, XtNresizeCallback, x_layout_widgets, | 1759 XtAddCallback (container, XtNresizeCallback, x_layout_widgets, |
1731 (XtPointer) f); | 1760 (XtPointer) f); |
1732 XtAddCallback (container, XtNqueryGeometryCallback, x_do_query_geometry, | 1761 XtAddCallback (container, XtNqueryGeometryCallback, x_do_query_geometry, |
1733 (XtPointer) f); | 1762 (XtPointer) f); |
1734 | 1763 |
1735 /* Create the text area */ | 1764 /* Create the text area */ |
1736 ac = 0; | 1765 XtSetArg (al [0], XtNborderWidth, 0); /* should this be settable? */ |
1737 XtSetArg (av[ac], XtNborderWidth, 0); ac++; /* should this be settable? */ | 1766 XtSetArg (al [1], XtNemacsFrame, f); |
1738 XtSetArg (av[ac], (String) XtNemacsFrame, f); ac++; | 1767 text = XtCreateWidget (name, emacsFrameClass, container, al, 2); |
1739 text = XtCreateWidget (name, | |
1740 emacsFrameClass, | |
1741 container, av, ac); | |
1742 FRAME_X_TEXT_WIDGET (f) = text; | 1768 FRAME_X_TEXT_WIDGET (f) = text; |
1743 | 1769 |
1744 #ifdef HAVE_MENUBARS | 1770 #ifdef HAVE_MENUBARS |
1745 /* Create the initial menubar widget. */ | 1771 /* Create the initial menubar widget. */ |
1746 menubar_visible = x_initialize_frame_menubar (f); | 1772 menubar_visible = x_initialize_frame_menubar (f); |
1771 static void | 1797 static void |
1772 xemacs_XtPopup (Widget widget) | 1798 xemacs_XtPopup (Widget widget) |
1773 { | 1799 { |
1774 ShellWidget shell_widget = (ShellWidget) widget; | 1800 ShellWidget shell_widget = (ShellWidget) widget; |
1775 XtGrabKind call_data = XtGrabNone; | 1801 XtGrabKind call_data = XtGrabNone; |
1802 Arg al [1]; | |
1776 | 1803 |
1777 XtCallCallbacks (widget, XtNpopupCallback, (XtPointer)&call_data); | 1804 XtCallCallbacks (widget, XtNpopupCallback, (XtPointer)&call_data); |
1778 | 1805 |
1779 shell_widget->shell.popped_up = TRUE; | 1806 shell_widget->shell.popped_up = TRUE; |
1780 shell_widget->shell.grab_kind = XtGrabNone; | 1807 shell_widget->shell.grab_kind = XtGrabNone; |
1781 shell_widget->shell.spring_loaded = False; | 1808 shell_widget->shell.spring_loaded = False; |
1782 | 1809 |
1783 if (shell_widget->shell.create_popup_child_proc != NULL) | 1810 if (shell_widget->shell.create_popup_child_proc != NULL) |
1784 (*(shell_widget->shell.create_popup_child_proc))(widget); | 1811 (*(shell_widget->shell.create_popup_child_proc))(widget); |
1785 | 1812 |
1786 /* The XtVaSetValues below are not in XtPopup menu. We just want to | 1813 /* The XtSetValues below are not in XtPopup menu. We just want to |
1787 make absolutely sure... */ | 1814 make absolutely sure... */ |
1788 XtVaSetValues (widget, XtNmappedWhenManaged, False, NULL); | 1815 XtSetArg (al [0], XtNmappedWhenManaged, False); |
1816 XtSetValues (widget, al, 1); | |
1789 XtRealizeWidget (widget); | 1817 XtRealizeWidget (widget); |
1790 XtVaSetValues (widget, XtNmappedWhenManaged, True, NULL); | 1818 XtSetArg (al [0], XtNmappedWhenManaged, True); |
1819 XtSetValues (widget, al, 1); | |
1791 } | 1820 } |
1792 | 1821 |
1793 #ifdef HAVE_CDE | 1822 #ifdef HAVE_CDE |
1794 /* Does this have to be non-automatic? */ | 1823 /* Does this have to be non-automatic? */ |
1795 /* hack frame to respond to dnd messages */ | 1824 /* hack frame to respond to dnd messages */ |
1993 x_mask = 0; | 2022 x_mask = 0; |
1994 } | 2023 } |
1995 | 2024 |
1996 /* Store the X data into the widget. */ | 2025 /* Store the X data into the widget. */ |
1997 { | 2026 { |
1998 Arg av [10]; | 2027 Arg al [2]; |
1999 int ac = 0; | 2028 XtSetArg (al [0], XtNiconPixmap, x_pixmap); |
2000 XtSetArg (av [ac], XtNiconPixmap, x_pixmap); ac++; | 2029 XtSetArg (al [1], XtNiconMask, x_mask); |
2001 XtSetArg (av [ac], XtNiconMask, x_mask); ac++; | 2030 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2); |
2002 XtSetValues (FRAME_X_SHELL_WIDGET (f), av, ac); | |
2003 } | 2031 } |
2004 } | 2032 } |
2005 | 2033 |
2006 static void | 2034 static void |
2007 x_set_frame_pointer (struct frame *f) | 2035 x_set_frame_pointer (struct frame *f) |
2014 | 2042 |
2015 static Lisp_Object | 2043 static Lisp_Object |
2016 x_get_frame_parent (struct frame *f) | 2044 x_get_frame_parent (struct frame *f) |
2017 { | 2045 { |
2018 Widget parentwid = 0; | 2046 Widget parentwid = 0; |
2019 Arg av[1]; | 2047 Arg al[1]; |
2020 | 2048 |
2021 XtSetArg (av[0], XtNtransientFor, &parentwid); | 2049 XtSetArg (al[0], XtNtransientFor, &parentwid); |
2022 XtGetValues (FRAME_X_SHELL_WIDGET (f), av, 1); | 2050 XtGetValues (FRAME_X_SHELL_WIDGET (f), al, 1); |
2023 /* find the frame whose wid is parentwid */ | 2051 /* find the frame whose wid is parentwid */ |
2024 if (parentwid) | 2052 if (parentwid) |
2025 { | 2053 { |
2026 Lisp_Object frmcons; | 2054 Lisp_Object frmcons; |
2027 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f))) | 2055 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f))) |
2061 Display *dpy = XtDisplay (w); | 2089 Display *dpy = XtDisplay (w); |
2062 Dimension frame_w = DisplayWidth (dpy, DefaultScreen (dpy)); | 2090 Dimension frame_w = DisplayWidth (dpy, DefaultScreen (dpy)); |
2063 Dimension frame_h = DisplayHeight (dpy, DefaultScreen (dpy)); | 2091 Dimension frame_h = DisplayHeight (dpy, DefaultScreen (dpy)); |
2064 Dimension shell_w, shell_h, shell_bord; | 2092 Dimension shell_w, shell_h, shell_bord; |
2065 int win_gravity; | 2093 int win_gravity; |
2066 | 2094 Arg al [3]; |
2067 XtVaGetValues (w, | 2095 |
2068 XtNwidth, &shell_w, | 2096 XtSetArg (al [0], XtNwidth, &shell_w); |
2069 XtNheight, &shell_h, | 2097 XtSetArg (al [1], XtNheight, &shell_h); |
2070 XtNborderWidth, &shell_bord, | 2098 XtSetArg (al [2], XtNborderWidth, &shell_bord); |
2071 NULL); | 2099 XtGetValues (w, al, 3); |
2072 | 2100 |
2073 win_gravity = | 2101 win_gravity = |
2074 xoff >= 0 && yoff >= 0 ? NorthWestGravity : | 2102 xoff >= 0 && yoff >= 0 ? NorthWestGravity : |
2075 xoff >= 0 ? SouthWestGravity : | 2103 xoff >= 0 ? SouthWestGravity : |
2076 yoff >= 0 ? NorthEastGravity : | 2104 yoff >= 0 ? NorthEastGravity : |
2082 | 2110 |
2083 /* Update the hints so that, if this window is currently iconified, it will | 2111 /* Update the hints so that, if this window is currently iconified, it will |
2084 come back at the right place. We can't look at s->visible to determine | 2112 come back at the right place. We can't look at s->visible to determine |
2085 whether it is iconified because it might not be up-to-date yet (the queue | 2113 whether it is iconified because it might not be up-to-date yet (the queue |
2086 might not be processed). */ | 2114 might not be processed). */ |
2087 XtVaSetValues (w, | 2115 XtSetArg (al [0], XtNwinGravity, win_gravity); |
2088 XtNwinGravity, win_gravity, | 2116 XtSetArg (al [1], XtNx, xoff); |
2089 XtNx, xoff, | 2117 XtSetArg (al [2], XtNy, yoff); |
2090 XtNy, yoff, | 2118 XtSetValues (w, al, 3); |
2091 NULL); | |
2092 | 2119 |
2093 /* Sometimes you will find that | 2120 /* Sometimes you will find that |
2094 | 2121 |
2095 (set-frame-position (selected-frame) -50 -50) | 2122 (set-frame-position (selected-frame) -50 -50) |
2096 | 2123 |