comparison src/gtkutil.c @ 67528:c5c00342184b

* gtkutil.c (SSDATA): New macro to remove compiler warnings. (xg_get_image_for_pixmap, xg_create_frame_widgets) (xg_get_file_with_chooser): Use SSDATA instead of SDATA.
author Jan Djärv <jan.h.d@swipnet.se>
date Mon, 12 Dec 2005 08:08:56 +0000
parents a998f173b21a
children 5b8799d65159
comparison
equal deleted inserted replaced
67527:88807d05a058 67528:c5c00342184b
39 39
40 40
41 #define FRAME_TOTAL_PIXEL_HEIGHT(f) \ 41 #define FRAME_TOTAL_PIXEL_HEIGHT(f) \
42 (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)) 42 (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f))
43 43
44 /* Avoid "differ in sign" warnings */
45 #define SSDATA(x) ((char *) SDATA (x))
46
44 47
45 /*********************************************************************** 48 /***********************************************************************
46 Display handling functions 49 Display handling functions
47 ***********************************************************************/ 50 ***********************************************************************/
48 51
345 /* We already loaded the image once before calling this 348 /* We already loaded the image once before calling this
346 function, so this should not fail. */ 349 function, so this should not fail. */
347 xassert (STRINGP (file) != 0); 350 xassert (STRINGP (file) != 0);
348 351
349 if (! old_widget) 352 if (! old_widget)
350 old_widget = GTK_IMAGE (gtk_image_new_from_file (SDATA (file))); 353 old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file)));
351 else 354 else
352 gtk_image_set_from_file (old_widget, SDATA (file)); 355 gtk_image_set_from_file (old_widget, SSDATA (file));
353 356
354 UNGCPRO; 357 UNGCPRO;
355 return GTK_WIDGET (old_widget); 358 return GTK_WIDGET (old_widget);
356 } 359 }
357 } 360 }
733 } 736 }
734 737
735 /* Use same names as the Xt port does. I.e. Emacs.pane.emacs by default */ 738 /* Use same names as the Xt port does. I.e. Emacs.pane.emacs by default */
736 gtk_widget_set_name (wtop, EMACS_CLASS); 739 gtk_widget_set_name (wtop, EMACS_CLASS);
737 gtk_widget_set_name (wvbox, "pane"); 740 gtk_widget_set_name (wvbox, "pane");
738 gtk_widget_set_name (wfixed, SDATA (Vx_resource_name)); 741 gtk_widget_set_name (wfixed, SSDATA (Vx_resource_name));
739 742
740 /* If this frame has a title or name, set it in the title bar. */ 743 /* If this frame has a title or name, set it in the title bar. */
741 if (! NILP (f->title)) title = SDATA (ENCODE_UTF_8 (f->title)); 744 if (! NILP (f->title)) title = SSDATA (ENCODE_UTF_8 (f->title));
742 else if (! NILP (f->name)) title = SDATA (ENCODE_UTF_8 (f->name)); 745 else if (! NILP (f->name)) title = SSDATA (ENCODE_UTF_8 (f->name));
743 746
744 if (title) gtk_window_set_title (GTK_WINDOW (wtop), title); 747 if (title) gtk_window_set_title (GTK_WINDOW (wtop), title);
745 748
746 FRAME_GTK_OUTER_WIDGET (f) = wtop; 749 FRAME_GTK_OUTER_WIDGET (f) = wtop;
747 FRAME_GTK_WIDGET (f) = wfixed; 750 FRAME_GTK_WIDGET (f) = wfixed;
778 781
779 /* GTK documents says use gtk_window_set_resizable. But then a user 782 /* GTK documents says use gtk_window_set_resizable. But then a user
780 can't shrink the window from its starting size. */ 783 can't shrink the window from its starting size. */
781 gtk_window_set_policy (GTK_WINDOW (wtop), TRUE, TRUE, TRUE); 784 gtk_window_set_policy (GTK_WINDOW (wtop), TRUE, TRUE, TRUE);
782 gtk_window_set_wmclass (GTK_WINDOW (wtop), 785 gtk_window_set_wmclass (GTK_WINDOW (wtop),
783 SDATA (Vx_resource_name), 786 SSDATA (Vx_resource_name),
784 SDATA (Vx_resource_class)); 787 SSDATA (Vx_resource_class));
785 788
786 /* Add callback to do nothing on WM_DELETE_WINDOW. The default in 789 /* Add callback to do nothing on WM_DELETE_WINDOW. The default in
787 GTK is to destroy the widget. We want Emacs to do that instead. */ 790 GTK is to destroy the widget. We want Emacs to do that instead. */
788 g_signal_connect (G_OBJECT (wtop), "delete-event", 791 g_signal_connect (G_OBJECT (wtop), "delete-event",
789 G_CALLBACK (gtk_true), 0); 792 G_CALLBACK (gtk_true), 0);
1243 /* File chooser does not understand ~/... in the file name. It must be 1246 /* File chooser does not understand ~/... in the file name. It must be
1244 an absolute name starting with /. */ 1247 an absolute name starting with /. */
1245 if (default_filename[0] != '/') 1248 if (default_filename[0] != '/')
1246 file = Fexpand_file_name (file, Qnil); 1249 file = Fexpand_file_name (file, Qnil);
1247 1250
1248 default_filename = SDATA (file); 1251 default_filename = SSDATA (file);
1249 if (Ffile_directory_p (file)) 1252 if (Ffile_directory_p (file))
1250 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin), 1253 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin),
1251 default_filename); 1254 default_filename);
1252 else 1255 else
1253 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin), 1256 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),