comparison src/frame-x.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents e121b013d1f0
children ecf6ba7b0a10
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
225 225
226 void 226 void
227 x_wm_set_cell_size (Widget wmshell, int cw, int ch) 227 x_wm_set_cell_size (Widget wmshell, int cw, int ch)
228 { 228 {
229 Arg al [2]; 229 Arg al [2];
230 230
231 if (!XtIsWMShell (wmshell)) 231 if (!XtIsWMShell (wmshell))
232 abort (); 232 abort ();
233 if (cw <= 0 || ch <= 0) 233 if (cw <= 0 || ch <= 0)
234 abort (); 234 abort ();
235 235
240 240
241 void 241 void
242 x_wm_set_variable_size (Widget wmshell, int width, int height) 242 x_wm_set_variable_size (Widget wmshell, int width, int height)
243 { 243 {
244 Arg al [2]; 244 Arg al [2];
245 245
246 if (!XtIsWMShell (wmshell)) 246 if (!XtIsWMShell (wmshell))
247 abort (); 247 abort ();
248 #ifdef DEBUG_GEOMETRY_MANAGEMENT 248 #ifdef DEBUG_GEOMETRY_MANAGEMENT
249 /* See comment in EmacsShell.c */ 249 /* See comment in EmacsShell.c */
250 printf ("x_wm_set_variable_size: %d %d\n", width, height); 250 printf ("x_wm_set_variable_size: %d %d\n", width, height);
454 defi(Qborder_width, XtNborderWidth); 454 defi(Qborder_width, XtNborderWidth);
455 defi(Qwidth, XtNwidth); 455 defi(Qwidth, XtNwidth);
456 defi(Qheight, XtNheight); 456 defi(Qheight, XtNheight);
457 defi(Qleft, XtNx); 457 defi(Qleft, XtNx);
458 defi(Qtop, XtNy); 458 defi(Qtop, XtNy);
459 459
460 #undef def 460 #undef def
461 } 461 }
462 462
463 static Lisp_Object 463 static Lisp_Object
464 color_to_string (Widget w, unsigned long pixel) 464 color_to_string (Widget w, unsigned long pixel)
502 { 502 {
503 /* Naturally those bastards who wrote Xt couldn't be bothered 503 /* Naturally those bastards who wrote Xt couldn't be bothered
504 to learn about race conditions and such. We can't trust 504 to learn about race conditions and such. We can't trust
505 the X and Y values to have any semblance of correctness, 505 the X and Y values to have any semblance of correctness,
506 so we smash the right values in place. */ 506 so we smash the right values in place. */
507 507
508 /* We might be called before we've actually realized the window (if 508 /* We might be called before we've actually realized the window (if
509 we're checking for the minibuffer resource). This will bomb in 509 we're checking for the minibuffer resource). This will bomb in
510 that case so we don't bother calling it. */ 510 that case so we don't bother calling it. */
511 if (XtWindow (shell)) 511 if (XtWindow (shell))
512 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), 512 x_get_top_level_position (XtDisplay (shell), XtWindow (shell),
609 #endif 609 #endif
610 if (!XtWindow(shell)) 610 if (!XtWindow(shell))
611 x = y = 0; 611 x = y = 0;
612 else 612 else
613 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), &x, &y); 613 x_get_top_level_position (XtDisplay (shell), XtWindow (shell), &x, &y);
614 614
615 FROB (Qleft, make_int (x)); 615 FROB (Qleft, make_int (x));
616 FROB (Qtop, make_int (y)); 616 FROB (Qtop, make_int (y));
617 617
618 FROB (Qborder_width, make_int (w->core.border_width)); 618 FROB (Qborder_width, make_int (w->core.border_width));
619 FROB (Qinternal_border_width, 619 FROB (Qinternal_border_width,
674 XtSetArg (al[1], Xt_resource_encoding_name, encoding); 674 XtSetArg (al[1], Xt_resource_encoding_name, encoding);
675 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2); 675 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2);
676 } 676 }
677 } 677 }
678 678
679 static void 679 static void
680 x_set_title_from_bufbyte (struct frame *f, Bufbyte *name) 680 x_set_title_from_bufbyte (struct frame *f, Bufbyte *name)
681 { 681 {
682 x_set_frame_text_value (f, name, XtNtitle, XtNtitleEncoding); 682 x_set_frame_text_value (f, name, XtNtitle, XtNtitleEncoding);
683 } 683 }
684 684
711 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), w, h); 711 EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), w, h);
712 712
713 /* and also set the WMShell's geometry */ 713 /* and also set the WMShell's geometry */
714 (flags & XNegative) ? (xval = -x, xsign = '-') : (xval = x, xsign = '+'); 714 (flags & XNegative) ? (xval = -x, xsign = '-') : (xval = x, xsign = '+');
715 (flags & YNegative) ? (yval = -y, ysign = '-') : (yval = y, ysign = '+'); 715 (flags & YNegative) ? (yval = -y, ysign = '-') : (yval = y, ysign = '+');
716 716
717 if (uspos && ussize) 717 if (uspos && ussize)
718 sprintf (shell_geom, "=%dx%d%c%d%c%d", w, h, xsign, xval, ysign, yval); 718 sprintf (shell_geom, "=%dx%d%c%d%c%d", w, h, xsign, xval, ysign, yval);
719 else if (uspos) 719 else if (uspos)
720 sprintf (shell_geom, "=%c%d%c%d", xsign, xval, ysign, yval); 720 sprintf (shell_geom, "=%c%d%c%d", xsign, xval, ysign, yval);
721 else if (ussize) 721 else if (ussize)
722 sprintf (shell_geom, "=%dx%d", w, h); 722 sprintf (shell_geom, "=%dx%d", w, h);
723 723
724 if (uspos || ussize) 724 if (uspos || ussize)
725 { 725 {
726 temp = xmalloc (1 + strlen (shell_geom)); 726 temp = (char *) xmalloc (1 + strlen (shell_geom));
727 strcpy (temp, shell_geom); 727 strcpy (temp, shell_geom);
728 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp; 728 FRAME_X_GEOM_FREE_ME_PLEASE (f) = temp;
729 } 729 }
730 else 730 else
731 temp = NULL; 731 temp = NULL;
732 732
733 XtSetArg (al [0], XtNgeometry, temp); 733 XtSetArg (al [0], XtNgeometry, temp);
734 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 1); 734 XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 1);
735 } 735 }
736 736
737 /* Report to X that a frame property of frame S is being set or changed. 737 /* Report to X that a frame property of frame S is being set or changed.
749 Bool y_position_specified_p = False; 749 Bool y_position_specified_p = False;
750 Bool internal_border_width_specified = False; 750 Bool internal_border_width_specified = False;
751 Lisp_Object tail; 751 Lisp_Object tail;
752 Widget w = FRAME_X_TEXT_WIDGET (f); 752 Widget w = FRAME_X_TEXT_WIDGET (f);
753 Arg al [10]; 753 Arg al [10];
754 754
755 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) 755 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail)))
756 { 756 {
757 Lisp_Object prop = Fcar (tail); 757 Lisp_Object prop = Fcar (tail);
758 Lisp_Object val = Fcar (Fcdr (tail)); 758 Lisp_Object val = Fcar (Fcdr (tail));
759 759
760 if (STRINGP (prop)) 760 if (STRINGP (prop))
761 { 761 {
762 CONST char *extprop; 762 CONST char *extprop;
763 763
764 if (XSTRING_LENGTH (prop) == 0) 764 if (XSTRING_LENGTH (prop) == 0)
765 continue; 765 continue;
766 766
767 GET_C_STRING_CTEXT_DATA_ALLOCA (prop, extprop); 767 GET_C_STRING_CTEXT_DATA_ALLOCA (prop, extprop);
768 if (STRINGP (val)) 768 if (STRINGP (val))
896 896
897 if (!width_specified_p) 897 if (!width_specified_p)
898 width = FRAME_WIDTH (f); 898 width = FRAME_WIDTH (f);
899 if (!height_specified_p) 899 if (!height_specified_p)
900 height = FRAME_HEIGHT (f); 900 height = FRAME_HEIGHT (f);
901 901
902 /* Kludge kludge kludge kludge. */ 902 /* Kludge kludge kludge kludge. */
903 if (position_specified_p && 903 if (position_specified_p &&
904 (!x_position_specified_p || !y_position_specified_p)) 904 (!x_position_specified_p || !y_position_specified_p))
905 { 905 {
906 Position dummy; 906 Position dummy;
911 #if 0 911 #if 0
912 x = (int) (FRAME_X_SHELL_WIDGET (f)->core.x); 912 x = (int) (FRAME_X_SHELL_WIDGET (f)->core.x);
913 y = (int) (FRAME_X_SHELL_WIDGET (f)->core.y); 913 y = (int) (FRAME_X_SHELL_WIDGET (f)->core.y);
914 #endif 914 #endif
915 } 915 }
916 916
917 if (!f->init_finished) 917 if (!f->init_finished)
918 { 918 {
919 int flags = (size_specified_p ? WidthValue | HeightValue : 0) | 919 int flags = (size_specified_p ? WidthValue | HeightValue : 0) |
920 (position_specified_p ? 920 (position_specified_p ?
921 XValue | YValue | (x < 0 ? XNegative : 0) | (y < 0 ? YNegative : 0) 921 XValue | YValue | (x < 0 ? XNegative : 0) | (y < 0 ? YNegative : 0)
949 static void 949 static void
950 maybe_set_frame_title_format (Widget shell) 950 maybe_set_frame_title_format (Widget shell)
951 { 951 {
952 952
953 /* Only do this if this is the first X frame we're creating. 953 /* Only do this if this is the first X frame we're creating.
954 954
955 If the *title resource (or -title option) was specified, then 955 If the *title resource (or -title option) was specified, then
956 set frame-title-format to its value. 956 set frame-title-format to its value.
957 */ 957 */
958 958
959 if (!frame_title_format_already_set) 959 if (!frame_title_format_already_set)
1090 1090
1091 dnd_convert_cb_rec[0].callback = x_cde_convert_callback; 1091 dnd_convert_cb_rec[0].callback = x_cde_convert_callback;
1092 dnd_convert_cb_rec[0].closure = (XtPointer) Ctext; 1092 dnd_convert_cb_rec[0].closure = (XtPointer) Ctext;
1093 dnd_convert_cb_rec[1].callback = NULL; 1093 dnd_convert_cb_rec[1].callback = NULL;
1094 dnd_convert_cb_rec[1].closure = NULL; 1094 dnd_convert_cb_rec[1].closure = NULL;
1095 1095
1096 dnd_destroy_cb_rec[0].callback = x_cde_destroy_callback; 1096 dnd_destroy_cb_rec[0].callback = x_cde_destroy_callback;
1097 dnd_destroy_cb_rec[0].closure = (XtPointer) Ctext; 1097 dnd_destroy_cb_rec[0].closure = (XtPointer) Ctext;
1098 dnd_destroy_cb_rec[1].callback = NULL; 1098 dnd_destroy_cb_rec[1].callback = NULL;
1099 dnd_destroy_cb_rec[1].closure = NULL; 1099 dnd_destroy_cb_rec[1].closure = NULL;
1100 1100
1116 int ii; 1116 int ii;
1117 Lisp_Object path = Qnil; 1117 Lisp_Object path = Qnil;
1118 Lisp_Object frame = Qnil; 1118 Lisp_Object frame = Qnil;
1119 Lisp_Object data = Qnil; 1119 Lisp_Object data = Qnil;
1120 struct gcpro gcpro1, gcpro2, gcpro3; 1120 struct gcpro gcpro1, gcpro2, gcpro3;
1121 1121
1122 DtDndTransferCallbackStruct *transferInfo = 1122 DtDndTransferCallbackStruct *transferInfo =
1123 (DtDndTransferCallbackStruct *) callData; 1123 (DtDndTransferCallbackStruct *) callData;
1124 1124
1125 if (transferInfo == NULL) 1125 if (transferInfo == NULL)
1126 return; 1126 return;
1127 1127
1128 GCPRO3 (path, frame, data); 1128 GCPRO3 (path, frame, data);
1129 1129
1130 frame = make_frame ((struct frame *) clientData); 1130 frame = make_frame ((struct frame *) clientData);
1131 if (transferInfo->dropData->protocol == DtDND_FILENAME_TRANSFER) 1131 if (transferInfo->dropData->protocol == DtDND_FILENAME_TRANSFER)
1132 { 1132 {
1133 for (ii = 0; ii < transferInfo->dropData->numItems; ii++) 1133 for (ii = 0; ii < transferInfo->dropData->numItems; ii++)
1134 { 1134 {
1135 filePath = transferInfo->dropData->data.files[ii]; 1135 filePath = transferInfo->dropData->data.files[ii];
1136 /* ### Mule-izing required */ 1136 /* ### Mule-izing required */
1137 path = make_string ((Bufbyte *)filePath, strlen (filePath)); 1137 path = make_string ((Bufbyte *)filePath, strlen (filePath));
1138 va_run_hook_with_args (Qdrag_and_drop_functions, 2, frame, path); 1138 va_run_hook_with_args (Qdrag_and_drop_functions, 2, frame, path);
1139 } 1139 }
1140 } 1140 }
1141 else if (transferInfo->dropData->protocol == DtDND_BUFFER_TRANSFER) 1141 else if (transferInfo->dropData->protocol == DtDND_BUFFER_TRANSFER)
1142 { 1142 {
1143 int speccount = specpdl_depth(); 1143 int speccount = specpdl_depth();
1144 1144
1145 record_unwind_protect(abort_current_drag, Qnil); 1145 record_unwind_protect(abort_current_drag, Qnil);
1146 drag_not_done = 1; 1146 drag_not_done = 1;
1147 for (ii = 0; ii < transferInfo->dropData->numItems; ii++) 1147 for (ii = 0; ii < transferInfo->dropData->numItems; ii++)
1148 { 1148 {
1149 filePath = transferInfo->dropData->data.buffers[ii].name; 1149 filePath = transferInfo->dropData->data.buffers[ii].name;
1166 #endif /* HAVE_CDE */ 1166 #endif /* HAVE_CDE */
1167 1167
1168 #ifdef HAVE_OFFIX_DND 1168 #ifdef HAVE_OFFIX_DND
1169 #include <OffiX/DragAndDrop.h> 1169 #include <OffiX/DragAndDrop.h>
1170 1170
1171 void 1171 void
1172 x_offix_drop_event_handler (Widget widget, XtPointer data, XEvent *event, 1172 x_offix_drop_event_handler (Widget widget, XtPointer data, XEvent *event,
1173 Boolean *b) 1173 Boolean *b)
1174 { 1174 {
1175 int i, len, Type; 1175 int i, len, Type;
1176 unsigned char *Data; 1176 unsigned char *Data;
1177 unsigned long Size; 1177 unsigned long Size;
1178 1178
1179 Lisp_Object path = Qnil; 1179 Lisp_Object path = Qnil;
1180 Lisp_Object frame = Qnil; 1180 Lisp_Object frame = Qnil;
1186 if (!DndIsDropMessage(event)) /* the better way */ 1186 if (!DndIsDropMessage(event)) /* the better way */
1187 { 1187 {
1188 stderr_out("DndDropHandler: pseudo drop received (ignore me!)\n"); 1188 stderr_out("DndDropHandler: pseudo drop received (ignore me!)\n");
1189 return; 1189 return;
1190 } 1190 }
1191 1191
1192 Type = DndDataType (event); 1192 Type = DndDataType (event);
1193 DndGetData (&Data, &Size); 1193 DndGetData (&Data, &Size);
1194 1194
1195 GCPRO4 (path, frame, dnd_data, dnd_type); 1195 GCPRO4 (path, frame, dnd_data, dnd_type);
1196 1196
1197 frame = make_frame ((struct frame *) data); 1197 frame = make_frame ((struct frame *) data);
1198 1198
1199 stderr_out("DndDropHandler: valid drop received (T%d S%u)\n",Type,Size); 1199 stderr_out("DndDropHandler: valid drop received (T%d S%u)\n",Type,Size);
1200 1200
1201 switch (Type) 1201 switch (Type)
1202 { 1202 {
1203 case DndFiles: 1203 case DndFiles:
1204 while (*Data) 1204 while (*Data)
1205 { 1205 {
1335 or 1335 or
1336 argv[0] FRAME-NAME container emacsTextPane 1336 argv[0] FRAME-NAME container emacsTextPane
1337 ApplicationShell EmacsShell EmacsManager EmacsFrame 1337 ApplicationShell EmacsShell EmacsManager EmacsFrame
1338 1338
1339 #ifdef EXTERNAL_WIDGET 1339 #ifdef EXTERNAL_WIDGET
1340 The ExternalShell widget is simply a replacement for the Shell widget 1340 The ExternalShell widget is simply a replacement for the Shell widget
1341 which is able to deal with using an externally-supplied window instead 1341 which is able to deal with using an externally-supplied window instead
1342 of always creating its own. 1342 of always creating its own.
1343 #endif 1343 #endif
1344 1344
1345 */ 1345 */
1391 int app_flags = 0; 1391 int app_flags = 0;
1392 int app_x = 0; 1392 int app_x = 0;
1393 int app_y = 0; 1393 int app_y = 0;
1394 unsigned int app_w = 0; 1394 unsigned int app_w = 0;
1395 unsigned int app_h = 0; 1395 unsigned int app_h = 0;
1396 1396
1397 /* Geometry of the EmacsFrame */ 1397 /* Geometry of the EmacsFrame */
1398 int frame_flags = 0; 1398 int frame_flags = 0;
1399 int frame_x = 0; 1399 int frame_x = 0;
1400 int frame_y = 0; 1400 int frame_y = 0;
1401 unsigned int frame_w = 0; 1401 unsigned int frame_w = 0;
1402 unsigned int frame_h = 0; 1402 unsigned int frame_h = 0;
1403 1403
1404 /* Hairily merged geometry */ 1404 /* Hairily merged geometry */
1405 int x = 0; 1405 int x = 0;
1406 int y = 0; 1406 int y = 0;
1407 unsigned int w = 80; 1407 unsigned int w = 80;
1408 unsigned int h = 40; 1408 unsigned int h = 40;
1488 if (frame_flags & (XValue | YValue)) 1488 if (frame_flags & (XValue | YValue))
1489 { 1489 {
1490 XtSetArg (al [0], XtNwidth, &frame_w); 1490 XtSetArg (al [0], XtNwidth, &frame_w);
1491 XtSetArg (al [1], XtNheight, &frame_h); 1491 XtSetArg (al [1], XtNheight, &frame_h);
1492 XtGetValues (ew, al, 2); 1492 XtGetValues (ew, al, 2);
1493 1493
1494 if (frame_flags & XNegative) 1494 if (frame_flags & XNegative)
1495 frame_x += frame_w; 1495 frame_x += frame_w;
1496 if (frame_flags & YNegative) 1496 if (frame_flags & YNegative)
1497 frame_y += frame_h; 1497 frame_y += frame_h;
1498 1498
1550 1550
1551 if (ew_geom) 1551 if (ew_geom)
1552 frame_flags = XParseGeometry (ew_geom, 1552 frame_flags = XParseGeometry (ew_geom,
1553 &frame_x, &frame_y, 1553 &frame_x, &frame_y,
1554 &frame_w, &frame_h); 1554 &frame_w, &frame_h);
1555 1555
1556 if (first_x_frame_p (f)) 1556 if (first_x_frame_p (f))
1557 { 1557 {
1558 /* If this is the first frame created: 1558 /* If this is the first frame created:
1559 ==================================== 1559 ====================================
1560 1560
1689 { 1689 {
1690 /* The scrollbar positioning is completely handled by redisplay. We 1690 /* The scrollbar positioning is completely handled by redisplay. We
1691 just need to know which sides they are supposed to go on. */ 1691 just need to know which sides they are supposed to go on. */
1692 unsigned char scrollbar_placement; 1692 unsigned char scrollbar_placement;
1693 Arg al [1]; 1693 Arg al [1];
1694 1694
1695 XtSetArg (al [0], XtNscrollBarPlacement, &scrollbar_placement); 1695 XtSetArg (al [0], XtNscrollBarPlacement, &scrollbar_placement);
1696 XtGetValues (text, al, 1); 1696 XtGetValues (text, al, 1);
1697 f->scrollbar_on_left = (scrollbar_placement == XtTOP_LEFT || 1697 f->scrollbar_on_left = (scrollbar_placement == XtTOP_LEFT ||
1698 scrollbar_placement == XtBOTTOM_LEFT); 1698 scrollbar_placement == XtBOTTOM_LEFT);
1699 f->scrollbar_on_top = (scrollbar_placement == XtTOP_LEFT || 1699 f->scrollbar_on_top = (scrollbar_placement == XtTOP_LEFT ||
1764 1764
1765 if (STRINGP (f->name)) 1765 if (STRINGP (f->name))
1766 GET_C_STRING_CTEXT_DATA_ALLOCA (f->name, name); 1766 GET_C_STRING_CTEXT_DATA_ALLOCA (f->name, name);
1767 else 1767 else
1768 name = "emacs"; 1768 name = "emacs";
1769 1769
1770 /* The widget hierarchy is 1770 /* The widget hierarchy is
1771 1771
1772 argv[0] shell pane FRAME-NAME 1772 argv[0] shell pane FRAME-NAME
1773 ApplicationShell EmacsShell EmacsManager EmacsFrame 1773 ApplicationShell EmacsShell EmacsManager EmacsFrame
1774 1774
1867 XtSetArg (al [0], XtNborderWidth, 0); /* should this be settable? */ 1867 XtSetArg (al [0], XtNborderWidth, 0); /* should this be settable? */
1868 XtSetArg (al [1], XtNemacsFrame, f); 1868 XtSetArg (al [1], XtNemacsFrame, f);
1869 text = XtCreateWidget (name, emacsFrameClass, container, al, 2); 1869 text = XtCreateWidget (name, emacsFrameClass, container, al, 2);
1870 FRAME_X_TEXT_WIDGET (f) = text; 1870 FRAME_X_TEXT_WIDGET (f) = text;
1871 1871
1872 #ifdef HAVE_MENUBARS 1872 #ifdef HAVE_MENUBARS
1873 /* Create the initial menubar widget. */ 1873 /* Create the initial menubar widget. */
1874 menubar_visible = x_initialize_frame_menubar (f); 1874 menubar_visible = x_initialize_frame_menubar (f);
1875 FRAME_X_TOP_WIDGETS (f)[0] = menubar = FRAME_X_MENUBAR_WIDGET (f); 1875 FRAME_X_TOP_WIDGETS (f)[0] = menubar = FRAME_X_MENUBAR_WIDGET (f);
1876 FRAME_X_NUM_TOP_WIDGETS (f) = 1; 1876 FRAME_X_NUM_TOP_WIDGETS (f) = 1;
1877 1877
1878 if (menubar_visible) 1878 if (menubar_visible)
1879 XtManageChild (menubar); 1879 XtManageChild (menubar);
1880 #endif /* HAVE_MENUBARS */ 1880 #endif /* HAVE_MENUBARS */
1881 XtManageChild (text); 1881 XtManageChild (text);
1882 XtManageChild (container); 1882 XtManageChild (container);
1976 } 1976 }
1977 1977
1978 #ifdef HAVE_XIM 1978 #ifdef HAVE_XIM
1979 XIM_init_frame (f); 1979 XIM_init_frame (f);
1980 #endif /* HAVE_XIM */ 1980 #endif /* HAVE_XIM */
1981 1981
1982 #ifdef HACK_EDITRES 1982 #ifdef HACK_EDITRES
1983 /* Allow XEmacs to respond to EditRes requests. See the O'Reilly Xt */ 1983 /* Allow XEmacs to respond to EditRes requests. See the O'Reilly Xt */
1984 /* Instrinsics Programming Manual, Motif Edition, Aug 1993, Sect 14.14, */ 1984 /* Instrinsics Programming Manual, Motif Edition, Aug 1993, Sect 14.14, */
1985 /* pp. 483-493. */ 1985 /* pp. 483-493. */
1986 XtAddEventHandler (shell_widget, /* the shell widget in question */ 1986 XtAddEventHandler (shell_widget, /* the shell widget in question */
1987 (EventMask) NoEventMask,/* OR with existing mask */ 1987 (EventMask) NoEventMask,/* OR with existing mask */
1988 True, /* called on non-maskable events? */ 1988 True, /* called on non-maskable events? */
1989 _XEditResCheckMessages, /* the handler */ 1989 (XtEventHandler) _XEditResCheckMessages, /* the handler */
1990 NULL); 1990 NULL);
1991 #endif /* HACK_EDITRES */ 1991 #endif /* HACK_EDITRES */
1992 1992
1993 #ifdef HAVE_CDE 1993 #ifdef HAVE_CDE
1994 { 1994 {
2008 2008
2009 #ifdef HAVE_OFFIX_DND 2009 #ifdef HAVE_OFFIX_DND
2010 { 2010 {
2011 DndInitialize (FRAME_X_SHELL_WIDGET (f)); 2011 DndInitialize (FRAME_X_SHELL_WIDGET (f));
2012 DndRegisterDropWidget (FRAME_X_TEXT_WIDGET (f), 2012 DndRegisterDropWidget (FRAME_X_TEXT_WIDGET (f),
2013 x_offix_drop_event_handler, 2013 x_offix_drop_event_handler,
2014 (XtPointer) f); 2014 (XtPointer) f);
2015 2015
2016 } 2016 }
2017 #endif 2017 #endif
2018 2018
2021 be initialized to something relevant to the time we created the window. 2021 be initialized to something relevant to the time we created the window.
2022 */ 2022 */
2023 XChangeProperty (XtDisplay (frame_widget), XtWindow (frame_widget), 2023 XChangeProperty (XtDisplay (frame_widget), XtWindow (frame_widget),
2024 DEVICE_XATOM_WM_PROTOCOLS (d), XA_ATOM, 32, PropModeAppend, 2024 DEVICE_XATOM_WM_PROTOCOLS (d), XA_ATOM, 32, PropModeAppend,
2025 (unsigned char*) NULL, 0); 2025 (unsigned char*) NULL, 0);
2026 2026
2027 x_send_synthetic_mouse_event (f); 2027 x_send_synthetic_mouse_event (f);
2028 } 2028 }
2029 2029
2030 static void 2030 static void
2031 allocate_x_frame_struct (struct frame *f) 2031 allocate_x_frame_struct (struct frame *f)
2032 { 2032 {
2033 /* zero out all slots. */ 2033 /* zero out all slots. */
2034 f->frame_data = malloc_type_and_zero (struct x_frame); 2034 f->frame_data = xnew_and_zero (struct x_frame);
2035 2035
2036 /* yeah, except the lisp ones */ 2036 /* yeah, except the lisp ones */
2037 FRAME_X_ICON_PIXMAP (f) = Qnil; 2037 FRAME_X_ICON_PIXMAP (f) = Qnil;
2038 FRAME_X_ICON_PIXMAP_MASK (f) = Qnil; 2038 FRAME_X_ICON_PIXMAP_MASK (f) = Qnil;
2039 #ifdef ENERGIZE 2039 #ifdef ENERGIZE
2220 might not be processed). */ 2220 might not be processed). */
2221 XtSetArg (al [0], XtNwinGravity, win_gravity); 2221 XtSetArg (al [0], XtNwinGravity, win_gravity);
2222 XtSetArg (al [1], XtNx, xoff); 2222 XtSetArg (al [1], XtNx, xoff);
2223 XtSetArg (al [2], XtNy, yoff); 2223 XtSetArg (al [2], XtNy, yoff);
2224 XtSetValues (w, al, 3); 2224 XtSetValues (w, al, 3);
2225 2225
2226 /* Sometimes you will find that 2226 /* Sometimes you will find that
2227 2227
2228 (set-frame-position (selected-frame) -50 -50) 2228 (set-frame-position (selected-frame) -50 -50)
2229 2229
2230 doesn't put the frame where you expect it to: i.e. it's closer to 2230 doesn't put the frame where you expect it to: i.e. it's closer to
2334 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); 2334 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device));
2335 2335
2336 if (FRAME_VISIBLE_P(f) || force) 2336 if (FRAME_VISIBLE_P(f) || force)
2337 { 2337 {
2338 emacs_window = XtWindow (FRAME_X_SHELL_WIDGET (f)); 2338 emacs_window = XtWindow (FRAME_X_SHELL_WIDGET (f));
2339 /* first raises all the dialog boxes, then put emacs just below the 2339 /* first raises all the dialog boxes, then put emacs just below the
2340 * bottom most dialog box */ 2340 * bottom most dialog box */
2341 bottom_dialog = lw_raise_all_pop_up_widgets (); 2341 bottom_dialog = lw_raise_all_pop_up_widgets ();
2342 if (bottom_dialog && XtWindow (bottom_dialog)) 2342 if (bottom_dialog && XtWindow (bottom_dialog))
2343 { 2343 {
2344 xwc.sibling = XtWindow (bottom_dialog); 2344 xwc.sibling = XtWindow (bottom_dialog);
2369 x_lower_frame (struct frame *f) 2369 x_lower_frame (struct frame *f)
2370 { 2370 {
2371 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); 2371 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device));
2372 XWindowChanges xwc; 2372 XWindowChanges xwc;
2373 unsigned int flags; 2373 unsigned int flags;
2374 2374
2375 if (FRAME_VISIBLE_P(f)) 2375 if (FRAME_VISIBLE_P(f))
2376 { 2376 {
2377 xwc.stack_mode = Below; 2377 xwc.stack_mode = Below;
2378 flags = CWStackMode; 2378 flags = CWStackMode;
2379 if (!XReconfigureWMWindow (display, XtWindow (FRAME_X_SHELL_WIDGET (f)), 2379 if (!XReconfigureWMWindow (display, XtWindow (FRAME_X_SHELL_WIDGET (f)),
2507 Note also that under fvwm a frame can be Viewable (and thus Mapped) 2507 Note also that under fvwm a frame can be Viewable (and thus Mapped)
2508 but still X-invisible 2508 but still X-invisible
2509 f->visible = xwa.map_state == IsViewable; */ 2509 f->visible = xwa.map_state == IsViewable; */
2510 viewable = xwa.map_state == IsViewable; 2510 viewable = xwa.map_state == IsViewable;
2511 2511
2512 2512
2513 if (viewable) 2513 if (viewable)
2514 { 2514 {
2515 Window focus; 2515 Window focus;
2516 int revert_to; 2516 int revert_to;
2517 XGetInputFocus (XtDisplay (shell_widget), &focus, &revert_to); 2517 XGetInputFocus (XtDisplay (shell_widget), &focus, &revert_to);
2669 2669
2670 window-id The X window ID corresponding to the 2670 window-id The X window ID corresponding to the
2671 frame. May be set only at startup, and 2671 frame. May be set only at startup, and
2672 only if external widget support was 2672 only if external widget support was
2673 compiled in; doing so causes the frame 2673 compiled in; doing so causes the frame
2674 to be created as an \"external widget\" 2674 to be created as an "external widget"
2675 in another program that uses an existing 2675 in another program that uses an existing
2676 window in the program rather than creating 2676 window in the program rather than creating
2677 a new one. 2677 a new one.
2678 initially-unmapped If non-nil, the frame will not be visible 2678 initially-unmapped If non-nil, the frame will not be visible
2679 when it is created. In this case, you 2679 when it is created. In this case, you
2680 need to call `make-frame-visible' to make 2680 need to call `make-frame-visible' to make
2681 the frame appear. 2681 the frame appear.
2682 popup If non-nil, it should be a frame, and this 2682 popup If non-nil, it should be a frame, and this
2683 frame will be created as a \"popup\" frame 2683 frame will be created as a "popup" frame
2684 whose parent is the given frame. This 2684 whose parent is the given frame. This
2685 will make the window manager treat the 2685 will make the window manager treat the
2686 frame as a dialog box, which may entail 2686 frame as a dialog box, which may entail
2687 doing different things (e.g. not asking 2687 doing different things (e.g. not asking
2688 for positioning, and not iconifying 2688 for positioning, and not iconifying