Mercurial > hg > xemacs-beta
comparison src/frame-x.c @ 163:0132846995bd r20-3b8
Import from CVS: tag r20-3b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:43:35 +0200 |
parents | 360340f9fd5f |
children | 5a88923fcbfe |
comparison
equal
deleted
inserted
replaced
162:4de2936b4e77 | 163:0132846995bd |
---|---|
199 if (! XtIsWMShell (shell)) abort (); | 199 if (! XtIsWMShell (shell)) abort (); |
200 | 200 |
201 /* Because of questionable logic in Shell.c, this sequence can't work: | 201 /* Because of questionable logic in Shell.c, this sequence can't work: |
202 | 202 |
203 w = XtCreatePopupShell (...); | 203 w = XtCreatePopupShell (...); |
204 XtVaSetValues (w, XtNiconic, True, 0); | 204 XtVaSetValues (w, XtNiconic, True, NULL); |
205 XtRealizeWidget (w); | 205 XtRealizeWidget (w); |
206 | 206 |
207 The iconic resource is only consulted at initialization time (when | 207 The iconic resource is only consulted at initialization time (when |
208 XtCreatePopupShell is called) instead of at realization time (just | 208 XtCreatePopupShell is called) instead of at realization time (just |
209 before the window gets created, which would be more sensible) or | 209 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. | 214 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 | 215 Calls to XtSetValues are ignored in the window between creation and |
216 realization. This is true of MIT X11R5 patch level 25, at least. | 216 realization. This is true of MIT X11R5 patch level 25, at least. |
217 (Apparently some other versions of Xt don't have this bug?) | 217 (Apparently some other versions of Xt don't have this bug?) |
218 */ | 218 */ |
219 XtVaSetValues (shell, XtNiconic, iconic_p, 0); | 219 XtVaSetValues (shell, XtNiconic, iconic_p, NULL); |
220 EmacsShellSmashIconicHint (shell, iconic_p); | 220 EmacsShellSmashIconicHint (shell, iconic_p); |
221 } | 221 } |
222 | 222 |
223 void | 223 void |
224 x_wm_set_cell_size (Widget wmshell, int cw, int ch) | 224 x_wm_set_cell_size (Widget wmshell, int cw, int ch) |
229 abort (); | 229 abort (); |
230 | 230 |
231 XtVaSetValues (wmshell, | 231 XtVaSetValues (wmshell, |
232 XtNwidthInc, cw, | 232 XtNwidthInc, cw, |
233 XtNheightInc, ch, | 233 XtNheightInc, ch, |
234 0); | 234 NULL); |
235 } | 235 } |
236 | 236 |
237 void | 237 void |
238 x_wm_set_variable_size (Widget wmshell, int width, int height) | 238 x_wm_set_variable_size (Widget wmshell, int width, int height) |
239 { | 239 { |
245 fflush (stdout); | 245 fflush (stdout); |
246 #endif | 246 #endif |
247 XtVaSetValues (wmshell, | 247 XtVaSetValues (wmshell, |
248 XtNwidthCells, width, | 248 XtNwidthCells, width, |
249 XtNheightCells, height, | 249 XtNheightCells, height, |
250 0); | 250 NULL); |
251 } | 251 } |
252 | 252 |
253 /* If the WM_PROTOCOLS property does not already contain WM_TAKE_FOCUS | 253 /* 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 | 254 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). | 255 because of the toolkit (Motif adds them, for example, but Xt doesn't). |
716 strcpy (temp, shell_geom); | 716 strcpy (temp, shell_geom); |
717 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp; | 717 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp; |
718 } | 718 } |
719 else | 719 else |
720 temp = NULL; | 720 temp = NULL; |
721 XtVaSetValues (FRAME_X_SHELL_WIDGET (f), XtNgeometry, temp, 0); | 721 XtVaSetValues (FRAME_X_SHELL_WIDGET (f), XtNgeometry, temp, NULL); |
722 } | 722 } |
723 | 723 |
724 /* Report to X that a frame property of frame S is being set or changed. | 724 /* 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. | 725 If the property is not specially recognized, do nothing. |
726 */ | 726 */ |
756 Extbyte *extval; | 756 Extbyte *extval; |
757 Extcount extvallen; | 757 Extcount extvallen; |
758 | 758 |
759 GET_STRING_CTEXT_DATA_ALLOCA (val, extval, extvallen); | 759 GET_STRING_CTEXT_DATA_ALLOCA (val, extval, extvallen); |
760 XtVaSetValues (w, XtVaTypedArg, extprop, | 760 XtVaSetValues (w, XtVaTypedArg, extprop, |
761 XtRString, extval, extvallen + 1, 0); | 761 XtRString, extval, extvallen + 1, NULL); |
762 } | 762 } |
763 else | 763 else |
764 XtVaSetValues (w, XtVaTypedArg, | 764 XtVaSetValues (w, XtVaTypedArg, |
765 extprop, XtRInt, XINT (val), | 765 extprop, XtRInt, XINT (val), |
766 sizeof (int), | 766 sizeof (int), |
767 0); | 767 NULL); |
768 } | 768 } |
769 else if (SYMBOLP (prop)) | 769 else if (SYMBOLP (prop)) |
770 { | 770 { |
771 Lisp_Object str = Fget (prop, Qx_resource_name, Qnil); | 771 Lisp_Object str = Fget (prop, Qx_resource_name, Qnil); |
772 int int_p = !NILP (Fget (prop, Qintegerp, Qnil)); | 772 int int_p = !NILP (Fget (prop, Qintegerp, Qnil)); |
836 | 836 |
837 if (int_p) | 837 if (int_p) |
838 { | 838 { |
839 CHECK_INT (val); | 839 CHECK_INT (val); |
840 XtVaSetValues (w, (char *) XSTRING_DATA (str), | 840 XtVaSetValues (w, (char *) XSTRING_DATA (str), |
841 XINT (val), 0); | 841 XINT (val), NULL); |
842 } | 842 } |
843 else if (EQ (val, Qt)) | 843 else if (EQ (val, Qt)) |
844 XtVaSetValues (w, | 844 XtVaSetValues (w, |
845 /* XtN... */ | 845 /* XtN... */ |
846 (char *) XSTRING_DATA (str), | 846 (char *) XSTRING_DATA (str), |
847 True, | 847 True, |
848 0); | 848 NULL); |
849 else if (EQ (val, Qnil)) | 849 else if (EQ (val, Qnil)) |
850 XtVaSetValues (w, | 850 XtVaSetValues (w, |
851 /* XtN... */ | 851 /* XtN... */ |
852 (char *) XSTRING_DATA (str), | 852 (char *) XSTRING_DATA (str), |
853 False, | 853 False, |
854 0); | 854 NULL); |
855 else | 855 else |
856 { | 856 { |
857 CHECK_STRING (val); | 857 CHECK_STRING (val); |
858 XtVaSetValues (w, XtVaTypedArg, | 858 XtVaSetValues (w, XtVaTypedArg, |
859 /* XtN... */ | 859 /* XtN... */ |
860 (char *) XSTRING_DATA (str), | 860 (char *) XSTRING_DATA (str), |
861 XtRString, | 861 XtRString, |
862 XSTRING_DATA (val), | 862 XSTRING_DATA (val), |
863 XSTRING_LENGTH (val) + 1, | 863 XSTRING_LENGTH (val) + 1, |
864 0); | 864 NULL); |
865 } | 865 } |
866 | 866 |
867 #ifdef HAVE_SCROLLBARS | 867 #ifdef HAVE_SCROLLBARS |
868 if (!strcmp ((char *) XSTRING_DATA (str), "scrollBarWidth") | 868 if (!strcmp ((char *) XSTRING_DATA (str), "scrollBarWidth") |
869 || !strcmp ((char *) XSTRING_DATA (str), | 869 || !strcmp ((char *) XSTRING_DATA (str), |
1352 is. (Assume it is smart and pays attention to our values.) | 1352 is. (Assume it is smart and pays attention to our values.) |
1353 */ | 1353 */ |
1354 | 1354 |
1355 if (!FRAME_X_TOP_LEVEL_FRAME_P (f)) | 1355 if (!FRAME_X_TOP_LEVEL_FRAME_P (f)) |
1356 { | 1356 { |
1357 XtVaGetValues (ew, XtNgeometry, &ew_geom, 0); | 1357 XtVaGetValues (ew, XtNgeometry, &ew_geom, NULL); |
1358 if (ew_geom) | 1358 if (ew_geom) |
1359 frame_flags = XParseGeometry (ew_geom, &frame_x, &frame_y, | 1359 frame_flags = XParseGeometry (ew_geom, &frame_x, &frame_y, |
1360 &frame_w, &frame_h); | 1360 &frame_w, &frame_h); |
1361 if (! (frame_flags & (WidthValue | HeightValue))) | 1361 if (! (frame_flags & (WidthValue | HeightValue))) |
1362 { | 1362 { |
1363 XtVaGetValues (ew, XtNwidth, &frame_w, | 1363 XtVaGetValues (ew, XtNwidth, &frame_w, |
1364 XtNheight, &frame_h, 0); | 1364 XtNheight, &frame_h, NULL); |
1365 if (!frame_w && !frame_h) | 1365 if (!frame_w && !frame_h) |
1366 { | 1366 { |
1367 frame_w = 64; | 1367 frame_w = 64; |
1368 frame_h = 12; | 1368 frame_h = 12; |
1369 frame_flags |= WidthValue | HeightValue; | 1369 frame_flags |= WidthValue | HeightValue; |
1372 if (frame_flags & (WidthValue | HeightValue)) | 1372 if (frame_flags & (WidthValue | HeightValue)) |
1373 EmacsFrameSetCharSize (ew, frame_w, frame_h); | 1373 EmacsFrameSetCharSize (ew, frame_w, frame_h); |
1374 if (frame_flags & (XValue | YValue)) | 1374 if (frame_flags & (XValue | YValue)) |
1375 { | 1375 { |
1376 XtVaGetValues (ew, XtNwidth, &frame_w, | 1376 XtVaGetValues (ew, XtNwidth, &frame_w, |
1377 XtNheight, &frame_h, 0); | 1377 XtNheight, &frame_h, NULL); |
1378 if (frame_flags & XNegative) | 1378 if (frame_flags & XNegative) |
1379 frame_x += frame_w; | 1379 frame_x += frame_w; |
1380 if (frame_flags & YNegative) | 1380 if (frame_flags & YNegative) |
1381 frame_y += frame_h; | 1381 frame_y += frame_h; |
1382 XtVaSetValues (ew, XtNx, frame_x, XtNy, frame_y, 0); | 1382 XtVaSetValues (ew, XtNx, frame_x, XtNy, frame_y, NULL); |
1383 } | 1383 } |
1384 return; | 1384 return; |
1385 } | 1385 } |
1386 #endif | 1386 #endif |
1387 | 1387 |
1392 | 1392 |
1393 /* If the EmacsFrame doesn't have a geometry but the shell does, | 1393 /* If the EmacsFrame doesn't have a geometry but the shell does, |
1394 treat that as the geometry of the frame. (Is this bogus? | 1394 treat that as the geometry of the frame. (Is this bogus? |
1395 I'm not sure.) */ | 1395 I'm not sure.) */ |
1396 | 1396 |
1397 XtVaGetValues (ew, XtNgeometry, &ew_geom, 0); | 1397 XtVaGetValues (ew, XtNgeometry, &ew_geom, NULL); |
1398 if (!ew_geom) | 1398 if (!ew_geom) |
1399 { | 1399 { |
1400 XtVaGetValues (wmshell, XtNgeometry, &geom, 0); | 1400 XtVaGetValues (wmshell, XtNgeometry, &geom, NULL); |
1401 if (geom) | 1401 if (geom) |
1402 { | 1402 { |
1403 ew_geom = geom; | 1403 ew_geom = geom; |
1404 XtVaSetValues (ew, XtNgeometry, ew_geom, 0); | 1404 XtVaSetValues (ew, XtNgeometry, ew_geom, NULL); |
1405 } | 1405 } |
1406 } | 1406 } |
1407 | 1407 |
1408 /* If the Shell is iconic, then the EmacsFrame is iconic. (Is | 1408 /* If the Shell is iconic, then the EmacsFrame is iconic. (Is |
1409 this bogus? I'm not sure.) */ | 1409 this bogus? I'm not sure.) */ |
1410 XtVaGetValues (ew, XtNiconic, &ew_iconic_p, 0); | 1410 XtVaGetValues (ew, XtNiconic, &ew_iconic_p, NULL); |
1411 if (!ew_iconic_p) | 1411 if (!ew_iconic_p) |
1412 { | 1412 { |
1413 XtVaGetValues (wmshell, XtNiconic, &iconic_p, 0); | 1413 XtVaGetValues (wmshell, XtNiconic, &iconic_p, NULL); |
1414 if (iconic_p) | 1414 if (iconic_p) |
1415 { | 1415 { |
1416 ew_iconic_p = iconic_p; | 1416 ew_iconic_p = iconic_p; |
1417 XtVaSetValues (ew, XtNiconic, iconic_p, 0); | 1417 XtVaSetValues (ew, XtNiconic, iconic_p, NULL); |
1418 } | 1418 } |
1419 } | 1419 } |
1420 | 1420 |
1421 XtVaGetValues (app_shell, XtNgeometry, &geom, 0); | 1421 XtVaGetValues (app_shell, XtNgeometry, &geom, NULL); |
1422 if (geom) | 1422 if (geom) |
1423 app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h); | 1423 app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h); |
1424 | 1424 |
1425 if (ew_geom) | 1425 if (ew_geom) |
1426 frame_flags = XParseGeometry (ew_geom, &frame_x, &frame_y, | 1426 frame_flags = XParseGeometry (ew_geom, &frame_x, &frame_y, |
1465 } | 1465 } |
1466 | 1466 |
1467 /* If the AppShell is iconic, then the EmacsFrame is iconic. */ | 1467 /* If the AppShell is iconic, then the EmacsFrame is iconic. */ |
1468 if (!ew_iconic_p) | 1468 if (!ew_iconic_p) |
1469 { | 1469 { |
1470 XtVaGetValues (app_shell, XtNiconic, &iconic_p, 0); | 1470 XtVaGetValues (app_shell, XtNiconic, &iconic_p, NULL); |
1471 if (iconic_p) | 1471 if (iconic_p) |
1472 { | 1472 { |
1473 ew_iconic_p = iconic_p; | 1473 ew_iconic_p = iconic_p; |
1474 XtVaSetValues (ew, XtNiconic, iconic_p, 0); | 1474 XtVaSetValues (ew, XtNiconic, iconic_p, NULL); |
1475 } | 1475 } |
1476 } | 1476 } |
1477 } | 1477 } |
1478 else | 1478 else |
1479 { | 1479 { |
1559 #ifdef HAVE_SCROLLBARS | 1559 #ifdef HAVE_SCROLLBARS |
1560 { | 1560 { |
1561 /* The scrollbar positioning is completely handled by redisplay. We | 1561 /* The scrollbar positioning is completely handled by redisplay. We |
1562 just need to know which sides they are supposed to go on. */ | 1562 just need to know which sides they are supposed to go on. */ |
1563 unsigned char scrollbar_placement; | 1563 unsigned char scrollbar_placement; |
1564 XtVaGetValues (text, XtNscrollBarPlacement, &scrollbar_placement, 0); | 1564 XtVaGetValues (text, XtNscrollBarPlacement, &scrollbar_placement, NULL); |
1565 f->scrollbar_on_left = (scrollbar_placement == XtTOP_LEFT || | 1565 f->scrollbar_on_left = (scrollbar_placement == XtTOP_LEFT || |
1566 scrollbar_placement == XtBOTTOM_LEFT); | 1566 scrollbar_placement == XtBOTTOM_LEFT); |
1567 f->scrollbar_on_top = (scrollbar_placement == XtTOP_LEFT || | 1567 f->scrollbar_on_top = (scrollbar_placement == XtTOP_LEFT || |
1568 scrollbar_placement == XtTOP_RIGHT); | 1568 scrollbar_placement == XtTOP_RIGHT); |
1569 f->scrollbar_y_offset = topbreadth + textbord; | 1569 f->scrollbar_y_offset = topbreadth + textbord; |
1723 maybe_set_frame_title_format (shell); | 1723 maybe_set_frame_title_format (shell); |
1724 | 1724 |
1725 /* Create the manager widget */ | 1725 /* Create the manager widget */ |
1726 container = XtVaCreateWidget ("container", | 1726 container = XtVaCreateWidget ("container", |
1727 emacsManagerWidgetClass, | 1727 emacsManagerWidgetClass, |
1728 shell, 0); | 1728 shell, NULL); |
1729 FRAME_X_CONTAINER_WIDGET (f) = container; | 1729 FRAME_X_CONTAINER_WIDGET (f) = container; |
1730 XtAddCallback (container, XtNresizeCallback, x_layout_widgets, | 1730 XtAddCallback (container, XtNresizeCallback, x_layout_widgets, |
1731 (XtPointer) f); | 1731 (XtPointer) f); |
1732 XtAddCallback (container, XtNqueryGeometryCallback, x_do_query_geometry, | 1732 XtAddCallback (container, XtNqueryGeometryCallback, x_do_query_geometry, |
1733 (XtPointer) f); | 1733 (XtPointer) f); |
2066 | 2066 |
2067 XtVaGetValues (w, | 2067 XtVaGetValues (w, |
2068 XtNwidth, &shell_w, | 2068 XtNwidth, &shell_w, |
2069 XtNheight, &shell_h, | 2069 XtNheight, &shell_h, |
2070 XtNborderWidth, &shell_bord, | 2070 XtNborderWidth, &shell_bord, |
2071 0); | 2071 NULL); |
2072 | 2072 |
2073 win_gravity = | 2073 win_gravity = |
2074 xoff >= 0 && yoff >= 0 ? NorthWestGravity : | 2074 xoff >= 0 && yoff >= 0 ? NorthWestGravity : |
2075 xoff >= 0 ? SouthWestGravity : | 2075 xoff >= 0 ? SouthWestGravity : |
2076 yoff >= 0 ? NorthEastGravity : | 2076 yoff >= 0 ? NorthEastGravity : |
2086 might not be processed). */ | 2086 might not be processed). */ |
2087 XtVaSetValues (w, | 2087 XtVaSetValues (w, |
2088 XtNwinGravity, win_gravity, | 2088 XtNwinGravity, win_gravity, |
2089 XtNx, xoff, | 2089 XtNx, xoff, |
2090 XtNy, yoff, | 2090 XtNy, yoff, |
2091 0); | 2091 NULL); |
2092 | 2092 |
2093 /* Sometimes you will find that | 2093 /* Sometimes you will find that |
2094 | 2094 |
2095 (set-frame-position (selected-frame) -50 -50) | 2095 (set-frame-position (selected-frame) -50 -50) |
2096 | 2096 |