aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2006-01-04 21:13:49 +0000
committerJan Djärv2006-01-04 21:13:49 +0000
commit0facd9c3c56e1ced8abf6d24206aecae9f254d47 (patch)
tree71f3d088daac0b385da13d57e6abb9ee32ce444a /src
parentb76747af07091b8e44df8f8351e3fef388d4f142 (diff)
downloademacs-0facd9c3c56e1ced8abf6d24206aecae9f254d47.tar.gz
emacs-0facd9c3c56e1ced8abf6d24206aecae9f254d47.zip
* gtkutil.c (xg_get_image_for_pixmap): If the image is from a file,
let GTK do all image processing. Importing Emacs own pixmaps to GTK looks bad for inactive tool bar items with some Gnome themes.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/gtkutil.c58
2 files changed, 35 insertions, 29 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 75a0dcc5890..b72a38da57a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12006-01-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * gtkutil.c (xg_get_image_for_pixmap): If the image is from a file,
4 let GTK do all image processing. Importing Emacs own pixmaps to GTK
5 looks bad for inactive tool bar items with some Gnome themes.
6
12006-01-04 Eli Zaretskii <eliz@gnu.org> 72006-01-04 Eli Zaretskii <eliz@gnu.org>
2 8
3 * .gdbinit: Avoid a warning message when x_error_quitter is not 9 * .gdbinit: Avoid a warning message when x_error_quitter is not
diff --git a/src/gtkutil.c b/src/gtkutil.c
index cb8e5a21860..ce66c5de35e 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -322,43 +322,43 @@ xg_get_image_for_pixmap (f, img, widget, old_widget)
322 GdkPixmap *gmask; 322 GdkPixmap *gmask;
323 GdkDisplay *gdpy; 323 GdkDisplay *gdpy;
324 324
325 /* If we are on a one bit display, let GTK do all the image handling. 325 /* If we have a file, let GTK do all the image handling.
326 This seems to be the only way to make insensitive and activated icons 326 This seems to be the only way to make insensitive and activated icons
327 look good. */ 327 look good in all cases. */
328 if (x_screen_planes (f) == 1) 328 Lisp_Object specified_file = Qnil;
329 { 329 Lisp_Object tail;
330 Lisp_Object specified_file = Qnil; 330 extern Lisp_Object QCfile;
331 Lisp_Object tail;
332 extern Lisp_Object QCfile;
333
334 for (tail = XCDR (img->spec);
335 NILP (specified_file) && CONSP (tail) && CONSP (XCDR (tail));
336 tail = XCDR (XCDR (tail)))
337 if (EQ (XCAR (tail), QCfile))
338 specified_file = XCAR (XCDR (tail));
339 331
340 if (STRINGP (specified_file)) 332 for (tail = XCDR (img->spec);
341 { 333 NILP (specified_file) && CONSP (tail) && CONSP (XCDR (tail));
334 tail = XCDR (XCDR (tail)))
335 if (EQ (XCAR (tail), QCfile))
336 specified_file = XCAR (XCDR (tail));
342 337
343 Lisp_Object file = Qnil; 338 if (STRINGP (specified_file))
344 struct gcpro gcpro1; 339 {
345 GCPRO1 (file); 340 Lisp_Object file = Qnil;
341 struct gcpro gcpro1;
342 GCPRO1 (file);
346 343
347 file = x_find_image_file (specified_file); 344 file = x_find_image_file (specified_file);
348 /* We already loaded the image once before calling this 345 /* We already loaded the image once before calling this
349 function, so this should not fail. */ 346 function, so this should not fail. */
350 xassert (STRINGP (file) != 0); 347 xassert (STRINGP (file) != 0);
351 348
352 if (! old_widget) 349 if (! old_widget)
353 old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file))); 350 old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file)));
354 else 351 else
355 gtk_image_set_from_file (old_widget, SSDATA (file)); 352 gtk_image_set_from_file (old_widget, SSDATA (file));
356 353
357 UNGCPRO; 354 UNGCPRO;
358 return GTK_WIDGET (old_widget); 355 return GTK_WIDGET (old_widget);
359 }
360 } 356 }
361 357
358 /* No file, do the image handling ourselves. This will look very bad
359 on a monochrome display, and sometimes bad on all displays with
360 certain themes. */
361
362 gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); 362 gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
363 gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap); 363 gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap);
364 gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0; 364 gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0;