Mercurial > emacs
changeset 68027:606e8e24acfe
* 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.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Wed, 04 Jan 2006 21:13:49 +0000 |
parents | c7ec296cf313 |
children | b0c2a07f73f6 |
files | src/ChangeLog src/gtkutil.c |
diffstat | 2 files changed, 39 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Jan 04 20:16:50 2006 +0000 +++ b/src/ChangeLog Wed Jan 04 21:13:49 2006 +0000 @@ -1,3 +1,9 @@ +2006-01-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * 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. + 2006-01-04 Eli Zaretskii <eliz@gnu.org> * .gdbinit: Avoid a warning message when x_error_quitter is not
--- a/src/gtkutil.c Wed Jan 04 20:16:50 2006 +0000 +++ b/src/gtkutil.c Wed Jan 04 21:13:49 2006 +0000 @@ -322,43 +322,43 @@ GdkPixmap *gmask; GdkDisplay *gdpy; - /* If we are on a one bit display, let GTK do all the image handling. + /* If we have a file, let GTK do all the image handling. This seems to be the only way to make insensitive and activated icons - look good. */ - if (x_screen_planes (f) == 1) + look good in all cases. */ + Lisp_Object specified_file = Qnil; + Lisp_Object tail; + extern Lisp_Object QCfile; + + for (tail = XCDR (img->spec); + NILP (specified_file) && CONSP (tail) && CONSP (XCDR (tail)); + tail = XCDR (XCDR (tail))) + if (EQ (XCAR (tail), QCfile)) + specified_file = XCAR (XCDR (tail)); + + if (STRINGP (specified_file)) { - Lisp_Object specified_file = Qnil; - Lisp_Object tail; - extern Lisp_Object QCfile; - - for (tail = XCDR (img->spec); - NILP (specified_file) && CONSP (tail) && CONSP (XCDR (tail)); - tail = XCDR (XCDR (tail))) - if (EQ (XCAR (tail), QCfile)) - specified_file = XCAR (XCDR (tail)); - - if (STRINGP (specified_file)) - { - - Lisp_Object file = Qnil; - struct gcpro gcpro1; - GCPRO1 (file); - - file = x_find_image_file (specified_file); - /* We already loaded the image once before calling this - function, so this should not fail. */ - xassert (STRINGP (file) != 0); - - if (! old_widget) - old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file))); - else - gtk_image_set_from_file (old_widget, SSDATA (file)); - - UNGCPRO; - return GTK_WIDGET (old_widget); - } + Lisp_Object file = Qnil; + struct gcpro gcpro1; + GCPRO1 (file); + + file = x_find_image_file (specified_file); + /* We already loaded the image once before calling this + function, so this should not fail. */ + xassert (STRINGP (file) != 0); + + if (! old_widget) + old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file))); + else + gtk_image_set_from_file (old_widget, SSDATA (file)); + + UNGCPRO; + return GTK_WIDGET (old_widget); } + /* No file, do the image handling ourselves. This will look very bad + on a monochrome display, and sometimes bad on all displays with + certain themes. */ + gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap); gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0;