aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2003-07-31 16:10:53 +0000
committerJan Djärv2003-07-31 16:10:53 +0000
commit465aa50afc635773061ce89b3398c5613d8eb8c0 (patch)
tree12620283470991b4f0ac6d858d026348559f3daa /src
parente430e5baa09f3451c5d03290b5c51e783a30fd26 (diff)
downloademacs-465aa50afc635773061ce89b3398c5613d8eb8c0.tar.gz
emacs-465aa50afc635773061ce89b3398c5613d8eb8c0.zip
* xfns.c (xg_set_icon): Rewrite to compile with GTK 2.0 and 2.2.
* xterm.c (x_bitmap_icon): Return if xg_set_icon succeeds.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/xfns.c61
-rw-r--r--src/xterm.c2
3 files changed, 45 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 71f2ff865f8..6c92bf7cd88 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12003-07-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * xfns.c (xg_set_icon): Rewrite to compile with GTK 2.0 and 2.2.
4
5 * xterm.c (x_bitmap_icon): Return if xg_set_icon succeeds.
6
12003-07-31 Kenichi Handa <handa@m17n.org> 72003-07-31 Kenichi Handa <handa@m17n.org>
2 8
3 * process.c (read_process_output): Return the actually read bytes 9 * process.c (read_process_output): Return the actually read bytes
diff --git a/src/xfns.c b/src/xfns.c
index b567b11d283..af7ed7473e8 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1092,36 +1092,51 @@ x_set_wait_for_wm (f, new_value, old_value)
1092 1092
1093#ifdef USE_GTK 1093#ifdef USE_GTK
1094 1094
1095/* Wrapper for gtk_window_icon_from_file() */ 1095static Lisp_Object x_find_image_file P_ ((Lisp_Object file));
1096
1097/* Set icon from FILE for frame F. By using GTK functions the icon
1098 may be any format that GdkPixbuf knows about, i.e. not just bitmaps. */
1096 1099
1097int 1100int
1098xg_set_icon(f, file) 1101xg_set_icon(f, file)
1099 struct frame *f; 1102 FRAME_PTR f;
1100 Lisp_Object file; 1103 Lisp_Object file;
1101{ 1104{
1102 struct gcpro gcpro1, gcpro2, gcpro3; 1105 struct gcpro gcpro1;
1103 int fd; 1106 int result = 0;
1104 int result = 1; 1107 Lisp_Object found;
1105 Lisp_Object found, search_path;
1106 char *filename;
1107 1108
1108 search_path = Fcons (Vdata_directory, Vx_bitmap_file_path); 1109 GCPRO1 (found);
1109 1110
1110 GCPRO3 (found, search_path, file); 1111 found = x_find_image_file (file);
1111 fd = openp (search_path, file, Qnil, &found, Qnil); 1112
1112 if (fd > 0) 1113 if (! NILP (found))
1113 { 1114 {
1114 filename = (char *) SDATA (found); 1115 GdkPixbuf *pixbuf;
1115 BLOCK_INPUT; 1116 GError *err = NULL;
1116 result = 1117 char *filename;
1117 gtk_window_set_icon_from_file (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 1118
1118 filename, 1119 filename = SDATA (found);
1119 NULL); 1120 BLOCK_INPUT;
1120 UNBLOCK_INPUT; 1121
1121 } 1122 pixbuf = gdk_pixbuf_new_from_file (filename, &err);
1122 emacs_close (fd); 1123
1123 UNGCPRO; 1124 if (pixbuf)
1124 return result; 1125 {
1126 gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1127 pixbuf);
1128 g_object_unref (pixbuf);
1129
1130 result = 1;
1131 }
1132 else
1133 g_error_free (err);
1134
1135 UNBLOCK_INPUT;
1136 }
1137
1138 UNGCPRO;
1139 return result;
1125} 1140}
1126#endif /* USE_GTK */ 1141#endif /* USE_GTK */
1127 1142
diff --git a/src/xterm.c b/src/xterm.c
index 7ffff61f361..5463ce8e192 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7474,7 +7474,7 @@ x_bitmap_icon (f, file)
7474#ifdef USE_GTK 7474#ifdef USE_GTK
7475 /* Use gtk_window_set_icon_from_file() if available, 7475 /* Use gtk_window_set_icon_from_file() if available,
7476 It's not restricted to bitmaps */ 7476 It's not restricted to bitmaps */
7477 if (!xg_set_icon(f, file)) 7477 if (xg_set_icon(f, file))
7478 return 0; 7478 return 0;
7479#endif /* USE_GTK */ 7479#endif /* USE_GTK */
7480 bitmap_id = x_create_bitmap_from_file (f, file); 7480 bitmap_id = x_create_bitmap_from_file (f, file);