diff options
| author | Miles Bader | 2007-08-29 05:03:40 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-08-29 05:03:40 +0000 |
| commit | 1bb9a689acfe821e0aa777ddf4e074556c7817a1 (patch) | |
| tree | f5478f932f35dc848934f28d5489204ff55e7e89 /src | |
| parent | 45f1ce5dc2e5e7830727b22925ad0ebc834726bd (diff) | |
| parent | cb5b9015b372175f1fc90cb7ba3f43298c621509 (diff) | |
| download | emacs-1bb9a689acfe821e0aa777ddf4e074556c7817a1.tar.gz emacs-1bb9a689acfe821e0aa777ddf4e074556c7817a1.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 857-865)
- Update from CVS
- Merge from emacs--rel--22
- Update from CVS: lisp/emacs-lisp/avl-tree.el: New file.
- Remove RCS keywords
* emacs--rel--22 (patch 97-100)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 246-247)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-252
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 118 | ||||
| -rw-r--r-- | src/Makefile.in | 7 | ||||
| -rw-r--r-- | src/config.in | 3 | ||||
| -rw-r--r-- | src/dispextern.h | 3 | ||||
| -rw-r--r-- | src/fileio.c | 26 | ||||
| -rw-r--r-- | src/gtkutil.c | 239 | ||||
| -rw-r--r-- | src/image.c | 480 | ||||
| -rw-r--r-- | src/keyboard.c | 9 | ||||
| -rw-r--r-- | src/lread.c | 39 | ||||
| -rw-r--r-- | src/m/amdx86-64.h | 9 | ||||
| -rw-r--r-- | src/mac.c | 109 | ||||
| -rw-r--r-- | src/macterm.c | 15 | ||||
| -rw-r--r-- | src/puresize.h | 2 | ||||
| -rw-r--r-- | src/w32reg.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 22 |
15 files changed, 935 insertions, 148 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 06fcf372e81..e2ff82ff975 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,119 @@ | |||
| 1 | 2007-08-28 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * keyboard.c: Qrtl is new. | ||
| 4 | (parse_tool_bar_item): Handle :rtl keyword. | ||
| 5 | (syms_of_keyboard): Intern :rtl keyword. | ||
| 6 | |||
| 7 | * dispextern.h (enum tool_bar_item_idx): Add TOOL_BAR_ITEM_RTL_IMAGE. | ||
| 8 | |||
| 9 | * gtkutil.c (xg_tool_bar_expose_callback): Just do SET_FRAME_GARBAGED | ||
| 10 | so no Lisp code is executed. | ||
| 11 | (file_for_image, find_rtl_image): New functions. | ||
| 12 | (xg_get_image_for_pixmap): Use file_for_image | ||
| 13 | (update_frame_tool_bar): If direction is RTL, use RTL image if | ||
| 14 | defined. Use Gtk stock images if defined. | ||
| 15 | |||
| 16 | 2007-08-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 17 | |||
| 18 | * macterm.c (x_draw_composite_glyph_string_foreground): Draw rectangle | ||
| 19 | for nonexistent or zero-width glyph in composition glyph. | ||
| 20 | |||
| 21 | 2007-08-25 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 22 | |||
| 23 | * m/amdx86-64.h: Redirect to intel386.h if compiling for i386. | ||
| 24 | |||
| 25 | * xdisp.c (Finvisible_p): New function. | ||
| 26 | (syms_of_xdisp): defsubr it. | ||
| 27 | |||
| 28 | 2007-08-24 Juanma Barranquero <lekktu@gmail.com> | ||
| 29 | |||
| 30 | * image.c (syms_of_image) <image-library-alist, cross-disabled-images>: | ||
| 31 | Doc fixes. | ||
| 32 | |||
| 33 | 2007-08-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 34 | |||
| 35 | * mac.c [MAC_OSX] (select_and_poll_event, sys_select): Fix last changes. | ||
| 36 | |||
| 37 | 2007-08-24 Martin Rudalics <rudalics@gmx.at> | ||
| 38 | |||
| 39 | * fileio.c (Finsert_file_contents): Consult CHARS_MODIFF to tell | ||
| 40 | whether decoding has modified buffer contents. | ||
| 41 | |||
| 42 | 2007-08-24 Jason Rumney <jasonr@gnu.org> | ||
| 43 | |||
| 44 | * image.c [HAVE_NTGUI]: Define dynamic loaded functions for SVG. | ||
| 45 | (Qgdk_pixbuf, Qglib) [HAVE_NTGUI]: New symbols. | ||
| 46 | (syms_of_image) [HAVE_NTGUI]: Intern and staticpro them. | ||
| 47 | (init_svg_functions) [HAVE_NTGUI]: New function. | ||
| 48 | (fn_g_type_init, fn_g_object_unref, fn_g_error_free): New #defines. | ||
| 49 | (svg_load_image): Use them. | ||
| 50 | (svg_load_image) [HAVE_NTGUI]: Implement background. | ||
| 51 | |||
| 52 | 2007-08-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 53 | |||
| 54 | * Makefile.in (RSVG_LIBS, RSVG_CFLAGS): New variables. | ||
| 55 | (ALL_CFLAGS): Use ${RSVG_CFLAGS} instead of @RSVG_CFLAGS@. | ||
| 56 | (LIBX): Remove @RSVG_LIBS@. | ||
| 57 | (LIBES): Add $(RSVG_LIBS). | ||
| 58 | |||
| 59 | * image.c (svg_load_image): Blend with specified background if exists. | ||
| 60 | Use IMAGE_BACKGROUND. Add Mac OS Support. | ||
| 61 | |||
| 62 | * mac.c (wakeup_from_rne_enabled_p) [MAC_OSX]: Remove variable. | ||
| 63 | (ENABLE_WAKEUP_FROM_RNE, DISABLE_WAKEUP_FROM_RNE) [MAC_OSX]: | ||
| 64 | Remove macros. | ||
| 65 | [MAC_OSX] (socket_callback): Do nothing. | ||
| 66 | [MAC_OSX] (select_and_poll_event): Use CFRunLoopRunInMode instead of | ||
| 67 | ReceiveNextEvent. | ||
| 68 | [MAC_OSX] (sys_select): Likewise. Don't set context as argument to | ||
| 69 | socket_callback. | ||
| 70 | (mac_wakeup_from_rne) [MAC_OSX]: Do nothing. | ||
| 71 | |||
| 72 | 2007-08-22 Glenn Morris <rgm@gnu.org> | ||
| 73 | |||
| 74 | * image.c (x_find_image_file): Search in etc/images/ rather than etc/. | ||
| 75 | |||
| 76 | 2007-08-22 Paul Pogonyshev <pogonyshev@gmx.net> | ||
| 77 | |||
| 78 | * Makefile.in (ALL_CFLAGS, LIBX): Add RSVG_LIBS. | ||
| 79 | |||
| 80 | * image.c: Add support for SVG images. Some additional comments | ||
| 81 | by Joakim Verona <joakim@verona.se>. When HAVE_RSVG is defined: | ||
| 82 | (svg_image_p): New function to test for SVG image. | ||
| 83 | (svg_load): New function to load SVG image. | ||
| 84 | (svg_load_image): New function, helper for svg_load. | ||
| 85 | (Qsvg): New Lisp_object. | ||
| 86 | (svg_keyword_index): New enum. | ||
| 87 | (svg_format): New static `image_keyword' struct. | ||
| 88 | (svg_type): New static `image_type' struct. | ||
| 89 | (librsvg/rsvg.h): Include it. | ||
| 90 | |||
| 91 | 2007-08-23 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 92 | |||
| 93 | * lread.c (load_warn_old_style_backquotes): Fix up array size typo. | ||
| 94 | |||
| 95 | 2007-08-22 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 96 | |||
| 97 | * lread.c (Qold_style_backquotes): New var. | ||
| 98 | (syms_of_lread): Init and staticpro it. | ||
| 99 | (load_warn_old_style_backquotes): New fun. | ||
| 100 | (Fload): Use them to warn about old style backquotes. | ||
| 101 | (end_of_file_error, Fload): Remove unused vars. | ||
| 102 | |||
| 103 | * lisp.h (Fclear_face_cache, Fx_send_client_event): Declare. | ||
| 104 | |||
| 105 | * lread.c (Vold_style_backquotes): New var. | ||
| 106 | (syms_of_lread): Init and export it to Elisp. | ||
| 107 | (read1): Set it when we find an old-style (back)quote. | ||
| 108 | |||
| 109 | 2007-08-22 Jason Rumney <jasonr@gnu.org> | ||
| 110 | |||
| 111 | * w32reg.c (SYSTEM_DEFAULT_RESOURCES): Add missing NULL terminator. | ||
| 112 | |||
| 113 | 2007-08-22 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 114 | |||
| 115 | * puresize.h (BASE_PURESIZE): Increase to 1140000. | ||
| 116 | |||
| 1 | 2007-08-19 Richard Stallman <rms@gnu.org> | 117 | 2007-08-19 Richard Stallman <rms@gnu.org> |
| 2 | 118 | ||
| 3 | * eval.c (Ffunction, Fquote): Signal error if not 1 argument. | 119 | * eval.c (Ffunction, Fquote): Signal error if not 1 argument. |
| @@ -130,7 +246,7 @@ | |||
| 130 | (mac_valid_selection_target_p): Rename from valid_scrap_target_type_p. | 246 | (mac_valid_selection_target_p): Rename from valid_scrap_target_type_p. |
| 131 | (mac_clear_selection): Rename from clear_scrap. | 247 | (mac_clear_selection): Rename from clear_scrap. |
| 132 | (get_flavor_type_from_symbol): New argument SEL and subsume function of | 248 | (get_flavor_type_from_symbol): New argument SEL and subsume function of |
| 133 | scrap_has_target_type. All uses changed. | 249 | scrap_has_target_type. All uses changed. |
| 134 | (mac_get_selection_ownership_info, mac_valid_selection_value_p) | 250 | (mac_get_selection_ownership_info, mac_valid_selection_value_p) |
| 135 | (mac_selection_has_target_p): New functions. | 251 | (mac_selection_has_target_p): New functions. |
| 136 | (mac_put_selection_value): Rename from put_scrap_string. | 252 | (mac_put_selection_value): Rename from put_scrap_string. |
diff --git a/src/Makefile.in b/src/Makefile.in index f4d548b7460..217e9846e23 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -282,7 +282,7 @@ TOOLKIT_DEFINES = | |||
| 282 | 282 | ||
| 283 | /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM | 283 | /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM |
| 284 | since it may have -I options that should override those two. */ | 284 | since it may have -I options that should override those two. */ |
| 285 | ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ | 285 | ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ |
| 286 | .c.o: | 286 | .c.o: |
| 287 | $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< | 287 | $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< |
| 288 | 288 | ||
| @@ -470,6 +470,9 @@ LIBX= $(LIBXMENU) LD_SWITCH_X_SITE -lX10 LIBX10_MACHINE LIBX10_SYSTEM | |||
| 470 | LIBSOUND= @LIBSOUND@ | 470 | LIBSOUND= @LIBSOUND@ |
| 471 | CFLAGS_SOUND= @CFLAGS_SOUND@ | 471 | CFLAGS_SOUND= @CFLAGS_SOUND@ |
| 472 | 472 | ||
| 473 | RSVG_LIBS= @RSVG_LIBS@ | ||
| 474 | RSVG_CFLAGS= @RSVG_CFLAGS@ | ||
| 475 | |||
| 473 | #ifndef ORDINARY_LINK | 476 | #ifndef ORDINARY_LINK |
| 474 | /* Fix linking if compiled with GCC. */ | 477 | /* Fix linking if compiled with GCC. */ |
| 475 | #ifdef __GNUC__ | 478 | #ifdef __GNUC__ |
| @@ -949,7 +952,7 @@ SOME_MACHINE_LISP = ${dotdot}/lisp/mouse.elc \ | |||
| 949 | Note that SunOS needs -lm to come before -lc; otherwise, you get | 952 | Note that SunOS needs -lm to come before -lc; otherwise, you get |
| 950 | duplicated symbols. If the standard libraries were compiled | 953 | duplicated symbols. If the standard libraries were compiled |
| 951 | with GCC, we might need gnulib again after them. */ | 954 | with GCC, we might need gnulib again after them. */ |
| 952 | LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) LIBGPM \ | 955 | LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) LIBGPM \ |
| 953 | LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ | 956 | LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ |
| 954 | LIBS_DEBUG $(GETLOADAVG_LIBS) \ | 957 | LIBS_DEBUG $(GETLOADAVG_LIBS) \ |
| 955 | @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ \ | 958 | @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ \ |
diff --git a/src/config.in b/src/config.in index abe5119add8..f2636c50626 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -504,6 +504,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 504 | /* Define to 1 if you have the `rmdir' function. */ | 504 | /* Define to 1 if you have the `rmdir' function. */ |
| 505 | #undef HAVE_RMDIR | 505 | #undef HAVE_RMDIR |
| 506 | 506 | ||
| 507 | /* Define to 1 if using librsvg. */ | ||
| 508 | #undef HAVE_RSVG | ||
| 509 | |||
| 507 | /* Define to 1 if you have the `select' function. */ | 510 | /* Define to 1 if you have the `select' function. */ |
| 508 | #undef HAVE_SELECT | 511 | #undef HAVE_SELECT |
| 509 | 512 | ||
diff --git a/src/dispextern.h b/src/dispextern.h index 58ba3a91ee3..c07b4b36f92 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2589,6 +2589,9 @@ enum tool_bar_item_idx | |||
| 2589 | /* Help string. */ | 2589 | /* Help string. */ |
| 2590 | TOOL_BAR_ITEM_HELP, | 2590 | TOOL_BAR_ITEM_HELP, |
| 2591 | 2591 | ||
| 2592 | /* Icon file name of right to left image when an RTL locale is used. */ | ||
| 2593 | TOOL_BAR_ITEM_RTL_IMAGE, | ||
| 2594 | |||
| 2592 | /* Sentinel = number of slots in tool_bar_items occupied by one | 2595 | /* Sentinel = number of slots in tool_bar_items occupied by one |
| 2593 | tool-bar item. */ | 2596 | tool-bar item. */ |
| 2594 | TOOL_BAR_ITEM_NSLOTS | 2597 | TOOL_BAR_ITEM_NSLOTS |
diff --git a/src/fileio.c b/src/fileio.c index 983bd72d282..58c3e75111c 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -4710,14 +4710,21 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4710 | int opoint = PT; | 4710 | int opoint = PT; |
| 4711 | int opoint_byte = PT_BYTE; | 4711 | int opoint_byte = PT_BYTE; |
| 4712 | int oinserted = ZV - BEGV; | 4712 | int oinserted = ZV - BEGV; |
| 4713 | int ochars_modiff = CHARS_MODIFF; | ||
| 4713 | 4714 | ||
| 4714 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | 4715 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |
| 4715 | insval = call3 (Qformat_decode, | 4716 | insval = call3 (Qformat_decode, |
| 4716 | Qnil, make_number (oinserted), visit); | 4717 | Qnil, make_number (oinserted), visit); |
| 4717 | CHECK_NUMBER (insval); | 4718 | CHECK_NUMBER (insval); |
| 4718 | if (XINT (insval) == oinserted) | 4719 | if (ochars_modiff == CHARS_MODIFF) |
| 4720 | /* format_decode didn't modify buffer's characters => move | ||
| 4721 | point back to position before inserted text and leave | ||
| 4722 | value of inserted alone. */ | ||
| 4719 | SET_PT_BOTH (opoint, opoint_byte); | 4723 | SET_PT_BOTH (opoint, opoint_byte); |
| 4720 | inserted = XFASTINT (insval); | 4724 | else |
| 4725 | /* format_decode modified buffer's characters => consider | ||
| 4726 | entire buffer changed and leave point at point-min. */ | ||
| 4727 | inserted = XFASTINT (insval); | ||
| 4721 | } | 4728 | } |
| 4722 | 4729 | ||
| 4723 | /* For consistency with format-decode call these now iff inserted > 0 | 4730 | /* For consistency with format-decode call these now iff inserted > 0 |
| @@ -4740,15 +4747,24 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4740 | int opoint = PT; | 4747 | int opoint = PT; |
| 4741 | int opoint_byte = PT_BYTE; | 4748 | int opoint_byte = PT_BYTE; |
| 4742 | int oinserted = ZV - BEGV; | 4749 | int oinserted = ZV - BEGV; |
| 4743 | 4750 | int ochars_modiff = CHARS_MODIFF; | |
| 4751 | |||
| 4744 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | 4752 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |
| 4745 | insval = call1 (XCAR (p), make_number (oinserted)); | 4753 | insval = call1 (XCAR (p), make_number (oinserted)); |
| 4746 | if (!NILP (insval)) | 4754 | if (!NILP (insval)) |
| 4747 | { | 4755 | { |
| 4748 | CHECK_NUMBER (insval); | 4756 | CHECK_NUMBER (insval); |
| 4749 | if (XINT (insval) == oinserted) | 4757 | if (ochars_modiff == CHARS_MODIFF) |
| 4758 | /* after_insert_file_functions didn't modify | ||
| 4759 | buffer's characters => move point back to | ||
| 4760 | position before inserted text and leave value of | ||
| 4761 | inserted alone. */ | ||
| 4750 | SET_PT_BOTH (opoint, opoint_byte); | 4762 | SET_PT_BOTH (opoint, opoint_byte); |
| 4751 | inserted = XFASTINT (insval); | 4763 | else |
| 4764 | /* after_insert_file_functions did modify buffer's | ||
| 4765 | characters => consider entire buffer changed and | ||
| 4766 | leave point at point-min. */ | ||
| 4767 | inserted = XFASTINT (insval); | ||
| 4752 | } | 4768 | } |
| 4753 | } | 4769 | } |
| 4754 | 4770 | ||
diff --git a/src/gtkutil.c b/src/gtkutil.c index 7dc451a5d04..9fb011de919 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -298,6 +298,23 @@ xg_get_pixbuf_from_pix_and_mask (gpix, gmask, cmap) | |||
| 298 | return icon_buf; | 298 | return icon_buf; |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | static Lisp_Object | ||
| 302 | file_for_image(image) | ||
| 303 | Lisp_Object image; | ||
| 304 | { | ||
| 305 | Lisp_Object specified_file = Qnil; | ||
| 306 | Lisp_Object tail; | ||
| 307 | extern Lisp_Object QCfile; | ||
| 308 | |||
| 309 | for (tail = XCDR (image); | ||
| 310 | NILP (specified_file) && CONSP (tail) && CONSP (XCDR (tail)); | ||
| 311 | tail = XCDR (XCDR (tail))) | ||
| 312 | if (EQ (XCAR (tail), QCfile)) | ||
| 313 | specified_file = XCAR (XCDR (tail)); | ||
| 314 | |||
| 315 | return specified_file; | ||
| 316 | } | ||
| 317 | |||
| 301 | /* For the image defined in IMG, make and return a GtkImage. For displays with | 318 | /* For the image defined in IMG, make and return a GtkImage. For displays with |
| 302 | 8 planes or less we must make a GdkPixbuf and apply the mask manually. | 319 | 8 planes or less we must make a GdkPixbuf and apply the mask manually. |
| 303 | Otherwise the highlightning and dimming the tool bar code in GTK does | 320 | Otherwise the highlightning and dimming the tool bar code in GTK does |
| @@ -323,16 +340,8 @@ xg_get_image_for_pixmap (f, img, widget, old_widget) | |||
| 323 | /* If we have a file, let GTK do all the image handling. | 340 | /* If we have a file, let GTK do all the image handling. |
| 324 | This seems to be the only way to make insensitive and activated icons | 341 | This seems to be the only way to make insensitive and activated icons |
| 325 | look good in all cases. */ | 342 | look good in all cases. */ |
| 326 | Lisp_Object specified_file = Qnil; | 343 | Lisp_Object specified_file = file_for_image (img->spec); |
| 327 | Lisp_Object tail; | ||
| 328 | Lisp_Object file; | 344 | Lisp_Object file; |
| 329 | extern Lisp_Object QCfile; | ||
| 330 | |||
| 331 | for (tail = XCDR (img->spec); | ||
| 332 | NILP (specified_file) && CONSP (tail) && CONSP (XCDR (tail)); | ||
| 333 | tail = XCDR (XCDR (tail))) | ||
| 334 | if (EQ (XCAR (tail), QCfile)) | ||
| 335 | specified_file = XCAR (XCDR (tail)); | ||
| 336 | 345 | ||
| 337 | /* We already loaded the image once before calling this | 346 | /* We already loaded the image once before calling this |
| 338 | function, so this only fails if the image file has been removed. | 347 | function, so this only fails if the image file has been removed. |
| @@ -3332,6 +3341,16 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) | |||
| 3332 | /* The key for storing the button widget in its proxy menu item. */ | 3341 | /* The key for storing the button widget in its proxy menu item. */ |
| 3333 | #define XG_TOOL_BAR_PROXY_BUTTON "emacs-tool-bar-proxy-button" | 3342 | #define XG_TOOL_BAR_PROXY_BUTTON "emacs-tool-bar-proxy-button" |
| 3334 | 3343 | ||
| 3344 | /* The key for the data we put in the GtkImage widgets. The data is | ||
| 3345 | the stock name used by Emacs. We use this to see if we need to update | ||
| 3346 | the GtkImage with a new image. */ | ||
| 3347 | #define XG_TOOL_BAR_STOCK_NAME "emacs-tool-bar-stock-name" | ||
| 3348 | |||
| 3349 | /* Callback function invoked when a tool bar item is pressed. | ||
| 3350 | W is the button widget in the tool bar that got pressed, | ||
| 3351 | CLIENT_DATA is an integer that is the index of the button in the | ||
| 3352 | tool bar. 0 is the first button. */ | ||
| 3353 | |||
| 3335 | static gboolean | 3354 | static gboolean |
| 3336 | xg_tool_bar_button_cb (widget, event, user_data) | 3355 | xg_tool_bar_button_cb (widget, event, user_data) |
| 3337 | GtkWidget *widget; | 3356 | GtkWidget *widget; |
| @@ -3614,8 +3633,10 @@ xg_tool_bar_item_expose_callback (w, event, client_data) | |||
| 3614 | return FALSE; | 3633 | return FALSE; |
| 3615 | } | 3634 | } |
| 3616 | 3635 | ||
| 3636 | #define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) | ||
| 3637 | |||
| 3617 | /* This callback is called when a tool bar shall be redrawn. | 3638 | /* This callback is called when a tool bar shall be redrawn. |
| 3618 | We need to update the tool bar from here in case the image cache | 3639 | We need to update the images in case the image cache |
| 3619 | has deleted the pixmaps used in the tool bar. | 3640 | has deleted the pixmaps used in the tool bar. |
| 3620 | W is the GtkToolbar to be redrawn. | 3641 | W is the GtkToolbar to be redrawn. |
| 3621 | EVENT is the expose event for W. | 3642 | EVENT is the expose event for W. |
| @@ -3629,7 +3650,8 @@ xg_tool_bar_expose_callback (w, event, client_data) | |||
| 3629 | GdkEventExpose *event; | 3650 | GdkEventExpose *event; |
| 3630 | gpointer client_data; | 3651 | gpointer client_data; |
| 3631 | { | 3652 | { |
| 3632 | update_frame_tool_bar ((FRAME_PTR) client_data); | 3653 | FRAME_PTR f = (FRAME_PTR) client_data; |
| 3654 | SET_FRAME_GARBAGED (f); | ||
| 3633 | return FALSE; | 3655 | return FALSE; |
| 3634 | } | 3656 | } |
| 3635 | 3657 | ||
| @@ -3690,6 +3712,40 @@ xg_create_tool_bar (f) | |||
| 3690 | SET_FRAME_GARBAGED (f); | 3712 | SET_FRAME_GARBAGED (f); |
| 3691 | } | 3713 | } |
| 3692 | 3714 | ||
| 3715 | /* Find the right-to-left image named by RTL in the tool bar images for F. | ||
| 3716 | Returns IMAGE if RTL is not found. */ | ||
| 3717 | |||
| 3718 | static Lisp_Object | ||
| 3719 | find_rtl_image (f, image, rtl) | ||
| 3720 | FRAME_PTR f; | ||
| 3721 | Lisp_Object image; | ||
| 3722 | Lisp_Object rtl; | ||
| 3723 | { | ||
| 3724 | int i; | ||
| 3725 | Lisp_Object file, rtl_name; | ||
| 3726 | struct gcpro gcpro1, gcpro2; | ||
| 3727 | GCPRO2 (file, rtl_name); | ||
| 3728 | |||
| 3729 | rtl_name = Ffile_name_nondirectory (rtl); | ||
| 3730 | |||
| 3731 | for (i = 0; i < f->n_tool_bar_items; ++i) | ||
| 3732 | { | ||
| 3733 | Lisp_Object rtl_image = PROP (TOOL_BAR_ITEM_IMAGES); | ||
| 3734 | if (!NILP (file = file_for_image (rtl_image))) | ||
| 3735 | { | ||
| 3736 | file = call1 (intern ("file-name-sans-extension"), | ||
| 3737 | Ffile_name_nondirectory (file)); | ||
| 3738 | if (EQ (Fequal (file, rtl_name), Qt)) | ||
| 3739 | { | ||
| 3740 | image = rtl_image; | ||
| 3741 | break; | ||
| 3742 | } | ||
| 3743 | } | ||
| 3744 | } | ||
| 3745 | |||
| 3746 | return image; | ||
| 3747 | } | ||
| 3748 | |||
| 3693 | /* Update the tool bar for frame F. Add new buttons and remove old. */ | 3749 | /* Update the tool bar for frame F. Add new buttons and remove old. */ |
| 3694 | 3750 | ||
| 3695 | void | 3751 | void |
| @@ -3700,7 +3756,9 @@ update_frame_tool_bar (f) | |||
| 3700 | GtkRequisition old_req, new_req; | 3756 | GtkRequisition old_req, new_req; |
| 3701 | struct x_output *x = f->output_data.x; | 3757 | struct x_output *x = f->output_data.x; |
| 3702 | int hmargin = 0, vmargin = 0; | 3758 | int hmargin = 0, vmargin = 0; |
| 3759 | GtkToolbar *wtoolbar; | ||
| 3703 | GtkToolItem *ti; | 3760 | GtkToolItem *ti; |
| 3761 | GtkTextDirection dir; | ||
| 3704 | 3762 | ||
| 3705 | if (! FRAME_GTK_WIDGET (f)) | 3763 | if (! FRAME_GTK_WIDGET (f)) |
| 3706 | return; | 3764 | return; |
| @@ -3734,20 +3792,27 @@ update_frame_tool_bar (f) | |||
| 3734 | if (! x->toolbar_widget) | 3792 | if (! x->toolbar_widget) |
| 3735 | xg_create_tool_bar (f); | 3793 | xg_create_tool_bar (f); |
| 3736 | 3794 | ||
| 3737 | gtk_widget_size_request (x->toolbar_widget, &old_req); | 3795 | wtoolbar = GTK_TOOLBAR (x->toolbar_widget); |
| 3796 | gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req); | ||
| 3797 | dir = gtk_widget_get_direction (x->toolbar_widget); | ||
| 3738 | 3798 | ||
| 3739 | for (i = 0; i < f->n_tool_bar_items; ++i) | 3799 | for (i = 0; i < f->n_tool_bar_items; ++i) |
| 3740 | { | 3800 | { |
| 3741 | #define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) | ||
| 3742 | 3801 | ||
| 3743 | int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); | 3802 | int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); |
| 3744 | int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); | 3803 | int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); |
| 3745 | int idx; | 3804 | int idx; |
| 3746 | int img_id; | 3805 | int img_id; |
| 3747 | struct image *img; | 3806 | int icon_size = 0; |
| 3807 | struct image *img = NULL; | ||
| 3748 | Lisp_Object image; | 3808 | Lisp_Object image; |
| 3809 | Lisp_Object stock; | ||
| 3810 | GtkStockItem stock_item; | ||
| 3811 | char *stock_name = NULL; | ||
| 3812 | Lisp_Object rtl; | ||
| 3749 | GtkWidget *wbutton; | 3813 | GtkWidget *wbutton; |
| 3750 | GtkWidget *weventbox; | 3814 | GtkWidget *weventbox; |
| 3815 | Lisp_Object func = intern ("x-gtk-map-stock"); | ||
| 3751 | 3816 | ||
| 3752 | ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i); | 3817 | ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i); |
| 3753 | 3818 | ||
| @@ -3757,59 +3822,98 @@ update_frame_tool_bar (f) | |||
| 3757 | wbutton = gtk_bin_get_child (GTK_BIN (weventbox)); | 3822 | wbutton = gtk_bin_get_child (GTK_BIN (weventbox)); |
| 3758 | } | 3823 | } |
| 3759 | 3824 | ||
| 3760 | /* If image is a vector, choose the image according to the | ||
| 3761 | button state. */ | ||
| 3762 | image = PROP (TOOL_BAR_ITEM_IMAGES); | 3825 | image = PROP (TOOL_BAR_ITEM_IMAGES); |
| 3763 | if (VECTORP (image)) | ||
| 3764 | { | ||
| 3765 | if (enabled_p) | ||
| 3766 | idx = (selected_p | ||
| 3767 | ? TOOL_BAR_IMAGE_ENABLED_SELECTED | ||
| 3768 | : TOOL_BAR_IMAGE_ENABLED_DESELECTED); | ||
| 3769 | else | ||
| 3770 | idx = (selected_p | ||
| 3771 | ? TOOL_BAR_IMAGE_DISABLED_SELECTED | ||
| 3772 | : TOOL_BAR_IMAGE_DISABLED_DESELECTED); | ||
| 3773 | |||
| 3774 | xassert (ASIZE (image) >= idx); | ||
| 3775 | image = AREF (image, idx); | ||
| 3776 | } | ||
| 3777 | else | ||
| 3778 | idx = -1; | ||
| 3779 | 3826 | ||
| 3780 | /* Ignore invalid image specifications. */ | 3827 | /* Ignore invalid image specifications. */ |
| 3781 | if (!valid_image_p (image)) | 3828 | if (!valid_image_p (image)) |
| 3782 | { | 3829 | { |
| 3783 | if (ti) gtk_widget_hide_all (GTK_WIDGET (ti)); | 3830 | if (wbutton) gtk_widget_hide (wbutton); |
| 3784 | continue; | 3831 | continue; |
| 3785 | } | 3832 | } |
| 3786 | 3833 | ||
| 3787 | img_id = lookup_image (f, image); | 3834 | if (EQ (Qt, Ffboundp (func))) |
| 3788 | img = IMAGE_FROM_ID (f, img_id); | 3835 | stock = call1 (func, file_for_image (image)); |
| 3789 | prepare_image_for_display (f, img); | ||
| 3790 | 3836 | ||
| 3791 | if (img->load_failed_p || img->pixmap == None) | 3837 | if (! NILP (stock) && STRINGP (stock) |
| 3838 | && gtk_stock_lookup (SSDATA (stock), &stock_item)) | ||
| 3839 | { | ||
| 3840 | stock_name = SSDATA (stock); | ||
| 3841 | icon_size = gtk_toolbar_get_icon_size (wtoolbar); | ||
| 3842 | } | ||
| 3843 | else | ||
| 3792 | { | 3844 | { |
| 3793 | if (ti) | 3845 | /* No stock image, or stock item not known. Try regular image. */ |
| 3794 | gtk_widget_hide_all (GTK_WIDGET (ti)); | 3846 | |
| 3795 | else | 3847 | /* If image is a vector, choose the image according to the |
| 3848 | button state. */ | ||
| 3849 | if (dir == GTK_TEXT_DIR_RTL | ||
| 3850 | && !NILP (rtl = PROP (TOOL_BAR_ITEM_RTL_IMAGE)) | ||
| 3851 | && STRINGP (rtl)) | ||
| 3796 | { | 3852 | { |
| 3797 | /* Insert an empty (non-image) button */ | 3853 | image = find_rtl_image (f, image, rtl); |
| 3798 | weventbox = gtk_event_box_new (); | 3854 | } |
| 3799 | wbutton = gtk_button_new (); | 3855 | |
| 3800 | gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE); | 3856 | if (VECTORP (image)) |
| 3801 | gtk_button_set_relief (GTK_BUTTON (wbutton), GTK_RELIEF_NONE); | 3857 | { |
| 3802 | gtk_container_add (GTK_CONTAINER (weventbox), wbutton); | 3858 | if (enabled_p) |
| 3803 | ti = gtk_tool_item_new (); | 3859 | idx = (selected_p |
| 3804 | gtk_container_add (GTK_CONTAINER (ti), weventbox); | 3860 | ? TOOL_BAR_IMAGE_ENABLED_SELECTED |
| 3805 | gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1); | 3861 | : TOOL_BAR_IMAGE_ENABLED_DESELECTED); |
| 3862 | else | ||
| 3863 | idx = (selected_p | ||
| 3864 | ? TOOL_BAR_IMAGE_DISABLED_SELECTED | ||
| 3865 | : TOOL_BAR_IMAGE_DISABLED_DESELECTED); | ||
| 3866 | |||
| 3867 | xassert (ASIZE (image) >= idx); | ||
| 3868 | image = AREF (image, idx); | ||
| 3869 | } | ||
| 3870 | else | ||
| 3871 | idx = -1; | ||
| 3872 | |||
| 3873 | img_id = lookup_image (f, image); | ||
| 3874 | img = IMAGE_FROM_ID (f, img_id); | ||
| 3875 | prepare_image_for_display (f, img); | ||
| 3876 | |||
| 3877 | if (img->load_failed_p || img->pixmap == None) | ||
| 3878 | { | ||
| 3879 | if (ti) | ||
| 3880 | gtk_widget_hide_all (GTK_WIDGET (ti)); | ||
| 3881 | else | ||
| 3882 | { | ||
| 3883 | /* Insert an empty (non-image) button */ | ||
| 3884 | weventbox = gtk_event_box_new (); | ||
| 3885 | wbutton = gtk_button_new (); | ||
| 3886 | gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE); | ||
| 3887 | gtk_button_set_relief (GTK_BUTTON (wbutton), | ||
| 3888 | GTK_RELIEF_NONE); | ||
| 3889 | gtk_container_add (GTK_CONTAINER (weventbox), wbutton); | ||
| 3890 | ti = gtk_tool_item_new (); | ||
| 3891 | gtk_container_add (GTK_CONTAINER (ti), weventbox); | ||
| 3892 | gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1); | ||
| 3893 | } | ||
| 3894 | continue; | ||
| 3806 | } | 3895 | } |
| 3807 | continue; | ||
| 3808 | } | 3896 | } |
| 3809 | 3897 | ||
| 3810 | if (ti == NULL) | 3898 | if (ti == NULL) |
| 3811 | { | 3899 | { |
| 3812 | GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); | 3900 | GtkWidget *w; |
| 3901 | if (stock_name) | ||
| 3902 | { | ||
| 3903 | w = gtk_image_new_from_stock (stock_name, icon_size); | ||
| 3904 | g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_STOCK_NAME, | ||
| 3905 | (gpointer) xstrdup (stock_name), | ||
| 3906 | (GDestroyNotify) xfree); | ||
| 3907 | } | ||
| 3908 | else | ||
| 3909 | { | ||
| 3910 | w = xg_get_image_for_pixmap (f, img, x->widget, NULL); | ||
| 3911 | /* Save the image so we can see if an update is needed when | ||
| 3912 | this function is called again. */ | ||
| 3913 | g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, | ||
| 3914 | (gpointer)img->pixmap); | ||
| 3915 | } | ||
| 3916 | |||
| 3813 | gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); | 3917 | gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); |
| 3814 | wbutton = gtk_button_new (); | 3918 | wbutton = gtk_button_new (); |
| 3815 | gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE); | 3919 | gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE); |
| @@ -3833,10 +3937,6 @@ update_frame_tool_bar (f) | |||
| 3833 | 3937 | ||
| 3834 | gtk_widget_show_all (GTK_WIDGET (ti)); | 3938 | gtk_widget_show_all (GTK_WIDGET (ti)); |
| 3835 | 3939 | ||
| 3836 | /* Save the image so we can see if an update is needed when | ||
| 3837 | this function is called again. */ | ||
| 3838 | g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, | ||
| 3839 | (gpointer)img->pixmap); | ||
| 3840 | 3940 | ||
| 3841 | g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f); | 3941 | g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f); |
| 3842 | 3942 | ||
| @@ -3878,13 +3978,30 @@ update_frame_tool_bar (f) | |||
| 3878 | GtkWidget *wimage = gtk_bin_get_child (GTK_BIN (wbutton)); | 3978 | GtkWidget *wimage = gtk_bin_get_child (GTK_BIN (wbutton)); |
| 3879 | Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage), | 3979 | Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage), |
| 3880 | XG_TOOL_BAR_IMAGE_DATA); | 3980 | XG_TOOL_BAR_IMAGE_DATA); |
| 3881 | gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin); | 3981 | gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage), |
| 3982 | XG_TOOL_BAR_STOCK_NAME); | ||
| 3983 | if (stock_name && | ||
| 3984 | (! old_stock_name || strcmp (old_stock_name, stock_name) != 0)) | ||
| 3985 | { | ||
| 3986 | gtk_image_set_from_stock (GTK_IMAGE (wimage), | ||
| 3987 | stock_name, icon_size); | ||
| 3988 | g_object_set_data_full (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME, | ||
| 3989 | (gpointer) xstrdup (stock_name), | ||
| 3990 | (GDestroyNotify) xfree); | ||
| 3991 | g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, | ||
| 3992 | NULL); | ||
| 3993 | } | ||
| 3994 | else if (img && old_img != img->pixmap) | ||
| 3995 | { | ||
| 3996 | (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); | ||
| 3997 | g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, | ||
| 3998 | (gpointer)img->pixmap); | ||
| 3882 | 3999 | ||
| 3883 | if (old_img != img->pixmap) | 4000 | g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME, |
| 3884 | (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); | 4001 | NULL); |
| 4002 | } | ||
| 3885 | 4003 | ||
| 3886 | g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, | 4004 | gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin); |
| 3887 | (gpointer)img->pixmap); | ||
| 3888 | 4005 | ||
| 3889 | gtk_widget_set_sensitive (wbutton, enabled_p); | 4006 | gtk_widget_set_sensitive (wbutton, enabled_p); |
| 3890 | gtk_widget_show_all (GTK_WIDGET (ti)); | 4007 | gtk_widget_show_all (GTK_WIDGET (ti)); |
| @@ -3901,7 +4018,7 @@ update_frame_tool_bar (f) | |||
| 3901 | if (ti) gtk_widget_hide_all (GTK_WIDGET (ti)); | 4018 | if (ti) gtk_widget_hide_all (GTK_WIDGET (ti)); |
| 3902 | } while (ti != NULL); | 4019 | } while (ti != NULL); |
| 3903 | 4020 | ||
| 3904 | gtk_widget_size_request (x->toolbar_widget, &new_req); | 4021 | gtk_widget_size_request (GTK_WIDGET (wtoolbar), &new_req); |
| 3905 | if (old_req.height != new_req.height | 4022 | if (old_req.height != new_req.height |
| 3906 | && ! FRAME_X_OUTPUT (f)->toolbar_detached) | 4023 | && ! FRAME_X_OUTPUT (f)->toolbar_detached) |
| 3907 | { | 4024 | { |
diff --git a/src/image.c b/src/image.c index a3cd3195217..54c01cf36b3 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* Functions for image support on window system. | 1 | /* Functions for image support on window system. |
| 2 | Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, | 2 | Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
| 3 | 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. | 3 | 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
| 4 | Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| 6 | 7 | ||
| @@ -1317,8 +1318,8 @@ image_ascent (img, face, slice) | |||
| 1317 | { | 1318 | { |
| 1318 | #ifdef HAVE_NTGUI | 1319 | #ifdef HAVE_NTGUI |
| 1319 | /* W32 specific version. Why?. ++kfs */ | 1320 | /* W32 specific version. Why?. ++kfs */ |
| 1320 | ascent = height / 2 - (FONT_DESCENT(face->font) | 1321 | ascent = height / 2 - (FONT_DESCENT (face->font) |
| 1321 | - FONT_BASE(face->font)) / 2; | 1322 | - FONT_BASE (face->font)) / 2; |
| 1322 | #else | 1323 | #else |
| 1323 | /* This expression is arranged so that if the image can't be | 1324 | /* This expression is arranged so that if the image can't be |
| 1324 | exactly centered, it will be moved slightly up. This is | 1325 | exactly centered, it will be moved slightly up. This is |
| @@ -2095,7 +2096,7 @@ forall_images_in_image_cache (f, fn) | |||
| 2095 | 2096 | ||
| 2096 | /* Load a DLL implementing an image type. | 2097 | /* Load a DLL implementing an image type. |
| 2097 | The `image-library-alist' variable associates a symbol, | 2098 | The `image-library-alist' variable associates a symbol, |
| 2098 | identifying an image type, to a list of possible filenames. | 2099 | identifying an image type, to a list of possible filenames. |
| 2099 | The function returns NULL if no library could be loaded for | 2100 | The function returns NULL if no library could be loaded for |
| 2100 | the given image type, or if the library was previously loaded; | 2101 | the given image type, or if the library was previously loaded; |
| 2101 | else the handle of the DLL. */ | 2102 | else the handle of the DLL. */ |
| @@ -2251,7 +2252,7 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap) | |||
| 2251 | 2252 | ||
| 2252 | if (*pixmap == NULL) | 2253 | if (*pixmap == NULL) |
| 2253 | { | 2254 | { |
| 2254 | DWORD err = GetLastError(); | 2255 | DWORD err = GetLastError (); |
| 2255 | Lisp_Object errcode; | 2256 | Lisp_Object errcode; |
| 2256 | /* All system errors are < 10000, so the following is safe. */ | 2257 | /* All system errors are < 10000, so the following is safe. */ |
| 2257 | XSETINT (errcode, (int) err); | 2258 | XSETINT (errcode, (int) err); |
| @@ -2353,7 +2354,7 @@ x_put_x_image (f, ximg, pixmap, width, height) | |||
| 2353 | static unsigned char *slurp_file P_ ((char *, int *)); | 2354 | static unsigned char *slurp_file P_ ((char *, int *)); |
| 2354 | 2355 | ||
| 2355 | 2356 | ||
| 2356 | /* Find image file FILE. Look in data-directory, then | 2357 | /* Find image file FILE. Look in data-directory/images, then |
| 2357 | x-bitmap-file-path. Value is the encoded full name of the file | 2358 | x-bitmap-file-path. Value is the encoded full name of the file |
| 2358 | found, or nil if not found. */ | 2359 | found, or nil if not found. */ |
| 2359 | 2360 | ||
| @@ -2366,7 +2367,11 @@ x_find_image_file (file) | |||
| 2366 | int fd; | 2367 | int fd; |
| 2367 | 2368 | ||
| 2368 | file_found = Qnil; | 2369 | file_found = Qnil; |
| 2369 | search_path = Fcons (Vdata_directory, Vx_bitmap_file_path); | 2370 | /* TODO I think this should use something like image-load-path |
| 2371 | instead. Unfortunately, that can contain non-string elements. */ | ||
| 2372 | search_path = Fcons (Fexpand_file_name (build_string ("images"), | ||
| 2373 | Vdata_directory), | ||
| 2374 | Vx_bitmap_file_path); | ||
| 2370 | GCPRO2 (file_found, search_path); | 2375 | GCPRO2 (file_found, search_path); |
| 2371 | 2376 | ||
| 2372 | /* Try to find FILE in data-directory, then x-bitmap-file-path. */ | 2377 | /* Try to find FILE in data-directory, then x-bitmap-file-path. */ |
| @@ -3103,7 +3108,8 @@ w32_create_pixmap_from_bitmap_data (int width, int height, char *data) | |||
| 3103 | return bmp; | 3108 | return bmp; |
| 3104 | } | 3109 | } |
| 3105 | 3110 | ||
| 3106 | static void convert_mono_to_color_image (f, img, foreground, background) | 3111 | static void |
| 3112 | convert_mono_to_color_image (f, img, foreground, background) | ||
| 3107 | struct frame *f; | 3113 | struct frame *f; |
| 3108 | struct image *img; | 3114 | struct image *img; |
| 3109 | COLORREF foreground, background; | 3115 | COLORREF foreground, background; |
| @@ -3146,7 +3152,7 @@ static void convert_mono_to_color_image (f, img, foreground, background) | |||
| 3146 | 3152 | ||
| 3147 | 3153 | ||
| 3148 | static void | 3154 | static void |
| 3149 | Create_Pixmap_From_Bitmap_Data(f, img, data, fg, bg, non_default_colors) | 3155 | Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors) |
| 3150 | struct frame *f; | 3156 | struct frame *f; |
| 3151 | struct image *img; | 3157 | struct image *img; |
| 3152 | char *data; | 3158 | char *data; |
| @@ -5052,7 +5058,8 @@ x_to_xcolors (f, img, rgb_p) | |||
| 5052 | created with CreateDIBSection, with the pointer to the bit values | 5058 | created with CreateDIBSection, with the pointer to the bit values |
| 5053 | stored in ximg->data. */ | 5059 | stored in ximg->data. */ |
| 5054 | 5060 | ||
| 5055 | static void XPutPixel (ximg, x, y, color) | 5061 | static void |
| 5062 | XPutPixel (ximg, x, y, color) | ||
| 5056 | XImagePtr ximg; | 5063 | XImagePtr ximg; |
| 5057 | int x, y; | 5064 | int x, y; |
| 5058 | COLORREF color; | 5065 | COLORREF color; |
| @@ -6706,7 +6713,7 @@ init_jpeg_functions (Lisp_Object libraries) | |||
| 6706 | /* Wrapper since we can't directly assign the function pointer | 6713 | /* Wrapper since we can't directly assign the function pointer |
| 6707 | to another function pointer that was declared more completely easily. */ | 6714 | to another function pointer that was declared more completely easily. */ |
| 6708 | static boolean | 6715 | static boolean |
| 6709 | jpeg_resync_to_restart_wrapper(cinfo, desired) | 6716 | jpeg_resync_to_restart_wrapper (cinfo, desired) |
| 6710 | j_decompress_ptr cinfo; | 6717 | j_decompress_ptr cinfo; |
| 6711 | int desired; | 6718 | int desired; |
| 6712 | { | 6719 | { |
| @@ -7800,7 +7807,7 @@ gif_load (f, img) | |||
| 7800 | memsrc.index = 0; | 7807 | memsrc.index = 0; |
| 7801 | 7808 | ||
| 7802 | /* Casting return value avoids a GCC warning on W32. */ | 7809 | /* Casting return value avoids a GCC warning on W32. */ |
| 7803 | gif = (GifFileType *)fn_DGifOpen(&memsrc, gif_read_from_memory); | 7810 | gif = (GifFileType *) fn_DGifOpen (&memsrc, gif_read_from_memory); |
| 7804 | if (!gif) | 7811 | if (!gif) |
| 7805 | { | 7812 | { |
| 7806 | image_error ("Cannot open memory source `%s'", img->spec, Qnil); | 7813 | image_error ("Cannot open memory source `%s'", img->spec, Qnil); |
| @@ -8201,6 +8208,418 @@ gif_load (f, img) | |||
| 8201 | 8208 | ||
| 8202 | 8209 | ||
| 8203 | /*********************************************************************** | 8210 | /*********************************************************************** |
| 8211 | SVG | ||
| 8212 | ***********************************************************************/ | ||
| 8213 | |||
| 8214 | #if defined (HAVE_RSVG) | ||
| 8215 | |||
| 8216 | /* Function prototypes. */ | ||
| 8217 | |||
| 8218 | static int svg_image_p P_ ((Lisp_Object object)); | ||
| 8219 | static int svg_load P_ ((struct frame *f, struct image *img)); | ||
| 8220 | |||
| 8221 | static int svg_load_image P_ ((struct frame *, struct image *, | ||
| 8222 | unsigned char *, unsigned int)); | ||
| 8223 | |||
| 8224 | /* The symbol `svg' identifying images of this type. */ | ||
| 8225 | |||
| 8226 | Lisp_Object Qsvg; | ||
| 8227 | |||
| 8228 | /* Indices of image specification fields in svg_format, below. */ | ||
| 8229 | |||
| 8230 | enum svg_keyword_index | ||
| 8231 | { | ||
| 8232 | SVG_TYPE, | ||
| 8233 | SVG_DATA, | ||
| 8234 | SVG_FILE, | ||
| 8235 | SVG_ASCENT, | ||
| 8236 | SVG_MARGIN, | ||
| 8237 | SVG_RELIEF, | ||
| 8238 | SVG_ALGORITHM, | ||
| 8239 | SVG_HEURISTIC_MASK, | ||
| 8240 | SVG_MASK, | ||
| 8241 | SVG_BACKGROUND, | ||
| 8242 | SVG_LAST | ||
| 8243 | }; | ||
| 8244 | |||
| 8245 | /* Vector of image_keyword structures describing the format | ||
| 8246 | of valid user-defined image specifications. */ | ||
| 8247 | |||
| 8248 | static struct image_keyword svg_format[SVG_LAST] = | ||
| 8249 | { | ||
| 8250 | {":type", IMAGE_SYMBOL_VALUE, 1}, | ||
| 8251 | {":data", IMAGE_STRING_VALUE, 0}, | ||
| 8252 | {":file", IMAGE_STRING_VALUE, 0}, | ||
| 8253 | {":ascent", IMAGE_ASCENT_VALUE, 0}, | ||
| 8254 | {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, | ||
| 8255 | {":relief", IMAGE_INTEGER_VALUE, 0}, | ||
| 8256 | {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, | ||
| 8257 | {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, | ||
| 8258 | {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, | ||
| 8259 | {":background", IMAGE_STRING_OR_NIL_VALUE, 0} | ||
| 8260 | }; | ||
| 8261 | |||
| 8262 | /* Structure describing the image type `svg'. Its the same type of | ||
| 8263 | structure defined for all image formats, handled by emacs image | ||
| 8264 | functions. See struct image_type in dispextern.h. */ | ||
| 8265 | |||
| 8266 | static struct image_type svg_type = | ||
| 8267 | { | ||
| 8268 | /* An identifier showing that this is an image structure for the SVG format. */ | ||
| 8269 | &Qsvg, | ||
| 8270 | /* Handle to a function that can be used to identify a SVG file. */ | ||
| 8271 | svg_image_p, | ||
| 8272 | /* Handle to function used to load a SVG file. */ | ||
| 8273 | svg_load, | ||
| 8274 | /* Handle to function to free sresources for SVG. */ | ||
| 8275 | x_clear_image, | ||
| 8276 | /* An internal field to link to the next image type in a list of | ||
| 8277 | image types, will be filled in when registering the format. */ | ||
| 8278 | NULL | ||
| 8279 | }; | ||
| 8280 | |||
| 8281 | |||
| 8282 | /* Return non-zero if OBJECT is a valid SVG image specification. Do | ||
| 8283 | this by calling parse_image_spec and supplying the keywords that | ||
| 8284 | identify the SVG format. */ | ||
| 8285 | |||
| 8286 | static int | ||
| 8287 | svg_image_p (object) | ||
| 8288 | Lisp_Object object; | ||
| 8289 | { | ||
| 8290 | struct image_keyword fmt[SVG_LAST]; | ||
| 8291 | bcopy (svg_format, fmt, sizeof fmt); | ||
| 8292 | |||
| 8293 | if (!parse_image_spec (object, fmt, SVG_LAST, Qsvg)) | ||
| 8294 | return 0; | ||
| 8295 | |||
| 8296 | /* Must specify either the :data or :file keyword. */ | ||
| 8297 | return fmt[SVG_FILE].count + fmt[SVG_DATA].count == 1; | ||
| 8298 | } | ||
| 8299 | |||
| 8300 | #include <librsvg/rsvg.h> | ||
| 8301 | |||
| 8302 | #ifdef HAVE_NTGUI | ||
| 8303 | |||
| 8304 | /* SVG library functions. */ | ||
| 8305 | DEF_IMGLIB_FN (rsvg_handle_new); | ||
| 8306 | DEF_IMGLIB_FN (rsvg_handle_set_size_callback); | ||
| 8307 | DEF_IMGLIB_FN (rsvg_handle_write); | ||
| 8308 | DEF_IMGLIB_FN (rsvg_handle_close); | ||
| 8309 | DEF_IMGLIB_FN (rsvg_handle_get_pixbuf); | ||
| 8310 | DEF_IMGLIB_FN (rsvg_handle_free); | ||
| 8311 | |||
| 8312 | DEF_IMGLIB_FN (gdk_pixbuf_get_width); | ||
| 8313 | DEF_IMGLIB_FN (gdk_pixbuf_get_height); | ||
| 8314 | DEF_IMGLIB_FN (gdk_pixbuf_get_pixels); | ||
| 8315 | DEF_IMGLIB_FN (gdk_pixbuf_get_rowstride); | ||
| 8316 | DEF_IMGLIB_FN (gdk_pixbuf_get_colorspace); | ||
| 8317 | DEF_IMGLIB_FN (gdk_pixbuf_get_n_channels); | ||
| 8318 | DEF_IMGLIB_FN (gdk_pixbuf_get_has_alpha); | ||
| 8319 | DEF_IMGLIB_FN (gdk_pixbuf_get_bits_per_sample); | ||
| 8320 | |||
| 8321 | DEF_IMGLIB_FN (g_type_init); | ||
| 8322 | DEF_IMGLIB_FN (g_object_unref); | ||
| 8323 | DEF_IMGLIB_FN (g_error_free); | ||
| 8324 | |||
| 8325 | Lisp_Object Qgdk_pixbuf, Qglib; | ||
| 8326 | |||
| 8327 | static int | ||
| 8328 | init_svg_functions (Lisp_Object libraries) | ||
| 8329 | { | ||
| 8330 | HMODULE library, gdklib, glib; | ||
| 8331 | |||
| 8332 | if (!(glib = w32_delayed_load (libraries, Qglib)) | ||
| 8333 | || !(gdklib = w32_delayed_load (libraries, Qgdk_pixbuf)) | ||
| 8334 | || !(library = w32_delayed_load (libraries, Qsvg))) | ||
| 8335 | return 0; | ||
| 8336 | |||
| 8337 | LOAD_IMGLIB_FN (library, rsvg_handle_new); | ||
| 8338 | LOAD_IMGLIB_FN (library, rsvg_handle_set_size_callback); | ||
| 8339 | LOAD_IMGLIB_FN (library, rsvg_handle_write); | ||
| 8340 | LOAD_IMGLIB_FN (library, rsvg_handle_close); | ||
| 8341 | LOAD_IMGLIB_FN (library, rsvg_handle_get_pixbuf); | ||
| 8342 | LOAD_IMGLIB_FN (library, rsvg_handle_free); | ||
| 8343 | |||
| 8344 | LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_width); | ||
| 8345 | LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_height); | ||
| 8346 | LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_pixels); | ||
| 8347 | LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_rowstride); | ||
| 8348 | LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_colorspace); | ||
| 8349 | LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_n_channels); | ||
| 8350 | LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_has_alpha); | ||
| 8351 | LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_bits_per_sample); | ||
| 8352 | |||
| 8353 | LOAD_IMGLIB_FN (glib, g_type_init); | ||
| 8354 | LOAD_IMGLIB_FN (glib, g_object_unref); | ||
| 8355 | LOAD_IMGLIB_FN (glib, g_error_free); | ||
| 8356 | return 1; | ||
| 8357 | } | ||
| 8358 | |||
| 8359 | #else | ||
| 8360 | /* The following aliases for library functions allow dynamic loading | ||
| 8361 | to be used on some platforms. */ | ||
| 8362 | #define fn_rsvg_handle_new rsvg_handle_new | ||
| 8363 | #define fn_rsvg_handle_set_size_callback rsvg_handle_set_size_callback | ||
| 8364 | #define fn_rsvg_handle_write rsvg_handle_write | ||
| 8365 | #define fn_rsvg_handle_close rsvg_handle_close | ||
| 8366 | #define fn_rsvg_handle_get_pixbuf rsvg_handle_get_pixbuf | ||
| 8367 | #define fn_rsvg_handle_free rsvg_handle_free | ||
| 8368 | |||
| 8369 | #define fn_gdk_pixbuf_get_width gdk_pixbuf_get_width | ||
| 8370 | #define fn_gdk_pixbuf_get_height gdk_pixbuf_get_height | ||
| 8371 | #define fn_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels | ||
| 8372 | #define fn_gdk_pixbuf_get_rowstride gdk_pixbuf_get_rowstride | ||
| 8373 | #define fn_gdk_pixbuf_get_colorspace gdk_pixbuf_get_colorspace | ||
| 8374 | #define fn_gdk_pixbuf_get_n_channels gdk_pixbuf_get_n_channels | ||
| 8375 | #define fn_gdk_pixbuf_get_has_alpha gdk_pixbuf_get_has_alpha | ||
| 8376 | #define fn_gdk_pixbuf_get_bits_per_sample gdk_pixbuf_get_bits_per_sample | ||
| 8377 | |||
| 8378 | #define fn_g_type_init g_type_init | ||
| 8379 | #define fn_g_object_unref g_object_unref | ||
| 8380 | #define fn_g_error_free g_error_free | ||
| 8381 | #endif /* !HAVE_NTGUI */ | ||
| 8382 | |||
| 8383 | /* Load SVG image IMG for use on frame F. Value is non-zero if | ||
| 8384 | successful. this function will go into the svg_type structure, and | ||
| 8385 | the prototype thus needs to be compatible with that structure. */ | ||
| 8386 | |||
| 8387 | static int | ||
| 8388 | svg_load (f, img) | ||
| 8389 | struct frame *f; | ||
| 8390 | struct image *img; | ||
| 8391 | { | ||
| 8392 | int success_p = 0; | ||
| 8393 | Lisp_Object file_name; | ||
| 8394 | |||
| 8395 | /* If IMG->spec specifies a file name, create a non-file spec from it. */ | ||
| 8396 | file_name = image_spec_value (img->spec, QCfile, NULL); | ||
| 8397 | if (STRINGP (file_name)) | ||
| 8398 | { | ||
| 8399 | Lisp_Object file; | ||
| 8400 | unsigned char *contents; | ||
| 8401 | int size; | ||
| 8402 | struct gcpro gcpro1; | ||
| 8403 | |||
| 8404 | file = x_find_image_file (file_name); | ||
| 8405 | GCPRO1 (file); | ||
| 8406 | if (!STRINGP (file)) | ||
| 8407 | { | ||
| 8408 | image_error ("Cannot find image file `%s'", file_name, Qnil); | ||
| 8409 | UNGCPRO; | ||
| 8410 | return 0; | ||
| 8411 | } | ||
| 8412 | |||
| 8413 | /* Read the entire file into memory. */ | ||
| 8414 | contents = slurp_file (SDATA (file), &size); | ||
| 8415 | if (contents == NULL) | ||
| 8416 | { | ||
| 8417 | image_error ("Error loading SVG image `%s'", img->spec, Qnil); | ||
| 8418 | UNGCPRO; | ||
| 8419 | return 0; | ||
| 8420 | } | ||
| 8421 | /* If the file was slurped into memory properly, parse it. */ | ||
| 8422 | success_p = svg_load_image (f, img, contents, size); | ||
| 8423 | xfree (contents); | ||
| 8424 | UNGCPRO; | ||
| 8425 | } | ||
| 8426 | /* Else its not a file, its a lisp object. Load the image from a | ||
| 8427 | lisp object rather than a file. */ | ||
| 8428 | else | ||
| 8429 | { | ||
| 8430 | Lisp_Object data; | ||
| 8431 | |||
| 8432 | data = image_spec_value (img->spec, QCdata, NULL); | ||
| 8433 | success_p = svg_load_image (f, img, SDATA (data), SBYTES (data)); | ||
| 8434 | } | ||
| 8435 | |||
| 8436 | return success_p; | ||
| 8437 | } | ||
| 8438 | |||
| 8439 | /* svg_load_image is a helper function for svg_load, which does the actual | ||
| 8440 | loading given contents and size, apart from frame and image | ||
| 8441 | structures, passed from svg_load. | ||
| 8442 | |||
| 8443 | Uses librsvg to do most of the image processing. | ||
| 8444 | |||
| 8445 | Returns non-zero when sucessful. */ | ||
| 8446 | static int | ||
| 8447 | svg_load_image (f, img, contents, size) | ||
| 8448 | /* Pointer to emacs frame sturcture. */ | ||
| 8449 | struct frame *f; | ||
| 8450 | /* Pointer to emacs image structure. */ | ||
| 8451 | struct image *img; | ||
| 8452 | /* String containing the SVG XML data to be parsed. */ | ||
| 8453 | unsigned char *contents; | ||
| 8454 | /* Size of data in bytes. */ | ||
| 8455 | unsigned int size; | ||
| 8456 | { | ||
| 8457 | RsvgHandle *rsvg_handle; | ||
| 8458 | GError *error = NULL; | ||
| 8459 | GdkPixbuf *pixbuf; | ||
| 8460 | int width; | ||
| 8461 | int height; | ||
| 8462 | const guint8 *pixels; | ||
| 8463 | int rowstride; | ||
| 8464 | XImagePtr ximg; | ||
| 8465 | Lisp_Object specified_bg; | ||
| 8466 | XColor background; | ||
| 8467 | int x; | ||
| 8468 | int y; | ||
| 8469 | |||
| 8470 | /* g_type_init is a glib function that must be called prior to using | ||
| 8471 | gnome type library functions. */ | ||
| 8472 | fn_g_type_init (); | ||
| 8473 | /* Make a handle to a new rsvg object. */ | ||
| 8474 | rsvg_handle = fn_rsvg_handle_new (); | ||
| 8475 | |||
| 8476 | /* Parse the contents argument and fill in the rsvg_handle. */ | ||
| 8477 | fn_rsvg_handle_write (rsvg_handle, contents, size, &error); | ||
| 8478 | if (error) | ||
| 8479 | goto rsvg_error; | ||
| 8480 | |||
| 8481 | /* The parsing is complete, rsvg_handle is ready to used, close it | ||
| 8482 | for further writes. */ | ||
| 8483 | fn_rsvg_handle_close (rsvg_handle, &error); | ||
| 8484 | if (error) | ||
| 8485 | goto rsvg_error; | ||
| 8486 | /* We can now get a valid pixel buffer from the svg file, if all | ||
| 8487 | went ok. */ | ||
| 8488 | pixbuf = fn_rsvg_handle_get_pixbuf (rsvg_handle); | ||
| 8489 | eassert (pixbuf); | ||
| 8490 | |||
| 8491 | /* Extract some meta data from the svg handle. */ | ||
| 8492 | width = fn_gdk_pixbuf_get_width (pixbuf); | ||
| 8493 | height = fn_gdk_pixbuf_get_height (pixbuf); | ||
| 8494 | pixels = fn_gdk_pixbuf_get_pixels (pixbuf); | ||
| 8495 | rowstride = fn_gdk_pixbuf_get_rowstride (pixbuf); | ||
| 8496 | |||
| 8497 | /* Validate the svg meta data. */ | ||
| 8498 | eassert (fn_gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB); | ||
| 8499 | eassert (fn_gdk_pixbuf_get_n_channels (pixbuf) == 4); | ||
| 8500 | eassert (fn_gdk_pixbuf_get_has_alpha (pixbuf)); | ||
| 8501 | eassert (fn_gdk_pixbuf_get_bits_per_sample (pixbuf) == 8); | ||
| 8502 | |||
| 8503 | /* Try to create a x pixmap to hold the svg pixmap. */ | ||
| 8504 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) | ||
| 8505 | { | ||
| 8506 | fn_g_object_unref (pixbuf); | ||
| 8507 | return 0; | ||
| 8508 | } | ||
| 8509 | |||
| 8510 | init_color_table (); | ||
| 8511 | |||
| 8512 | /* Handle alpha channel by combining the image with a background | ||
| 8513 | color. */ | ||
| 8514 | specified_bg = image_spec_value (img->spec, QCbackground, NULL); | ||
| 8515 | if (STRINGP (specified_bg) | ||
| 8516 | && x_defined_color (f, SDATA (specified_bg), &background, 0)) | ||
| 8517 | { | ||
| 8518 | background.red >>= 8; | ||
| 8519 | background.green >>= 8; | ||
| 8520 | background.blue >>= 8; | ||
| 8521 | } | ||
| 8522 | else | ||
| 8523 | { | ||
| 8524 | #ifdef HAVE_X_WINDOWS | ||
| 8525 | background.pixel = FRAME_BACKGROUND_PIXEL (f); | ||
| 8526 | x_query_color (f, &background); | ||
| 8527 | |||
| 8528 | /* SVG pixmaps specify transparency in the last byte, so right | ||
| 8529 | shift 8 bits to get rid of it, since emacs doesn't support | ||
| 8530 | transparency. */ | ||
| 8531 | background.red >>= 8; | ||
| 8532 | background.green >>= 8; | ||
| 8533 | background.blue >>= 8; | ||
| 8534 | #elif defined (MAC_OS) | ||
| 8535 | background.pixel = FRAME_BACKGROUND_PIXEL (f); | ||
| 8536 | background.red = RED_FROM_ULONG (background.pixel); | ||
| 8537 | background.green = GREEN_FROM_ULONG (background.pixel); | ||
| 8538 | background.blue = BLUE_FROM_ULONG (background.pixel); | ||
| 8539 | #elif defined (HAVE_NTGUI) | ||
| 8540 | background.pixel = FRAME_BACKGROUND_PIXEL (f); | ||
| 8541 | #if 0 /* W32 TODO : Colormap support. */ | ||
| 8542 | x_query_color (f, &background); | ||
| 8543 | #endif | ||
| 8544 | |||
| 8545 | /* SVG pixmaps specify transparency in the last byte, so right | ||
| 8546 | shift 8 bits to get rid of it, since emacs doesn't support | ||
| 8547 | transparency. */ | ||
| 8548 | background.red >>= 8; | ||
| 8549 | background.green >>= 8; | ||
| 8550 | background.blue >>= 8; | ||
| 8551 | #else /* not HAVE_X_WINDOWS && not MAC_OS*/ | ||
| 8552 | #error FIXME | ||
| 8553 | #endif | ||
| 8554 | } | ||
| 8555 | |||
| 8556 | /* This loop handles opacity values, since Emacs assumes | ||
| 8557 | non-transparent images. Each pixel must be "flattened" by | ||
| 8558 | calculating he resulting color, given the transparency of the | ||
| 8559 | pixel, and the image background color. */ | ||
| 8560 | for (y = 0; y < height; ++y) | ||
| 8561 | { | ||
| 8562 | for (x = 0; x < width; ++x) | ||
| 8563 | { | ||
| 8564 | unsigned red; | ||
| 8565 | unsigned green; | ||
| 8566 | unsigned blue; | ||
| 8567 | unsigned opacity; | ||
| 8568 | |||
| 8569 | red = *pixels++; | ||
| 8570 | green = *pixels++; | ||
| 8571 | blue = *pixels++; | ||
| 8572 | opacity = *pixels++; | ||
| 8573 | |||
| 8574 | red = ((red * opacity) | ||
| 8575 | + (background.red * ((1 << 8) - opacity))); | ||
| 8576 | green = ((green * opacity) | ||
| 8577 | + (background.green * ((1 << 8) - opacity))); | ||
| 8578 | blue = ((blue * opacity) | ||
| 8579 | + (background.blue * ((1 << 8) - opacity))); | ||
| 8580 | |||
| 8581 | XPutPixel (ximg, x, y, lookup_rgb_color (f, red, green, blue)); | ||
| 8582 | } | ||
| 8583 | |||
| 8584 | pixels += rowstride - 4 * width; | ||
| 8585 | } | ||
| 8586 | |||
| 8587 | #ifdef COLOR_TABLE_SUPPORT | ||
| 8588 | /* Remember colors allocated for this image. */ | ||
| 8589 | img->colors = colors_in_color_table (&img->ncolors); | ||
| 8590 | free_color_table (); | ||
| 8591 | #endif /* COLOR_TABLE_SUPPORT */ | ||
| 8592 | |||
| 8593 | fn_g_object_unref (pixbuf); | ||
| 8594 | |||
| 8595 | img->width = width; | ||
| 8596 | img->height = height; | ||
| 8597 | |||
| 8598 | /* Maybe fill in the background field while we have ximg handy. | ||
| 8599 | Casting avoids a GCC warning. */ | ||
| 8600 | IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg); | ||
| 8601 | |||
| 8602 | /* Put the image into the pixmap, then free the X image and its | ||
| 8603 | buffer. */ | ||
| 8604 | x_put_x_image (f, ximg, img->pixmap, width, height); | ||
| 8605 | x_destroy_x_image (ximg); | ||
| 8606 | |||
| 8607 | return 1; | ||
| 8608 | |||
| 8609 | rsvg_error: | ||
| 8610 | /* FIXME: Use error->message so the user knows what is the actual | ||
| 8611 | problem with the image. */ | ||
| 8612 | image_error ("Error parsing SVG image `%s'", img->spec, Qnil); | ||
| 8613 | fn_g_error_free (error); | ||
| 8614 | return 0; | ||
| 8615 | } | ||
| 8616 | |||
| 8617 | #endif /* defined (HAVE_RSVG) */ | ||
| 8618 | |||
| 8619 | |||
| 8620 | |||
| 8621 | |||
| 8622 | /*********************************************************************** | ||
| 8204 | Ghostscript | 8623 | Ghostscript |
| 8205 | ***********************************************************************/ | 8624 | ***********************************************************************/ |
| 8206 | 8625 | ||
| @@ -8591,6 +9010,11 @@ of `image-library-alist', which see). */) | |||
| 8591 | return CHECK_LIB_AVAILABLE (&png_type, init_png_functions, libraries); | 9010 | return CHECK_LIB_AVAILABLE (&png_type, init_png_functions, libraries); |
| 8592 | #endif | 9011 | #endif |
| 8593 | 9012 | ||
| 9013 | #if defined (HAVE_RSVG) | ||
| 9014 | if (EQ (type, Qsvg)) | ||
| 9015 | return CHECK_LIB_AVAILABLE (&svg_type, init_svg_functions, libraries); | ||
| 9016 | #endif | ||
| 9017 | |||
| 8594 | #ifdef HAVE_GHOSTSCRIPT | 9018 | #ifdef HAVE_GHOSTSCRIPT |
| 8595 | if (EQ (type, Qpostscript)) | 9019 | if (EQ (type, Qpostscript)) |
| 8596 | return CHECK_LIB_AVAILABLE (&gs_type, init_gs_functions, libraries); | 9020 | return CHECK_LIB_AVAILABLE (&gs_type, init_gs_functions, libraries); |
| @@ -8629,7 +9053,7 @@ alternate filenames for the corresponding external libraries. | |||
| 8629 | Emacs tries to load the libraries in the order they appear on the | 9053 | Emacs tries to load the libraries in the order they appear on the |
| 8630 | list; if none is loaded, the running session of Emacs won't | 9054 | list; if none is loaded, the running session of Emacs won't |
| 8631 | support the image type. Types 'pbm and 'xbm don't need to be | 9055 | support the image type. Types 'pbm and 'xbm don't need to be |
| 8632 | listed; they're always supported. */); | 9056 | listed; they are always supported. */); |
| 8633 | Vimage_library_alist = Qnil; | 9057 | Vimage_library_alist = Qnil; |
| 8634 | Fput (intern ("image-library-alist"), Qrisky_local_variable, Qt); | 9058 | Fput (intern ("image-library-alist"), Qrisky_local_variable, Qt); |
| 8635 | 9059 | ||
| @@ -8650,11 +9074,11 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 8650 | 9074 | ||
| 8651 | Qpbm = intern ("pbm"); | 9075 | Qpbm = intern ("pbm"); |
| 8652 | staticpro (&Qpbm); | 9076 | staticpro (&Qpbm); |
| 8653 | ADD_IMAGE_TYPE(Qpbm); | 9077 | ADD_IMAGE_TYPE (Qpbm); |
| 8654 | 9078 | ||
| 8655 | Qxbm = intern ("xbm"); | 9079 | Qxbm = intern ("xbm"); |
| 8656 | staticpro (&Qxbm); | 9080 | staticpro (&Qxbm); |
| 8657 | ADD_IMAGE_TYPE(Qxbm); | 9081 | ADD_IMAGE_TYPE (Qxbm); |
| 8658 | 9082 | ||
| 8659 | define_image_type (&xbm_type, 1); | 9083 | define_image_type (&xbm_type, 1); |
| 8660 | define_image_type (&pbm_type, 1); | 9084 | define_image_type (&pbm_type, 1); |
| @@ -8692,7 +9116,7 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 8692 | Qpostscript = intern ("postscript"); | 9116 | Qpostscript = intern ("postscript"); |
| 8693 | staticpro (&Qpostscript); | 9117 | staticpro (&Qpostscript); |
| 8694 | #ifdef HAVE_GHOSTSCRIPT | 9118 | #ifdef HAVE_GHOSTSCRIPT |
| 8695 | ADD_IMAGE_TYPE(Qpostscript); | 9119 | ADD_IMAGE_TYPE (Qpostscript); |
| 8696 | QCloader = intern (":loader"); | 9120 | QCloader = intern (":loader"); |
| 8697 | staticpro (&QCloader); | 9121 | staticpro (&QCloader); |
| 8698 | QCbounding_box = intern (":bounding-box"); | 9122 | QCbounding_box = intern (":bounding-box"); |
| @@ -8706,33 +9130,45 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 8706 | #if defined (HAVE_XPM) || defined (MAC_OS) | 9130 | #if defined (HAVE_XPM) || defined (MAC_OS) |
| 8707 | Qxpm = intern ("xpm"); | 9131 | Qxpm = intern ("xpm"); |
| 8708 | staticpro (&Qxpm); | 9132 | staticpro (&Qxpm); |
| 8709 | ADD_IMAGE_TYPE(Qxpm); | 9133 | ADD_IMAGE_TYPE (Qxpm); |
| 8710 | #endif | 9134 | #endif |
| 8711 | 9135 | ||
| 8712 | #if defined (HAVE_JPEG) || defined (MAC_OS) | 9136 | #if defined (HAVE_JPEG) || defined (MAC_OS) |
| 8713 | Qjpeg = intern ("jpeg"); | 9137 | Qjpeg = intern ("jpeg"); |
| 8714 | staticpro (&Qjpeg); | 9138 | staticpro (&Qjpeg); |
| 8715 | ADD_IMAGE_TYPE(Qjpeg); | 9139 | ADD_IMAGE_TYPE (Qjpeg); |
| 8716 | #endif | 9140 | #endif |
| 8717 | 9141 | ||
| 8718 | #if defined (HAVE_TIFF) || defined (MAC_OS) | 9142 | #if defined (HAVE_TIFF) || defined (MAC_OS) |
| 8719 | Qtiff = intern ("tiff"); | 9143 | Qtiff = intern ("tiff"); |
| 8720 | staticpro (&Qtiff); | 9144 | staticpro (&Qtiff); |
| 8721 | ADD_IMAGE_TYPE(Qtiff); | 9145 | ADD_IMAGE_TYPE (Qtiff); |
| 8722 | #endif | 9146 | #endif |
| 8723 | 9147 | ||
| 8724 | #if defined (HAVE_GIF) || defined (MAC_OS) | 9148 | #if defined (HAVE_GIF) || defined (MAC_OS) |
| 8725 | Qgif = intern ("gif"); | 9149 | Qgif = intern ("gif"); |
| 8726 | staticpro (&Qgif); | 9150 | staticpro (&Qgif); |
| 8727 | ADD_IMAGE_TYPE(Qgif); | 9151 | ADD_IMAGE_TYPE (Qgif); |
| 8728 | #endif | 9152 | #endif |
| 8729 | 9153 | ||
| 8730 | #if defined (HAVE_PNG) || defined (MAC_OS) | 9154 | #if defined (HAVE_PNG) || defined (MAC_OS) |
| 8731 | Qpng = intern ("png"); | 9155 | Qpng = intern ("png"); |
| 8732 | staticpro (&Qpng); | 9156 | staticpro (&Qpng); |
| 8733 | ADD_IMAGE_TYPE(Qpng); | 9157 | ADD_IMAGE_TYPE (Qpng); |
| 8734 | #endif | 9158 | #endif |
| 8735 | 9159 | ||
| 9160 | #if defined (HAVE_RSVG) | ||
| 9161 | Qsvg = intern ("svg"); | ||
| 9162 | staticpro (&Qsvg); | ||
| 9163 | ADD_IMAGE_TYPE (Qsvg); | ||
| 9164 | #ifdef HAVE_NTGUI | ||
| 9165 | Qgdk_pixbuf = intern ("gdk-pixbuf"); | ||
| 9166 | staticpro (&Qgdk_pixbuf); | ||
| 9167 | Qglib = intern ("glib"); | ||
| 9168 | staticpro (&Qglib); | ||
| 9169 | #endif /* HAVE_NTGUI */ | ||
| 9170 | #endif /* HAVE_RSVG */ | ||
| 9171 | |||
| 8736 | defsubr (&Sinit_image_library); | 9172 | defsubr (&Sinit_image_library); |
| 8737 | defsubr (&Sclear_image_cache); | 9173 | defsubr (&Sclear_image_cache); |
| 8738 | defsubr (&Simage_refresh); | 9174 | defsubr (&Simage_refresh); |
| @@ -8747,7 +9183,7 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 8747 | 9183 | ||
| 8748 | DEFVAR_BOOL ("cross-disabled-images", &cross_disabled_images, | 9184 | DEFVAR_BOOL ("cross-disabled-images", &cross_disabled_images, |
| 8749 | doc: /* Non-nil means always draw a cross over disabled images. | 9185 | doc: /* Non-nil means always draw a cross over disabled images. |
| 8750 | Disabled images are those having an `:conversion disabled' property. | 9186 | Disabled images are those having a `:conversion disabled' property. |
| 8751 | A cross is always drawn on black & white displays. */); | 9187 | A cross is always drawn on black & white displays. */); |
| 8752 | cross_disabled_images = 0; | 9188 | cross_disabled_images = 0; |
| 8753 | 9189 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index c55faba6f7f..d202fc4fc9a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -7907,10 +7907,11 @@ static Lisp_Object tool_bar_item_properties; | |||
| 7907 | 7907 | ||
| 7908 | static int ntool_bar_items; | 7908 | static int ntool_bar_items; |
| 7909 | 7909 | ||
| 7910 | /* The symbols `tool-bar', and `:image'. */ | 7910 | /* The symbols `tool-bar', `:image' and `:rtl'. */ |
| 7911 | 7911 | ||
| 7912 | extern Lisp_Object Qtool_bar; | 7912 | extern Lisp_Object Qtool_bar; |
| 7913 | Lisp_Object QCimage; | 7913 | Lisp_Object QCimage; |
| 7914 | Lisp_Object Qrtl; | ||
| 7914 | 7915 | ||
| 7915 | /* Function prototypes. */ | 7916 | /* Function prototypes. */ |
| 7916 | 7917 | ||
| @@ -8196,6 +8197,9 @@ parse_tool_bar_item (key, item) | |||
| 8196 | /* Value is either a single image specification or a vector | 8197 | /* Value is either a single image specification or a vector |
| 8197 | of 4 such specifications for the different button states. */ | 8198 | of 4 such specifications for the different button states. */ |
| 8198 | PROP (TOOL_BAR_ITEM_IMAGES) = value; | 8199 | PROP (TOOL_BAR_ITEM_IMAGES) = value; |
| 8200 | else if (EQ (key, Qrtl)) | ||
| 8201 | /* ':rtl STRING' */ | ||
| 8202 | PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value; | ||
| 8199 | } | 8203 | } |
| 8200 | 8204 | ||
| 8201 | /* If got a filter apply it on binding. */ | 8205 | /* If got a filter apply it on binding. */ |
| @@ -11222,6 +11226,9 @@ syms_of_keyboard () | |||
| 11222 | staticpro (&Qhelp_echo); | 11226 | staticpro (&Qhelp_echo); |
| 11223 | Qhelp_echo = intern ("help-echo"); | 11227 | Qhelp_echo = intern ("help-echo"); |
| 11224 | 11228 | ||
| 11229 | staticpro (&Qrtl); | ||
| 11230 | Qrtl = intern (":rtl"); | ||
| 11231 | |||
| 11225 | staticpro (&item_properties); | 11232 | staticpro (&item_properties); |
| 11226 | item_properties = Qnil; | 11233 | item_properties = Qnil; |
| 11227 | 11234 | ||
diff --git a/src/lread.c b/src/lread.c index fcc344d5875..6bec084c5c6 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -203,6 +203,7 @@ static file_offset prev_saved_doc_string_position; | |||
| 203 | Fread initializes this to zero, so we need not specbind it | 203 | Fread initializes this to zero, so we need not specbind it |
| 204 | or worry about what happens to it when there is an error. */ | 204 | or worry about what happens to it when there is an error. */ |
| 205 | static int new_backquote_flag; | 205 | static int new_backquote_flag; |
| 206 | static Lisp_Object Vold_style_backquotes, Qold_style_backquotes; | ||
| 206 | 207 | ||
| 207 | /* A list of file names for files being loaded in Fload. Used to | 208 | /* A list of file names for files being loaded in Fload. Used to |
| 208 | check for recursive loads. */ | 209 | check for recursive loads. */ |
| @@ -882,6 +883,20 @@ load_error_handler (data) | |||
| 882 | return Qnil; | 883 | return Qnil; |
| 883 | } | 884 | } |
| 884 | 885 | ||
| 886 | static Lisp_Object | ||
| 887 | load_warn_old_style_backquotes (file) | ||
| 888 | Lisp_Object file; | ||
| 889 | { | ||
| 890 | if (!NILP (Vold_style_backquotes)) | ||
| 891 | { | ||
| 892 | Lisp_Object args[2]; | ||
| 893 | args[0] = build_string ("!! File %s uses old-style backquotes !!"); | ||
| 894 | args[1] = file; | ||
| 895 | Fmessage (2, args); | ||
| 896 | } | ||
| 897 | return Qnil; | ||
| 898 | } | ||
| 899 | |||
| 885 | DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0, | 900 | DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0, |
| 886 | doc: /* Return the suffixes that `load' should try if a suffix is \ | 901 | doc: /* Return the suffixes that `load' should try if a suffix is \ |
| 887 | required. | 902 | required. |
| @@ -946,7 +961,6 @@ Return t if the file exists and loads successfully. */) | |||
| 946 | register FILE *stream; | 961 | register FILE *stream; |
| 947 | register int fd = -1; | 962 | register int fd = -1; |
| 948 | int count = SPECPDL_INDEX (); | 963 | int count = SPECPDL_INDEX (); |
| 949 | Lisp_Object temp; | ||
| 950 | struct gcpro gcpro1, gcpro2, gcpro3; | 964 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 951 | Lisp_Object found, efound, hist_file_name; | 965 | Lisp_Object found, efound, hist_file_name; |
| 952 | /* 1 means we printed the ".el is newer" message. */ | 966 | /* 1 means we printed the ".el is newer" message. */ |
| @@ -1083,6 +1097,11 @@ Return t if the file exists and loads successfully. */) | |||
| 1083 | : found) ; | 1097 | : found) ; |
| 1084 | 1098 | ||
| 1085 | version = -1; | 1099 | version = -1; |
| 1100 | |||
| 1101 | /* Check fore the presence of old-style quotes and warn about them. */ | ||
| 1102 | specbind (Qold_style_backquotes, Qnil); | ||
| 1103 | record_unwind_protect (load_warn_old_style_backquotes, file); | ||
| 1104 | |||
| 1086 | if (!bcmp (SDATA (found) + SBYTES (found) - 4, | 1105 | if (!bcmp (SDATA (found) + SBYTES (found) - 4, |
| 1087 | ".elc", 4) | 1106 | ".elc", 4) |
| 1088 | || (version = safe_to_load_p (fd)) > 0) | 1107 | || (version = safe_to_load_p (fd)) > 0) |
| @@ -1579,8 +1598,6 @@ readevalloop_1 (old) | |||
| 1579 | static void | 1598 | static void |
| 1580 | end_of_file_error () | 1599 | end_of_file_error () |
| 1581 | { | 1600 | { |
| 1582 | Lisp_Object data; | ||
| 1583 | |||
| 1584 | if (STRINGP (Vload_file_name)) | 1601 | if (STRINGP (Vload_file_name)) |
| 1585 | xsignal1 (Qend_of_file, Vload_file_name); | 1602 | xsignal1 (Qend_of_file, Vload_file_name); |
| 1586 | 1603 | ||
| @@ -2571,7 +2588,10 @@ read1 (readcharfun, pch, first_in_list) | |||
| 2571 | 2588 | ||
| 2572 | case '`': | 2589 | case '`': |
| 2573 | if (first_in_list) | 2590 | if (first_in_list) |
| 2574 | goto default_label; | 2591 | { |
| 2592 | Vold_style_backquotes = Qt; | ||
| 2593 | goto default_label; | ||
| 2594 | } | ||
| 2575 | else | 2595 | else |
| 2576 | { | 2596 | { |
| 2577 | Lisp_Object value; | 2597 | Lisp_Object value; |
| @@ -2606,7 +2626,10 @@ read1 (readcharfun, pch, first_in_list) | |||
| 2606 | return Fcons (comma_type, Fcons (value, Qnil)); | 2626 | return Fcons (comma_type, Fcons (value, Qnil)); |
| 2607 | } | 2627 | } |
| 2608 | else | 2628 | else |
| 2609 | goto default_label; | 2629 | { |
| 2630 | Vold_style_backquotes = Qt; | ||
| 2631 | goto default_label; | ||
| 2632 | } | ||
| 2610 | 2633 | ||
| 2611 | case '?': | 2634 | case '?': |
| 2612 | { | 2635 | { |
| @@ -4322,6 +4345,12 @@ to load. See also `load-dangerous-libraries'. */); | |||
| 4322 | doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */); | 4345 | doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */); |
| 4323 | Veval_buffer_list = Qnil; | 4346 | Veval_buffer_list = Qnil; |
| 4324 | 4347 | ||
| 4348 | DEFVAR_LISP ("old-style-backquotes", &Vold_style_backquotes, | ||
| 4349 | doc: /* Set to non-nil when `read' encounters an old-style backquote. */); | ||
| 4350 | Vold_style_backquotes = Qnil; | ||
| 4351 | Qold_style_backquotes = intern ("old-style-backquotes"); | ||
| 4352 | staticpro (&Qold_style_backquotes); | ||
| 4353 | |||
| 4325 | /* Vsource_directory was initialized in init_lread. */ | 4354 | /* Vsource_directory was initialized in init_lread. */ |
| 4326 | 4355 | ||
| 4327 | load_descriptor_list = Qnil; | 4356 | load_descriptor_list = Qnil; |
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h index 681be8b0647..1f759cc9ec6 100644 --- a/src/m/amdx86-64.h +++ b/src/m/amdx86-64.h | |||
| @@ -18,6 +18,14 @@ along with GNU Emacs; see the file COPYING. If not, write to | |||
| 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. */ | 19 | Boston, MA 02110-1301, USA. */ |
| 20 | 20 | ||
| 21 | #ifdef i386 | ||
| 22 | /* Although we're running on an amd64 kernel, we're actually compiling for | ||
| 23 | the x86 architecture. The user should probably have provided an | ||
| 24 | explicit --build to `configure', but if everything else than the kernel | ||
| 25 | is running in i386 mode, then the bug is really ours: we should have | ||
| 26 | guessed better. */ | ||
| 27 | #include "m/intel386.h" | ||
| 28 | #else | ||
| 21 | 29 | ||
| 22 | /* The following line tells the configuration script what sort of | 30 | /* The following line tells the configuration script what sort of |
| 23 | operating system this machine is likely to run. | 31 | operating system this machine is likely to run. |
| @@ -156,6 +164,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 156 | #endif | 164 | #endif |
| 157 | 165 | ||
| 158 | #endif /* __FreeBSD__ */ | 166 | #endif /* __FreeBSD__ */ |
| 167 | #endif /* !i386 */ | ||
| 159 | 168 | ||
| 160 | /* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e | 169 | /* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e |
| 161 | (do not change this comment) */ | 170 | (do not change this comment) */ |
| @@ -79,6 +79,7 @@ static ComponentInstance as_scripting_component; | |||
| 79 | /* The single script context used for all script executions. */ | 79 | /* The single script context used for all script executions. */ |
| 80 | static OSAID as_script_context; | 80 | static OSAID as_script_context; |
| 81 | 81 | ||
| 82 | #ifndef MAC_OS_X | ||
| 82 | #if TARGET_API_MAC_CARBON | 83 | #if TARGET_API_MAC_CARBON |
| 83 | static int wakeup_from_rne_enabled_p = 0; | 84 | static int wakeup_from_rne_enabled_p = 0; |
| 84 | #define ENABLE_WAKEUP_FROM_RNE (wakeup_from_rne_enabled_p = 1) | 85 | #define ENABLE_WAKEUP_FROM_RNE (wakeup_from_rne_enabled_p = 1) |
| @@ -87,6 +88,7 @@ static int wakeup_from_rne_enabled_p = 0; | |||
| 87 | #define ENABLE_WAKEUP_FROM_RNE 0 | 88 | #define ENABLE_WAKEUP_FROM_RNE 0 |
| 88 | #define DISABLE_WAKEUP_FROM_RNE 0 | 89 | #define DISABLE_WAKEUP_FROM_RNE 0 |
| 89 | #endif | 90 | #endif |
| 91 | #endif | ||
| 90 | 92 | ||
| 91 | #ifndef MAC_OSX | 93 | #ifndef MAC_OSX |
| 92 | static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *)); | 94 | static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *)); |
| @@ -4987,8 +4989,8 @@ extern int noninteractive; | |||
| 4987 | SELECT_TIMEOUT_THRESHOLD_RUNLOOP seconds). | 4989 | SELECT_TIMEOUT_THRESHOLD_RUNLOOP seconds). |
| 4988 | -> Create CFSocket for each socket and add it into the current | 4990 | -> Create CFSocket for each socket and add it into the current |
| 4989 | event RunLoop so that the current event loop gets quit when | 4991 | event RunLoop so that the current event loop gets quit when |
| 4990 | the socket becomes ready. Then ReceiveNextEvent can wait for | 4992 | the socket becomes ready. Then CFRunLoopRunInMode can wait |
| 4991 | both kinds of inputs. | 4993 | for both kinds of inputs. |
| 4992 | 4. Otherwise. | 4994 | 4. Otherwise. |
| 4993 | -> Periodically poll the window input channel while repeatedly | 4995 | -> Periodically poll the window input channel while repeatedly |
| 4994 | executing `select' with a short timeout | 4996 | executing `select' with a short timeout |
| @@ -5010,12 +5012,6 @@ socket_callback (s, type, address, data, info) | |||
| 5010 | const void *data; | 5012 | const void *data; |
| 5011 | void *info; | 5013 | void *info; |
| 5012 | { | 5014 | { |
| 5013 | int fd = CFSocketGetNative (s); | ||
| 5014 | SELECT_TYPE *ofds = (SELECT_TYPE *)info; | ||
| 5015 | |||
| 5016 | if ((type == kCFSocketReadCallBack && FD_ISSET (fd, &ofds[0])) | ||
| 5017 | || (type == kCFSocketConnectCallBack && FD_ISSET (fd, &ofds[1]))) | ||
| 5018 | QuitEventLoop (GetCurrentEventLoop ()); | ||
| 5019 | } | 5015 | } |
| 5020 | #endif /* SELECT_USE_CFSOCKET */ | 5016 | #endif /* SELECT_USE_CFSOCKET */ |
| 5021 | 5017 | ||
| @@ -5025,42 +5021,64 @@ select_and_poll_event (nfds, rfds, wfds, efds, timeout) | |||
| 5025 | SELECT_TYPE *rfds, *wfds, *efds; | 5021 | SELECT_TYPE *rfds, *wfds, *efds; |
| 5026 | EMACS_TIME *timeout; | 5022 | EMACS_TIME *timeout; |
| 5027 | { | 5023 | { |
| 5028 | OSStatus err = noErr; | 5024 | int timedout_p = 0; |
| 5029 | int r = 0; | 5025 | int r = 0; |
| 5026 | EMACS_TIME select_timeout; | ||
| 5027 | EventTimeout timeoutval = | ||
| 5028 | (timeout | ||
| 5029 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | ||
| 5030 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | ||
| 5031 | : kEventDurationForever); | ||
| 5032 | SELECT_TYPE orfds, owfds, oefds; | ||
| 5030 | 5033 | ||
| 5031 | /* Try detect_input_pending before ReceiveNextEvent in the same | 5034 | if (timeout == NULL) |
| 5035 | { | ||
| 5036 | if (rfds) orfds = *rfds; | ||
| 5037 | if (wfds) owfds = *wfds; | ||
| 5038 | if (efds) oefds = *efds; | ||
| 5039 | } | ||
| 5040 | |||
| 5041 | /* Try detect_input_pending before CFRunLoopRunInMode in the same | ||
| 5032 | BLOCK_INPUT block, in case that some input has already been read | 5042 | BLOCK_INPUT block, in case that some input has already been read |
| 5033 | asynchronously. */ | 5043 | asynchronously. */ |
| 5034 | BLOCK_INPUT; | 5044 | BLOCK_INPUT; |
| 5035 | ENABLE_WAKEUP_FROM_RNE; | 5045 | while (1) |
| 5036 | if (!detect_input_pending ()) | ||
| 5037 | { | 5046 | { |
| 5038 | EMACS_TIME select_timeout; | 5047 | if (detect_input_pending ()) |
| 5039 | EventTimeout timeoutval = | 5048 | break; |
| 5040 | (timeout | ||
| 5041 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | ||
| 5042 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | ||
| 5043 | : kEventDurationForever); | ||
| 5044 | 5049 | ||
| 5045 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); | 5050 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); |
| 5046 | r = select (nfds, rfds, wfds, efds, &select_timeout); | 5051 | r = select (nfds, rfds, wfds, efds, &select_timeout); |
| 5052 | if (r != 0) | ||
| 5053 | break; | ||
| 5054 | |||
| 5047 | if (timeoutval == 0.0) | 5055 | if (timeoutval == 0.0) |
| 5048 | err = eventLoopTimedOutErr; | 5056 | timedout_p = 1; |
| 5049 | else if (r == 0) | 5057 | else |
| 5050 | { | 5058 | { |
| 5051 | #if USE_CG_DRAWING | 5059 | #if USE_CG_DRAWING |
| 5052 | mac_prepare_for_quickdraw (NULL); | 5060 | mac_prepare_for_quickdraw (NULL); |
| 5053 | #endif | 5061 | #endif |
| 5054 | err = ReceiveNextEvent (0, NULL, timeoutval, | 5062 | if (CFRunLoopRunInMode (kCFRunLoopDefaultMode, |
| 5055 | kEventLeaveInQueue, NULL); | 5063 | timeoutval >= 0 ? timeoutval : 100000, true) |
| 5064 | == kCFRunLoopRunTimedOut) | ||
| 5065 | timedout_p = 1; | ||
| 5056 | } | 5066 | } |
| 5067 | |||
| 5068 | if (timeout == NULL && timedout_p) | ||
| 5069 | { | ||
| 5070 | if (rfds) *rfds = orfds; | ||
| 5071 | if (wfds) *wfds = owfds; | ||
| 5072 | if (efds) *efds = oefds; | ||
| 5073 | } | ||
| 5074 | else | ||
| 5075 | break; | ||
| 5057 | } | 5076 | } |
| 5058 | DISABLE_WAKEUP_FROM_RNE; | ||
| 5059 | UNBLOCK_INPUT; | 5077 | UNBLOCK_INPUT; |
| 5060 | 5078 | ||
| 5061 | if (r != 0) | 5079 | if (r != 0) |
| 5062 | return r; | 5080 | return r; |
| 5063 | else if (err == noErr) | 5081 | else if (!timedout_p) |
| 5064 | { | 5082 | { |
| 5065 | /* Pretend that `select' is interrupted by a signal. */ | 5083 | /* Pretend that `select' is interrupted by a signal. */ |
| 5066 | detect_input_pending (); | 5084 | detect_input_pending (); |
| @@ -5077,25 +5095,25 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5077 | SELECT_TYPE *rfds, *wfds, *efds; | 5095 | SELECT_TYPE *rfds, *wfds, *efds; |
| 5078 | EMACS_TIME *timeout; | 5096 | EMACS_TIME *timeout; |
| 5079 | { | 5097 | { |
| 5080 | OSStatus err = noErr; | 5098 | int timedout_p = 0; |
| 5081 | int r; | 5099 | int r; |
| 5082 | EMACS_TIME select_timeout; | 5100 | EMACS_TIME select_timeout; |
| 5083 | static SELECT_TYPE ofds[3]; | 5101 | SELECT_TYPE orfds, owfds, oefds; |
| 5084 | 5102 | ||
| 5085 | if (inhibit_window_system || noninteractive | 5103 | if (inhibit_window_system || noninteractive |
| 5086 | || nfds < 1 || rfds == NULL || !FD_ISSET (0, rfds)) | 5104 | || nfds < 1 || rfds == NULL || !FD_ISSET (0, rfds)) |
| 5087 | return select (nfds, rfds, wfds, efds, timeout); | 5105 | return select (nfds, rfds, wfds, efds, timeout); |
| 5088 | 5106 | ||
| 5089 | FD_CLR (0, rfds); | 5107 | FD_CLR (0, rfds); |
| 5090 | ofds[0] = *rfds; | 5108 | orfds = *rfds; |
| 5091 | 5109 | ||
| 5092 | if (wfds) | 5110 | if (wfds) |
| 5093 | ofds[1] = *wfds; | 5111 | owfds = *wfds; |
| 5094 | else | 5112 | else |
| 5095 | FD_ZERO (&ofds[1]); | 5113 | FD_ZERO (&owfds); |
| 5096 | 5114 | ||
| 5097 | if (efds) | 5115 | if (efds) |
| 5098 | ofds[2] = *efds; | 5116 | oefds = *efds; |
| 5099 | else | 5117 | else |
| 5100 | { | 5118 | { |
| 5101 | EventTimeout timeoutval = | 5119 | EventTimeout timeoutval = |
| @@ -5123,25 +5141,23 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5123 | if (r != 0 || timeoutval == 0.0) | 5141 | if (r != 0 || timeoutval == 0.0) |
| 5124 | return r; | 5142 | return r; |
| 5125 | 5143 | ||
| 5126 | *rfds = ofds[0]; | 5144 | *rfds = orfds; |
| 5127 | if (wfds) | 5145 | if (wfds) |
| 5128 | *wfds = ofds[1]; | 5146 | *wfds = owfds; |
| 5129 | 5147 | ||
| 5130 | #if SELECT_USE_CFSOCKET | 5148 | #if SELECT_USE_CFSOCKET |
| 5131 | if (timeoutval > 0 && timeoutval <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) | 5149 | if (timeoutval > 0 && timeoutval <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) |
| 5132 | goto poll_periodically; | 5150 | goto poll_periodically; |
| 5133 | 5151 | ||
| 5134 | /* Try detect_input_pending before ReceiveNextEvent in the same | 5152 | /* Try detect_input_pending before CFRunLoopRunInMode in the |
| 5135 | BLOCK_INPUT block, in case that some input has already been | 5153 | same BLOCK_INPUT block, in case that some input has already |
| 5136 | read asynchronously. */ | 5154 | been read asynchronously. */ |
| 5137 | BLOCK_INPUT; | 5155 | BLOCK_INPUT; |
| 5138 | ENABLE_WAKEUP_FROM_RNE; | ||
| 5139 | if (!detect_input_pending ()) | 5156 | if (!detect_input_pending ()) |
| 5140 | { | 5157 | { |
| 5141 | int minfd, fd; | 5158 | int minfd, fd; |
| 5142 | CFRunLoopRef runloop = | 5159 | CFRunLoopRef runloop = |
| 5143 | (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); | 5160 | (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); |
| 5144 | static const CFSocketContext context = {0, ofds, NULL, NULL, NULL}; | ||
| 5145 | static CFMutableDictionaryRef sources; | 5161 | static CFMutableDictionaryRef sources; |
| 5146 | 5162 | ||
| 5147 | if (sources == NULL) | 5163 | if (sources == NULL) |
| @@ -5166,7 +5182,7 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5166 | CFSocketCreateWithNative (NULL, fd, | 5182 | CFSocketCreateWithNative (NULL, fd, |
| 5167 | (kCFSocketReadCallBack | 5183 | (kCFSocketReadCallBack |
| 5168 | | kCFSocketConnectCallBack), | 5184 | | kCFSocketConnectCallBack), |
| 5169 | socket_callback, &context); | 5185 | socket_callback, NULL); |
| 5170 | 5186 | ||
| 5171 | if (socket == NULL) | 5187 | if (socket == NULL) |
| 5172 | continue; | 5188 | continue; |
| @@ -5183,8 +5199,10 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5183 | #if USE_CG_DRAWING | 5199 | #if USE_CG_DRAWING |
| 5184 | mac_prepare_for_quickdraw (NULL); | 5200 | mac_prepare_for_quickdraw (NULL); |
| 5185 | #endif | 5201 | #endif |
| 5186 | err = ReceiveNextEvent (0, NULL, timeoutval, | 5202 | if (CFRunLoopRunInMode (kCFRunLoopDefaultMode, |
| 5187 | kEventLeaveInQueue, NULL); | 5203 | timeoutval >= 0 ? timeoutval : 100000, true) |
| 5204 | == kCFRunLoopRunTimedOut) | ||
| 5205 | timedout_p = 1; | ||
| 5188 | 5206 | ||
| 5189 | for (fd = minfd; fd < nfds; fd++) | 5207 | for (fd = minfd; fd < nfds; fd++) |
| 5190 | if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds))) | 5208 | if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds))) |
| @@ -5196,10 +5214,9 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5196 | CFRunLoopRemoveSource (runloop, source, kCFRunLoopDefaultMode); | 5214 | CFRunLoopRemoveSource (runloop, source, kCFRunLoopDefaultMode); |
| 5197 | } | 5215 | } |
| 5198 | } | 5216 | } |
| 5199 | DISABLE_WAKEUP_FROM_RNE; | ||
| 5200 | UNBLOCK_INPUT; | 5217 | UNBLOCK_INPUT; |
| 5201 | 5218 | ||
| 5202 | if (err == noErr || err == eventLoopQuitErr) | 5219 | if (!timedout_p) |
| 5203 | { | 5220 | { |
| 5204 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); | 5221 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); |
| 5205 | return select_and_poll_event (nfds, rfds, wfds, efds, | 5222 | return select_and_poll_event (nfds, rfds, wfds, efds, |
| @@ -5235,11 +5252,11 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5235 | if (r != 0) | 5252 | if (r != 0) |
| 5236 | return r; | 5253 | return r; |
| 5237 | 5254 | ||
| 5238 | *rfds = ofds[0]; | 5255 | *rfds = orfds; |
| 5239 | if (wfds) | 5256 | if (wfds) |
| 5240 | *wfds = ofds[1]; | 5257 | *wfds = owfds; |
| 5241 | if (efds) | 5258 | if (efds) |
| 5242 | *efds = ofds[2]; | 5259 | *efds = oefds; |
| 5243 | 5260 | ||
| 5244 | if (timeout) | 5261 | if (timeout) |
| 5245 | { | 5262 | { |
| @@ -5402,10 +5419,12 @@ init_mac_osx_environment () | |||
| 5402 | void | 5419 | void |
| 5403 | mac_wakeup_from_rne () | 5420 | mac_wakeup_from_rne () |
| 5404 | { | 5421 | { |
| 5422 | #ifndef MAC_OSX | ||
| 5405 | if (wakeup_from_rne_enabled_p) | 5423 | if (wakeup_from_rne_enabled_p) |
| 5406 | /* Post a harmless event so as to wake up from | 5424 | /* Post a harmless event so as to wake up from |
| 5407 | ReceiveNextEvent. */ | 5425 | ReceiveNextEvent. */ |
| 5408 | mac_post_mouse_moved_event (); | 5426 | mac_post_mouse_moved_event (); |
| 5427 | #endif | ||
| 5409 | } | 5428 | } |
| 5410 | #endif | 5429 | #endif |
| 5411 | 5430 | ||
diff --git a/src/macterm.c b/src/macterm.c index 654afcf6b1a..734bf52e180 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -3058,10 +3058,17 @@ x_draw_composite_glyph_string_foreground (s) | |||
| 3058 | else | 3058 | else |
| 3059 | { | 3059 | { |
| 3060 | for (i = 0; i < s->nchars; i++, ++s->gidx) | 3060 | for (i = 0; i < s->nchars; i++, ++s->gidx) |
| 3061 | mac_draw_image_string_16 (s->f, s->gc, | 3061 | if (mac_per_char_metric (GC_FONT (s->gc), s->char2b + i, 0) == NULL) |
| 3062 | x + s->cmp->offsets[s->gidx * 2], | 3062 | /* This is a nonexistent or zero-width glyph such as a |
| 3063 | s->ybase - s->cmp->offsets[s->gidx * 2 + 1], | 3063 | combining diacritic. Draw a rectangle. */ |
| 3064 | s->char2b + i, 1, 0, s->face->overstrike); | 3064 | mac_draw_rectangle (s->f, s->gc, |
| 3065 | x + s->cmp->offsets[s->gidx * 2], s->y, | ||
| 3066 | FONT_WIDTH (GC_FONT (s->gc)) - 1, s->height - 1); | ||
| 3067 | else | ||
| 3068 | mac_draw_image_string_16 (s->f, s->gc, | ||
| 3069 | x + s->cmp->offsets[s->gidx * 2], | ||
| 3070 | s->ybase - s->cmp->offsets[s->gidx * 2 + 1], | ||
| 3071 | s->char2b + i, 1, 0, s->face->overstrike); | ||
| 3065 | } | 3072 | } |
| 3066 | } | 3073 | } |
| 3067 | 3074 | ||
diff --git a/src/puresize.h b/src/puresize.h index c6456730075..8ce51dbfd8b 100644 --- a/src/puresize.h +++ b/src/puresize.h | |||
| @@ -43,7 +43,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 43 | #endif | 43 | #endif |
| 44 | 44 | ||
| 45 | #ifndef BASE_PURESIZE | 45 | #ifndef BASE_PURESIZE |
| 46 | #define BASE_PURESIZE (1130000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) | 46 | #define BASE_PURESIZE (1140000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ | 49 | /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ |
diff --git a/src/w32reg.c b/src/w32reg.c index 1bea4795be9..6acecfdb5fd 100644 --- a/src/w32reg.c +++ b/src/w32reg.c | |||
| @@ -41,7 +41,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 41 | "emacs.tool-bar.attributeBackground:SystemButtonFace\0" \ | 41 | "emacs.tool-bar.attributeBackground:SystemButtonFace\0" \ |
| 42 | "emacs.menu.attributeForeground:SystemMenuText\0" \ | 42 | "emacs.menu.attributeForeground:SystemMenuText\0" \ |
| 43 | "emacs.menu.attributeBackground:SystemMenu\0" \ | 43 | "emacs.menu.attributeBackground:SystemMenu\0" \ |
| 44 | "emacs.scroll-bar.attributeForeground:SystemScrollbar" | 44 | "emacs.scroll-bar.attributeForeground:SystemScrollbar\0" |
| 45 | 45 | ||
| 46 | /* Other possibilities for default faces: | 46 | /* Other possibilities for default faces: |
| 47 | 47 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index a24dea966cf..060a1c50d1c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -18587,6 +18587,27 @@ invisible_p (propval, list) | |||
| 18587 | return 0; | 18587 | return 0; |
| 18588 | } | 18588 | } |
| 18589 | 18589 | ||
| 18590 | DEFUN ("invisible-p", Finvisible_p, Sinvisible_p, 1, 1, 0, | ||
| 18591 | doc: /* Non-nil if the property makes the text invisible. | ||
| 18592 | POS-OR-PROP can be a marker or number, in which case it is taken to be | ||
| 18593 | a position in the current buffer and the value of the `invisible' property | ||
| 18594 | is checked; or it can be some other value, which is then presumed to be the | ||
| 18595 | value of the `invisible' property of the text of interest. | ||
| 18596 | The non-nil value returned can be t for truly invisible text or something | ||
| 18597 | else if the text is replaced by an ellipsis. */) | ||
| 18598 | (pos_or_prop) | ||
| 18599 | Lisp_Object pos_or_prop; | ||
| 18600 | { | ||
| 18601 | Lisp_Object prop | ||
| 18602 | = (NATNUMP (pos_or_prop) || MARKERP (pos_or_prop) | ||
| 18603 | ? Fget_char_property (pos_or_prop, Qinvisible, Qnil) | ||
| 18604 | : pos_or_prop); | ||
| 18605 | int invis = TEXT_PROP_MEANS_INVISIBLE (prop); | ||
| 18606 | return (invis == 0 ? Qnil | ||
| 18607 | : invis == 1 ? Qt | ||
| 18608 | : make_number (invis)); | ||
| 18609 | } | ||
| 18610 | |||
| 18590 | /* Calculate a width or height in pixels from a specification using | 18611 | /* Calculate a width or height in pixels from a specification using |
| 18591 | the following elements: | 18612 | the following elements: |
| 18592 | 18613 | ||
| @@ -24112,6 +24133,7 @@ syms_of_xdisp () | |||
| 24112 | defsubr (&Slookup_image_map); | 24133 | defsubr (&Slookup_image_map); |
| 24113 | #endif | 24134 | #endif |
| 24114 | defsubr (&Sformat_mode_line); | 24135 | defsubr (&Sformat_mode_line); |
| 24136 | defsubr (&Sinvisible_p); | ||
| 24115 | 24137 | ||
| 24116 | staticpro (&Qmenu_bar_update_hook); | 24138 | staticpro (&Qmenu_bar_update_hook); |
| 24117 | Qmenu_bar_update_hook = intern ("menu-bar-update-hook"); | 24139 | Qmenu_bar_update_hook = intern ("menu-bar-update-hook"); |