Mercurial > emacs
comparison src/xfns.c @ 20629:69d52f3bdb46
(x_create_bitmap_from_file): Use size_byte on strings.
(x_set_name, x_set_title, validate_x_resource_name): Likewise.
(Fx_get_resource, display_x_get_resource): Likewise.
(x_get_resource_string): Likewise.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 09 Jan 1998 23:20:32 +0000 |
parents | cdfaf8ce5208 |
children | 50929073a0ba |
comparison
equal
deleted
inserted
replaced
20628:05919533e157 | 20629:69d52f3bdb46 |
---|---|
597 return -1; | 597 return -1; |
598 | 598 |
599 id = x_allocate_bitmap_record (f); | 599 id = x_allocate_bitmap_record (f); |
600 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | 600 dpyinfo->bitmaps[id - 1].pixmap = bitmap; |
601 dpyinfo->bitmaps[id - 1].refcount = 1; | 601 dpyinfo->bitmaps[id - 1].refcount = 1; |
602 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1); | 602 dpyinfo->bitmaps[id - 1].file |
603 = (char *) xmalloc (XSTRING (file)->size_byte + 1); | |
603 dpyinfo->bitmaps[id - 1].depth = 1; | 604 dpyinfo->bitmaps[id - 1].depth = 1; |
604 dpyinfo->bitmaps[id - 1].height = height; | 605 dpyinfo->bitmaps[id - 1].height = height; |
605 dpyinfo->bitmaps[id - 1].width = width; | 606 dpyinfo->bitmaps[id - 1].width = width; |
606 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); | 607 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); |
607 | 608 |
1820 Lisp_Object icon_name; | 1821 Lisp_Object icon_name; |
1821 | 1822 |
1822 text.value = XSTRING (name)->data; | 1823 text.value = XSTRING (name)->data; |
1823 text.encoding = XA_STRING; | 1824 text.encoding = XA_STRING; |
1824 text.format = 8; | 1825 text.format = 8; |
1825 text.nitems = XSTRING (name)->size; | 1826 text.nitems = XSTRING (name)->size_byte; |
1826 | 1827 |
1827 icon_name = (!NILP (f->icon_name) ? f->icon_name : name); | 1828 icon_name = (!NILP (f->icon_name) ? f->icon_name : name); |
1828 | 1829 |
1829 icon.value = XSTRING (icon_name)->data; | 1830 icon.value = XSTRING (icon_name)->data; |
1830 icon.encoding = XA_STRING; | 1831 icon.encoding = XA_STRING; |
1831 icon.format = 8; | 1832 icon.format = 8; |
1832 icon.nitems = XSTRING (icon_name)->size; | 1833 icon.nitems = XSTRING (icon_name)->size_byte; |
1833 #ifdef USE_X_TOOLKIT | 1834 #ifdef USE_X_TOOLKIT |
1834 XSetWMName (FRAME_X_DISPLAY (f), | 1835 XSetWMName (FRAME_X_DISPLAY (f), |
1835 XtWindow (f->output_data.x->widget), &text); | 1836 XtWindow (f->output_data.x->widget), &text); |
1836 XSetWMIconName (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget), | 1837 XSetWMIconName (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget), |
1837 &icon); | 1838 &icon); |
1910 Lisp_Object icon_name; | 1911 Lisp_Object icon_name; |
1911 | 1912 |
1912 text.value = XSTRING (name)->data; | 1913 text.value = XSTRING (name)->data; |
1913 text.encoding = XA_STRING; | 1914 text.encoding = XA_STRING; |
1914 text.format = 8; | 1915 text.format = 8; |
1915 text.nitems = XSTRING (name)->size; | 1916 text.nitems = XSTRING (name)->size_byte; |
1916 | 1917 |
1917 icon_name = (!NILP (f->icon_name) ? f->icon_name : name); | 1918 icon_name = (!NILP (f->icon_name) ? f->icon_name : name); |
1918 | 1919 |
1919 icon.value = XSTRING (icon_name)->data; | 1920 icon.value = XSTRING (icon_name)->data; |
1920 icon.encoding = XA_STRING; | 1921 icon.encoding = XA_STRING; |
1921 icon.format = 8; | 1922 icon.format = 8; |
1922 icon.nitems = XSTRING (icon_name)->size; | 1923 icon.nitems = XSTRING (icon_name)->size_byte; |
1923 #ifdef USE_X_TOOLKIT | 1924 #ifdef USE_X_TOOLKIT |
1924 XSetWMName (FRAME_X_DISPLAY (f), | 1925 XSetWMName (FRAME_X_DISPLAY (f), |
1925 XtWindow (f->output_data.x->widget), &text); | 1926 XtWindow (f->output_data.x->widget), &text); |
1926 XSetWMIconName (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget), | 1927 XSetWMIconName (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget), |
1927 &icon); | 1928 &icon); |
2047 if (STRINGP (Vx_resource_name)) | 2048 if (STRINGP (Vx_resource_name)) |
2048 { | 2049 { |
2049 unsigned char *p = XSTRING (Vx_resource_name)->data; | 2050 unsigned char *p = XSTRING (Vx_resource_name)->data; |
2050 int i; | 2051 int i; |
2051 | 2052 |
2052 len = XSTRING (Vx_resource_name)->size; | 2053 len = XSTRING (Vx_resource_name)->size_byte; |
2053 | 2054 |
2054 /* Only letters, digits, - and _ are valid in resource names. | 2055 /* Only letters, digits, - and _ are valid in resource names. |
2055 Count the valid characters and count the invalid ones. */ | 2056 Count the valid characters and count the invalid ones. */ |
2056 for (i = 0; i < len; i++) | 2057 for (i = 0; i < len; i++) |
2057 { | 2058 { |
2131 | 2132 |
2132 validate_x_resource_name (); | 2133 validate_x_resource_name (); |
2133 | 2134 |
2134 /* Allocate space for the components, the dots which separate them, | 2135 /* Allocate space for the components, the dots which separate them, |
2135 and the final '\0'. Make them big enough for the worst case. */ | 2136 and the final '\0'. Make them big enough for the worst case. */ |
2136 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size | 2137 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size_byte |
2137 + (STRINGP (component) | 2138 + (STRINGP (component) |
2138 ? XSTRING (component)->size : 0) | 2139 ? XSTRING (component)->size_byte : 0) |
2139 + XSTRING (attribute)->size | 2140 + XSTRING (attribute)->size_byte |
2140 + 3); | 2141 + 3); |
2141 | 2142 |
2142 class_key = (char *) alloca (XSTRING (Vx_resource_class)->size | 2143 class_key = (char *) alloca (XSTRING (Vx_resource_class)->size_byte |
2143 + XSTRING (class)->size | 2144 + XSTRING (class)->size_byte |
2144 + (STRINGP (subclass) | 2145 + (STRINGP (subclass) |
2145 ? XSTRING (subclass)->size : 0) | 2146 ? XSTRING (subclass)->size_byte : 0) |
2146 + 3); | 2147 + 3); |
2147 | 2148 |
2148 /* Start with emacs.FRAMENAME for the name (the specific one) | 2149 /* Start with emacs.FRAMENAME for the name (the specific one) |
2149 and with `Emacs' for the class key (the general one). */ | 2150 and with `Emacs' for the class key (the general one). */ |
2150 strcpy (name_key, XSTRING (Vx_resource_name)->data); | 2151 strcpy (name_key, XSTRING (Vx_resource_name)->data); |
2199 | 2200 |
2200 validate_x_resource_name (); | 2201 validate_x_resource_name (); |
2201 | 2202 |
2202 /* Allocate space for the components, the dots which separate them, | 2203 /* Allocate space for the components, the dots which separate them, |
2203 and the final '\0'. Make them big enough for the worst case. */ | 2204 and the final '\0'. Make them big enough for the worst case. */ |
2204 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size | 2205 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size_byte |
2205 + (STRINGP (component) | 2206 + (STRINGP (component) |
2206 ? XSTRING (component)->size : 0) | 2207 ? XSTRING (component)->size_byte : 0) |
2207 + XSTRING (attribute)->size | 2208 + XSTRING (attribute)->size_byte |
2208 + 3); | 2209 + 3); |
2209 | 2210 |
2210 class_key = (char *) alloca (XSTRING (Vx_resource_class)->size | 2211 class_key = (char *) alloca (XSTRING (Vx_resource_class)->size_byte |
2211 + XSTRING (class)->size | 2212 + XSTRING (class)->size_byte |
2212 + (STRINGP (subclass) | 2213 + (STRINGP (subclass) |
2213 ? XSTRING (subclass)->size : 0) | 2214 ? XSTRING (subclass)->size_byte : 0) |
2214 + 3); | 2215 + 3); |
2215 | 2216 |
2216 /* Start with emacs.FRAMENAME for the name (the specific one) | 2217 /* Start with emacs.FRAMENAME for the name (the specific one) |
2217 and with `Emacs' for the class key (the general one). */ | 2218 and with `Emacs' for the class key (the general one). */ |
2218 strcpy (name_key, XSTRING (Vx_resource_name)->data); | 2219 strcpy (name_key, XSTRING (Vx_resource_name)->data); |
2251 char *name_key; | 2252 char *name_key; |
2252 char *class_key; | 2253 char *class_key; |
2253 | 2254 |
2254 /* Allocate space for the components, the dots which separate them, | 2255 /* Allocate space for the components, the dots which separate them, |
2255 and the final '\0'. */ | 2256 and the final '\0'. */ |
2256 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size | 2257 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size_byte |
2257 + strlen (attribute) + 2); | 2258 + strlen (attribute) + 2); |
2258 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | 2259 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) |
2259 + strlen (class) + 2); | 2260 + strlen (class) + 2); |
2260 | 2261 |
2261 sprintf (name_key, "%s.%s", | 2262 sprintf (name_key, "%s.%s", |
4868 if (keysym == NoSymbol) | 4869 if (keysym == NoSymbol) |
4869 error ("Keysym does not exist"); | 4870 error ("Keysym does not exist"); |
4870 | 4871 |
4871 if (NILP (modifiers)) | 4872 if (NILP (modifiers)) |
4872 XRebindKeysym (x_current_display, keysym, modifier_list, 0, | 4873 XRebindKeysym (x_current_display, keysym, modifier_list, 0, |
4873 XSTRING (newstring)->data, XSTRING (newstring)->size); | 4874 XSTRING (newstring)->data, XSTRING (newstring)->size_byte); |
4874 else | 4875 else |
4875 { | 4876 { |
4876 register Lisp_Object rest, mod; | 4877 register Lisp_Object rest, mod; |
4877 register int i = 0; | 4878 register int i = 0; |
4878 | 4879 |
4896 error ("Element is not a modifier keysym"); | 4897 error ("Element is not a modifier keysym"); |
4897 i++; | 4898 i++; |
4898 } | 4899 } |
4899 | 4900 |
4900 XRebindKeysym (x_current_display, keysym, modifier_list, i, | 4901 XRebindKeysym (x_current_display, keysym, modifier_list, i, |
4901 XSTRING (newstring)->data, XSTRING (newstring)->size); | 4902 XSTRING (newstring)->data, XSTRING (newstring)->size_byte); |
4902 } | 4903 } |
4903 | 4904 |
4904 return Qnil; | 4905 return Qnil; |
4905 } | 4906 } |
4906 | 4907 |
4927 { | 4928 { |
4928 item = Fcar (strings); | 4929 item = Fcar (strings); |
4929 if (!NILP (item)) | 4930 if (!NILP (item)) |
4930 { | 4931 { |
4931 CHECK_STRING (item, 2); | 4932 CHECK_STRING (item, 2); |
4932 strsize = XSTRING (item)->size; | 4933 strsize = XSTRING (item)->size_byte; |
4933 rawstring = (unsigned char *) xmalloc (strsize); | 4934 rawstring = (unsigned char *) xmalloc (strsize); |
4934 bcopy (XSTRING (item)->data, rawstring, strsize); | 4935 bcopy (XSTRING (item)->data, rawstring, strsize); |
4935 modifier[1] = 1 << i; | 4936 modifier[1] = 1 << i; |
4936 XRebindKeysym (x_current_display, rawkey, modifier, 1, | 4937 XRebindKeysym (x_current_display, rawkey, modifier, 1, |
4937 rawstring, strsize); | 4938 rawstring, strsize); |