comparison src/xfns.c @ 112434:9de5a68b57e1

Promote SSDATA macro from gtkutil.c and xsmfns.c to lisp.h.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 22 Jan 2011 18:56:06 -0800
parents 42e22c4f06b7
children
comparison
equal deleted inserted replaced
112433:7b649f6eac4f 112434:9de5a68b57e1
721 721
722 if (! NILP (found)) 722 if (! NILP (found))
723 { 723 {
724 GdkPixbuf *pixbuf; 724 GdkPixbuf *pixbuf;
725 GError *err = NULL; 725 GError *err = NULL;
726 char *filename = (char *) SDATA (found); 726 char *filename = SSDATA (found);
727 BLOCK_INPUT; 727 BLOCK_INPUT;
728 728
729 pixbuf = gdk_pixbuf_new_from_file (filename, &err); 729 pixbuf = gdk_pixbuf_new_from_file (filename, &err);
730 730
731 if (pixbuf) 731 if (pixbuf)
1159 return; 1159 return;
1160 1160
1161 BLOCK_INPUT; 1161 BLOCK_INPUT;
1162 if (NILP (arg)) 1162 if (NILP (arg))
1163 result = x_text_icon (f, 1163 result = x_text_icon (f,
1164 (char *) SDATA ((!NILP (f->icon_name) 1164 SSDATA ((!NILP (f->icon_name)
1165 ? f->icon_name 1165 ? f->icon_name
1166 : f->name))); 1166 : f->name)));
1167 else 1167 else
1168 result = x_bitmap_icon (f, arg); 1168 result = x_bitmap_icon (f, arg);
1169 1169
1170 if (result) 1170 if (result)
1171 { 1171 {
1196 return; 1196 return;
1197 1197
1198 BLOCK_INPUT; 1198 BLOCK_INPUT;
1199 1199
1200 result = x_text_icon (f, 1200 result = x_text_icon (f,
1201 (char *) SDATA ((!NILP (f->icon_name) 1201 SSDATA ((!NILP (f->icon_name)
1202 ? f->icon_name 1202 ? f->icon_name
1203 : !NILP (f->title) 1203 : !NILP (f->title)
1204 ? f->title 1204 ? f->title
1205 : f->name))); 1205 : f->name)));
1206 1206
1207 if (result) 1207 if (result)
1208 { 1208 {
1209 UNBLOCK_INPUT; 1209 UNBLOCK_INPUT;
1210 error ("No icon window available"); 1210 error ("No icon window available");
1596 encoded_icon_name = ENCODE_UTF_8 (f->icon_name); 1596 encoded_icon_name = ENCODE_UTF_8 (f->icon_name);
1597 } 1597 }
1598 1598
1599 #ifdef USE_GTK 1599 #ifdef USE_GTK
1600 gtk_window_set_title (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 1600 gtk_window_set_title (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1601 (char *) SDATA (encoded_name)); 1601 SSDATA (encoded_name));
1602 #else /* not USE_GTK */ 1602 #else /* not USE_GTK */
1603 XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text); 1603 XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text);
1604 XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 1604 XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
1605 FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_name, 1605 FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_name,
1606 FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING, 1606 FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING,
1607 8, PropModeReplace, 1607 8, PropModeReplace,
1608 (char *) SDATA (encoded_name), 1608 SSDATA (encoded_name),
1609 SBYTES (encoded_name)); 1609 SBYTES (encoded_name));
1610 #endif /* not USE_GTK */ 1610 #endif /* not USE_GTK */
1611 1611
1612 XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &icon); 1612 XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &icon);
1613 XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 1613 XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
1614 FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_icon_name, 1614 FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_icon_name,
1615 FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING, 1615 FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING,
1616 8, PropModeReplace, 1616 8, PropModeReplace,
1617 (char *) SDATA (encoded_icon_name), 1617 SSDATA (encoded_icon_name),
1618 SBYTES (encoded_icon_name)); 1618 SBYTES (encoded_icon_name));
1619 1619
1620 if (do_free_icon_value) 1620 if (do_free_icon_value)
1621 xfree (icon.value); 1621 xfree (icon.value);
1622 if (do_free_text_value) 1622 if (do_free_text_value)
2395 for the window manager, so GC relocation won't bother it. 2395 for the window manager, so GC relocation won't bother it.
2396 2396
2397 Elsewhere we specify the window name for the window manager. */ 2397 Elsewhere we specify the window name for the window manager. */
2398 2398
2399 { 2399 {
2400 char *str = (char *) SDATA (Vx_resource_name); 2400 char *str = SSDATA (Vx_resource_name);
2401 f->namebuf = (char *) xmalloc (strlen (str) + 1); 2401 f->namebuf = (char *) xmalloc (strlen (str) + 1);
2402 strcpy (f->namebuf, str); 2402 strcpy (f->namebuf, str);
2403 } 2403 }
2404 2404
2405 ac = 0; 2405 ac = 0;
2544 2544
2545 FRAME_X_WINDOW (f) = XtWindow (frame_widget); 2545 FRAME_X_WINDOW (f) = XtWindow (frame_widget);
2546 2546
2547 validate_x_resource_name (); 2547 validate_x_resource_name ();
2548 2548
2549 class_hints.res_name = (char *) SDATA (Vx_resource_name); 2549 class_hints.res_name = SSDATA (Vx_resource_name);
2550 class_hints.res_class = (char *) SDATA (Vx_resource_class); 2550 class_hints.res_class = SSDATA (Vx_resource_class);
2551 XSetClassHint (FRAME_X_DISPLAY (f), XtWindow (shell_widget), &class_hints); 2551 XSetClassHint (FRAME_X_DISPLAY (f), XtWindow (shell_widget), &class_hints);
2552 2552
2553 #ifdef HAVE_X_I18N 2553 #ifdef HAVE_X_I18N
2554 FRAME_XIC (f) = NULL; 2554 FRAME_XIC (f) = NULL;
2555 if (use_xim) 2555 if (use_xim)
2709 } 2709 }
2710 #endif /* HAVE_X_I18N */ 2710 #endif /* HAVE_X_I18N */
2711 2711
2712 validate_x_resource_name (); 2712 validate_x_resource_name ();
2713 2713
2714 class_hints.res_name = (char *) SDATA (Vx_resource_name); 2714 class_hints.res_name = SSDATA (Vx_resource_name);
2715 class_hints.res_class = (char *) SDATA (Vx_resource_class); 2715 class_hints.res_class = SSDATA (Vx_resource_class);
2716 XSetClassHint (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &class_hints); 2716 XSetClassHint (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &class_hints);
2717 2717
2718 /* The menubar is part of the ordinary display; 2718 /* The menubar is part of the ordinary display;
2719 it does not count in addition to the height of the window. */ 2719 it does not count in addition to the height of the window. */
2720 f->output_data.x->menubar_height = 0; 2720 f->output_data.x->menubar_height = 0;
2822 Qicon) 2822 Qicon)
2823 ? IconicState 2823 ? IconicState
2824 : NormalState)); 2824 : NormalState));
2825 #endif 2825 #endif
2826 2826
2827 x_text_icon (f, (char *) SDATA ((!NILP (f->icon_name) 2827 x_text_icon (f, SSDATA ((!NILP (f->icon_name)
2828 ? f->icon_name 2828 ? f->icon_name
2829 : f->name))); 2829 : f->name)));
2830 2830
2831 UNBLOCK_INPUT; 2831 UNBLOCK_INPUT;
2832 } 2832 }
2833 2833
2834 /* Make the GCs needed for this window, setting the 2834 /* Make the GCs needed for this window, setting the
4045 Vx_resource_name = Vinvocation_name; 4045 Vx_resource_name = Vinvocation_name;
4046 4046
4047 validate_x_resource_name (); 4047 validate_x_resource_name ();
4048 4048
4049 dpyinfo = x_term_init (name, (char *)0, 4049 dpyinfo = x_term_init (name, (char *)0,
4050 (char *) SDATA (Vx_resource_name)); 4050 SSDATA (Vx_resource_name));
4051 4051
4052 if (dpyinfo == 0) 4052 if (dpyinfo == 0)
4053 error ("Cannot connect to X server %s", SDATA (name)); 4053 error ("Cannot connect to X server %s", SDATA (name));
4054 4054
4055 x_in_use = 1; 4055 x_in_use = 1;
4080 if (! EQ (Vinitial_window_system, intern ("x"))) 4080 if (! EQ (Vinitial_window_system, intern ("x")))
4081 error ("Not using X Windows"); /* That doesn't stop us anymore. */ 4081 error ("Not using X Windows"); /* That doesn't stop us anymore. */
4082 #endif 4082 #endif
4083 4083
4084 if (! NILP (xrm_string)) 4084 if (! NILP (xrm_string))
4085 xrm_option = (unsigned char *) SDATA (xrm_string); 4085 xrm_option = SDATA (xrm_string);
4086 else 4086 else
4087 xrm_option = (unsigned char *) 0; 4087 xrm_option = (unsigned char *) 0;
4088 4088
4089 validate_x_resource_name (); 4089 validate_x_resource_name ();
4090 4090
4091 /* This is what opens the connection and sets x_current_display. 4091 /* This is what opens the connection and sets x_current_display.
4092 This also initializes many symbols, such as those used for input. */ 4092 This also initializes many symbols, such as those used for input. */
4093 dpyinfo = x_term_init (display, xrm_option, 4093 dpyinfo = x_term_init (display, xrm_option,
4094 (char *) SDATA (Vx_resource_name)); 4094 SSDATA (Vx_resource_name));
4095 4095
4096 if (dpyinfo == 0) 4096 if (dpyinfo == 0)
4097 { 4097 {
4098 if (!NILP (must_succeed)) 4098 if (!NILP (must_succeed))
4099 fatal ("Cannot connect to X server %s.\n\ 4099 fatal ("Cannot connect to X server %s.\n\