diff options
| author | Miles Bader | 2007-06-16 22:32:13 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-06-16 22:32:13 +0000 |
| commit | b36153926049c95ef192786f4ef6151dc6506de4 (patch) | |
| tree | 51890fa5961aa1dc989178cbbfabb03d2e443687 /src | |
| parent | 650e2d284dcf9786a78abc3fef12599cf60d95da (diff) | |
| parent | 1562d1e9a73e608dbfe76bbedbeb2350d39e224f (diff) | |
| download | emacs-b36153926049c95ef192786f4ef6151dc6506de4.tar.gz emacs-b36153926049c95ef192786f4ef6151dc6506de4.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 793-802)
- Update from CVS
- Remove RCS keywords
- Merge from emacs--rel--22
* emacs--rel--22 (patch 42-50)
- Update from CVS
- Merge from gnus--rel--5.10
- Gnus ChangeLog tweaks
* gnus--rel--5.10 (patch 229-232)
- Merge from emacs--devo--0, emacs--rel--22
- ChangeLog tweak
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-223
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 103 | ||||
| -rw-r--r-- | src/composite.c | 13 | ||||
| -rw-r--r-- | src/config.in | 6 | ||||
| -rw-r--r-- | src/dispextern.h | 4 | ||||
| -rw-r--r-- | src/editfns.c | 13 | ||||
| -rw-r--r-- | src/frame.h | 4 | ||||
| -rw-r--r-- | src/image.c | 22 | ||||
| -rw-r--r-- | src/macfns.c | 29 | ||||
| -rw-r--r-- | src/macgui.h | 7 | ||||
| -rw-r--r-- | src/macmenu.c | 4 | ||||
| -rw-r--r-- | src/macterm.c | 662 | ||||
| -rw-r--r-- | src/macterm.h | 20 | ||||
| -rw-r--r-- | src/regex.c | 71 | ||||
| -rw-r--r-- | src/term.c | 1 | ||||
| -rw-r--r-- | src/w32.c | 82 | ||||
| -rw-r--r-- | src/w32menu.c | 31 | ||||
| -rw-r--r-- | src/xdisp.c | 6 | ||||
| -rw-r--r-- | src/xfns.c | 5 | ||||
| -rw-r--r-- | src/xmenu.c | 4 |
19 files changed, 1012 insertions, 75 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ea0d71f90db..51975848e71 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,93 @@ | |||
| 1 | 2007-06-16 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32menu.c (add_menu_item): Escape `&' characters in menu items | ||
| 4 | and their keybindings. | ||
| 5 | |||
| 6 | 2007-06-15 Chong Yidong <cyd@stupidchicken.com> | ||
| 7 | |||
| 8 | * composite.c (update_compositions): Fix last fix. | ||
| 9 | |||
| 10 | 2007-06-14 Jason Rumney <jasonr@gnu.org> | ||
| 11 | |||
| 12 | * w32.c (get_process_times_fn): New function pointer. | ||
| 13 | (globals_of_w32): Intialize it if present in kernel32.dll. | ||
| 14 | (w32_get_internal_run_time): New function. | ||
| 15 | |||
| 16 | * editfns.c (Fget_internal_run_time) [WINDOWSNT]: Use it. | ||
| 17 | |||
| 18 | 2007-06-14 Kenichi Handa <handa@etlken.m17n.org> | ||
| 19 | |||
| 20 | * composite.c (update_compositions): Check the validness of | ||
| 21 | compositions. | ||
| 22 | |||
| 23 | 2007-06-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 24 | |||
| 25 | * frame.h (struct frame) [MAC_OS]: New member external_tool_bar. | ||
| 26 | (FRAME_EXTERNAL_TOOL_BAR) [MAC_OS]: Use it. | ||
| 27 | |||
| 28 | * macfns.c (mac_window) [USE_MAC_TOOLBAR]: Set toolbar_win_gravity. | ||
| 29 | (x_set_tool_bar_lines) [USE_MAC_TOOLBAR]: Set FRAME_EXTERNAL_TOOL_BAR. | ||
| 30 | |||
| 31 | * macgui.h (USE_MAC_TOOLBAR): New define. | ||
| 32 | |||
| 33 | * macmenu.c [TARGET_API_MAC_CARBON] (menu_target_item_handler): | ||
| 34 | Return immediately unless popup is activated. | ||
| 35 | |||
| 36 | * macterm.c (x_draw_fringe_bitmap) [MAC_OSX]: Extend fringe | ||
| 37 | background to scroll bar gap. | ||
| 38 | (x_scroll_bar_create) [MAC_OSX]: Set bar->fringe_extended_p. | ||
| 39 | (XTset_vertical_scroll_bar) [MAC_OSX]: Put leftmost/rightmost | ||
| 40 | scroll bars on frame edge. Check fringe background extension. | ||
| 41 | Don't clear extended fringe background area. | ||
| 42 | (TOOLBAR_IDENTIFIER, TOOLBAR_ICON_ITEM_IDENTIFIER) | ||
| 43 | (TOOLBAR_ITEM_COMMAND_ID_OFFSET, TOOLBAR_ITEM_COMMAND_ID_P) | ||
| 44 | (TOOLBAR_ITEM_COMMAND_ID_VALUE, TOOLBAR_ITEM_MAKE_COMMAND_ID): | ||
| 45 | [USE_MAC_TOOLBAR]: New macros. | ||
| 46 | (mac_move_window_with_gravity, mac_get_window_origin_with_gravity) | ||
| 47 | (mac_handle_toolbar_event, mac_image_spec_to_cg_image) | ||
| 48 | (mac_create_frame_tool_bar, update_frame_tool_bar, free_frame_tool_bar) | ||
| 49 | (mac_tool_bar_note_mouse_movement, mac_handle_toolbar_command_event) | ||
| 50 | [USE_MAC_TOOLBAR]: New functions. | ||
| 51 | (mac_handle_window_event) [USE_MAC_TOOLBAR]: Reposition window | ||
| 52 | manually if previous repositioning has failed. | ||
| 53 | (mac_handle_keyboard_event): Use precomputed event kind. | ||
| 54 | (XTread_socket) [USE_MAC_TOOLBAR]: Handle click in structure region | ||
| 55 | as tool bar item click. Handle mouse movement over tool bar items. | ||
| 56 | |||
| 57 | * macterm.h (struct mac_output) [USE_MAC_TOOLBAR]: New member | ||
| 58 | toolbar_win_gravity. | ||
| 59 | (struct scroll_bar) [MAC_OSX]: New member fringe_extended_p. | ||
| 60 | (update_frame_tool_bar, free_frame_tool_bar) [USE_MAC_TOOLBAR]: | ||
| 61 | Add externs. | ||
| 62 | |||
| 63 | * xdisp.c (update_tool_bar, redisplay_tool_bar, redisplay_window) | ||
| 64 | [USE_MAC_TOOLBAR]: Sync with GTK+ tool bar display. | ||
| 65 | |||
| 66 | 2007-06-14 Chong Yidong <cyd@stupidchicken.com> | ||
| 67 | |||
| 68 | * image.c (search_image_cache): Remove unused variable. | ||
| 69 | |||
| 70 | 2007-06-13 Chong Yidong <cyd@stupidchicken.com> | ||
| 71 | |||
| 72 | * xfns.c, xmenu.c: Link to xaw3d if available. | ||
| 73 | |||
| 74 | 2007-06-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 75 | |||
| 76 | * dispextern.h (struct image) [HAVE_WINDOW_SYSTEM]: New members | ||
| 77 | frame_foreground and frame_background. | ||
| 78 | |||
| 79 | * image.c (lookup_image): Save frame foreground and background colors. | ||
| 80 | (search_image_cache): Check if saved and current frame colors match. | ||
| 81 | |||
| 82 | 2007-06-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 83 | |||
| 84 | * regex.c (regex_compile): Remove the `regnum' counter. | ||
| 85 | Use bufp->re_nsub instead. Add support for \(?N:RE\). | ||
| 86 | |||
| 87 | 2007-06-11 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 88 | |||
| 89 | * term.c: Include intervals.h to declare Fget_text_property. | ||
| 90 | |||
| 1 | 2007-06-10 Jason Rumney <jasonr@gnu.org> | 91 | 2007-06-10 Jason Rumney <jasonr@gnu.org> |
| 2 | 92 | ||
| 3 | * w32fns.c (Fx_file_dialog): Take size from struct not pointer. | 93 | * w32fns.c (Fx_file_dialog): Take size from struct not pointer. |
| @@ -106,11 +196,11 @@ | |||
| 106 | New function. | 196 | New function. |
| 107 | (init_dm_notification_handler) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: | 197 | (init_dm_notification_handler) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: |
| 108 | Register it. | 198 | Register it. |
| 109 | (XTread_socket) [TARGET_API_MAC_CARBON]: Consolidate | 199 | (XTread_socket) [TARGET_API_MAC_CARBON]: |
| 110 | SendEventToEventTarget calls. Use FRAME_OUTER_TO_INNER_DIFF_X and | 200 | Consolidate SendEventToEventTarget calls. |
| 111 | FRAME_OUTER_TO_INNER_DIFF_Y. Move application activation handler | 201 | Use FRAME_OUTER_TO_INNER_DIFF_X and FRAME_OUTER_TO_INNER_DIFF_Y. |
| 112 | to mac_handle_application_event. Move keyboard handler to | 202 | Move application activation handler to mac_handle_application_event. |
| 113 | mac_handle_keyboard_event. | 203 | Move keyboard handler to mac_handle_keyboard_event. |
| 114 | (XTread_socket) [!TARGET_API_MAC_CARBON]: Use do_keystroke. | 204 | (XTread_socket) [!TARGET_API_MAC_CARBON]: Use do_keystroke. |
| 115 | (mac_initialize) [TARGET_API_MAC_CARBON]: Don't call | 205 | (mac_initialize) [TARGET_API_MAC_CARBON]: Don't call |
| 116 | init_command_handler. Call install_application_handler. | 206 | init_command_handler. Call install_application_handler. |
| @@ -124,8 +214,7 @@ | |||
| 124 | 214 | ||
| 125 | 2007-06-06 Chong Yidong <cyd@stupidchicken.com> | 215 | 2007-06-06 Chong Yidong <cyd@stupidchicken.com> |
| 126 | 216 | ||
| 127 | * image.c (xpm_load): Remove spurious call to | 217 | * image.c (xpm_load): Remove spurious call to xpm_init_color_cache. |
| 128 | xpm_init_color_cache. | ||
| 129 | 218 | ||
| 130 | 2007-06-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 219 | 2007-06-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 131 | 220 | ||
diff --git a/src/composite.c b/src/composite.c index d44acf24722..332f4df81de 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -537,7 +537,8 @@ update_compositions (from, to, check_mask) | |||
| 537 | avoid it, in such a case, we change the property of the | 537 | avoid it, in such a case, we change the property of the |
| 538 | latter to the copy of it. */ | 538 | latter to the copy of it. */ |
| 539 | if (from > BEGV | 539 | if (from > BEGV |
| 540 | && find_composition (from - 1, -1, &start, &end, &prop, Qnil)) | 540 | && find_composition (from - 1, -1, &start, &end, &prop, Qnil) |
| 541 | && COMPOSITION_VALID_P (start, end, prop)) | ||
| 541 | { | 542 | { |
| 542 | min_pos = start; | 543 | min_pos = start; |
| 543 | if (end > to) | 544 | if (end > to) |
| @@ -550,7 +551,8 @@ update_compositions (from, to, check_mask) | |||
| 550 | from = end; | 551 | from = end; |
| 551 | } | 552 | } |
| 552 | else if (from < ZV | 553 | else if (from < ZV |
| 553 | && find_composition (from, -1, &start, &from, &prop, Qnil)) | 554 | && find_composition (from, -1, &start, &from, &prop, Qnil) |
| 555 | && COMPOSITION_VALID_P (start, from, prop)) | ||
| 554 | { | 556 | { |
| 555 | if (from > to) | 557 | if (from > to) |
| 556 | max_pos = from; | 558 | max_pos = from; |
| @@ -565,6 +567,7 @@ update_compositions (from, to, check_mask) | |||
| 565 | (to - 1). */ | 567 | (to - 1). */ |
| 566 | while (from < to - 1 | 568 | while (from < to - 1 |
| 567 | && find_composition (from, to, &start, &from, &prop, Qnil) | 569 | && find_composition (from, to, &start, &from, &prop, Qnil) |
| 570 | && COMPOSITION_VALID_P (start, from, prop) | ||
| 568 | && from < to - 1) | 571 | && from < to - 1) |
| 569 | run_composition_function (start, from, prop); | 572 | run_composition_function (start, from, prop); |
| 570 | } | 573 | } |
| @@ -572,7 +575,8 @@ update_compositions (from, to, check_mask) | |||
| 572 | if (check_mask & CHECK_TAIL) | 575 | if (check_mask & CHECK_TAIL) |
| 573 | { | 576 | { |
| 574 | if (from < to | 577 | if (from < to |
| 575 | && find_composition (to - 1, -1, &start, &end, &prop, Qnil)) | 578 | && find_composition (to - 1, -1, &start, &end, &prop, Qnil) |
| 579 | && COMPOSITION_VALID_P (start, end, prop)) | ||
| 576 | { | 580 | { |
| 577 | /* TO should be also at composition boundary. But, | 581 | /* TO should be also at composition boundary. But, |
| 578 | insertion or deletion will make two compositions adjacent | 582 | insertion or deletion will make two compositions adjacent |
| @@ -589,7 +593,8 @@ update_compositions (from, to, check_mask) | |||
| 589 | run_composition_function (start, end, prop); | 593 | run_composition_function (start, end, prop); |
| 590 | } | 594 | } |
| 591 | else if (to < ZV | 595 | else if (to < ZV |
| 592 | && find_composition (to, -1, &start, &end, &prop, Qnil)) | 596 | && find_composition (to, -1, &start, &end, &prop, Qnil) |
| 597 | && COMPOSITION_VALID_P (start, end, prop)) | ||
| 593 | { | 598 | { |
| 594 | run_composition_function (start, end, prop); | 599 | run_composition_function (start, end, prop); |
| 595 | max_pos = end; | 600 | max_pos = end; |
diff --git a/src/config.in b/src/config.in index 136565ab928..db6b5ebaee3 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -231,7 +231,8 @@ Boston, MA 02110-1301, USA. */ | |||
| 231 | /* Define to 1 if you have the `get_current_dir_name' function. */ | 231 | /* Define to 1 if you have the `get_current_dir_name' function. */ |
| 232 | #undef HAVE_GET_CURRENT_DIR_NAME | 232 | #undef HAVE_GET_CURRENT_DIR_NAME |
| 233 | 233 | ||
| 234 | /* Define to 1 if you have the ungif library (-lungif). */ | 234 | /* Define to 1 if you have a gif library (default -lungif; otherwise specify |
| 235 | with LIBGIF). */ | ||
| 235 | #undef HAVE_GIF | 236 | #undef HAVE_GIF |
| 236 | 237 | ||
| 237 | /* Define to 1 if you have the gpm library (-lgpm). */ | 238 | /* Define to 1 if you have the gpm library (-lgpm). */ |
| @@ -777,6 +778,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 777 | Solaris, for example). */ | 778 | Solaris, for example). */ |
| 778 | #undef LD_SWITCH_X_SITE_AUX | 779 | #undef LD_SWITCH_X_SITE_AUX |
| 779 | 780 | ||
| 781 | /* Compiler option to link with the gif library (if not -lungif). */ | ||
| 782 | #undef LIBGIF | ||
| 783 | |||
| 780 | /* Define to 1 if localtime caches TZ. */ | 784 | /* Define to 1 if localtime caches TZ. */ |
| 781 | #undef LOCALTIME_CACHE | 785 | #undef LOCALTIME_CACHE |
| 782 | 786 | ||
diff --git a/src/dispextern.h b/src/dispextern.h index e2ad4b73e5a..9aeb660bc0f 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2441,6 +2441,10 @@ struct image | |||
| 2441 | if necessary. */ | 2441 | if necessary. */ |
| 2442 | unsigned long background; | 2442 | unsigned long background; |
| 2443 | 2443 | ||
| 2444 | /* Foreground and background colors of the frame on which the image | ||
| 2445 | is created. */ | ||
| 2446 | unsigned long frame_foreground, frame_background; | ||
| 2447 | |||
| 2444 | /* True if this image has a `transparent' background -- that is, is | 2448 | /* True if this image has a `transparent' background -- that is, is |
| 2445 | uses an image mask. The accessor macro for this is | 2449 | uses an image mask. The accessor macro for this is |
| 2446 | `IMAGE_BACKGROUND_TRANSPARENT'. */ | 2450 | `IMAGE_BACKGROUND_TRANSPARENT'. */ |
diff --git a/src/editfns.c b/src/editfns.c index 22aa47688a5..b615012c700 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -84,6 +84,11 @@ extern char **environ; | |||
| 84 | 84 | ||
| 85 | extern size_t emacs_strftimeu P_ ((char *, size_t, const char *, | 85 | extern size_t emacs_strftimeu P_ ((char *, size_t, const char *, |
| 86 | const struct tm *, int)); | 86 | const struct tm *, int)); |
| 87 | |||
| 88 | #ifdef WINDOWSNT | ||
| 89 | extern Lisp_Object w32_get_internal_run_time (); | ||
| 90 | #endif | ||
| 91 | |||
| 87 | static int tm_diff P_ ((struct tm *, struct tm *)); | 92 | static int tm_diff P_ ((struct tm *, struct tm *)); |
| 88 | static void find_field P_ ((Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *)); | 93 | static void find_field P_ ((Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *)); |
| 89 | static void update_buffer_properties P_ ((int, int)); | 94 | static void update_buffer_properties P_ ((int, int)); |
| @@ -1481,9 +1486,13 @@ on systems that do not provide resolution finer than a second. */) | |||
| 1481 | return list3 (make_number ((secs >> 16) & 0xffff), | 1486 | return list3 (make_number ((secs >> 16) & 0xffff), |
| 1482 | make_number ((secs >> 0) & 0xffff), | 1487 | make_number ((secs >> 0) & 0xffff), |
| 1483 | make_number (usecs)); | 1488 | make_number (usecs)); |
| 1484 | #else | 1489 | #else /* ! HAVE_GETRUSAGE */ |
| 1490 | #if WINDOWSNT | ||
| 1491 | return w32_get_internal_run_time (); | ||
| 1492 | #else /* ! WINDOWSNT */ | ||
| 1485 | return Fcurrent_time (); | 1493 | return Fcurrent_time (); |
| 1486 | #endif | 1494 | #endif /* WINDOWSNT */ |
| 1495 | #endif /* HAVE_GETRUSAGE */ | ||
| 1487 | } | 1496 | } |
| 1488 | 1497 | ||
| 1489 | 1498 | ||
diff --git a/src/frame.h b/src/frame.h index db60700c5ad..4a97a6095e0 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -218,7 +218,7 @@ struct frame | |||
| 218 | be used for output. */ | 218 | be used for output. */ |
| 219 | unsigned glyphs_initialized_p : 1; | 219 | unsigned glyphs_initialized_p : 1; |
| 220 | 220 | ||
| 221 | #if defined (USE_GTK) | 221 | #if defined (USE_GTK) || defined (MAC_OS) |
| 222 | /* Nonzero means using a tool bar that comes from the toolkit. */ | 222 | /* Nonzero means using a tool bar that comes from the toolkit. */ |
| 223 | int external_tool_bar; | 223 | int external_tool_bar; |
| 224 | #endif | 224 | #endif |
| @@ -561,7 +561,7 @@ typedef struct frame *FRAME_PTR; | |||
| 561 | 561 | ||
| 562 | /* Nonzero if this frame should display a tool bar | 562 | /* Nonzero if this frame should display a tool bar |
| 563 | in a way that does not use any text lines. */ | 563 | in a way that does not use any text lines. */ |
| 564 | #if defined (USE_GTK) | 564 | #if defined (USE_GTK) || defined (MAC_OS) |
| 565 | #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar | 565 | #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar |
| 566 | #else | 566 | #else |
| 567 | #define FRAME_EXTERNAL_TOOL_BAR(f) 0 | 567 | #define FRAME_EXTERNAL_TOOL_BAR(f) 0 |
diff --git a/src/image.c b/src/image.c index 9cfcd5a63f8..2dd578afc39 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1642,22 +1642,28 @@ search_image_cache (f, spec, hash) | |||
| 1642 | { | 1642 | { |
| 1643 | struct image *img; | 1643 | struct image *img; |
| 1644 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 1644 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
| 1645 | Lisp_Object specified_bg = image_spec_value (spec, QCbackground, NULL); | ||
| 1646 | int i = hash % IMAGE_CACHE_BUCKETS_SIZE; | 1645 | int i = hash % IMAGE_CACHE_BUCKETS_SIZE; |
| 1647 | 1646 | ||
| 1648 | /* If the image spec does not specify a background color, the cached | 1647 | /* If the image spec does not specify a background color, the cached |
| 1649 | image must have the same background color as the current frame. | 1648 | image must have the same background color as the current frame. |
| 1650 | The following code be improved. For example, jpeg does not | 1649 | The foreground color must also match, for the sake of monochrome |
| 1651 | support transparency, but currently a jpeg image spec won't match | 1650 | images. |
| 1652 | a cached spec created with a different frame background. The | 1651 | |
| 1653 | extra memory usage is probably negligible in practice. */ | 1652 | In fact, we could ignore the foreground color matching condition |
| 1653 | for color images, or if the image spec specifies :foreground; | ||
| 1654 | similarly we could ignore the background color matching condition | ||
| 1655 | for formats that don't use transparency (such as jpeg), or if the | ||
| 1656 | image spec specifies :background. However, the extra memory | ||
| 1657 | usage is probably negligible in practice, so we don't bother. */ | ||
| 1654 | if (!c) return NULL; | 1658 | if (!c) return NULL; |
| 1655 | 1659 | ||
| 1656 | for (img = c->buckets[i]; img; img = img->next) | 1660 | for (img = c->buckets[i]; img; img = img->next) |
| 1657 | if (img->hash == hash | 1661 | if (img->hash == hash |
| 1658 | && !NILP (Fequal (img->spec, spec)) | 1662 | && !NILP (Fequal (img->spec, spec)) |
| 1659 | && (STRINGP (specified_bg) | 1663 | /* If the image spec specifies a background, it doesn't matter |
| 1660 | || img->background == FRAME_BACKGROUND_PIXEL (f))) | 1664 | what the frame background is. */ |
| 1665 | && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) | ||
| 1666 | && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) | ||
| 1661 | break; | 1667 | break; |
| 1662 | return img; | 1668 | return img; |
| 1663 | } | 1669 | } |
| @@ -1929,6 +1935,8 @@ lookup_image (f, spec) | |||
| 1929 | img = make_image (spec, hash); | 1935 | img = make_image (spec, hash); |
| 1930 | cache_image (f, img); | 1936 | cache_image (f, img); |
| 1931 | img->load_failed_p = img->type->load (f, img) == 0; | 1937 | img->load_failed_p = img->type->load (f, img) == 0; |
| 1938 | img->frame_foreground = FRAME_FOREGROUND_PIXEL (f); | ||
| 1939 | img->frame_background = FRAME_BACKGROUND_PIXEL (f); | ||
| 1932 | 1940 | ||
| 1933 | /* If we can't load the image, and we don't have a width and | 1941 | /* If we can't load the image, and we don't have a width and |
| 1934 | height, use some arbitrary width and height so that we can | 1942 | height, use some arbitrary width and height so that we can |
diff --git a/src/macfns.c b/src/macfns.c index b3ab709116a..d47a716c928 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -1682,6 +1682,25 @@ x_set_tool_bar_lines (f, value, oldval) | |||
| 1682 | /* Make sure we redisplay all windows in this frame. */ | 1682 | /* Make sure we redisplay all windows in this frame. */ |
| 1683 | ++windows_or_buffers_changed; | 1683 | ++windows_or_buffers_changed; |
| 1684 | 1684 | ||
| 1685 | #if USE_MAC_TOOLBAR | ||
| 1686 | FRAME_TOOL_BAR_LINES (f) = 0; | ||
| 1687 | if (nlines) | ||
| 1688 | { | ||
| 1689 | FRAME_EXTERNAL_TOOL_BAR (f) = 1; | ||
| 1690 | if (FRAME_MAC_P (f) && !IsWindowToolbarVisible (FRAME_MAC_WINDOW (f))) | ||
| 1691 | /* Make sure next redisplay shows the tool bar. */ | ||
| 1692 | XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = Qt; | ||
| 1693 | } | ||
| 1694 | else | ||
| 1695 | { | ||
| 1696 | if (FRAME_EXTERNAL_TOOL_BAR (f)) | ||
| 1697 | free_frame_tool_bar (f); | ||
| 1698 | FRAME_EXTERNAL_TOOL_BAR (f) = 0; | ||
| 1699 | } | ||
| 1700 | |||
| 1701 | return; | ||
| 1702 | #endif | ||
| 1703 | |||
| 1685 | delta = nlines - FRAME_TOOL_BAR_LINES (f); | 1704 | delta = nlines - FRAME_TOOL_BAR_LINES (f); |
| 1686 | 1705 | ||
| 1687 | /* Don't resize the tool-bar to more than we have room for. */ | 1706 | /* Don't resize the tool-bar to more than we have room for. */ |
| @@ -2284,6 +2303,16 @@ mac_window (f) | |||
| 2284 | XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f), | 2303 | XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f), |
| 2285 | FRAME_BACKGROUND_PIXEL (f)); | 2304 | FRAME_BACKGROUND_PIXEL (f)); |
| 2286 | 2305 | ||
| 2306 | #if USE_MAC_TOOLBAR | ||
| 2307 | /* At the moment, the size of the tool bar is not yet known. We | ||
| 2308 | record the gravity value of the newly created window and use it | ||
| 2309 | to adjust the position of the window (especially for a negative | ||
| 2310 | specification of its vertical position) when the tool bar is | ||
| 2311 | first redisplayed. */ | ||
| 2312 | if (FRAME_EXTERNAL_TOOL_BAR (f)) | ||
| 2313 | f->output_data.mac->toolbar_win_gravity = f->win_gravity; | ||
| 2314 | #endif | ||
| 2315 | |||
| 2287 | validate_x_resource_name (); | 2316 | validate_x_resource_name (); |
| 2288 | 2317 | ||
| 2289 | /* x_set_name normally ignores requests to set the name if the | 2318 | /* x_set_name normally ignores requests to set the name if the |
diff --git a/src/macgui.h b/src/macgui.h index 34a3f905487..a141a6563f0 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -119,6 +119,13 @@ typedef unsigned long Time; | |||
| 119 | #endif | 119 | #endif |
| 120 | #endif | 120 | #endif |
| 121 | 121 | ||
| 122 | /* Whether to use HIToolbar. */ | ||
| 123 | #ifndef USE_MAC_TOOLBAR | ||
| 124 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 && MAC_OS_X_VERSION_MIN_REQUIRED != 1020 | ||
| 125 | #define USE_MAC_TOOLBAR 1 | ||
| 126 | #endif | ||
| 127 | #endif | ||
| 128 | |||
| 122 | typedef WindowRef Window; | 129 | typedef WindowRef Window; |
| 123 | typedef GWorldPtr Pixmap; | 130 | typedef GWorldPtr Pixmap; |
| 124 | 131 | ||
diff --git a/src/macmenu.c b/src/macmenu.c index 5e6ad6f7d10..932af50bbd8 100644 --- a/src/macmenu.c +++ b/src/macmenu.c | |||
| @@ -1602,6 +1602,10 @@ menu_target_item_handler (next_handler, event, data) | |||
| 1602 | GrafPtr port; | 1602 | GrafPtr port; |
| 1603 | int specpdl_count = SPECPDL_INDEX (); | 1603 | int specpdl_count = SPECPDL_INDEX (); |
| 1604 | 1604 | ||
| 1605 | /* Don't be bothered with the overflowed toolbar items menu. */ | ||
| 1606 | if (!popup_activated ()) | ||
| 1607 | return eventNotHandledErr; | ||
| 1608 | |||
| 1605 | err = GetEventParameter (event, kEventParamDirectObject, typeMenuRef, | 1609 | err = GetEventParameter (event, kEventParamDirectObject, typeMenuRef, |
| 1606 | NULL, sizeof (MenuRef), NULL, &menu); | 1610 | NULL, sizeof (MenuRef), NULL, &menu); |
| 1607 | if (err == noErr) | 1611 | if (err == noErr) |
diff --git a/src/macterm.c b/src/macterm.c index 1a67a9ebec1..d770f867ff7 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -2197,6 +2197,57 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 2197 | struct face *face = p->face; | 2197 | struct face *face = p->face; |
| 2198 | int rowY; | 2198 | int rowY; |
| 2199 | 2199 | ||
| 2200 | #ifdef MAC_OSX | ||
| 2201 | if (p->bx >= 0 && !p->overlay_p) | ||
| 2202 | { | ||
| 2203 | int bx = p->bx, nx = p->nx; | ||
| 2204 | |||
| 2205 | #if 0 /* MAC_TODO: stipple */ | ||
| 2206 | /* In case the same realized face is used for fringes and | ||
| 2207 | for something displayed in the text (e.g. face `region' on | ||
| 2208 | mono-displays, the fill style may have been changed to | ||
| 2209 | FillSolid in x_draw_glyph_string_background. */ | ||
| 2210 | if (face->stipple) | ||
| 2211 | XSetFillStyle (FRAME_X_DISPLAY (f), face->gc, FillOpaqueStippled); | ||
| 2212 | else | ||
| 2213 | XSetForeground (FRAME_X_DISPLAY (f), face->gc, face->background); | ||
| 2214 | #endif | ||
| 2215 | |||
| 2216 | /* If the fringe is adjacent to the left (right) scroll bar of a | ||
| 2217 | leftmost (rightmost, respectively) window, then extend its | ||
| 2218 | background to the gap between the fringe and the bar. */ | ||
| 2219 | if ((WINDOW_LEFTMOST_P (w) | ||
| 2220 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 2221 | || (WINDOW_RIGHTMOST_P (w) | ||
| 2222 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) | ||
| 2223 | { | ||
| 2224 | int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); | ||
| 2225 | |||
| 2226 | if (sb_width > 0) | ||
| 2227 | { | ||
| 2228 | int left = WINDOW_SCROLL_BAR_AREA_X (w); | ||
| 2229 | int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w) | ||
| 2230 | * FRAME_COLUMN_WIDTH (f)); | ||
| 2231 | |||
| 2232 | if (left + width == bx) | ||
| 2233 | { | ||
| 2234 | bx = left + sb_width; | ||
| 2235 | nx += width - sb_width; | ||
| 2236 | } | ||
| 2237 | else if (bx + nx == left) | ||
| 2238 | nx += width - sb_width; | ||
| 2239 | } | ||
| 2240 | } | ||
| 2241 | |||
| 2242 | mac_erase_rectangle (f, face->gc, bx, p->by, nx, p->ny); | ||
| 2243 | |||
| 2244 | #if 0 /* MAC_TODO: stipple */ | ||
| 2245 | if (!face->stipple) | ||
| 2246 | XSetForeground (FRAME_X_DISPLAY (f), face->gc, face->foreground); | ||
| 2247 | #endif | ||
| 2248 | } | ||
| 2249 | #endif /* MAC_OSX */ | ||
| 2250 | |||
| 2200 | /* Must clip because of partially visible lines. */ | 2251 | /* Must clip because of partially visible lines. */ |
| 2201 | rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | 2252 | rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); |
| 2202 | if (p->y < rowY) | 2253 | if (p->y < rowY) |
| @@ -2214,6 +2265,7 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 2214 | else | 2265 | else |
| 2215 | x_clip_to_row (w, row, -1, face->gc); | 2266 | x_clip_to_row (w, row, -1, face->gc); |
| 2216 | 2267 | ||
| 2268 | #ifndef MAC_OSX | ||
| 2217 | if (p->bx >= 0 && !p->overlay_p) | 2269 | if (p->bx >= 0 && !p->overlay_p) |
| 2218 | { | 2270 | { |
| 2219 | #if 0 /* MAC_TODO: stipple */ | 2271 | #if 0 /* MAC_TODO: stipple */ |
| @@ -2234,6 +2286,7 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 2234 | XSetForeground (FRAME_X_DISPLAY (f), face->gc, face->foreground); | 2286 | XSetForeground (FRAME_X_DISPLAY (f), face->gc, face->foreground); |
| 2235 | #endif | 2287 | #endif |
| 2236 | } | 2288 | } |
| 2289 | #endif /* !MAC_OSX */ | ||
| 2237 | 2290 | ||
| 2238 | if (p->which | 2291 | if (p->which |
| 2239 | #if USE_CG_DRAWING | 2292 | #if USE_CG_DRAWING |
| @@ -4997,6 +5050,9 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height) | |||
| 4997 | XSETINT (bar->start, 0); | 5050 | XSETINT (bar->start, 0); |
| 4998 | XSETINT (bar->end, 0); | 5051 | XSETINT (bar->end, 0); |
| 4999 | bar->dragging = Qnil; | 5052 | bar->dragging = Qnil; |
| 5053 | #ifdef MAC_OSX | ||
| 5054 | bar->fringe_extended_p = Qnil; | ||
| 5055 | #endif | ||
| 5000 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5056 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5001 | bar->track_top = Qnil; | 5057 | bar->track_top = Qnil; |
| 5002 | bar->track_height = Qnil; | 5058 | bar->track_height = Qnil; |
| @@ -5129,6 +5185,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5129 | struct scroll_bar *bar; | 5185 | struct scroll_bar *bar; |
| 5130 | int top, height, left, sb_left, width, sb_width, disp_top, disp_height; | 5186 | int top, height, left, sb_left, width, sb_width, disp_top, disp_height; |
| 5131 | int window_y, window_height; | 5187 | int window_y, window_height; |
| 5188 | #ifdef MAC_OSX | ||
| 5189 | int fringe_extended_p; | ||
| 5190 | #endif | ||
| 5132 | 5191 | ||
| 5133 | /* Get window dimensions. */ | 5192 | /* Get window dimensions. */ |
| 5134 | window_box (w, -1, 0, &window_y, 0, &window_height); | 5193 | window_box (w, -1, 0, &window_y, 0, &window_height); |
| @@ -5148,9 +5207,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5148 | 5207 | ||
| 5149 | /* Compute the left edge of the scroll bar. */ | 5208 | /* Compute the left edge of the scroll bar. */ |
| 5150 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) | 5209 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) |
| 5151 | sb_left = left; | 5210 | sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0); |
| 5152 | else | 5211 | else |
| 5153 | sb_left = left + width - sb_width; | 5212 | sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width); |
| 5154 | 5213 | ||
| 5155 | /* Adjustments according to Inside Macintosh to make it look nice */ | 5214 | /* Adjustments according to Inside Macintosh to make it look nice */ |
| 5156 | disp_top = top; | 5215 | disp_top = top; |
| @@ -5171,11 +5230,29 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5171 | sb_left++; | 5230 | sb_left++; |
| 5172 | #endif | 5231 | #endif |
| 5173 | 5232 | ||
| 5233 | #ifdef MAC_OSX | ||
| 5234 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 5235 | fringe_extended_p = (WINDOW_LEFTMOST_P (w) | ||
| 5236 | && WINDOW_LEFT_FRINGE_WIDTH (w) | ||
| 5237 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 5238 | || WINDOW_LEFT_MARGIN_COLS (w) == 0)); | ||
| 5239 | else | ||
| 5240 | fringe_extended_p = (WINDOW_RIGHTMOST_P (w) | ||
| 5241 | && WINDOW_RIGHT_FRINGE_WIDTH (w) | ||
| 5242 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 5243 | || WINDOW_RIGHT_MARGIN_COLS (w) == 0)); | ||
| 5244 | #endif | ||
| 5245 | |||
| 5174 | /* Does the scroll bar exist yet? */ | 5246 | /* Does the scroll bar exist yet? */ |
| 5175 | if (NILP (w->vertical_scroll_bar)) | 5247 | if (NILP (w->vertical_scroll_bar)) |
| 5176 | { | 5248 | { |
| 5177 | BLOCK_INPUT; | 5249 | BLOCK_INPUT; |
| 5178 | mac_clear_area (f, left, top, width, height); | 5250 | #ifdef MAC_OSX |
| 5251 | if (fringe_extended_p) | ||
| 5252 | mac_clear_area (f, sb_left, top, sb_width, height); | ||
| 5253 | else | ||
| 5254 | #endif | ||
| 5255 | mac_clear_area (f, left, top, width, height); | ||
| 5179 | UNBLOCK_INPUT; | 5256 | UNBLOCK_INPUT; |
| 5180 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height, disp_top, | 5257 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height, disp_top, |
| 5181 | disp_height); | 5258 | disp_height); |
| @@ -5195,11 +5272,20 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5195 | if (!(XINT (bar->left) == sb_left | 5272 | if (!(XINT (bar->left) == sb_left |
| 5196 | && XINT (bar->top) == top | 5273 | && XINT (bar->top) == top |
| 5197 | && XINT (bar->width) == sb_width | 5274 | && XINT (bar->width) == sb_width |
| 5198 | && XINT (bar->height) == height)) | 5275 | && XINT (bar->height) == height |
| 5276 | #ifdef MAC_OSX | ||
| 5277 | && !NILP (bar->fringe_extended_p) == fringe_extended_p | ||
| 5278 | #endif | ||
| 5279 | )) | ||
| 5199 | { | 5280 | { |
| 5200 | /* Since toolkit scroll bars are smaller than the space reserved | 5281 | /* Since toolkit scroll bars are smaller than the space reserved |
| 5201 | for them on the frame, we have to clear "under" them. */ | 5282 | for them on the frame, we have to clear "under" them. */ |
| 5202 | mac_clear_area (f, left, top, width, height); | 5283 | #ifdef MAC_OSX |
| 5284 | if (fringe_extended_p) | ||
| 5285 | mac_clear_area (f, sb_left, top, sb_width, height); | ||
| 5286 | else | ||
| 5287 | #endif | ||
| 5288 | mac_clear_area (f, left, top, width, height); | ||
| 5203 | 5289 | ||
| 5204 | #if USE_CG_DRAWING | 5290 | #if USE_CG_DRAWING |
| 5205 | mac_prepare_for_quickdraw (f); | 5291 | mac_prepare_for_quickdraw (f); |
| @@ -5228,6 +5314,10 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5228 | UNBLOCK_INPUT; | 5314 | UNBLOCK_INPUT; |
| 5229 | } | 5315 | } |
| 5230 | 5316 | ||
| 5317 | #ifdef MAC_OSX | ||
| 5318 | bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; | ||
| 5319 | #endif | ||
| 5320 | |||
| 5231 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5321 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5232 | if (NILP (bar->track_top)) | 5322 | if (NILP (bar->track_top)) |
| 5233 | { | 5323 | { |
| @@ -5591,6 +5681,539 @@ x_scroll_bar_clear (f) | |||
| 5591 | 5681 | ||
| 5592 | 5682 | ||
| 5593 | /*********************************************************************** | 5683 | /*********************************************************************** |
| 5684 | Tool-bars | ||
| 5685 | ***********************************************************************/ | ||
| 5686 | #if USE_MAC_TOOLBAR | ||
| 5687 | |||
| 5688 | /* In identifiers such as function/variable names, Emacs tool bar is | ||
| 5689 | referred to as `tool_bar', and Carbon HIToolbar as `toolbar'. */ | ||
| 5690 | |||
| 5691 | #define TOOLBAR_IDENTIFIER (CFSTR ("org.gnu.Emacs.toolbar")) | ||
| 5692 | #define TOOLBAR_ICON_ITEM_IDENTIFIER (CFSTR ("org.gnu.Emacs.toolbar.icon")) | ||
| 5693 | |||
| 5694 | #define TOOLBAR_ITEM_COMMAND_ID_OFFSET 'Tb\0\0' | ||
| 5695 | #define TOOLBAR_ITEM_COMMAND_ID_P(id) \ | ||
| 5696 | (((id) & ~0xffff) == TOOLBAR_ITEM_COMMAND_ID_OFFSET) | ||
| 5697 | #define TOOLBAR_ITEM_COMMAND_ID_VALUE(id) \ | ||
| 5698 | ((id) - TOOLBAR_ITEM_COMMAND_ID_OFFSET) | ||
| 5699 | #define TOOLBAR_ITEM_MAKE_COMMAND_ID(value) \ | ||
| 5700 | ((value) + TOOLBAR_ITEM_COMMAND_ID_OFFSET) | ||
| 5701 | |||
| 5702 | static int mac_event_to_emacs_modifiers P_ ((EventRef)); | ||
| 5703 | static void mac_handle_origin_change P_ ((struct frame *)); | ||
| 5704 | static OSStatus mac_handle_toolbar_command_event P_ ((EventHandlerCallRef, | ||
| 5705 | EventRef, void *)); | ||
| 5706 | |||
| 5707 | static void | ||
| 5708 | mac_move_window_with_gravity (f, win_gravity, left, top) | ||
| 5709 | struct frame *f; | ||
| 5710 | int win_gravity; | ||
| 5711 | short left, top; | ||
| 5712 | { | ||
| 5713 | Rect inner, outer; | ||
| 5714 | |||
| 5715 | mac_get_window_bounds (f, &inner, &outer); | ||
| 5716 | |||
| 5717 | switch (win_gravity) | ||
| 5718 | { | ||
| 5719 | case NorthWestGravity: | ||
| 5720 | case WestGravity: | ||
| 5721 | case SouthWestGravity: | ||
| 5722 | left += inner.left - outer.left; | ||
| 5723 | break; | ||
| 5724 | |||
| 5725 | case NorthGravity: | ||
| 5726 | case CenterGravity: | ||
| 5727 | case SouthGravity: | ||
| 5728 | left += ((inner.left - outer.left) + (inner.right - outer.right)) / 2; | ||
| 5729 | break; | ||
| 5730 | |||
| 5731 | case NorthEastGravity: | ||
| 5732 | case EastGravity: | ||
| 5733 | case SouthEastGravity: | ||
| 5734 | left += inner.right - outer.right; | ||
| 5735 | break; | ||
| 5736 | } | ||
| 5737 | |||
| 5738 | switch (win_gravity) | ||
| 5739 | { | ||
| 5740 | case NorthWestGravity: | ||
| 5741 | case NorthGravity: | ||
| 5742 | case NorthEastGravity: | ||
| 5743 | top += inner.top - outer.top; | ||
| 5744 | break; | ||
| 5745 | |||
| 5746 | case WestGravity: | ||
| 5747 | case CenterGravity: | ||
| 5748 | case EastGravity: | ||
| 5749 | top += ((inner.top - outer.top) + (inner.bottom - outer.bottom)) / 2; | ||
| 5750 | break; | ||
| 5751 | |||
| 5752 | case SouthWestGravity: | ||
| 5753 | case SouthGravity: | ||
| 5754 | case SouthEastGravity: | ||
| 5755 | top += inner.bottom - outer.bottom; | ||
| 5756 | break; | ||
| 5757 | } | ||
| 5758 | |||
| 5759 | MoveWindow (FRAME_MAC_WINDOW (f), left, top, false); | ||
| 5760 | } | ||
| 5761 | |||
| 5762 | static void | ||
| 5763 | mac_get_window_origin_with_gravity (f, win_gravity, left, top) | ||
| 5764 | struct frame *f; | ||
| 5765 | int win_gravity; | ||
| 5766 | short *left, *top; | ||
| 5767 | { | ||
| 5768 | Rect inner, outer; | ||
| 5769 | |||
| 5770 | mac_get_window_bounds (f, &inner, &outer); | ||
| 5771 | |||
| 5772 | switch (win_gravity) | ||
| 5773 | { | ||
| 5774 | case NorthWestGravity: | ||
| 5775 | case WestGravity: | ||
| 5776 | case SouthWestGravity: | ||
| 5777 | *left = outer.left; | ||
| 5778 | break; | ||
| 5779 | |||
| 5780 | case NorthGravity: | ||
| 5781 | case CenterGravity: | ||
| 5782 | case SouthGravity: | ||
| 5783 | *left = outer.left + ((outer.right - outer.left) | ||
| 5784 | - (inner.right - inner.left)) / 2; | ||
| 5785 | break; | ||
| 5786 | |||
| 5787 | case NorthEastGravity: | ||
| 5788 | case EastGravity: | ||
| 5789 | case SouthEastGravity: | ||
| 5790 | *left = outer.right - (inner.right - inner.left); | ||
| 5791 | break; | ||
| 5792 | } | ||
| 5793 | |||
| 5794 | switch (win_gravity) | ||
| 5795 | { | ||
| 5796 | case NorthWestGravity: | ||
| 5797 | case NorthGravity: | ||
| 5798 | case NorthEastGravity: | ||
| 5799 | *top = outer.top; | ||
| 5800 | break; | ||
| 5801 | |||
| 5802 | case WestGravity: | ||
| 5803 | case CenterGravity: | ||
| 5804 | case EastGravity: | ||
| 5805 | *top = outer.top + ((outer.bottom - outer.top) | ||
| 5806 | - (inner.bottom - inner.top)) / 2; | ||
| 5807 | break; | ||
| 5808 | |||
| 5809 | case SouthWestGravity: | ||
| 5810 | case SouthGravity: | ||
| 5811 | case SouthEastGravity: | ||
| 5812 | *top = outer.bottom - (inner.bottom - inner.top); | ||
| 5813 | break; | ||
| 5814 | } | ||
| 5815 | } | ||
| 5816 | |||
| 5817 | static OSStatus | ||
| 5818 | mac_handle_toolbar_event (next_handler, event, data) | ||
| 5819 | EventHandlerCallRef next_handler; | ||
| 5820 | EventRef event; | ||
| 5821 | void *data; | ||
| 5822 | { | ||
| 5823 | OSStatus err, result = eventNotHandledErr; | ||
| 5824 | |||
| 5825 | switch (GetEventKind (event)) | ||
| 5826 | { | ||
| 5827 | case kEventToolbarGetDefaultIdentifiers: | ||
| 5828 | result = noErr; | ||
| 5829 | break; | ||
| 5830 | |||
| 5831 | case kEventToolbarGetAllowedIdentifiers: | ||
| 5832 | { | ||
| 5833 | CFMutableArrayRef array; | ||
| 5834 | |||
| 5835 | GetEventParameter (event, kEventParamMutableArray, | ||
| 5836 | typeCFMutableArrayRef, NULL, | ||
| 5837 | sizeof (CFMutableArrayRef), NULL, &array); | ||
| 5838 | CFArrayAppendValue (array, TOOLBAR_ICON_ITEM_IDENTIFIER); | ||
| 5839 | result = noErr; | ||
| 5840 | } | ||
| 5841 | break; | ||
| 5842 | |||
| 5843 | case kEventToolbarCreateItemWithIdentifier: | ||
| 5844 | { | ||
| 5845 | CFStringRef identifier; | ||
| 5846 | HIToolbarItemRef item = NULL; | ||
| 5847 | |||
| 5848 | GetEventParameter (event, kEventParamToolbarItemIdentifier, | ||
| 5849 | typeCFStringRef, NULL, | ||
| 5850 | sizeof (CFStringRef), NULL, &identifier); | ||
| 5851 | |||
| 5852 | if (CFStringCompare (identifier, TOOLBAR_ICON_ITEM_IDENTIFIER, 0) | ||
| 5853 | == kCFCompareEqualTo) | ||
| 5854 | HIToolbarItemCreate (identifier, | ||
| 5855 | kHIToolbarItemAllowDuplicates | ||
| 5856 | | kHIToolbarItemCantBeRemoved, &item); | ||
| 5857 | |||
| 5858 | if (item) | ||
| 5859 | { | ||
| 5860 | SetEventParameter (event, kEventParamToolbarItem, | ||
| 5861 | typeHIToolbarItemRef, | ||
| 5862 | sizeof (HIToolbarItemRef), &item); | ||
| 5863 | result = noErr; | ||
| 5864 | } | ||
| 5865 | } | ||
| 5866 | break; | ||
| 5867 | |||
| 5868 | default: | ||
| 5869 | abort (); | ||
| 5870 | } | ||
| 5871 | |||
| 5872 | return result; | ||
| 5873 | } | ||
| 5874 | |||
| 5875 | static CGImageRef | ||
| 5876 | mac_image_spec_to_cg_image (f, image) | ||
| 5877 | struct frame *f; | ||
| 5878 | Lisp_Object image; | ||
| 5879 | { | ||
| 5880 | if (!valid_image_p (image)) | ||
| 5881 | return NULL; | ||
| 5882 | else | ||
| 5883 | { | ||
| 5884 | int img_id = lookup_image (f, image); | ||
| 5885 | struct image *img = IMAGE_FROM_ID (f, img_id); | ||
| 5886 | |||
| 5887 | prepare_image_for_display (f, img); | ||
| 5888 | |||
| 5889 | return img->data.ptr_val; | ||
| 5890 | } | ||
| 5891 | } | ||
| 5892 | |||
| 5893 | /* Create a tool bar for frame F. */ | ||
| 5894 | |||
| 5895 | static OSStatus | ||
| 5896 | mac_create_frame_tool_bar (f) | ||
| 5897 | FRAME_PTR f; | ||
| 5898 | { | ||
| 5899 | OSStatus err; | ||
| 5900 | HIToolbarRef toolbar; | ||
| 5901 | |||
| 5902 | err = HIToolbarCreate (TOOLBAR_IDENTIFIER, kHIToolbarNoAttributes, | ||
| 5903 | &toolbar); | ||
| 5904 | if (err == noErr) | ||
| 5905 | { | ||
| 5906 | static const EventTypeSpec specs[] = | ||
| 5907 | {{kEventClassToolbar, kEventToolbarGetDefaultIdentifiers}, | ||
| 5908 | {kEventClassToolbar, kEventToolbarGetAllowedIdentifiers}, | ||
| 5909 | {kEventClassToolbar, kEventToolbarCreateItemWithIdentifier}}; | ||
| 5910 | |||
| 5911 | err = InstallEventHandler (HIObjectGetEventTarget (toolbar), | ||
| 5912 | mac_handle_toolbar_event, | ||
| 5913 | GetEventTypeCount (specs), specs, | ||
| 5914 | f, NULL); | ||
| 5915 | } | ||
| 5916 | |||
| 5917 | if (err == noErr) | ||
| 5918 | err = HIToolbarSetDisplayMode (toolbar, kHIToolbarDisplayModeIconOnly); | ||
| 5919 | if (err == noErr) | ||
| 5920 | { | ||
| 5921 | static const EventTypeSpec specs[] = | ||
| 5922 | {{kEventClassCommand, kEventCommandProcess}}; | ||
| 5923 | |||
| 5924 | err = InstallWindowEventHandler (FRAME_MAC_WINDOW (f), | ||
| 5925 | mac_handle_toolbar_command_event, | ||
| 5926 | GetEventTypeCount (specs), | ||
| 5927 | specs, f, NULL); | ||
| 5928 | } | ||
| 5929 | if (err == noErr) | ||
| 5930 | err = SetWindowToolbar (FRAME_MAC_WINDOW (f), toolbar); | ||
| 5931 | |||
| 5932 | if (toolbar) | ||
| 5933 | CFRelease (toolbar); | ||
| 5934 | |||
| 5935 | return err; | ||
| 5936 | } | ||
| 5937 | |||
| 5938 | /* Update the tool bar for frame F. Add new buttons and remove old. */ | ||
| 5939 | |||
| 5940 | void | ||
| 5941 | update_frame_tool_bar (f) | ||
| 5942 | FRAME_PTR f; | ||
| 5943 | { | ||
| 5944 | HIToolbarRef toolbar = NULL; | ||
| 5945 | short left, top; | ||
| 5946 | CFArrayRef old_items = NULL; | ||
| 5947 | CFIndex old_count; | ||
| 5948 | int i, pos, win_gravity = f->output_data.mac->toolbar_win_gravity; | ||
| 5949 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | ||
| 5950 | |||
| 5951 | BLOCK_INPUT; | ||
| 5952 | |||
| 5953 | GetWindowToolbar (FRAME_MAC_WINDOW (f), &toolbar); | ||
| 5954 | if (toolbar == NULL) | ||
| 5955 | { | ||
| 5956 | mac_create_frame_tool_bar (f); | ||
| 5957 | GetWindowToolbar (FRAME_MAC_WINDOW (f), &toolbar); | ||
| 5958 | if (toolbar == NULL) | ||
| 5959 | goto out; | ||
| 5960 | if (win_gravity >= NorthWestGravity && win_gravity <= SouthEastGravity) | ||
| 5961 | mac_get_window_origin_with_gravity (f, win_gravity, &left, &top); | ||
| 5962 | } | ||
| 5963 | |||
| 5964 | HIToolbarCopyItems (toolbar, &old_items); | ||
| 5965 | if (old_items == NULL) | ||
| 5966 | goto out; | ||
| 5967 | |||
| 5968 | old_count = CFArrayGetCount (old_items); | ||
| 5969 | pos = 0; | ||
| 5970 | for (i = 0; i < f->n_tool_bar_items; ++i) | ||
| 5971 | { | ||
| 5972 | #define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) | ||
| 5973 | |||
| 5974 | int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); | ||
| 5975 | int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); | ||
| 5976 | int idx; | ||
| 5977 | Lisp_Object image; | ||
| 5978 | CGImageRef cg_image; | ||
| 5979 | CFStringRef label; | ||
| 5980 | HIToolbarItemRef item; | ||
| 5981 | |||
| 5982 | /* If image is a vector, choose the image according to the | ||
| 5983 | button state. */ | ||
| 5984 | image = PROP (TOOL_BAR_ITEM_IMAGES); | ||
| 5985 | if (VECTORP (image)) | ||
| 5986 | { | ||
| 5987 | if (enabled_p) | ||
| 5988 | idx = (selected_p | ||
| 5989 | ? TOOL_BAR_IMAGE_ENABLED_SELECTED | ||
| 5990 | : TOOL_BAR_IMAGE_ENABLED_DESELECTED); | ||
| 5991 | else | ||
| 5992 | idx = (selected_p | ||
| 5993 | ? TOOL_BAR_IMAGE_DISABLED_SELECTED | ||
| 5994 | : TOOL_BAR_IMAGE_DISABLED_DESELECTED); | ||
| 5995 | |||
| 5996 | xassert (ASIZE (image) >= idx); | ||
| 5997 | image = AREF (image, idx); | ||
| 5998 | } | ||
| 5999 | else | ||
| 6000 | idx = -1; | ||
| 6001 | |||
| 6002 | cg_image = mac_image_spec_to_cg_image (f, image); | ||
| 6003 | /* Ignore invalid image specifications. */ | ||
| 6004 | if (cg_image == NULL) | ||
| 6005 | continue; | ||
| 6006 | |||
| 6007 | label = cfstring_create_with_string (PROP (TOOL_BAR_ITEM_CAPTION)); | ||
| 6008 | if (label == NULL) | ||
| 6009 | label = CFSTR (""); | ||
| 6010 | |||
| 6011 | if (pos < old_count) | ||
| 6012 | { | ||
| 6013 | CGImageRef old_cg_image = NULL; | ||
| 6014 | CFStringRef old_label = NULL; | ||
| 6015 | Boolean old_enabled_p; | ||
| 6016 | |||
| 6017 | item = (HIToolbarItemRef) CFArrayGetValueAtIndex (old_items, pos); | ||
| 6018 | |||
| 6019 | HIToolbarItemCopyImage (item, &old_cg_image); | ||
| 6020 | if (cg_image != old_cg_image) | ||
| 6021 | HIToolbarItemSetImage (item, cg_image); | ||
| 6022 | CGImageRelease (old_cg_image); | ||
| 6023 | |||
| 6024 | HIToolbarItemCopyLabel (item, &old_label); | ||
| 6025 | if (CFStringCompare (label, old_label, 0) != kCFCompareEqualTo) | ||
| 6026 | HIToolbarItemSetLabel (item, label); | ||
| 6027 | CFRelease (old_label); | ||
| 6028 | |||
| 6029 | old_enabled_p = HIToolbarItemIsEnabled (item); | ||
| 6030 | if ((enabled_p || idx >= 0) != old_enabled_p) | ||
| 6031 | HIToolbarItemSetEnabled (item, (enabled_p || idx >= 0)); | ||
| 6032 | } | ||
| 6033 | else | ||
| 6034 | { | ||
| 6035 | item = NULL; | ||
| 6036 | HIToolbarCreateItemWithIdentifier (toolbar, | ||
| 6037 | TOOLBAR_ICON_ITEM_IDENTIFIER, | ||
| 6038 | NULL, &item); | ||
| 6039 | if (item) | ||
| 6040 | { | ||
| 6041 | HIToolbarItemSetImage (item, cg_image); | ||
| 6042 | HIToolbarItemSetLabel (item, label); | ||
| 6043 | HIToolbarItemSetEnabled (item, (enabled_p || idx >= 0)); | ||
| 6044 | HIToolbarAppendItem (toolbar, item); | ||
| 6045 | CFRelease (item); | ||
| 6046 | } | ||
| 6047 | } | ||
| 6048 | |||
| 6049 | CFRelease (label); | ||
| 6050 | if (item) | ||
| 6051 | { | ||
| 6052 | HIToolbarItemSetCommandID (item, TOOLBAR_ITEM_MAKE_COMMAND_ID (i)); | ||
| 6053 | pos++; | ||
| 6054 | } | ||
| 6055 | } | ||
| 6056 | |||
| 6057 | CFRelease (old_items); | ||
| 6058 | |||
| 6059 | while (pos < old_count) | ||
| 6060 | HIToolbarRemoveItemAtIndex (toolbar, --old_count); | ||
| 6061 | |||
| 6062 | ShowHideWindowToolbar (FRAME_MAC_WINDOW (f), true, | ||
| 6063 | !win_gravity && f == mac_focus_frame (dpyinfo)); | ||
| 6064 | /* Mac OS X 10.3 does not issue kEventWindowBoundsChanged events on | ||
| 6065 | toolbar visibility change. */ | ||
| 6066 | mac_handle_origin_change (f); | ||
| 6067 | if (win_gravity >= NorthWestGravity && win_gravity <= SouthEastGravity) | ||
| 6068 | { | ||
| 6069 | mac_move_window_with_gravity (f, win_gravity, left, top); | ||
| 6070 | /* If the title bar is completely outside the screen, adjust the | ||
| 6071 | position. */ | ||
| 6072 | ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, | ||
| 6073 | kWindowConstrainMoveRegardlessOfFit | ||
| 6074 | | kWindowConstrainAllowPartial, NULL, NULL); | ||
| 6075 | f->output_data.mac->toolbar_win_gravity = 0; | ||
| 6076 | } | ||
| 6077 | |||
| 6078 | out: | ||
| 6079 | UNBLOCK_INPUT; | ||
| 6080 | } | ||
| 6081 | |||
| 6082 | /* Hide the tool bar on frame F. Unlike the counterpart on GTK+, it | ||
| 6083 | doesn't deallocate the resources. */ | ||
| 6084 | |||
| 6085 | void | ||
| 6086 | free_frame_tool_bar (f) | ||
| 6087 | FRAME_PTR f; | ||
| 6088 | { | ||
| 6089 | if (IsWindowToolbarVisible (FRAME_MAC_WINDOW (f))) | ||
| 6090 | { | ||
| 6091 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | ||
| 6092 | |||
| 6093 | BLOCK_INPUT; | ||
| 6094 | ShowHideWindowToolbar (FRAME_MAC_WINDOW (f), false, | ||
| 6095 | f == mac_focus_frame (dpyinfo)); | ||
| 6096 | /* Mac OS X 10.3 does not issue kEventWindowBoundsChanged events | ||
| 6097 | on toolbar visibility change. */ | ||
| 6098 | mac_handle_origin_change (f); | ||
| 6099 | UNBLOCK_INPUT; | ||
| 6100 | } | ||
| 6101 | } | ||
| 6102 | |||
| 6103 | static void | ||
| 6104 | mac_tool_bar_note_mouse_movement (f, event) | ||
| 6105 | struct frame *f; | ||
| 6106 | EventRef event; | ||
| 6107 | { | ||
| 6108 | OSStatus err; | ||
| 6109 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | ||
| 6110 | int mouse_down_p; | ||
| 6111 | HIViewRef item_view; | ||
| 6112 | UInt32 command_id; | ||
| 6113 | |||
| 6114 | mouse_down_p = (dpyinfo->grabbed | ||
| 6115 | && f == last_mouse_frame | ||
| 6116 | && FRAME_LIVE_P (f)); | ||
| 6117 | if (mouse_down_p) | ||
| 6118 | return; | ||
| 6119 | |||
| 6120 | err = HIViewGetViewForMouseEvent (HIViewGetRoot (FRAME_MAC_WINDOW (f)), | ||
| 6121 | event, &item_view); | ||
| 6122 | /* This doesn't work on Mac OS X 10.2. On Mac OS X 10.3 and 10.4, a | ||
| 6123 | toolbar item view seems to have the same command ID with that of | ||
| 6124 | the toolbar item. */ | ||
| 6125 | if (err == noErr) | ||
| 6126 | err = GetControlCommandID (item_view, &command_id); | ||
| 6127 | if (err == noErr && TOOLBAR_ITEM_COMMAND_ID_P (command_id)) | ||
| 6128 | { | ||
| 6129 | int i = TOOLBAR_ITEM_COMMAND_ID_VALUE (command_id); | ||
| 6130 | |||
| 6131 | if (i < f->n_tool_bar_items) | ||
| 6132 | { | ||
| 6133 | HIRect bounds; | ||
| 6134 | HIViewRef content_view; | ||
| 6135 | |||
| 6136 | err = HIViewGetBounds (item_view, &bounds); | ||
| 6137 | if (err == noErr) | ||
| 6138 | err = HIViewFindByID (HIViewGetRoot (FRAME_MAC_WINDOW (f)), | ||
| 6139 | kHIViewWindowContentID, &content_view); | ||
| 6140 | if (err == noErr) | ||
| 6141 | err = HIViewConvertRect (&bounds, item_view, content_view); | ||
| 6142 | if (err == noErr) | ||
| 6143 | SetRect (&last_mouse_glyph, | ||
| 6144 | CGRectGetMinX (bounds), CGRectGetMinY (bounds), | ||
| 6145 | CGRectGetMaxX (bounds), CGRectGetMaxY (bounds)); | ||
| 6146 | |||
| 6147 | help_echo_object = help_echo_window = Qnil; | ||
| 6148 | help_echo_pos = -1; | ||
| 6149 | help_echo_string = PROP (TOOL_BAR_ITEM_HELP); | ||
| 6150 | if (NILP (help_echo_string)) | ||
| 6151 | help_echo_string = PROP (TOOL_BAR_ITEM_CAPTION); | ||
| 6152 | } | ||
| 6153 | } | ||
| 6154 | } | ||
| 6155 | |||
| 6156 | static OSStatus | ||
| 6157 | mac_handle_toolbar_command_event (next_handler, event, data) | ||
| 6158 | EventHandlerCallRef next_handler; | ||
| 6159 | EventRef event; | ||
| 6160 | void *data; | ||
| 6161 | { | ||
| 6162 | OSStatus err, result = eventNotHandledErr; | ||
| 6163 | struct frame *f = (struct frame *) data; | ||
| 6164 | HICommand command; | ||
| 6165 | |||
| 6166 | err = GetEventParameter (event, kEventParamDirectObject, | ||
| 6167 | typeHICommand, NULL, | ||
| 6168 | sizeof (HICommand), NULL, &command); | ||
| 6169 | if (err != noErr) | ||
| 6170 | return result; | ||
| 6171 | |||
| 6172 | switch (GetEventKind (event)) | ||
| 6173 | { | ||
| 6174 | case kEventCommandProcess: | ||
| 6175 | if (!TOOLBAR_ITEM_COMMAND_ID_P (command.commandID)) | ||
| 6176 | result = CallNextEventHandler (next_handler, event); | ||
| 6177 | else | ||
| 6178 | { | ||
| 6179 | int i = TOOLBAR_ITEM_COMMAND_ID_VALUE (command.commandID); | ||
| 6180 | |||
| 6181 | if (i < f->n_tool_bar_items | ||
| 6182 | && !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P))) | ||
| 6183 | { | ||
| 6184 | Lisp_Object frame; | ||
| 6185 | struct input_event buf; | ||
| 6186 | |||
| 6187 | EVENT_INIT (buf); | ||
| 6188 | |||
| 6189 | XSETFRAME (frame, f); | ||
| 6190 | buf.kind = TOOL_BAR_EVENT; | ||
| 6191 | buf.frame_or_window = frame; | ||
| 6192 | buf.arg = frame; | ||
| 6193 | kbd_buffer_store_event (&buf); | ||
| 6194 | |||
| 6195 | buf.kind = TOOL_BAR_EVENT; | ||
| 6196 | buf.frame_or_window = frame; | ||
| 6197 | buf.arg = PROP (TOOL_BAR_ITEM_KEY); | ||
| 6198 | buf.modifiers = mac_event_to_emacs_modifiers (event); | ||
| 6199 | kbd_buffer_store_event (&buf); | ||
| 6200 | |||
| 6201 | result = noErr; | ||
| 6202 | } | ||
| 6203 | } | ||
| 6204 | break; | ||
| 6205 | |||
| 6206 | default: | ||
| 6207 | abort (); | ||
| 6208 | } | ||
| 6209 | #undef PROP | ||
| 6210 | |||
| 6211 | return result; | ||
| 6212 | } | ||
| 6213 | #endif /* USE_MAC_TOOLBAR */ | ||
| 6214 | |||
| 6215 | |||
| 6216 | /*********************************************************************** | ||
| 5594 | Text Cursor | 6217 | Text Cursor |
| 5595 | ***********************************************************************/ | 6218 | ***********************************************************************/ |
| 5596 | 6219 | ||
| @@ -10101,6 +10724,13 @@ mac_handle_window_event (next_handler, event, data) | |||
| 10101 | kWindowCascadeOnParentWindowScreen | 10724 | kWindowCascadeOnParentWindowScreen |
| 10102 | #endif | 10725 | #endif |
| 10103 | ); | 10726 | ); |
| 10727 | #if USE_MAC_TOOLBAR | ||
| 10728 | /* This is a workaround. RepositionWindow fails to put | ||
| 10729 | a window at the cascading position when its parent | ||
| 10730 | window has a Carbon HIToolbar. */ | ||
| 10731 | if (f->top_pos == sf->top_pos && f->left_pos == sf->left_pos) | ||
| 10732 | MoveWindowStructure (wp, f->left_pos + 10, f->top_pos + 32); | ||
| 10733 | #endif | ||
| 10104 | } | 10734 | } |
| 10105 | result = noErr; | 10735 | result = noErr; |
| 10106 | } | 10736 | } |
| @@ -10383,8 +11013,7 @@ mac_handle_keyboard_event (next_handler, event, data) | |||
| 10383 | if (err != noErr) | 11013 | if (err != noErr) |
| 10384 | break; | 11014 | break; |
| 10385 | 11015 | ||
| 10386 | do_keystroke ((GetEventKind (event) == kEventRawKeyDown | 11016 | do_keystroke ((event_kind == kEventRawKeyDown ? keyDown : autoKey), |
| 10387 | ? keyDown : autoKey), | ||
| 10388 | char_code, key_code, modifiers, | 11017 | char_code, key_code, modifiers, |
| 10389 | ((unsigned long) | 11018 | ((unsigned long) |
| 10390 | (GetEventTime (event) / kEventDurationMillisecond)), | 11019 | (GetEventTime (event) / kEventDurationMillisecond)), |
| @@ -11438,6 +12067,21 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11438 | do_zoom_window (window_ptr, part_code); | 12067 | do_zoom_window (window_ptr, part_code); |
| 11439 | break; | 12068 | break; |
| 11440 | 12069 | ||
| 12070 | #if USE_MAC_TOOLBAR | ||
| 12071 | case inStructure: | ||
| 12072 | { | ||
| 12073 | OSStatus err; | ||
| 12074 | HIViewRef ch; | ||
| 12075 | |||
| 12076 | err = HIViewGetViewForMouseEvent (HIViewGetRoot (window_ptr), | ||
| 12077 | eventRef, &ch); | ||
| 12078 | /* This doesn't work on Mac OS X 10.2. */ | ||
| 12079 | if (err == noErr) | ||
| 12080 | HIViewClick (ch, eventRef); | ||
| 12081 | } | ||
| 12082 | break; | ||
| 12083 | #endif /* USE_MAC_TOOLBAR */ | ||
| 12084 | |||
| 11441 | default: | 12085 | default: |
| 11442 | break; | 12086 | break; |
| 11443 | } | 12087 | } |
| @@ -11522,6 +12166,10 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11522 | } | 12166 | } |
| 11523 | if (!note_mouse_movement (f, &mouse_pos)) | 12167 | if (!note_mouse_movement (f, &mouse_pos)) |
| 11524 | help_echo_string = previous_help_echo_string; | 12168 | help_echo_string = previous_help_echo_string; |
| 12169 | #if USE_MAC_TOOLBAR | ||
| 12170 | else | ||
| 12171 | mac_tool_bar_note_mouse_movement (f, eventRef); | ||
| 12172 | #endif | ||
| 11525 | } | 12173 | } |
| 11526 | } | 12174 | } |
| 11527 | 12175 | ||
diff --git a/src/macterm.h b/src/macterm.h index 7984ff2b970..f6ab9f70449 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -333,6 +333,16 @@ struct mac_output | |||
| 333 | /* Hints for the size and the position of a window. */ | 333 | /* Hints for the size and the position of a window. */ |
| 334 | XSizeHints *size_hints; | 334 | XSizeHints *size_hints; |
| 335 | 335 | ||
| 336 | #if USE_MAC_TOOLBAR | ||
| 337 | /* This variable records the gravity value of the window position if | ||
| 338 | the window has an external tool bar when it is created. The | ||
| 339 | position of the window is adjusted using this information when | ||
| 340 | the tool bar is first redisplayed. Once the tool bar is | ||
| 341 | redisplayed, it is set to 0 in order to avoid further | ||
| 342 | adjustment. */ | ||
| 343 | int toolbar_win_gravity; | ||
| 344 | #endif | ||
| 345 | |||
| 336 | #if USE_CG_DRAWING | 346 | #if USE_CG_DRAWING |
| 337 | /* Quartz 2D graphics context. */ | 347 | /* Quartz 2D graphics context. */ |
| 338 | CGContextRef cg_context; | 348 | CGContextRef cg_context; |
| @@ -441,6 +451,12 @@ struct scroll_bar { | |||
| 441 | being dragged, this is Qnil. */ | 451 | being dragged, this is Qnil. */ |
| 442 | Lisp_Object dragging; | 452 | Lisp_Object dragging; |
| 443 | 453 | ||
| 454 | #ifdef MAC_OSX | ||
| 455 | /* t if the background of the fringe that is adjacent to a scroll | ||
| 456 | bar is extended to the gap between the fringe and the bar. */ | ||
| 457 | Lisp_Object fringe_extended_p; | ||
| 458 | #endif | ||
| 459 | |||
| 444 | #ifdef USE_TOOLKIT_SCROLL_BARS | 460 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 445 | /* The position and size of the scroll bar handle track area in | 461 | /* The position and size of the scroll bar handle track area in |
| 446 | pixels, relative to the frame. */ | 462 | pixels, relative to the frame. */ |
| @@ -651,6 +667,10 @@ extern void mac_prepare_for_quickdraw P_ ((struct frame *)); | |||
| 651 | #endif | 667 | #endif |
| 652 | extern void mac_get_window_bounds P_ ((struct frame *, Rect *, Rect *)); | 668 | extern void mac_get_window_bounds P_ ((struct frame *, Rect *, Rect *)); |
| 653 | extern int mac_quit_char_key_p P_ ((UInt32, UInt32)); | 669 | extern int mac_quit_char_key_p P_ ((UInt32, UInt32)); |
| 670 | #if USE_MAC_TOOLBAR | ||
| 671 | extern void update_frame_tool_bar P_ ((FRAME_PTR f)); | ||
| 672 | extern void free_frame_tool_bar P_ ((FRAME_PTR f)); | ||
| 673 | #endif | ||
| 654 | 674 | ||
| 655 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 | 675 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 |
| 656 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 | 676 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 |
diff --git a/src/regex.c b/src/regex.c index 81c37730a9a..48f0dd92737 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -2620,11 +2620,6 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2620 | last -- ends with a forward jump of this sort. */ | 2620 | last -- ends with a forward jump of this sort. */ |
| 2621 | unsigned char *fixup_alt_jump = 0; | 2621 | unsigned char *fixup_alt_jump = 0; |
| 2622 | 2622 | ||
| 2623 | /* Counts open-groups as they are encountered. Remembered for the | ||
| 2624 | matching close-group on the compile stack, so the same register | ||
| 2625 | number is put in the stop_memory as the start_memory. */ | ||
| 2626 | regnum_t regnum = 0; | ||
| 2627 | |||
| 2628 | /* Work area for range table of charset. */ | 2623 | /* Work area for range table of charset. */ |
| 2629 | struct range_table_work_area range_table_work; | 2624 | struct range_table_work_area range_table_work; |
| 2630 | 2625 | ||
| @@ -3276,28 +3271,54 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3276 | handle_open: | 3271 | handle_open: |
| 3277 | { | 3272 | { |
| 3278 | int shy = 0; | 3273 | int shy = 0; |
| 3274 | regnum_t regnum = 0; | ||
| 3279 | if (p+1 < pend) | 3275 | if (p+1 < pend) |
| 3280 | { | 3276 | { |
| 3281 | /* Look for a special (?...) construct */ | 3277 | /* Look for a special (?...) construct */ |
| 3282 | if ((syntax & RE_SHY_GROUPS) && *p == '?') | 3278 | if ((syntax & RE_SHY_GROUPS) && *p == '?') |
| 3283 | { | 3279 | { |
| 3284 | PATFETCH (c); /* Gobble up the '?'. */ | 3280 | PATFETCH (c); /* Gobble up the '?'. */ |
| 3285 | PATFETCH (c); | 3281 | while (!shy) |
| 3286 | switch (c) | ||
| 3287 | { | 3282 | { |
| 3288 | case ':': shy = 1; break; | 3283 | PATFETCH (c); |
| 3289 | default: | 3284 | switch (c) |
| 3290 | /* Only (?:...) is supported right now. */ | 3285 | { |
| 3291 | FREE_STACK_RETURN (REG_BADPAT); | 3286 | case ':': shy = 1; break; |
| 3287 | case '0': | ||
| 3288 | /* An explicitly specified regnum must start | ||
| 3289 | with non-0. */ | ||
| 3290 | if (regnum == 0) | ||
| 3291 | FREE_STACK_RETURN (REG_BADPAT); | ||
| 3292 | case '1': case '2': case '3': case '4': | ||
| 3293 | case '5': case '6': case '7': case '8': case '9': | ||
| 3294 | regnum = 10*regnum + (c - '0'); break; | ||
| 3295 | default: | ||
| 3296 | /* Only (?:...) is supported right now. */ | ||
| 3297 | FREE_STACK_RETURN (REG_BADPAT); | ||
| 3298 | } | ||
| 3292 | } | 3299 | } |
| 3293 | } | 3300 | } |
| 3294 | } | 3301 | } |
| 3295 | 3302 | ||
| 3296 | if (!shy) | 3303 | if (!shy) |
| 3297 | { | 3304 | regnum = ++bufp->re_nsub; |
| 3298 | bufp->re_nsub++; | 3305 | else if (regnum) |
| 3299 | regnum++; | 3306 | { /* It's actually not shy, but explicitly numbered. */ |
| 3307 | shy = 0; | ||
| 3308 | if (regnum > bufp->re_nsub) | ||
| 3309 | bufp->re_nsub = regnum; | ||
| 3310 | else if (regnum > bufp->re_nsub | ||
| 3311 | /* Ideally, we'd want to check that the specified | ||
| 3312 | group can't have matched (i.e. all subgroups | ||
| 3313 | using the same regnum are in other branches of | ||
| 3314 | OR patterns), but we don't currently keep track | ||
| 3315 | of enough info to do that easily. */ | ||
| 3316 | || group_in_compile_stack (compile_stack, regnum)) | ||
| 3317 | FREE_STACK_RETURN (REG_BADPAT); | ||
| 3300 | } | 3318 | } |
| 3319 | else | ||
| 3320 | /* It's really shy. */ | ||
| 3321 | regnum = - bufp->re_nsub; | ||
| 3301 | 3322 | ||
| 3302 | if (COMPILE_STACK_FULL) | 3323 | if (COMPILE_STACK_FULL) |
| 3303 | { | 3324 | { |
| @@ -3316,12 +3337,11 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3316 | COMPILE_STACK_TOP.fixup_alt_jump | 3337 | COMPILE_STACK_TOP.fixup_alt_jump |
| 3317 | = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; | 3338 | = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; |
| 3318 | COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; | 3339 | COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; |
| 3319 | COMPILE_STACK_TOP.regnum = shy ? -regnum : regnum; | 3340 | COMPILE_STACK_TOP.regnum = regnum; |
| 3320 | 3341 | ||
| 3321 | /* Do not push a | 3342 | /* Do not push a start_memory for groups beyond the last one |
| 3322 | start_memory for groups beyond the last one we can | 3343 | we can represent in the compiled pattern. */ |
| 3323 | represent in the compiled pattern. */ | 3344 | if (regnum <= MAX_REGNUM && regnum > 0) |
| 3324 | if (regnum <= MAX_REGNUM && !shy) | ||
| 3325 | BUF_PUSH_2 (start_memory, regnum); | 3345 | BUF_PUSH_2 (start_memory, regnum); |
| 3326 | 3346 | ||
| 3327 | compile_stack.avail++; | 3347 | compile_stack.avail++; |
| @@ -3366,7 +3386,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3366 | /* We don't just want to restore into `regnum', because | 3386 | /* We don't just want to restore into `regnum', because |
| 3367 | later groups should continue to be numbered higher, | 3387 | later groups should continue to be numbered higher, |
| 3368 | as in `(ab)c(de)' -- the second group is #2. */ | 3388 | as in `(ab)c(de)' -- the second group is #2. */ |
| 3369 | regnum_t this_group_regnum; | 3389 | regnum_t regnum; |
| 3370 | 3390 | ||
| 3371 | compile_stack.avail--; | 3391 | compile_stack.avail--; |
| 3372 | begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; | 3392 | begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; |
| @@ -3375,7 +3395,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3375 | ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 | 3395 | ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 |
| 3376 | : 0; | 3396 | : 0; |
| 3377 | laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; | 3397 | laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; |
| 3378 | this_group_regnum = COMPILE_STACK_TOP.regnum; | 3398 | regnum = COMPILE_STACK_TOP.regnum; |
| 3379 | /* If we've reached MAX_REGNUM groups, then this open | 3399 | /* If we've reached MAX_REGNUM groups, then this open |
| 3380 | won't actually generate any code, so we'll have to | 3400 | won't actually generate any code, so we'll have to |
| 3381 | clear pending_exact explicitly. */ | 3401 | clear pending_exact explicitly. */ |
| @@ -3383,8 +3403,8 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3383 | 3403 | ||
| 3384 | /* We're at the end of the group, so now we know how many | 3404 | /* We're at the end of the group, so now we know how many |
| 3385 | groups were inside this one. */ | 3405 | groups were inside this one. */ |
| 3386 | if (this_group_regnum <= MAX_REGNUM && this_group_regnum > 0) | 3406 | if (regnum <= MAX_REGNUM && regnum > 0) |
| 3387 | BUF_PUSH_2 (stop_memory, this_group_regnum); | 3407 | BUF_PUSH_2 (stop_memory, regnum); |
| 3388 | } | 3408 | } |
| 3389 | break; | 3409 | break; |
| 3390 | 3410 | ||
| @@ -3710,8 +3730,9 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3710 | 3730 | ||
| 3711 | reg = c - '0'; | 3731 | reg = c - '0'; |
| 3712 | 3732 | ||
| 3713 | /* Can't back reference to a subexpression before its end. */ | 3733 | if (reg > bufp->re_nsub || reg < 1 |
| 3714 | if (reg > regnum || group_in_compile_stack (compile_stack, reg)) | 3734 | /* Can't back reference to a subexp before its end. */ |
| 3735 | || group_in_compile_stack (compile_stack, reg)) | ||
| 3715 | FREE_STACK_RETURN (REG_ESUBREG); | 3736 | FREE_STACK_RETURN (REG_ESUBREG); |
| 3716 | 3737 | ||
| 3717 | laststart = b; | 3738 | laststart = b; |
diff --git a/src/term.c b/src/term.c index 566b8b84915..0210a66afa9 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -42,6 +42,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 42 | #include "window.h" | 42 | #include "window.h" |
| 43 | #include "keymap.h" | 43 | #include "keymap.h" |
| 44 | #include "blockinput.h" | 44 | #include "blockinput.h" |
| 45 | #include "intervals.h" | ||
| 45 | 46 | ||
| 46 | /* For now, don't try to include termcap.h. On some systems, | 47 | /* For now, don't try to include termcap.h. On some systems, |
| 47 | configure finds a non-standard termcap.h that the main build | 48 | configure finds a non-standard termcap.h that the main build |
| @@ -137,6 +137,15 @@ typedef BOOL (WINAPI * GetTokenInformation_Proc) ( | |||
| 137 | LPVOID TokenInformation, | 137 | LPVOID TokenInformation, |
| 138 | DWORD TokenInformationLength, | 138 | DWORD TokenInformationLength, |
| 139 | PDWORD ReturnLength); | 139 | PDWORD ReturnLength); |
| 140 | typedef BOOL (WINAPI * GetProcessTimes_Proc) ( | ||
| 141 | HANDLE process_handle, | ||
| 142 | LPFILETIME creation_time, | ||
| 143 | LPFILETIME exit_time, | ||
| 144 | LPFILETIME kernel_time, | ||
| 145 | LPFILETIME user_time); | ||
| 146 | |||
| 147 | GetProcessTimes_Proc get_process_times_fn = NULL; | ||
| 148 | |||
| 140 | #ifdef _UNICODE | 149 | #ifdef _UNICODE |
| 141 | const char * const LookupAccountSid_Name = "LookupAccountSidW"; | 150 | const char * const LookupAccountSid_Name = "LookupAccountSidW"; |
| 142 | #else | 151 | #else |
| @@ -172,6 +181,46 @@ is_windows_9x () | |||
| 172 | return s_b_ret; | 181 | return s_b_ret; |
| 173 | } | 182 | } |
| 174 | 183 | ||
| 184 | /* Get total user and system times for get-internal-run-time. | ||
| 185 | Returns a list of three integers if the times are provided by the OS | ||
| 186 | (NT derivatives), otherwise it returns the result of current-time. */ | ||
| 187 | Lisp_Object | ||
| 188 | w32_get_internal_run_time () | ||
| 189 | { | ||
| 190 | if (get_process_times_fn) | ||
| 191 | { | ||
| 192 | FILETIME create, exit, kernel, user; | ||
| 193 | HANDLE proc = GetCurrentProcess(); | ||
| 194 | if ((*get_process_times_fn) (proc, &create, &exit, &kernel, &user)) | ||
| 195 | { | ||
| 196 | LARGE_INTEGER user_int, kernel_int, total; | ||
| 197 | int microseconds; | ||
| 198 | user_int.LowPart = user.dwLowDateTime; | ||
| 199 | user_int.HighPart = user.dwHighDateTime; | ||
| 200 | kernel_int.LowPart = kernel.dwLowDateTime; | ||
| 201 | kernel_int.HighPart = kernel.dwHighDateTime; | ||
| 202 | total.QuadPart = user_int.QuadPart + kernel_int.QuadPart; | ||
| 203 | /* FILETIME is 100 nanosecond increments, Emacs only wants | ||
| 204 | microsecond resolution. */ | ||
| 205 | total.QuadPart /= 10; | ||
| 206 | microseconds = total.QuadPart % 1000000; | ||
| 207 | total.QuadPart /= 1000000; | ||
| 208 | |||
| 209 | /* Sanity check to make sure we can represent the result. */ | ||
| 210 | if (total.HighPart == 0) | ||
| 211 | { | ||
| 212 | int secs = total.LowPart; | ||
| 213 | |||
| 214 | return list3 (make_number ((secs >> 16) & 0xffff), | ||
| 215 | make_number (secs & 0xffff), | ||
| 216 | make_number (microseconds)); | ||
| 217 | } | ||
| 218 | } | ||
| 219 | } | ||
| 220 | |||
| 221 | return Fcurrent_time (); | ||
| 222 | } | ||
| 223 | |||
| 175 | /* ** The wrapper functions ** */ | 224 | /* ** The wrapper functions ** */ |
| 176 | 225 | ||
| 177 | BOOL WINAPI open_process_token ( | 226 | BOOL WINAPI open_process_token ( |
| @@ -486,20 +535,16 @@ init_user_info () | |||
| 486 | the user-sid as the user id value (same for group id using the | 535 | the user-sid as the user id value (same for group id using the |
| 487 | primary group sid from the process token). */ | 536 | primary group sid from the process token). */ |
| 488 | 537 | ||
| 489 | char user_sid[256], name[256], domain[256]; | 538 | char user_sid[256], name[256], domain[256]; |
| 490 | DWORD length = sizeof (name), dlength = sizeof (domain), trash; | 539 | DWORD length = sizeof (name), dlength = sizeof (domain), trash; |
| 491 | HANDLE token = NULL; | 540 | HANDLE token = NULL; |
| 492 | SID_NAME_USE user_type; | 541 | SID_NAME_USE user_type; |
| 493 | 542 | ||
| 494 | if ( | 543 | if (open_process_token (GetCurrentProcess (), TOKEN_QUERY, &token) |
| 495 | open_process_token (GetCurrentProcess (), TOKEN_QUERY, &token) | 544 | && get_token_information (token, TokenUser, |
| 496 | && get_token_information ( | 545 | (PVOID) user_sid, sizeof (user_sid), &trash) |
| 497 | token, TokenUser, | 546 | && lookup_account_sid (NULL, *((PSID *) user_sid), name, &length, |
| 498 | (PVOID) user_sid, sizeof (user_sid), &trash) | 547 | domain, &dlength, &user_type)) |
| 499 | && lookup_account_sid ( | ||
| 500 | NULL, *((PSID *) user_sid), name, &length, | ||
| 501 | domain, &dlength, &user_type) | ||
| 502 | ) | ||
| 503 | { | 548 | { |
| 504 | strcpy (the_passwd.pw_name, name); | 549 | strcpy (the_passwd.pw_name, name); |
| 505 | /* Determine a reasonable uid value. */ | 550 | /* Determine a reasonable uid value. */ |
| @@ -524,7 +569,7 @@ init_user_info () | |||
| 524 | 569 | ||
| 525 | /* Get group id */ | 570 | /* Get group id */ |
| 526 | if (get_token_information (token, TokenPrimaryGroup, | 571 | if (get_token_information (token, TokenPrimaryGroup, |
| 527 | (PVOID) user_sid, sizeof (user_sid), &trash)) | 572 | (PVOID) user_sid, sizeof (user_sid), &trash)) |
| 528 | { | 573 | { |
| 529 | SID_IDENTIFIER_AUTHORITY * pSIA; | 574 | SID_IDENTIFIER_AUTHORITY * pSIA; |
| 530 | 575 | ||
| @@ -541,7 +586,7 @@ init_user_info () | |||
| 541 | } | 586 | } |
| 542 | } | 587 | } |
| 543 | /* If security calls are not supported (presumably because we | 588 | /* If security calls are not supported (presumably because we |
| 544 | are running under Windows 95), fallback to this. */ | 589 | are running under Windows 95), fallback to this. */ |
| 545 | else if (GetUserName (name, &length)) | 590 | else if (GetUserName (name, &length)) |
| 546 | { | 591 | { |
| 547 | strcpy (the_passwd.pw_name, name); | 592 | strcpy (the_passwd.pw_name, name); |
| @@ -4148,6 +4193,11 @@ BOOL WINAPI shutdown_handler(DWORD type) | |||
| 4148 | void | 4193 | void |
| 4149 | globals_of_w32 () | 4194 | globals_of_w32 () |
| 4150 | { | 4195 | { |
| 4196 | HMODULE kernel32 = GetModuleHandle ("kernel32.dll"); | ||
| 4197 | |||
| 4198 | get_process_times_fn = (GetProcessTimes_Proc) | ||
| 4199 | GetProcAddress (kernel32, "GetProcessTimes"); | ||
| 4200 | |||
| 4151 | g_b_init_is_windows_9x = 0; | 4201 | g_b_init_is_windows_9x = 0; |
| 4152 | g_b_init_open_process_token = 0; | 4202 | g_b_init_open_process_token = 0; |
| 4153 | g_b_init_get_token_information = 0; | 4203 | g_b_init_get_token_information = 0; |
diff --git a/src/w32menu.c b/src/w32menu.c index d7fdcd49b9f..3169be007ba 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -23,6 +23,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 23 | #include <signal.h> | 23 | #include <signal.h> |
| 24 | 24 | ||
| 25 | #include <stdio.h> | 25 | #include <stdio.h> |
| 26 | #include <mbstring.h> | ||
| 26 | #include "lisp.h" | 27 | #include "lisp.h" |
| 27 | #include "termhooks.h" | 28 | #include "termhooks.h" |
| 28 | #include "keyboard.h" | 29 | #include "keyboard.h" |
| @@ -2262,8 +2263,9 @@ static int | |||
| 2262 | add_menu_item (HMENU menu, widget_value *wv, HMENU item) | 2263 | add_menu_item (HMENU menu, widget_value *wv, HMENU item) |
| 2263 | { | 2264 | { |
| 2264 | UINT fuFlags; | 2265 | UINT fuFlags; |
| 2265 | char *out_string; | 2266 | char *out_string, *p, *q; |
| 2266 | int return_value; | 2267 | int return_value; |
| 2268 | size_t nlen, orig_len; | ||
| 2267 | 2269 | ||
| 2268 | if (name_is_separator (wv->name)) | 2270 | if (name_is_separator (wv->name)) |
| 2269 | { | 2271 | { |
| @@ -2287,6 +2289,33 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) | |||
| 2287 | else | 2289 | else |
| 2288 | out_string = wv->name; | 2290 | out_string = wv->name; |
| 2289 | 2291 | ||
| 2292 | /* Quote any special characters within the menu item's text and | ||
| 2293 | key binding. */ | ||
| 2294 | nlen = orig_len = strlen (out_string); | ||
| 2295 | for (p = out_string; *p; p = _mbsinc (p)) | ||
| 2296 | { | ||
| 2297 | if (_mbsnextc (p) == '&') | ||
| 2298 | nlen++; | ||
| 2299 | } | ||
| 2300 | if (nlen > orig_len) | ||
| 2301 | { | ||
| 2302 | p = out_string; | ||
| 2303 | out_string = alloca (nlen + 1); | ||
| 2304 | q = out_string; | ||
| 2305 | while (*p) | ||
| 2306 | { | ||
| 2307 | if (_mbsnextc (p) == '&') | ||
| 2308 | { | ||
| 2309 | _mbsncpy (q, p, 1); | ||
| 2310 | q = _mbsinc (q); | ||
| 2311 | } | ||
| 2312 | _mbsncpy (q, p, 1); | ||
| 2313 | p = _mbsinc (p); | ||
| 2314 | q = _mbsinc (q); | ||
| 2315 | } | ||
| 2316 | *q = '\0'; | ||
| 2317 | } | ||
| 2318 | |||
| 2290 | if (item != NULL) | 2319 | if (item != NULL) |
| 2291 | fuFlags = MF_POPUP; | 2320 | fuFlags = MF_POPUP; |
| 2292 | else if (wv->title || wv->call_data == 0) | 2321 | else if (wv->title || wv->call_data == 0) |
diff --git a/src/xdisp.c b/src/xdisp.c index b87a3d3ac08..9477ea76aee 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9525,7 +9525,7 @@ update_tool_bar (f, save_match_data) | |||
| 9525 | struct frame *f; | 9525 | struct frame *f; |
| 9526 | int save_match_data; | 9526 | int save_match_data; |
| 9527 | { | 9527 | { |
| 9528 | #ifdef USE_GTK | 9528 | #if defined (USE_GTK) || USE_MAC_TOOLBAR |
| 9529 | int do_update = FRAME_EXTERNAL_TOOL_BAR (f); | 9529 | int do_update = FRAME_EXTERNAL_TOOL_BAR (f); |
| 9530 | #else | 9530 | #else |
| 9531 | int do_update = WINDOWP (f->tool_bar_window) | 9531 | int do_update = WINDOWP (f->tool_bar_window) |
| @@ -9991,7 +9991,7 @@ redisplay_tool_bar (f) | |||
| 9991 | struct it it; | 9991 | struct it it; |
| 9992 | struct glyph_row *row; | 9992 | struct glyph_row *row; |
| 9993 | 9993 | ||
| 9994 | #ifdef USE_GTK | 9994 | #if defined (USE_GTK) || USE_MAC_TOOLBAR |
| 9995 | if (FRAME_EXTERNAL_TOOL_BAR (f)) | 9995 | if (FRAME_EXTERNAL_TOOL_BAR (f)) |
| 9996 | update_frame_tool_bar (f); | 9996 | update_frame_tool_bar (f); |
| 9997 | return 0; | 9997 | return 0; |
| @@ -13616,7 +13616,7 @@ redisplay_window (window, just_this_one_p) | |||
| 13616 | display_menu_bar (w); | 13616 | display_menu_bar (w); |
| 13617 | 13617 | ||
| 13618 | #ifdef HAVE_WINDOW_SYSTEM | 13618 | #ifdef HAVE_WINDOW_SYSTEM |
| 13619 | #ifdef USE_GTK | 13619 | #if defined (USE_GTK) || USE_MAC_TOOLBAR |
| 13620 | redisplay_tool_bar_p = FRAME_EXTERNAL_TOOL_BAR (f); | 13620 | redisplay_tool_bar_p = FRAME_EXTERNAL_TOOL_BAR (f); |
| 13621 | #else | 13621 | #else |
| 13622 | redisplay_tool_bar_p = WINDOWP (f->tool_bar_window) | 13622 | redisplay_tool_bar_p = WINDOWP (f->tool_bar_window) |
diff --git a/src/xfns.c b/src/xfns.c index dbc9f2d9b16..e4eeb737205 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -77,8 +77,13 @@ Boston, MA 02110-1301, USA. */ | |||
| 77 | #include <X11/Shell.h> | 77 | #include <X11/Shell.h> |
| 78 | 78 | ||
| 79 | #ifndef USE_MOTIF | 79 | #ifndef USE_MOTIF |
| 80 | #ifdef HAVE_XAW3D | ||
| 81 | #include <X11/Xaw3d/Paned.h> | ||
| 82 | #include <X11/Xaw3d/Label.h> | ||
| 83 | #else /* !HAVE_XAW3D */ | ||
| 80 | #include <X11/Xaw/Paned.h> | 84 | #include <X11/Xaw/Paned.h> |
| 81 | #include <X11/Xaw/Label.h> | 85 | #include <X11/Xaw/Label.h> |
| 86 | #endif /* HAVE_XAW3D */ | ||
| 82 | #endif /* USE_MOTIF */ | 87 | #endif /* USE_MOTIF */ |
| 83 | 88 | ||
| 84 | #ifdef USG | 89 | #ifdef USG |
diff --git a/src/xmenu.c b/src/xmenu.c index 4390e34a914..16ff30334d3 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -82,7 +82,11 @@ Boston, MA 02110-1301, USA. */ | |||
| 82 | #include <X11/StringDefs.h> | 82 | #include <X11/StringDefs.h> |
| 83 | #include <X11/Shell.h> | 83 | #include <X11/Shell.h> |
| 84 | #ifdef USE_LUCID | 84 | #ifdef USE_LUCID |
| 85 | #ifdef HAVE_XAW3D | ||
| 86 | #include <X11/Xaw3d/Paned.h> | ||
| 87 | #else /* !HAVE_XAW3D */ | ||
| 85 | #include <X11/Xaw/Paned.h> | 88 | #include <X11/Xaw/Paned.h> |
| 89 | #endif /* HAVE_XAW3D */ | ||
| 86 | #endif /* USE_LUCID */ | 90 | #endif /* USE_LUCID */ |
| 87 | #include "../lwlib/lwlib.h" | 91 | #include "../lwlib/lwlib.h" |
| 88 | #else /* not USE_X_TOOLKIT */ | 92 | #else /* not USE_X_TOOLKIT */ |