comparison src/frame-x.c @ 5125:b5df3737028a ben-lisp-object

merge
author Ben Wing <ben@xemacs.org>
date Wed, 24 Feb 2010 01:58:04 -0600
parents d1247f3cc363 3c3c1d139863
children 2a462149bd6a
comparison
equal deleted inserted replaced
5124:623d57b7fbe8 5125:b5df3737028a
462 462
463 static void 463 static void
464 init_x_prop_symbols (void) 464 init_x_prop_symbols (void)
465 { 465 {
466 #define def(sym, rsrc) \ 466 #define def(sym, rsrc) \
467 Fput (sym, Qx_resource_name, build_string (rsrc)) 467 Fput (sym, Qx_resource_name, build_ascstring (rsrc))
468 #define defi(sym,rsrc) \ 468 #define defi(sym,rsrc) \
469 def (sym, rsrc); Fput (sym, Qintegerp, Qt) 469 def (sym, rsrc); Fput (sym, Qintegerp, Qt)
470 470
471 #if 0 /* this interferes with things. #### fix this right */ 471 #if 0 /* this interferes with things. #### fix this right */
472 def (Qminibuffer, XtNminibuffer); 472 def (Qminibuffer, XtNminibuffer);
511 511
512 XColor color; 512 XColor color;
513 color.pixel = pixel; 513 color.pixel = pixel;
514 XQueryColor (XtDisplay (w), w->core.colormap, &color); 514 XQueryColor (XtDisplay (w), w->core.colormap, &color);
515 qxesprintf (buf, "#%04x%04x%04x", color.red, color.green, color.blue); 515 qxesprintf (buf, "#%04x%04x%04x", color.red, color.green, color.blue);
516 return build_intstring (buf); 516 return build_istring (buf);
517 } 517 }
518 518
519 static void 519 static void
520 x_get_top_level_position (Display *d, Window w, Position *x, Position *y) 520 x_get_top_level_position (Display *d, Window w, Position *x, Position *y)
521 { 521 {
647 Ibyte *ptr; 647 Ibyte *ptr;
648 /* Optimize for common ASCII case */ 648 /* Optimize for common ASCII case */
649 for (ptr = value; *ptr; ptr++) 649 for (ptr = value; *ptr; ptr++)
650 if (!byte_ascii_p (*ptr)) 650 if (!byte_ascii_p (*ptr))
651 { 651 {
652 const Extbyte *tmp;
653 encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f))); 652 encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f)));
654 C_STRING_TO_EXTERNAL (value, tmp, Qctext); 653 new_XtValue = (String) ITEXT_TO_EXTERNAL (value, Qctext);
655 new_XtValue = (String) tmp;
656 break; 654 break;
657 } 655 }
658 #endif /* MULE */ 656 #endif /* MULE */
659 657
660 /* #### Caching is device-independent - belongs in update_frame_title. */ 658 /* #### Caching is device-independent - belongs in update_frame_title. */
758 const Extbyte *extprop; 756 const Extbyte *extprop;
759 757
760 if (XSTRING_LENGTH (prop) == 0) 758 if (XSTRING_LENGTH (prop) == 0)
761 continue; 759 continue;
762 760
763 LISP_STRING_TO_EXTERNAL (prop, extprop, Qxt_widget_arg_encoding); 761 extprop = LISP_STRING_TO_EXTERNAL (prop, Qxt_widget_arg_encoding);
764 if (STRINGP (val)) 762 if (STRINGP (val))
765 { 763 {
766 const Extbyte *extval; 764 const Extbyte *extval;
767 Bytecount extvallen; 765 Bytecount extvallen;
768 766
769 /* !!#### I seriously doubt there is a single external format 767 /* !!#### I seriously doubt there is a single external format
770 for the value of a widget argument; it depends on the 768 for the value of a widget argument; it depends on the
771 semantics of the argument. So use of 769 semantics of the argument. So use of
772 Qxt_widget_arg_encoding is totally bogus. --ben */ 770 Qxt_widget_arg_encoding is totally bogus. --ben */
773 TO_EXTERNAL_FORMAT (LISP_STRING, val, 771 LISP_STRING_TO_SIZED_EXTERNAL (val, extval, extvallen,
774 ALLOCA, (extval, extvallen), 772 Qxt_widget_arg_encoding);
775 Qxt_widget_arg_encoding);
776 XtVaSetValues (w, XtVaTypedArg, extprop, 773 XtVaSetValues (w, XtVaTypedArg, extprop,
777 /* !!#### Verify this + 1 and document 774 /* !!#### Verify this + 1 and document
778 as zero-termination */ 775 as zero-termination */
779 XtRString, extval, extvallen + 1, 776 XtRString, extval, extvallen + 1,
780 NULL); 777 NULL);
850 if (!qxestrcmp_ascii (XSTRING_DATA (str), "internalBorderWidth")) 847 if (!qxestrcmp_ascii (XSTRING_DATA (str), "internalBorderWidth"))
851 { 848 {
852 internal_border_width_specified = True; 849 internal_border_width_specified = True;
853 } 850 }
854 851
855 LISP_STRING_TO_EXTERNAL (str, strext, Qxt_widget_arg_encoding); 852 strext = LISP_STRING_TO_EXTERNAL (str, Qxt_widget_arg_encoding);
856 if (int_p) 853 if (int_p)
857 { 854 {
858 CHECK_INT (val); 855 CHECK_INT (val);
859 Xt_SET_VALUE (w, strext, XINT (val)); 856 Xt_SET_VALUE (w, strext, XINT (val));
860 } 857 }
870 { 867 {
871 const Extbyte *extval; 868 const Extbyte *extval;
872 Bytecount extvallen; 869 Bytecount extvallen;
873 CHECK_STRING (val); 870 CHECK_STRING (val);
874 871
875 TO_EXTERNAL_FORMAT (LISP_STRING, val, 872 LISP_STRING_TO_SIZED_EXTERNAL (val, extval, extvallen,
876 ALLOCA, (extval, extvallen), 873 Qxt_widget_arg_encoding);
877 Qxt_widget_arg_encoding);
878 XtVaSetValues (w, XtVaTypedArg, 874 XtVaSetValues (w, XtVaTypedArg,
879 /* XtN... */ 875 /* XtN... */
880 strext, 876 strext,
881 /* !!#### Verify this + 1 and document 877 /* !!#### Verify this + 1 and document
882 as zero-termination */ 878 as zero-termination */
986 XtGetSubresources (XtParent (shell), (XtPointer) results, 982 XtGetSubresources (XtParent (shell), (XtPointer) results,
987 shell->core.name, 983 shell->core.name,
988 shell->core.widget_class->core_class.class_name, 984 shell->core.widget_class->core_class.class_name,
989 resources, XtNumber (resources), 0, 0); 985 resources, XtNumber (resources), 0, 0);
990 if (results[0]) 986 if (results[0])
991 Vframe_title_format = build_ext_string (results[0], Qctext); 987 Vframe_title_format = build_extstring (results[0], Qctext);
992 if (results[1]) 988 if (results[1])
993 Vframe_icon_title_format = build_ext_string (results[1], Qctext); 989 Vframe_icon_title_format = build_extstring (results[1], Qctext);
994 } 990 }
995 991
996 frame_title_format_already_set = 1; 992 frame_title_format_already_set = 1;
997 } 993 }
998 994
1033 eicat_lstr (ei, elt); 1029 eicat_lstr (ei, elt);
1034 eicat_ch (ei, '\0'); 1030 eicat_ch (ei, '\0');
1035 (*num_items_out)++; 1031 (*num_items_out)++;
1036 } 1032 }
1037 eicat_ch (ei, '\0'); 1033 eicat_ch (ei, '\0');
1038 SIZED_C_STRING_TO_SIZED_EXTERNAL_MALLOC (eidata (ei), eilen (ei), 1034 TO_EXTERNAL_FORMAT (DATA, (eidata (ei), eilen (ei)),
1039 dnd_data, *len_out, 1035 MALLOC, (dnd_data, *len_out),
1040 encoding); 1036 encoding);
1041 } 1037 }
1042 else 1038 else
1043 { 1039 {
1044 CHECK_STRING (data); 1040 CHECK_STRING (data);
1045 LISP_STRING_TO_SIZED_EXTERNAL_MALLOC (data, dnd_data, *len_out, 1041 LISP_STRING_TO_SIZED_EXTERNAL_MALLOC (data, dnd_data, *len_out,
1127 XtFree(dragData->data.files[i]); 1123 XtFree(dragData->data.files[i]);
1128 } 1124 }
1129 } 1125 }
1130 1126
1131 /* free the data string */ 1127 /* free the data string */
1132 xfree (clientData, XtPointer); 1128 xfree (clientData);
1133 1129
1134 CurrentDragWidget = NULL; 1130 CurrentDragWidget = NULL;
1135 } 1131 }
1136 1132
1137 static void 1133 static void
1225 XmDROP_COPY, 1221 XmDROP_COPY,
1226 dnd_convert_cb_rec, 1222 dnd_convert_cb_rec,
1227 dnd_destroy_cb_rec, 1223 dnd_destroy_cb_rec,
1228 NULL, 0); 1224 NULL, 0);
1229 1225
1230 xfree (dnd_data, Extbyte *); 1226 xfree (dnd_data);
1231 1227
1232 return num_items ? Qt : Qnil; 1228 return num_items ? Qt : Qnil;
1233 } 1229 }
1234 1230
1235 static void 1231 static void
1266 for (ii = 0; ii < transferInfo->dropData->numItems; ii++) 1262 for (ii = 0; ii < transferInfo->dropData->numItems; ii++)
1267 { 1263 {
1268 Ibyte *fileint; 1264 Ibyte *fileint;
1269 Ibyte *hurl; 1265 Ibyte *hurl;
1270 1266
1271 EXTERNAL_TO_C_STRING (transferInfo->dropData->data.files[ii], 1267 fileint =
1272 fileint, Qfile_name); 1268 EXTERNAL_TO_ITEXT (transferInfo->dropData->data.files[ii],
1269 Qfile_name);
1273 1270
1274 hurl = dnd_url_hexify_string (fileint, "file:"); 1271 hurl = dnd_url_hexify_string (fileint, "file:");
1275 l_data = Fcons (build_intstring (hurl), l_data); 1272 l_data = Fcons (build_istring (hurl), l_data);
1276 xfree (hurl, Ibyte *); 1273 xfree (hurl);
1277 } 1274 }
1278 } 1275 }
1279 else if (transferInfo->dropData->protocol == DtDND_BUFFER_TRANSFER) 1276 else if (transferInfo->dropData->protocol == DtDND_BUFFER_TRANSFER)
1280 { 1277 {
1281 int speccount = specpdl_depth (); 1278 int speccount = specpdl_depth ();
1293 for (ii = 0; ii < transferInfo->dropData->numItems; ii++) 1290 for (ii = 0; ii < transferInfo->dropData->numItems; ii++)
1294 { 1291 {
1295 /* let us forget this name thing for now... */ 1292 /* let us forget this name thing for now... */
1296 /* filePath = transferInfo->dropData->data.buffers[ii].name; 1293 /* filePath = transferInfo->dropData->data.buffers[ii].name;
1297 path = (filePath == NULL) ? Qnil 1294 path = (filePath == NULL) ? Qnil
1298 : build_ext_string (filePath, Q???); */ 1295 : build_extstring (filePath, Q???); */
1299 /* what, if the data is no text, and how can I tell it? */ 1296 /* what, if the data is no text, and how can I tell it? */
1300 l_data = 1297 l_data =
1301 Fcons (list3 (list1 (build_string ("text/plain")), 1298 Fcons (list3 (list1 (build_ascstring ("text/plain")),
1302 build_string ("8bit"), 1299 build_ascstring ("8bit"),
1303 make_ext_string 1300 make_extstring
1304 (transferInfo->dropData->data.buffers[ii].bp, 1301 (transferInfo->dropData->data.buffers[ii].bp,
1305 transferInfo->dropData->data.buffers[ii].size, 1302 transferInfo->dropData->data.buffers[ii].size,
1306 /* !!#### what goes here? */ 1303 /* !!#### what goes here? */
1307 Qdt_dnd_encoding)), 1304 Qdt_dnd_encoding)),
1308 l_data); 1305 l_data);
1767 int menubar_visible; 1764 int menubar_visible;
1768 Widget menubar; 1765 Widget menubar;
1769 #endif 1766 #endif
1770 1767
1771 if (STRINGP (f->name)) 1768 if (STRINGP (f->name))
1772 LISP_STRING_TO_EXTERNAL (f->name, name, Qctext); 1769 name = LISP_STRING_TO_EXTERNAL (f->name, Qctext);
1773 else 1770 else
1774 name = "emacs"; 1771 name = "emacs";
1775 1772
1776 /* The widget hierarchy is 1773 /* The widget hierarchy is
1777 1774
2204 { 2201 {
2205 Ibyte str[255]; 2202 Ibyte str[255];
2206 struct frame *f = decode_x_frame (frame); 2203 struct frame *f = decode_x_frame (frame);
2207 2204
2208 qxesprintf (str, "%lu", XtWindow (FRAME_X_TEXT_WIDGET (f))); 2205 qxesprintf (str, "%lu", XtWindow (FRAME_X_TEXT_WIDGET (f)));
2209 return build_intstring (str); 2206 return build_istring (str);
2210 } 2207 }
2211 2208
2212 2209
2213 /************************************************************************/ 2210 /************************************************************************/
2214 /* manipulating the X window */ 2211 /* manipulating the X window */
2602 2599
2603 #ifdef HAVE_CDE 2600 #ifdef HAVE_CDE
2604 DtDndDropUnregister (FRAME_X_TEXT_WIDGET (f)); 2601 DtDndDropUnregister (FRAME_X_TEXT_WIDGET (f));
2605 #endif /* HAVE_CDE */ 2602 #endif /* HAVE_CDE */
2606 2603
2607 #ifdef USE_XFT 2604 #ifdef HAVE_XFT
2608 /* If we have an XftDraw structure, we need to free it here. 2605 /* If we have an XftDraw structure, we need to free it here.
2609 We can't ever have an XftDraw without a Display, so we are safe 2606 We can't ever have an XftDraw without a Display, so we are safe
2610 to free it in here, and we avoid too much playing around with the 2607 to free it in here, and we avoid too much playing around with the
2611 malloc checking hooks this way. */ 2608 malloc checking hooks this way. */
2612 if (FRAME_X_XFTDRAW (f)) 2609 if (FRAME_X_XFTDRAW (f))
2638 2635
2639 FRAME_X_SHELL_WIDGET (f) = 0; 2636 FRAME_X_SHELL_WIDGET (f) = 0;
2640 2637
2641 if (FRAME_X_GEOM_FREE_ME_PLEASE (f)) 2638 if (FRAME_X_GEOM_FREE_ME_PLEASE (f))
2642 { 2639 {
2643 xfree (FRAME_X_GEOM_FREE_ME_PLEASE (f), Ascbyte *); 2640 xfree (FRAME_X_GEOM_FREE_ME_PLEASE (f));
2644 FRAME_X_GEOM_FREE_ME_PLEASE (f) = 0; 2641 FRAME_X_GEOM_FREE_ME_PLEASE (f) = 0;
2645 } 2642 }
2646 2643
2647 if (f->frame_data) 2644 if (f->frame_data)
2648 { 2645 {
2649 #ifndef NEW_GC 2646 #ifndef NEW_GC
2650 xfree (f->frame_data, void *); 2647 xfree (f->frame_data);
2651 #endif /* not NEW_GC */ 2648 #endif /* not NEW_GC */
2652 f->frame_data = 0; 2649 f->frame_data = 0;
2653 } 2650 }
2654 } 2651 }
2655 2652
2709 What does XtSetValues() do if that resource isn't present? */ 2706 What does XtSetValues() do if that resource isn't present? */
2710 if (!EQ (font, Vthe_null_font_instance)) 2707 if (!EQ (font, Vthe_null_font_instance))
2711 { 2708 {
2712 if (0) 2709 if (0)
2713 ; 2710 ;
2714 #ifdef USE_XFT 2711 #ifdef HAVE_XFT
2715 else if (FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))) 2712 else if (FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font)))
2716 { 2713 {
2717 Xt_SET_ARG (al[ac], XtNxftFont, 2714 Xt_SET_ARG (al[ac], XtNxftFont,
2718 (void *) FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))); 2715 (void *) FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font)));
2719 ac++; 2716 ac++;