diff options
| author | Miles Bader | 2007-06-16 22:33:42 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-06-16 22:33:42 +0000 |
| commit | 262d5ce7c21d6c1136fd2b8df67736e41e8e8953 (patch) | |
| tree | 853a5d30babd0abd585ccbe7f4e228bf43a42d5c /src | |
| parent | 5534694247d2b5259325ff43af0624aa2f8abb3e (diff) | |
| parent | af41f8a8d6660ad1fefad5bda69d1acb8e40b4d1 (diff) | |
| download | emacs-262d5ce7c21d6c1136fd2b8df67736e41e8e8953.tar.gz emacs-262d5ce7c21d6c1136fd2b8df67736e41e8e8953.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--multi-tty--0--patch-23
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 a2e1e5b8484..4d2e7ccb375 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 3e0606e9007..b0a5ebbc3ee 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -500,7 +500,8 @@ update_compositions (from, to, check_mask) | |||
| 500 | avoid it, in such a case, we change the property of the | 500 | avoid it, in such a case, we change the property of the |
| 501 | latter to the copy of it. */ | 501 | latter to the copy of it. */ |
| 502 | if (from > BEGV | 502 | if (from > BEGV |
| 503 | && find_composition (from - 1, -1, &start, &end, &prop, Qnil)) | 503 | && find_composition (from - 1, -1, &start, &end, &prop, Qnil) |
| 504 | && COMPOSITION_VALID_P (start, end, prop)) | ||
| 504 | { | 505 | { |
| 505 | if (from < end) | 506 | if (from < end) |
| 506 | Fput_text_property (make_number (from), make_number (end), | 507 | Fput_text_property (make_number (from), make_number (end), |
| @@ -510,7 +511,8 @@ update_compositions (from, to, check_mask) | |||
| 510 | from = end; | 511 | from = end; |
| 511 | } | 512 | } |
| 512 | else if (from < ZV | 513 | else if (from < ZV |
| 513 | && find_composition (from, -1, &start, &from, &prop, Qnil)) | 514 | && find_composition (from, -1, &start, &from, &prop, Qnil) |
| 515 | && COMPOSITION_VALID_P (start, from, prop)) | ||
| 514 | run_composition_function (start, from, prop); | 516 | run_composition_function (start, from, prop); |
| 515 | } | 517 | } |
| 516 | 518 | ||
| @@ -521,6 +523,7 @@ update_compositions (from, to, check_mask) | |||
| 521 | (to - 1). */ | 523 | (to - 1). */ |
| 522 | while (from < to - 1 | 524 | while (from < to - 1 |
| 523 | && find_composition (from, to, &start, &from, &prop, Qnil) | 525 | && find_composition (from, to, &start, &from, &prop, Qnil) |
| 526 | && COMPOSITION_VALID_P (start, from, prop) | ||
| 524 | && from < to - 1) | 527 | && from < to - 1) |
| 525 | run_composition_function (start, from, prop); | 528 | run_composition_function (start, from, prop); |
| 526 | } | 529 | } |
| @@ -528,7 +531,8 @@ update_compositions (from, to, check_mask) | |||
| 528 | if (check_mask & CHECK_TAIL) | 531 | if (check_mask & CHECK_TAIL) |
| 529 | { | 532 | { |
| 530 | if (from < to | 533 | if (from < to |
| 531 | && find_composition (to - 1, -1, &start, &end, &prop, Qnil)) | 534 | && find_composition (to - 1, -1, &start, &end, &prop, Qnil) |
| 535 | && COMPOSITION_VALID_P (start, end, prop)) | ||
| 532 | { | 536 | { |
| 533 | /* TO should be also at composition boundary. But, | 537 | /* TO should be also at composition boundary. But, |
| 534 | insertion or deletion will make two compositions adjacent | 538 | insertion or deletion will make two compositions adjacent |
| @@ -542,7 +546,8 @@ update_compositions (from, to, check_mask) | |||
| 542 | run_composition_function (start, end, prop); | 546 | run_composition_function (start, end, prop); |
| 543 | } | 547 | } |
| 544 | else if (to < ZV | 548 | else if (to < ZV |
| 545 | && find_composition (to, -1, &start, &end, &prop, Qnil)) | 549 | && find_composition (to, -1, &start, &end, &prop, Qnil) |
| 550 | && COMPOSITION_VALID_P (start, end, prop)) | ||
| 546 | run_composition_function (start, end, prop); | 551 | run_composition_function (start, end, prop); |
| 547 | } | 552 | } |
| 548 | } | 553 | } |
diff --git a/src/config.in b/src/config.in index f57e889cc44..2b7b5503dcb 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -228,7 +228,8 @@ Boston, MA 02110-1301, USA. */ | |||
| 228 | /* Define to 1 if you have the `get_current_dir_name' function. */ | 228 | /* Define to 1 if you have the `get_current_dir_name' function. */ |
| 229 | #undef HAVE_GET_CURRENT_DIR_NAME | 229 | #undef HAVE_GET_CURRENT_DIR_NAME |
| 230 | 230 | ||
| 231 | /* Define to 1 if you have the ungif library (-lungif). */ | 231 | /* Define to 1 if you have a gif library (default -lungif; otherwise specify |
| 232 | with LIBGIF). */ | ||
| 232 | #undef HAVE_GIF | 233 | #undef HAVE_GIF |
| 233 | 234 | ||
| 234 | /* Define to 1 if you have the gpm library (-lgpm). */ | 235 | /* Define to 1 if you have the gpm library (-lgpm). */ |
| @@ -768,6 +769,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 768 | Solaris, for example). */ | 769 | Solaris, for example). */ |
| 769 | #undef LD_SWITCH_X_SITE_AUX | 770 | #undef LD_SWITCH_X_SITE_AUX |
| 770 | 771 | ||
| 772 | /* Compiler option to link with the gif library (if not -lungif). */ | ||
| 773 | #undef LIBGIF | ||
| 774 | |||
| 771 | /* Define to 1 if localtime caches TZ. */ | 775 | /* Define to 1 if localtime caches TZ. */ |
| 772 | #undef LOCALTIME_CACHE | 776 | #undef LOCALTIME_CACHE |
| 773 | 777 | ||
diff --git a/src/dispextern.h b/src/dispextern.h index 4c3bd56e121..09dfa0f74d9 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2422,6 +2422,10 @@ struct image | |||
| 2422 | if necessary. */ | 2422 | if necessary. */ |
| 2423 | unsigned long background; | 2423 | unsigned long background; |
| 2424 | 2424 | ||
| 2425 | /* Foreground and background colors of the frame on which the image | ||
| 2426 | is created. */ | ||
| 2427 | unsigned long frame_foreground, frame_background; | ||
| 2428 | |||
| 2425 | /* True if this image has a `transparent' background -- that is, is | 2429 | /* True if this image has a `transparent' background -- that is, is |
| 2426 | uses an image mask. The accessor macro for this is | 2430 | uses an image mask. The accessor macro for this is |
| 2427 | `IMAGE_BACKGROUND_TRANSPARENT'. */ | 2431 | `IMAGE_BACKGROUND_TRANSPARENT'. */ |
diff --git a/src/editfns.c b/src/editfns.c index aca3383943d..5fd40ed51c7 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)); |
| @@ -1483,9 +1488,13 @@ on systems that do not provide resolution finer than a second. */) | |||
| 1483 | return list3 (make_number ((secs >> 16) & 0xffff), | 1488 | return list3 (make_number ((secs >> 16) & 0xffff), |
| 1484 | make_number ((secs >> 0) & 0xffff), | 1489 | make_number ((secs >> 0) & 0xffff), |
| 1485 | make_number (usecs)); | 1490 | make_number (usecs)); |
| 1486 | #else | 1491 | #else /* ! HAVE_GETRUSAGE */ |
| 1492 | #if WINDOWSNT | ||
| 1493 | return w32_get_internal_run_time (); | ||
| 1494 | #else /* ! WINDOWSNT */ | ||
| 1487 | return Fcurrent_time (); | 1495 | return Fcurrent_time (); |
| 1488 | #endif | 1496 | #endif /* WINDOWSNT */ |
| 1497 | #endif /* HAVE_GETRUSAGE */ | ||
| 1489 | } | 1498 | } |
| 1490 | 1499 | ||
| 1491 | 1500 | ||
diff --git a/src/frame.h b/src/frame.h index 47f7483994e..5686662bb96 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -197,7 +197,7 @@ struct frame | |||
| 197 | be used for output. */ | 197 | be used for output. */ |
| 198 | unsigned glyphs_initialized_p : 1; | 198 | unsigned glyphs_initialized_p : 1; |
| 199 | 199 | ||
| 200 | #if defined (USE_GTK) | 200 | #if defined (USE_GTK) || defined (MAC_OS) |
| 201 | /* Nonzero means using a tool bar that comes from the toolkit. */ | 201 | /* Nonzero means using a tool bar that comes from the toolkit. */ |
| 202 | int external_tool_bar; | 202 | int external_tool_bar; |
| 203 | #endif | 203 | #endif |
| @@ -534,7 +534,7 @@ typedef struct frame *FRAME_PTR; | |||
| 534 | 534 | ||
| 535 | /* Nonzero if this frame should display a tool bar | 535 | /* Nonzero if this frame should display a tool bar |
| 536 | in a way that does not use any text lines. */ | 536 | in a way that does not use any text lines. */ |
| 537 | #if defined (USE_GTK) | 537 | #if defined (USE_GTK) || defined (MAC_OS) |
| 538 | #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar | 538 | #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar |
| 539 | #else | 539 | #else |
| 540 | #define FRAME_EXTERNAL_TOOL_BAR(f) 0 | 540 | #define FRAME_EXTERNAL_TOOL_BAR(f) 0 |
diff --git a/src/image.c b/src/image.c index b53fe01d7f9..322689c8d0f 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 | } |
| @@ -1932,6 +1938,8 @@ lookup_image (f, spec) | |||
| 1932 | img = make_image (spec, hash); | 1938 | img = make_image (spec, hash); |
| 1933 | cache_image (f, img); | 1939 | cache_image (f, img); |
| 1934 | img->load_failed_p = img->type->load (f, img) == 0; | 1940 | img->load_failed_p = img->type->load (f, img) == 0; |
| 1941 | img->frame_foreground = FRAME_FOREGROUND_PIXEL (f); | ||
| 1942 | img->frame_background = FRAME_BACKGROUND_PIXEL (f); | ||
| 1935 | 1943 | ||
| 1936 | /* If we can't load the image, and we don't have a width and | 1944 | /* If we can't load the image, and we don't have a width and |
| 1937 | height, use some arbitrary width and height so that we can | 1945 | height, use some arbitrary width and height so that we can |
diff --git a/src/macfns.c b/src/macfns.c index cd02552df7a..a58c9975f45 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -1681,6 +1681,25 @@ x_set_tool_bar_lines (f, value, oldval) | |||
| 1681 | /* Make sure we redisplay all windows in this frame. */ | 1681 | /* Make sure we redisplay all windows in this frame. */ |
| 1682 | ++windows_or_buffers_changed; | 1682 | ++windows_or_buffers_changed; |
| 1683 | 1683 | ||
| 1684 | #if USE_MAC_TOOLBAR | ||
| 1685 | FRAME_TOOL_BAR_LINES (f) = 0; | ||
| 1686 | if (nlines) | ||
| 1687 | { | ||
| 1688 | FRAME_EXTERNAL_TOOL_BAR (f) = 1; | ||
| 1689 | if (FRAME_MAC_P (f) && !IsWindowToolbarVisible (FRAME_MAC_WINDOW (f))) | ||
| 1690 | /* Make sure next redisplay shows the tool bar. */ | ||
| 1691 | XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = Qt; | ||
| 1692 | } | ||
| 1693 | else | ||
| 1694 | { | ||
| 1695 | if (FRAME_EXTERNAL_TOOL_BAR (f)) | ||
| 1696 | free_frame_tool_bar (f); | ||
| 1697 | FRAME_EXTERNAL_TOOL_BAR (f) = 0; | ||
| 1698 | } | ||
| 1699 | |||
| 1700 | return; | ||
| 1701 | #endif | ||
| 1702 | |||
| 1684 | delta = nlines - FRAME_TOOL_BAR_LINES (f); | 1703 | delta = nlines - FRAME_TOOL_BAR_LINES (f); |
| 1685 | 1704 | ||
| 1686 | /* Don't resize the tool-bar to more than we have room for. */ | 1705 | /* Don't resize the tool-bar to more than we have room for. */ |
| @@ -2283,6 +2302,16 @@ mac_window (f, window_prompting, minibuffer_only) | |||
| 2283 | XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f), | 2302 | XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f), |
| 2284 | FRAME_BACKGROUND_PIXEL (f)); | 2303 | FRAME_BACKGROUND_PIXEL (f)); |
| 2285 | 2304 | ||
| 2305 | #if USE_MAC_TOOLBAR | ||
| 2306 | /* At the moment, the size of the tool bar is not yet known. We | ||
| 2307 | record the gravity value of the newly created window and use it | ||
| 2308 | to adjust the position of the window (especially for a negative | ||
| 2309 | specification of its vertical position) when the tool bar is | ||
| 2310 | first redisplayed. */ | ||
| 2311 | if (FRAME_EXTERNAL_TOOL_BAR (f)) | ||
| 2312 | f->output_data.mac->toolbar_win_gravity = f->win_gravity; | ||
| 2313 | #endif | ||
| 2314 | |||
| 2286 | validate_x_resource_name (); | 2315 | validate_x_resource_name (); |
| 2287 | 2316 | ||
| 2288 | /* x_set_name normally ignores requests to set the name if the | 2317 | /* x_set_name normally ignores requests to set the name if the |
diff --git a/src/macgui.h b/src/macgui.h index 990765593e1..fb6f858c547 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -117,6 +117,13 @@ typedef unsigned long Time; | |||
| 117 | #endif | 117 | #endif |
| 118 | #endif | 118 | #endif |
| 119 | 119 | ||
| 120 | /* Whether to use HIToolbar. */ | ||
| 121 | #ifndef USE_MAC_TOOLBAR | ||
| 122 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 && MAC_OS_X_VERSION_MIN_REQUIRED != 1020 | ||
| 123 | #define USE_MAC_TOOLBAR 1 | ||
| 124 | #endif | ||
| 125 | #endif | ||
| 126 | |||
| 120 | typedef WindowRef Window; | 127 | typedef WindowRef Window; |
| 121 | typedef GWorldPtr Pixmap; | 128 | typedef GWorldPtr Pixmap; |
| 122 | 129 | ||
diff --git a/src/macmenu.c b/src/macmenu.c index 1eb0b16cd95..c10a76f8a5d 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 f8c79d1c865..9ea51f87cfb 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 |
| @@ -4990,6 +5043,9 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height) | |||
| 4990 | XSETINT (bar->start, 0); | 5043 | XSETINT (bar->start, 0); |
| 4991 | XSETINT (bar->end, 0); | 5044 | XSETINT (bar->end, 0); |
| 4992 | bar->dragging = Qnil; | 5045 | bar->dragging = Qnil; |
| 5046 | #ifdef MAC_OSX | ||
| 5047 | bar->fringe_extended_p = Qnil; | ||
| 5048 | #endif | ||
| 4993 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5049 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 4994 | bar->track_top = Qnil; | 5050 | bar->track_top = Qnil; |
| 4995 | bar->track_height = Qnil; | 5051 | bar->track_height = Qnil; |
| @@ -5122,6 +5178,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5122 | struct scroll_bar *bar; | 5178 | struct scroll_bar *bar; |
| 5123 | int top, height, left, sb_left, width, sb_width, disp_top, disp_height; | 5179 | int top, height, left, sb_left, width, sb_width, disp_top, disp_height; |
| 5124 | int window_y, window_height; | 5180 | int window_y, window_height; |
| 5181 | #ifdef MAC_OSX | ||
| 5182 | int fringe_extended_p; | ||
| 5183 | #endif | ||
| 5125 | 5184 | ||
| 5126 | /* Get window dimensions. */ | 5185 | /* Get window dimensions. */ |
| 5127 | window_box (w, -1, 0, &window_y, 0, &window_height); | 5186 | window_box (w, -1, 0, &window_y, 0, &window_height); |
| @@ -5141,9 +5200,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5141 | 5200 | ||
| 5142 | /* Compute the left edge of the scroll bar. */ | 5201 | /* Compute the left edge of the scroll bar. */ |
| 5143 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) | 5202 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) |
| 5144 | sb_left = left; | 5203 | sb_left = left + (WINDOW_RIGHTMOST_P (w) ? width - sb_width : 0); |
| 5145 | else | 5204 | else |
| 5146 | sb_left = left + width - sb_width; | 5205 | sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width); |
| 5147 | 5206 | ||
| 5148 | /* Adjustments according to Inside Macintosh to make it look nice */ | 5207 | /* Adjustments according to Inside Macintosh to make it look nice */ |
| 5149 | disp_top = top; | 5208 | disp_top = top; |
| @@ -5164,11 +5223,29 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5164 | sb_left++; | 5223 | sb_left++; |
| 5165 | #endif | 5224 | #endif |
| 5166 | 5225 | ||
| 5226 | #ifdef MAC_OSX | ||
| 5227 | if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | ||
| 5228 | fringe_extended_p = (WINDOW_LEFTMOST_P (w) | ||
| 5229 | && WINDOW_LEFT_FRINGE_WIDTH (w) | ||
| 5230 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 5231 | || WINDOW_LEFT_MARGIN_COLS (w) == 0)); | ||
| 5232 | else | ||
| 5233 | fringe_extended_p = (WINDOW_RIGHTMOST_P (w) | ||
| 5234 | && WINDOW_RIGHT_FRINGE_WIDTH (w) | ||
| 5235 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 5236 | || WINDOW_RIGHT_MARGIN_COLS (w) == 0)); | ||
| 5237 | #endif | ||
| 5238 | |||
| 5167 | /* Does the scroll bar exist yet? */ | 5239 | /* Does the scroll bar exist yet? */ |
| 5168 | if (NILP (w->vertical_scroll_bar)) | 5240 | if (NILP (w->vertical_scroll_bar)) |
| 5169 | { | 5241 | { |
| 5170 | BLOCK_INPUT; | 5242 | BLOCK_INPUT; |
| 5171 | mac_clear_area (f, left, top, width, height); | 5243 | #ifdef MAC_OSX |
| 5244 | if (fringe_extended_p) | ||
| 5245 | mac_clear_area (f, sb_left, top, sb_width, height); | ||
| 5246 | else | ||
| 5247 | #endif | ||
| 5248 | mac_clear_area (f, left, top, width, height); | ||
| 5172 | UNBLOCK_INPUT; | 5249 | UNBLOCK_INPUT; |
| 5173 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height, disp_top, | 5250 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height, disp_top, |
| 5174 | disp_height); | 5251 | disp_height); |
| @@ -5188,11 +5265,20 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5188 | if (!(XINT (bar->left) == sb_left | 5265 | if (!(XINT (bar->left) == sb_left |
| 5189 | && XINT (bar->top) == top | 5266 | && XINT (bar->top) == top |
| 5190 | && XINT (bar->width) == sb_width | 5267 | && XINT (bar->width) == sb_width |
| 5191 | && XINT (bar->height) == height)) | 5268 | && XINT (bar->height) == height |
| 5269 | #ifdef MAC_OSX | ||
| 5270 | && !NILP (bar->fringe_extended_p) == fringe_extended_p | ||
| 5271 | #endif | ||
| 5272 | )) | ||
| 5192 | { | 5273 | { |
| 5193 | /* Since toolkit scroll bars are smaller than the space reserved | 5274 | /* Since toolkit scroll bars are smaller than the space reserved |
| 5194 | for them on the frame, we have to clear "under" them. */ | 5275 | for them on the frame, we have to clear "under" them. */ |
| 5195 | mac_clear_area (f, left, top, width, height); | 5276 | #ifdef MAC_OSX |
| 5277 | if (fringe_extended_p) | ||
| 5278 | mac_clear_area (f, sb_left, top, sb_width, height); | ||
| 5279 | else | ||
| 5280 | #endif | ||
| 5281 | mac_clear_area (f, left, top, width, height); | ||
| 5196 | 5282 | ||
| 5197 | #if USE_CG_DRAWING | 5283 | #if USE_CG_DRAWING |
| 5198 | mac_prepare_for_quickdraw (f); | 5284 | mac_prepare_for_quickdraw (f); |
| @@ -5221,6 +5307,10 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5221 | UNBLOCK_INPUT; | 5307 | UNBLOCK_INPUT; |
| 5222 | } | 5308 | } |
| 5223 | 5309 | ||
| 5310 | #ifdef MAC_OSX | ||
| 5311 | bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; | ||
| 5312 | #endif | ||
| 5313 | |||
| 5224 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5314 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5225 | if (NILP (bar->track_top)) | 5315 | if (NILP (bar->track_top)) |
| 5226 | { | 5316 | { |
| @@ -5584,6 +5674,539 @@ x_scroll_bar_clear (f) | |||
| 5584 | 5674 | ||
| 5585 | 5675 | ||
| 5586 | /*********************************************************************** | 5676 | /*********************************************************************** |
| 5677 | Tool-bars | ||
| 5678 | ***********************************************************************/ | ||
| 5679 | #if USE_MAC_TOOLBAR | ||
| 5680 | |||
| 5681 | /* In identifiers such as function/variable names, Emacs tool bar is | ||
| 5682 | referred to as `tool_bar', and Carbon HIToolbar as `toolbar'. */ | ||
| 5683 | |||
| 5684 | #define TOOLBAR_IDENTIFIER (CFSTR ("org.gnu.Emacs.toolbar")) | ||
| 5685 | #define TOOLBAR_ICON_ITEM_IDENTIFIER (CFSTR ("org.gnu.Emacs.toolbar.icon")) | ||
| 5686 | |||
| 5687 | #define TOOLBAR_ITEM_COMMAND_ID_OFFSET 'Tb\0\0' | ||
| 5688 | #define TOOLBAR_ITEM_COMMAND_ID_P(id) \ | ||
| 5689 | (((id) & ~0xffff) == TOOLBAR_ITEM_COMMAND_ID_OFFSET) | ||
| 5690 | #define TOOLBAR_ITEM_COMMAND_ID_VALUE(id) \ | ||
| 5691 | ((id) - TOOLBAR_ITEM_COMMAND_ID_OFFSET) | ||
| 5692 | #define TOOLBAR_ITEM_MAKE_COMMAND_ID(value) \ | ||
| 5693 | ((value) + TOOLBAR_ITEM_COMMAND_ID_OFFSET) | ||
| 5694 | |||
| 5695 | static int mac_event_to_emacs_modifiers P_ ((EventRef)); | ||
| 5696 | static void mac_handle_origin_change P_ ((struct frame *)); | ||
| 5697 | static OSStatus mac_handle_toolbar_command_event P_ ((EventHandlerCallRef, | ||
| 5698 | EventRef, void *)); | ||
| 5699 | |||
| 5700 | static void | ||
| 5701 | mac_move_window_with_gravity (f, win_gravity, left, top) | ||
| 5702 | struct frame *f; | ||
| 5703 | int win_gravity; | ||
| 5704 | short left, top; | ||
| 5705 | { | ||
| 5706 | Rect inner, outer; | ||
| 5707 | |||
| 5708 | mac_get_window_bounds (f, &inner, &outer); | ||
| 5709 | |||
| 5710 | switch (win_gravity) | ||
| 5711 | { | ||
| 5712 | case NorthWestGravity: | ||
| 5713 | case WestGravity: | ||
| 5714 | case SouthWestGravity: | ||
| 5715 | left += inner.left - outer.left; | ||
| 5716 | break; | ||
| 5717 | |||
| 5718 | case NorthGravity: | ||
| 5719 | case CenterGravity: | ||
| 5720 | case SouthGravity: | ||
| 5721 | left += ((inner.left - outer.left) + (inner.right - outer.right)) / 2; | ||
| 5722 | break; | ||
| 5723 | |||
| 5724 | case NorthEastGravity: | ||
| 5725 | case EastGravity: | ||
| 5726 | case SouthEastGravity: | ||
| 5727 | left += inner.right - outer.right; | ||
| 5728 | break; | ||
| 5729 | } | ||
| 5730 | |||
| 5731 | switch (win_gravity) | ||
| 5732 | { | ||
| 5733 | case NorthWestGravity: | ||
| 5734 | case NorthGravity: | ||
| 5735 | case NorthEastGravity: | ||
| 5736 | top += inner.top - outer.top; | ||
| 5737 | break; | ||
| 5738 | |||
| 5739 | case WestGravity: | ||
| 5740 | case CenterGravity: | ||
| 5741 | case EastGravity: | ||
| 5742 | top += ((inner.top - outer.top) + (inner.bottom - outer.bottom)) / 2; | ||
| 5743 | break; | ||
| 5744 | |||
| 5745 | case SouthWestGravity: | ||
| 5746 | case SouthGravity: | ||
| 5747 | case SouthEastGravity: | ||
| 5748 | top += inner.bottom - outer.bottom; | ||
| 5749 | break; | ||
| 5750 | } | ||
| 5751 | |||
| 5752 | MoveWindow (FRAME_MAC_WINDOW (f), left, top, false); | ||
| 5753 | } | ||
| 5754 | |||
| 5755 | static void | ||
| 5756 | mac_get_window_origin_with_gravity (f, win_gravity, left, top) | ||
| 5757 | struct frame *f; | ||
| 5758 | int win_gravity; | ||
| 5759 | short *left, *top; | ||
| 5760 | { | ||
| 5761 | Rect inner, outer; | ||
| 5762 | |||
| 5763 | mac_get_window_bounds (f, &inner, &outer); | ||
| 5764 | |||
| 5765 | switch (win_gravity) | ||
| 5766 | { | ||
| 5767 | case NorthWestGravity: | ||
| 5768 | case WestGravity: | ||
| 5769 | case SouthWestGravity: | ||
| 5770 | *left = outer.left; | ||
| 5771 | break; | ||
| 5772 | |||
| 5773 | case NorthGravity: | ||
| 5774 | case CenterGravity: | ||
| 5775 | case SouthGravity: | ||
| 5776 | *left = outer.left + ((outer.right - outer.left) | ||
| 5777 | - (inner.right - inner.left)) / 2; | ||
| 5778 | break; | ||
| 5779 | |||
| 5780 | case NorthEastGravity: | ||
| 5781 | case EastGravity: | ||
| 5782 | case SouthEastGravity: | ||
| 5783 | *left = outer.right - (inner.right - inner.left); | ||
| 5784 | break; | ||
| 5785 | } | ||
| 5786 | |||
| 5787 | switch (win_gravity) | ||
| 5788 | { | ||
| 5789 | case NorthWestGravity: | ||
| 5790 | case NorthGravity: | ||
| 5791 | case NorthEastGravity: | ||
| 5792 | *top = outer.top; | ||
| 5793 | break; | ||
| 5794 | |||
| 5795 | case WestGravity: | ||
| 5796 | case CenterGravity: | ||
| 5797 | case EastGravity: | ||
| 5798 | *top = outer.top + ((outer.bottom - outer.top) | ||
| 5799 | - (inner.bottom - inner.top)) / 2; | ||
| 5800 | break; | ||
| 5801 | |||
| 5802 | case SouthWestGravity: | ||
| 5803 | case SouthGravity: | ||
| 5804 | case SouthEastGravity: | ||
| 5805 | *top = outer.bottom - (inner.bottom - inner.top); | ||
| 5806 | break; | ||
| 5807 | } | ||
| 5808 | } | ||
| 5809 | |||
| 5810 | static OSStatus | ||
| 5811 | mac_handle_toolbar_event (next_handler, event, data) | ||
| 5812 | EventHandlerCallRef next_handler; | ||
| 5813 | EventRef event; | ||
| 5814 | void *data; | ||
| 5815 | { | ||
| 5816 | OSStatus err, result = eventNotHandledErr; | ||
| 5817 | |||
| 5818 | switch (GetEventKind (event)) | ||
| 5819 | { | ||
| 5820 | case kEventToolbarGetDefaultIdentifiers: | ||
| 5821 | result = noErr; | ||
| 5822 | break; | ||
| 5823 | |||
| 5824 | case kEventToolbarGetAllowedIdentifiers: | ||
| 5825 | { | ||
| 5826 | CFMutableArrayRef array; | ||
| 5827 | |||
| 5828 | GetEventParameter (event, kEventParamMutableArray, | ||
| 5829 | typeCFMutableArrayRef, NULL, | ||
| 5830 | sizeof (CFMutableArrayRef), NULL, &array); | ||
| 5831 | CFArrayAppendValue (array, TOOLBAR_ICON_ITEM_IDENTIFIER); | ||
| 5832 | result = noErr; | ||
| 5833 | } | ||
| 5834 | break; | ||
| 5835 | |||
| 5836 | case kEventToolbarCreateItemWithIdentifier: | ||
| 5837 | { | ||
| 5838 | CFStringRef identifier; | ||
| 5839 | HIToolbarItemRef item = NULL; | ||
| 5840 | |||
| 5841 | GetEventParameter (event, kEventParamToolbarItemIdentifier, | ||
| 5842 | typeCFStringRef, NULL, | ||
| 5843 | sizeof (CFStringRef), NULL, &identifier); | ||
| 5844 | |||
| 5845 | if (CFStringCompare (identifier, TOOLBAR_ICON_ITEM_IDENTIFIER, 0) | ||
| 5846 | == kCFCompareEqualTo) | ||
| 5847 | HIToolbarItemCreate (identifier, | ||
| 5848 | kHIToolbarItemAllowDuplicates | ||
| 5849 | | kHIToolbarItemCantBeRemoved, &item); | ||
| 5850 | |||
| 5851 | if (item) | ||
| 5852 | { | ||
| 5853 | SetEventParameter (event, kEventParamToolbarItem, | ||
| 5854 | typeHIToolbarItemRef, | ||
| 5855 | sizeof (HIToolbarItemRef), &item); | ||
| 5856 | result = noErr; | ||
| 5857 | } | ||
| 5858 | } | ||
| 5859 | break; | ||
| 5860 | |||
| 5861 | default: | ||
| 5862 | abort (); | ||
| 5863 | } | ||
| 5864 | |||
| 5865 | return result; | ||
| 5866 | } | ||
| 5867 | |||
| 5868 | static CGImageRef | ||
| 5869 | mac_image_spec_to_cg_image (f, image) | ||
| 5870 | struct frame *f; | ||
| 5871 | Lisp_Object image; | ||
| 5872 | { | ||
| 5873 | if (!valid_image_p (image)) | ||
| 5874 | return NULL; | ||
| 5875 | else | ||
| 5876 | { | ||
| 5877 | int img_id = lookup_image (f, image); | ||
| 5878 | struct image *img = IMAGE_FROM_ID (f, img_id); | ||
| 5879 | |||
| 5880 | prepare_image_for_display (f, img); | ||
| 5881 | |||
| 5882 | return img->data.ptr_val; | ||
| 5883 | } | ||
| 5884 | } | ||
| 5885 | |||
| 5886 | /* Create a tool bar for frame F. */ | ||
| 5887 | |||
| 5888 | static OSStatus | ||
| 5889 | mac_create_frame_tool_bar (f) | ||
| 5890 | FRAME_PTR f; | ||
| 5891 | { | ||
| 5892 | OSStatus err; | ||
| 5893 | HIToolbarRef toolbar; | ||
| 5894 | |||
| 5895 | err = HIToolbarCreate (TOOLBAR_IDENTIFIER, kHIToolbarNoAttributes, | ||
| 5896 | &toolbar); | ||
| 5897 | if (err == noErr) | ||
| 5898 | { | ||
| 5899 | static const EventTypeSpec specs[] = | ||
| 5900 | {{kEventClassToolbar, kEventToolbarGetDefaultIdentifiers}, | ||
| 5901 | {kEventClassToolbar, kEventToolbarGetAllowedIdentifiers}, | ||
| 5902 | {kEventClassToolbar, kEventToolbarCreateItemWithIdentifier}}; | ||
| 5903 | |||
| 5904 | err = InstallEventHandler (HIObjectGetEventTarget (toolbar), | ||
| 5905 | mac_handle_toolbar_event, | ||
| 5906 | GetEventTypeCount (specs), specs, | ||
| 5907 | f, NULL); | ||
| 5908 | } | ||
| 5909 | |||
| 5910 | if (err == noErr) | ||
| 5911 | err = HIToolbarSetDisplayMode (toolbar, kHIToolbarDisplayModeIconOnly); | ||
| 5912 | if (err == noErr) | ||
| 5913 | { | ||
| 5914 | static const EventTypeSpec specs[] = | ||
| 5915 | {{kEventClassCommand, kEventCommandProcess}}; | ||
| 5916 | |||
| 5917 | err = InstallWindowEventHandler (FRAME_MAC_WINDOW (f), | ||
| 5918 | mac_handle_toolbar_command_event, | ||
| 5919 | GetEventTypeCount (specs), | ||
| 5920 | specs, f, NULL); | ||
| 5921 | } | ||
| 5922 | if (err == noErr) | ||
| 5923 | err = SetWindowToolbar (FRAME_MAC_WINDOW (f), toolbar); | ||
| 5924 | |||
| 5925 | if (toolbar) | ||
| 5926 | CFRelease (toolbar); | ||
| 5927 | |||
| 5928 | return err; | ||
| 5929 | } | ||
| 5930 | |||
| 5931 | /* Update the tool bar for frame F. Add new buttons and remove old. */ | ||
| 5932 | |||
| 5933 | void | ||
| 5934 | update_frame_tool_bar (f) | ||
| 5935 | FRAME_PTR f; | ||
| 5936 | { | ||
| 5937 | HIToolbarRef toolbar = NULL; | ||
| 5938 | short left, top; | ||
| 5939 | CFArrayRef old_items = NULL; | ||
| 5940 | CFIndex old_count; | ||
| 5941 | int i, pos, win_gravity = f->output_data.mac->toolbar_win_gravity; | ||
| 5942 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | ||
| 5943 | |||
| 5944 | BLOCK_INPUT; | ||
| 5945 | |||
| 5946 | GetWindowToolbar (FRAME_MAC_WINDOW (f), &toolbar); | ||
| 5947 | if (toolbar == NULL) | ||
| 5948 | { | ||
| 5949 | mac_create_frame_tool_bar (f); | ||
| 5950 | GetWindowToolbar (FRAME_MAC_WINDOW (f), &toolbar); | ||
| 5951 | if (toolbar == NULL) | ||
| 5952 | goto out; | ||
| 5953 | if (win_gravity >= NorthWestGravity && win_gravity <= SouthEastGravity) | ||
| 5954 | mac_get_window_origin_with_gravity (f, win_gravity, &left, &top); | ||
| 5955 | } | ||
| 5956 | |||
| 5957 | HIToolbarCopyItems (toolbar, &old_items); | ||
| 5958 | if (old_items == NULL) | ||
| 5959 | goto out; | ||
| 5960 | |||
| 5961 | old_count = CFArrayGetCount (old_items); | ||
| 5962 | pos = 0; | ||
| 5963 | for (i = 0; i < f->n_tool_bar_items; ++i) | ||
| 5964 | { | ||
| 5965 | #define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) | ||
| 5966 | |||
| 5967 | int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); | ||
| 5968 | int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); | ||
| 5969 | int idx; | ||
| 5970 | Lisp_Object image; | ||
| 5971 | CGImageRef cg_image; | ||
| 5972 | CFStringRef label; | ||
| 5973 | HIToolbarItemRef item; | ||
| 5974 | |||
| 5975 | /* If image is a vector, choose the image according to the | ||
| 5976 | button state. */ | ||
| 5977 | image = PROP (TOOL_BAR_ITEM_IMAGES); | ||
| 5978 | if (VECTORP (image)) | ||
| 5979 | { | ||
| 5980 | if (enabled_p) | ||
| 5981 | idx = (selected_p | ||
| 5982 | ? TOOL_BAR_IMAGE_ENABLED_SELECTED | ||
| 5983 | : TOOL_BAR_IMAGE_ENABLED_DESELECTED); | ||
| 5984 | else | ||
| 5985 | idx = (selected_p | ||
| 5986 | ? TOOL_BAR_IMAGE_DISABLED_SELECTED | ||
| 5987 | : TOOL_BAR_IMAGE_DISABLED_DESELECTED); | ||
| 5988 | |||
| 5989 | xassert (ASIZE (image) >= idx); | ||
| 5990 | image = AREF (image, idx); | ||
| 5991 | } | ||
| 5992 | else | ||
| 5993 | idx = -1; | ||
| 5994 | |||
| 5995 | cg_image = mac_image_spec_to_cg_image (f, image); | ||
| 5996 | /* Ignore invalid image specifications. */ | ||
| 5997 | if (cg_image == NULL) | ||
| 5998 | continue; | ||
| 5999 | |||
| 6000 | label = cfstring_create_with_string (PROP (TOOL_BAR_ITEM_CAPTION)); | ||
| 6001 | if (label == NULL) | ||
| 6002 | label = CFSTR (""); | ||
| 6003 | |||
| 6004 | if (pos < old_count) | ||
| 6005 | { | ||
| 6006 | CGImageRef old_cg_image = NULL; | ||
| 6007 | CFStringRef old_label = NULL; | ||
| 6008 | Boolean old_enabled_p; | ||
| 6009 | |||
| 6010 | item = (HIToolbarItemRef) CFArrayGetValueAtIndex (old_items, pos); | ||
| 6011 | |||
| 6012 | HIToolbarItemCopyImage (item, &old_cg_image); | ||
| 6013 | if (cg_image != old_cg_image) | ||
| 6014 | HIToolbarItemSetImage (item, cg_image); | ||
| 6015 | CGImageRelease (old_cg_image); | ||
| 6016 | |||
| 6017 | HIToolbarItemCopyLabel (item, &old_label); | ||
| 6018 | if (CFStringCompare (label, old_label, 0) != kCFCompareEqualTo) | ||
| 6019 | HIToolbarItemSetLabel (item, label); | ||
| 6020 | CFRelease (old_label); | ||
| 6021 | |||
| 6022 | old_enabled_p = HIToolbarItemIsEnabled (item); | ||
| 6023 | if ((enabled_p || idx >= 0) != old_enabled_p) | ||
| 6024 | HIToolbarItemSetEnabled (item, (enabled_p || idx >= 0)); | ||
| 6025 | } | ||
| 6026 | else | ||
| 6027 | { | ||
| 6028 | item = NULL; | ||
| 6029 | HIToolbarCreateItemWithIdentifier (toolbar, | ||
| 6030 | TOOLBAR_ICON_ITEM_IDENTIFIER, | ||
| 6031 | NULL, &item); | ||
| 6032 | if (item) | ||
| 6033 | { | ||
| 6034 | HIToolbarItemSetImage (item, cg_image); | ||
| 6035 | HIToolbarItemSetLabel (item, label); | ||
| 6036 | HIToolbarItemSetEnabled (item, (enabled_p || idx >= 0)); | ||
| 6037 | HIToolbarAppendItem (toolbar, item); | ||
| 6038 | CFRelease (item); | ||
| 6039 | } | ||
| 6040 | } | ||
| 6041 | |||
| 6042 | CFRelease (label); | ||
| 6043 | if (item) | ||
| 6044 | { | ||
| 6045 | HIToolbarItemSetCommandID (item, TOOLBAR_ITEM_MAKE_COMMAND_ID (i)); | ||
| 6046 | pos++; | ||
| 6047 | } | ||
| 6048 | } | ||
| 6049 | |||
| 6050 | CFRelease (old_items); | ||
| 6051 | |||
| 6052 | while (pos < old_count) | ||
| 6053 | HIToolbarRemoveItemAtIndex (toolbar, --old_count); | ||
| 6054 | |||
| 6055 | ShowHideWindowToolbar (FRAME_MAC_WINDOW (f), true, | ||
| 6056 | !win_gravity && f == mac_focus_frame (dpyinfo)); | ||
| 6057 | /* Mac OS X 10.3 does not issue kEventWindowBoundsChanged events on | ||
| 6058 | toolbar visibility change. */ | ||
| 6059 | mac_handle_origin_change (f); | ||
| 6060 | if (win_gravity >= NorthWestGravity && win_gravity <= SouthEastGravity) | ||
| 6061 | { | ||
| 6062 | mac_move_window_with_gravity (f, win_gravity, left, top); | ||
| 6063 | /* If the title bar is completely outside the screen, adjust the | ||
| 6064 | position. */ | ||
| 6065 | ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, | ||
| 6066 | kWindowConstrainMoveRegardlessOfFit | ||
| 6067 | | kWindowConstrainAllowPartial, NULL, NULL); | ||
| 6068 | f->output_data.mac->toolbar_win_gravity = 0; | ||
| 6069 | } | ||
| 6070 | |||
| 6071 | out: | ||
| 6072 | UNBLOCK_INPUT; | ||
| 6073 | } | ||
| 6074 | |||
| 6075 | /* Hide the tool bar on frame F. Unlike the counterpart on GTK+, it | ||
| 6076 | doesn't deallocate the resources. */ | ||
| 6077 | |||
| 6078 | void | ||
| 6079 | free_frame_tool_bar (f) | ||
| 6080 | FRAME_PTR f; | ||
| 6081 | { | ||
| 6082 | if (IsWindowToolbarVisible (FRAME_MAC_WINDOW (f))) | ||
| 6083 | { | ||
| 6084 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | ||
| 6085 | |||
| 6086 | BLOCK_INPUT; | ||
| 6087 | ShowHideWindowToolbar (FRAME_MAC_WINDOW (f), false, | ||
| 6088 | f == mac_focus_frame (dpyinfo)); | ||
| 6089 | /* Mac OS X 10.3 does not issue kEventWindowBoundsChanged events | ||
| 6090 | on toolbar visibility change. */ | ||
| 6091 | mac_handle_origin_change (f); | ||
| 6092 | UNBLOCK_INPUT; | ||
| 6093 | } | ||
| 6094 | } | ||
| 6095 | |||
| 6096 | static void | ||
| 6097 | mac_tool_bar_note_mouse_movement (f, event) | ||
| 6098 | struct frame *f; | ||
| 6099 | EventRef event; | ||
| 6100 | { | ||
| 6101 | OSStatus err; | ||
| 6102 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | ||
| 6103 | int mouse_down_p; | ||
| 6104 | HIViewRef item_view; | ||
| 6105 | UInt32 command_id; | ||
| 6106 | |||
| 6107 | mouse_down_p = (dpyinfo->grabbed | ||
| 6108 | && f == last_mouse_frame | ||
| 6109 | && FRAME_LIVE_P (f)); | ||
| 6110 | if (mouse_down_p) | ||
| 6111 | return; | ||
| 6112 | |||
| 6113 | err = HIViewGetViewForMouseEvent (HIViewGetRoot (FRAME_MAC_WINDOW (f)), | ||
| 6114 | event, &item_view); | ||
| 6115 | /* This doesn't work on Mac OS X 10.2. On Mac OS X 10.3 and 10.4, a | ||
| 6116 | toolbar item view seems to have the same command ID with that of | ||
| 6117 | the toolbar item. */ | ||
| 6118 | if (err == noErr) | ||
| 6119 | err = GetControlCommandID (item_view, &command_id); | ||
| 6120 | if (err == noErr && TOOLBAR_ITEM_COMMAND_ID_P (command_id)) | ||
| 6121 | { | ||
| 6122 | int i = TOOLBAR_ITEM_COMMAND_ID_VALUE (command_id); | ||
| 6123 | |||
| 6124 | if (i < f->n_tool_bar_items) | ||
| 6125 | { | ||
| 6126 | HIRect bounds; | ||
| 6127 | HIViewRef content_view; | ||
| 6128 | |||
| 6129 | err = HIViewGetBounds (item_view, &bounds); | ||
| 6130 | if (err == noErr) | ||
| 6131 | err = HIViewFindByID (HIViewGetRoot (FRAME_MAC_WINDOW (f)), | ||
| 6132 | kHIViewWindowContentID, &content_view); | ||
| 6133 | if (err == noErr) | ||
| 6134 | err = HIViewConvertRect (&bounds, item_view, content_view); | ||
| 6135 | if (err == noErr) | ||
| 6136 | SetRect (&last_mouse_glyph, | ||
| 6137 | CGRectGetMinX (bounds), CGRectGetMinY (bounds), | ||
| 6138 | CGRectGetMaxX (bounds), CGRectGetMaxY (bounds)); | ||
| 6139 | |||
| 6140 | help_echo_object = help_echo_window = Qnil; | ||
| 6141 | help_echo_pos = -1; | ||
| 6142 | help_echo_string = PROP (TOOL_BAR_ITEM_HELP); | ||
| 6143 | if (NILP (help_echo_string)) | ||
| 6144 | help_echo_string = PROP (TOOL_BAR_ITEM_CAPTION); | ||
| 6145 | } | ||
| 6146 | } | ||
| 6147 | } | ||
| 6148 | |||
| 6149 | static OSStatus | ||
| 6150 | mac_handle_toolbar_command_event (next_handler, event, data) | ||
| 6151 | EventHandlerCallRef next_handler; | ||
| 6152 | EventRef event; | ||
| 6153 | void *data; | ||
| 6154 | { | ||
| 6155 | OSStatus err, result = eventNotHandledErr; | ||
| 6156 | struct frame *f = (struct frame *) data; | ||
| 6157 | HICommand command; | ||
| 6158 | |||
| 6159 | err = GetEventParameter (event, kEventParamDirectObject, | ||
| 6160 | typeHICommand, NULL, | ||
| 6161 | sizeof (HICommand), NULL, &command); | ||
| 6162 | if (err != noErr) | ||
| 6163 | return result; | ||
| 6164 | |||
| 6165 | switch (GetEventKind (event)) | ||
| 6166 | { | ||
| 6167 | case kEventCommandProcess: | ||
| 6168 | if (!TOOLBAR_ITEM_COMMAND_ID_P (command.commandID)) | ||
| 6169 | result = CallNextEventHandler (next_handler, event); | ||
| 6170 | else | ||
| 6171 | { | ||
| 6172 | int i = TOOLBAR_ITEM_COMMAND_ID_VALUE (command.commandID); | ||
| 6173 | |||
| 6174 | if (i < f->n_tool_bar_items | ||
| 6175 | && !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P))) | ||
| 6176 | { | ||
| 6177 | Lisp_Object frame; | ||
| 6178 | struct input_event buf; | ||
| 6179 | |||
| 6180 | EVENT_INIT (buf); | ||
| 6181 | |||
| 6182 | XSETFRAME (frame, f); | ||
| 6183 | buf.kind = TOOL_BAR_EVENT; | ||
| 6184 | buf.frame_or_window = frame; | ||
| 6185 | buf.arg = frame; | ||
| 6186 | kbd_buffer_store_event (&buf); | ||
| 6187 | |||
| 6188 | buf.kind = TOOL_BAR_EVENT; | ||
| 6189 | buf.frame_or_window = frame; | ||
| 6190 | buf.arg = PROP (TOOL_BAR_ITEM_KEY); | ||
| 6191 | buf.modifiers = mac_event_to_emacs_modifiers (event); | ||
| 6192 | kbd_buffer_store_event (&buf); | ||
| 6193 | |||
| 6194 | result = noErr; | ||
| 6195 | } | ||
| 6196 | } | ||
| 6197 | break; | ||
| 6198 | |||
| 6199 | default: | ||
| 6200 | abort (); | ||
| 6201 | } | ||
| 6202 | #undef PROP | ||
| 6203 | |||
| 6204 | return result; | ||
| 6205 | } | ||
| 6206 | #endif /* USE_MAC_TOOLBAR */ | ||
| 6207 | |||
| 6208 | |||
| 6209 | /*********************************************************************** | ||
| 5587 | Text Cursor | 6210 | Text Cursor |
| 5588 | ***********************************************************************/ | 6211 | ***********************************************************************/ |
| 5589 | 6212 | ||
| @@ -10075,6 +10698,13 @@ mac_handle_window_event (next_handler, event, data) | |||
| 10075 | kWindowCascadeOnParentWindowScreen | 10698 | kWindowCascadeOnParentWindowScreen |
| 10076 | #endif | 10699 | #endif |
| 10077 | ); | 10700 | ); |
| 10701 | #if USE_MAC_TOOLBAR | ||
| 10702 | /* This is a workaround. RepositionWindow fails to put | ||
| 10703 | a window at the cascading position when its parent | ||
| 10704 | window has a Carbon HIToolbar. */ | ||
| 10705 | if (f->top_pos == sf->top_pos && f->left_pos == sf->left_pos) | ||
| 10706 | MoveWindowStructure (wp, f->left_pos + 10, f->top_pos + 32); | ||
| 10707 | #endif | ||
| 10078 | } | 10708 | } |
| 10079 | result = noErr; | 10709 | result = noErr; |
| 10080 | } | 10710 | } |
| @@ -10357,8 +10987,7 @@ mac_handle_keyboard_event (next_handler, event, data) | |||
| 10357 | if (err != noErr) | 10987 | if (err != noErr) |
| 10358 | break; | 10988 | break; |
| 10359 | 10989 | ||
| 10360 | do_keystroke ((GetEventKind (event) == kEventRawKeyDown | 10990 | do_keystroke ((event_kind == kEventRawKeyDown ? keyDown : autoKey), |
| 10361 | ? keyDown : autoKey), | ||
| 10362 | char_code, key_code, modifiers, | 10991 | char_code, key_code, modifiers, |
| 10363 | ((unsigned long) | 10992 | ((unsigned long) |
| 10364 | (GetEventTime (event) / kEventDurationMillisecond)), | 10993 | (GetEventTime (event) / kEventDurationMillisecond)), |
| @@ -11412,6 +12041,21 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11412 | do_zoom_window (window_ptr, part_code); | 12041 | do_zoom_window (window_ptr, part_code); |
| 11413 | break; | 12042 | break; |
| 11414 | 12043 | ||
| 12044 | #if USE_MAC_TOOLBAR | ||
| 12045 | case inStructure: | ||
| 12046 | { | ||
| 12047 | OSStatus err; | ||
| 12048 | HIViewRef ch; | ||
| 12049 | |||
| 12050 | err = HIViewGetViewForMouseEvent (HIViewGetRoot (window_ptr), | ||
| 12051 | eventRef, &ch); | ||
| 12052 | /* This doesn't work on Mac OS X 10.2. */ | ||
| 12053 | if (err == noErr) | ||
| 12054 | HIViewClick (ch, eventRef); | ||
| 12055 | } | ||
| 12056 | break; | ||
| 12057 | #endif /* USE_MAC_TOOLBAR */ | ||
| 12058 | |||
| 11415 | default: | 12059 | default: |
| 11416 | break; | 12060 | break; |
| 11417 | } | 12061 | } |
| @@ -11496,6 +12140,10 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11496 | } | 12140 | } |
| 11497 | if (!note_mouse_movement (f, &mouse_pos)) | 12141 | if (!note_mouse_movement (f, &mouse_pos)) |
| 11498 | help_echo_string = previous_help_echo_string; | 12142 | help_echo_string = previous_help_echo_string; |
| 12143 | #if USE_MAC_TOOLBAR | ||
| 12144 | else | ||
| 12145 | mac_tool_bar_note_mouse_movement (f, eventRef); | ||
| 12146 | #endif | ||
| 11499 | } | 12147 | } |
| 11500 | } | 12148 | } |
| 11501 | 12149 | ||
diff --git a/src/macterm.h b/src/macterm.h index c880143634e..77710b11e71 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -336,6 +336,16 @@ struct mac_output | |||
| 336 | /* Hints for the size and the position of a window. */ | 336 | /* Hints for the size and the position of a window. */ |
| 337 | XSizeHints *size_hints; | 337 | XSizeHints *size_hints; |
| 338 | 338 | ||
| 339 | #if USE_MAC_TOOLBAR | ||
| 340 | /* This variable records the gravity value of the window position if | ||
| 341 | the window has an external tool bar when it is created. The | ||
| 342 | position of the window is adjusted using this information when | ||
| 343 | the tool bar is first redisplayed. Once the tool bar is | ||
| 344 | redisplayed, it is set to 0 in order to avoid further | ||
| 345 | adjustment. */ | ||
| 346 | int toolbar_win_gravity; | ||
| 347 | #endif | ||
| 348 | |||
| 339 | #if USE_CG_DRAWING | 349 | #if USE_CG_DRAWING |
| 340 | /* Quartz 2D graphics context. */ | 350 | /* Quartz 2D graphics context. */ |
| 341 | CGContextRef cg_context; | 351 | 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 7784a3ae616..1e80b9bbeef 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -2482,11 +2482,6 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2482 | last -- ends with a forward jump of this sort. */ | 2482 | last -- ends with a forward jump of this sort. */ |
| 2483 | unsigned char *fixup_alt_jump = 0; | 2483 | unsigned char *fixup_alt_jump = 0; |
| 2484 | 2484 | ||
| 2485 | /* Counts open-groups as they are encountered. Remembered for the | ||
| 2486 | matching close-group on the compile stack, so the same register | ||
| 2487 | number is put in the stop_memory as the start_memory. */ | ||
| 2488 | regnum_t regnum = 0; | ||
| 2489 | |||
| 2490 | /* Work area for range table of charset. */ | 2485 | /* Work area for range table of charset. */ |
| 2491 | struct range_table_work_area range_table_work; | 2486 | struct range_table_work_area range_table_work; |
| 2492 | 2487 | ||
| @@ -3123,28 +3118,54 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3123 | handle_open: | 3118 | handle_open: |
| 3124 | { | 3119 | { |
| 3125 | int shy = 0; | 3120 | int shy = 0; |
| 3121 | regnum_t regnum = 0; | ||
| 3126 | if (p+1 < pend) | 3122 | if (p+1 < pend) |
| 3127 | { | 3123 | { |
| 3128 | /* Look for a special (?...) construct */ | 3124 | /* Look for a special (?...) construct */ |
| 3129 | if ((syntax & RE_SHY_GROUPS) && *p == '?') | 3125 | if ((syntax & RE_SHY_GROUPS) && *p == '?') |
| 3130 | { | 3126 | { |
| 3131 | PATFETCH (c); /* Gobble up the '?'. */ | 3127 | PATFETCH (c); /* Gobble up the '?'. */ |
| 3132 | PATFETCH (c); | 3128 | while (!shy) |
| 3133 | switch (c) | ||
| 3134 | { | 3129 | { |
| 3135 | case ':': shy = 1; break; | 3130 | PATFETCH (c); |
| 3136 | default: | 3131 | switch (c) |
| 3137 | /* Only (?:...) is supported right now. */ | 3132 | { |
| 3138 | FREE_STACK_RETURN (REG_BADPAT); | 3133 | case ':': shy = 1; break; |
| 3134 | case '0': | ||
| 3135 | /* An explicitly specified regnum must start | ||
| 3136 | with non-0. */ | ||
| 3137 | if (regnum == 0) | ||
| 3138 | FREE_STACK_RETURN (REG_BADPAT); | ||
| 3139 | case '1': case '2': case '3': case '4': | ||
| 3140 | case '5': case '6': case '7': case '8': case '9': | ||
| 3141 | regnum = 10*regnum + (c - '0'); break; | ||
| 3142 | default: | ||
| 3143 | /* Only (?:...) is supported right now. */ | ||
| 3144 | FREE_STACK_RETURN (REG_BADPAT); | ||
| 3145 | } | ||
| 3139 | } | 3146 | } |
| 3140 | } | 3147 | } |
| 3141 | } | 3148 | } |
| 3142 | 3149 | ||
| 3143 | if (!shy) | 3150 | if (!shy) |
| 3144 | { | 3151 | regnum = ++bufp->re_nsub; |
| 3145 | bufp->re_nsub++; | 3152 | else if (regnum) |
| 3146 | regnum++; | 3153 | { /* It's actually not shy, but explicitly numbered. */ |
| 3154 | shy = 0; | ||
| 3155 | if (regnum > bufp->re_nsub) | ||
| 3156 | bufp->re_nsub = regnum; | ||
| 3157 | else if (regnum > bufp->re_nsub | ||
| 3158 | /* Ideally, we'd want to check that the specified | ||
| 3159 | group can't have matched (i.e. all subgroups | ||
| 3160 | using the same regnum are in other branches of | ||
| 3161 | OR patterns), but we don't currently keep track | ||
| 3162 | of enough info to do that easily. */ | ||
| 3163 | || group_in_compile_stack (compile_stack, regnum)) | ||
| 3164 | FREE_STACK_RETURN (REG_BADPAT); | ||
| 3147 | } | 3165 | } |
| 3166 | else | ||
| 3167 | /* It's really shy. */ | ||
| 3168 | regnum = - bufp->re_nsub; | ||
| 3148 | 3169 | ||
| 3149 | if (COMPILE_STACK_FULL) | 3170 | if (COMPILE_STACK_FULL) |
| 3150 | { | 3171 | { |
| @@ -3163,12 +3184,11 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3163 | COMPILE_STACK_TOP.fixup_alt_jump | 3184 | COMPILE_STACK_TOP.fixup_alt_jump |
| 3164 | = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; | 3185 | = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; |
| 3165 | COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; | 3186 | COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; |
| 3166 | COMPILE_STACK_TOP.regnum = shy ? -regnum : regnum; | 3187 | COMPILE_STACK_TOP.regnum = regnum; |
| 3167 | 3188 | ||
| 3168 | /* Do not push a | 3189 | /* Do not push a start_memory for groups beyond the last one |
| 3169 | start_memory for groups beyond the last one we can | 3190 | we can represent in the compiled pattern. */ |
| 3170 | represent in the compiled pattern. */ | 3191 | if (regnum <= MAX_REGNUM && regnum > 0) |
| 3171 | if (regnum <= MAX_REGNUM && !shy) | ||
| 3172 | BUF_PUSH_2 (start_memory, regnum); | 3192 | BUF_PUSH_2 (start_memory, regnum); |
| 3173 | 3193 | ||
| 3174 | compile_stack.avail++; | 3194 | compile_stack.avail++; |
| @@ -3213,7 +3233,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3213 | /* We don't just want to restore into `regnum', because | 3233 | /* We don't just want to restore into `regnum', because |
| 3214 | later groups should continue to be numbered higher, | 3234 | later groups should continue to be numbered higher, |
| 3215 | as in `(ab)c(de)' -- the second group is #2. */ | 3235 | as in `(ab)c(de)' -- the second group is #2. */ |
| 3216 | regnum_t this_group_regnum; | 3236 | regnum_t regnum; |
| 3217 | 3237 | ||
| 3218 | compile_stack.avail--; | 3238 | compile_stack.avail--; |
| 3219 | begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; | 3239 | begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; |
| @@ -3222,7 +3242,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3222 | ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 | 3242 | ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 |
| 3223 | : 0; | 3243 | : 0; |
| 3224 | laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; | 3244 | laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; |
| 3225 | this_group_regnum = COMPILE_STACK_TOP.regnum; | 3245 | regnum = COMPILE_STACK_TOP.regnum; |
| 3226 | /* If we've reached MAX_REGNUM groups, then this open | 3246 | /* If we've reached MAX_REGNUM groups, then this open |
| 3227 | won't actually generate any code, so we'll have to | 3247 | won't actually generate any code, so we'll have to |
| 3228 | clear pending_exact explicitly. */ | 3248 | clear pending_exact explicitly. */ |
| @@ -3230,8 +3250,8 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3230 | 3250 | ||
| 3231 | /* We're at the end of the group, so now we know how many | 3251 | /* We're at the end of the group, so now we know how many |
| 3232 | groups were inside this one. */ | 3252 | groups were inside this one. */ |
| 3233 | if (this_group_regnum <= MAX_REGNUM && this_group_regnum > 0) | 3253 | if (regnum <= MAX_REGNUM && regnum > 0) |
| 3234 | BUF_PUSH_2 (stop_memory, this_group_regnum); | 3254 | BUF_PUSH_2 (stop_memory, regnum); |
| 3235 | } | 3255 | } |
| 3236 | break; | 3256 | break; |
| 3237 | 3257 | ||
| @@ -3557,8 +3577,9 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3557 | 3577 | ||
| 3558 | reg = c - '0'; | 3578 | reg = c - '0'; |
| 3559 | 3579 | ||
| 3560 | /* Can't back reference to a subexpression before its end. */ | 3580 | if (reg > bufp->re_nsub || reg < 1 |
| 3561 | if (reg > regnum || group_in_compile_stack (compile_stack, reg)) | 3581 | /* Can't back reference to a subexp before its end. */ |
| 3582 | || group_in_compile_stack (compile_stack, reg)) | ||
| 3562 | FREE_STACK_RETURN (REG_ESUBREG); | 3583 | FREE_STACK_RETURN (REG_ESUBREG); |
| 3563 | 3584 | ||
| 3564 | laststart = b; | 3585 | laststart = b; |
diff --git a/src/term.c b/src/term.c index ceeac103e85..122eab91bdb 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -50,6 +50,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 50 | #include "blockinput.h" | 50 | #include "blockinput.h" |
| 51 | #include "syssignal.h" | 51 | #include "syssignal.h" |
| 52 | #include "systty.h" | 52 | #include "systty.h" |
| 53 | #include "intervals.h" | ||
| 53 | 54 | ||
| 54 | /* For now, don't try to include termcap.h. On some systems, | 55 | /* For now, don't try to include termcap.h. On some systems, |
| 55 | configure finds a non-standard termcap.h that the main build | 56 | 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); |
| @@ -4136,6 +4181,11 @@ BOOL WINAPI shutdown_handler(DWORD type) | |||
| 4136 | void | 4181 | void |
| 4137 | globals_of_w32 () | 4182 | globals_of_w32 () |
| 4138 | { | 4183 | { |
| 4184 | HMODULE kernel32 = GetModuleHandle ("kernel32.dll"); | ||
| 4185 | |||
| 4186 | get_process_times_fn = (GetProcessTimes_Proc) | ||
| 4187 | GetProcAddress (kernel32, "GetProcessTimes"); | ||
| 4188 | |||
| 4139 | g_b_init_is_windows_9x = 0; | 4189 | g_b_init_is_windows_9x = 0; |
| 4140 | g_b_init_open_process_token = 0; | 4190 | g_b_init_open_process_token = 0; |
| 4141 | g_b_init_get_token_information = 0; | 4191 | g_b_init_get_token_information = 0; |
diff --git a/src/w32menu.c b/src/w32menu.c index 5f507ad76c0..f86bfa3b7db 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -23,6 +23,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 23 | 23 | ||
| 24 | #include <signal.h> | 24 | #include <signal.h> |
| 25 | #include <stdio.h> | 25 | #include <stdio.h> |
| 26 | #include <mbstring.h> | ||
| 26 | 27 | ||
| 27 | #include "lisp.h" | 28 | #include "lisp.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 afa7f92a1cc..7c7fedeb0b8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9367,7 +9367,7 @@ update_tool_bar (f, save_match_data) | |||
| 9367 | struct frame *f; | 9367 | struct frame *f; |
| 9368 | int save_match_data; | 9368 | int save_match_data; |
| 9369 | { | 9369 | { |
| 9370 | #ifdef USE_GTK | 9370 | #if defined (USE_GTK) || USE_MAC_TOOLBAR |
| 9371 | int do_update = FRAME_EXTERNAL_TOOL_BAR (f); | 9371 | int do_update = FRAME_EXTERNAL_TOOL_BAR (f); |
| 9372 | #else | 9372 | #else |
| 9373 | int do_update = WINDOWP (f->tool_bar_window) | 9373 | int do_update = WINDOWP (f->tool_bar_window) |
| @@ -9833,7 +9833,7 @@ redisplay_tool_bar (f) | |||
| 9833 | struct it it; | 9833 | struct it it; |
| 9834 | struct glyph_row *row; | 9834 | struct glyph_row *row; |
| 9835 | 9835 | ||
| 9836 | #ifdef USE_GTK | 9836 | #if defined (USE_GTK) || USE_MAC_TOOLBAR |
| 9837 | if (FRAME_EXTERNAL_TOOL_BAR (f)) | 9837 | if (FRAME_EXTERNAL_TOOL_BAR (f)) |
| 9838 | update_frame_tool_bar (f); | 9838 | update_frame_tool_bar (f); |
| 9839 | return 0; | 9839 | return 0; |
| @@ -13478,7 +13478,7 @@ redisplay_window (window, just_this_one_p) | |||
| 13478 | #ifdef HAVE_WINDOW_SYSTEM | 13478 | #ifdef HAVE_WINDOW_SYSTEM |
| 13479 | if (FRAME_WINDOW_P (f)) | 13479 | if (FRAME_WINDOW_P (f)) |
| 13480 | { | 13480 | { |
| 13481 | #ifdef USE_GTK | 13481 | #if defined (USE_GTK) || USE_MAC_TOOLBAR |
| 13482 | redisplay_tool_bar_p = FRAME_EXTERNAL_TOOL_BAR (f); | 13482 | redisplay_tool_bar_p = FRAME_EXTERNAL_TOOL_BAR (f); |
| 13483 | #else | 13483 | #else |
| 13484 | redisplay_tool_bar_p = WINDOWP (f->tool_bar_window) | 13484 | redisplay_tool_bar_p = WINDOWP (f->tool_bar_window) |
diff --git a/src/xfns.c b/src/xfns.c index e51dea84118..0dab5d9dd64 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -73,8 +73,13 @@ Boston, MA 02110-1301, USA. */ | |||
| 73 | #include <X11/Shell.h> | 73 | #include <X11/Shell.h> |
| 74 | 74 | ||
| 75 | #ifndef USE_MOTIF | 75 | #ifndef USE_MOTIF |
| 76 | #ifdef HAVE_XAW3D | ||
| 77 | #include <X11/Xaw3d/Paned.h> | ||
| 78 | #include <X11/Xaw3d/Label.h> | ||
| 79 | #else /* !HAVE_XAW3D */ | ||
| 76 | #include <X11/Xaw/Paned.h> | 80 | #include <X11/Xaw/Paned.h> |
| 77 | #include <X11/Xaw/Label.h> | 81 | #include <X11/Xaw/Label.h> |
| 82 | #endif /* HAVE_XAW3D */ | ||
| 78 | #endif /* USE_MOTIF */ | 83 | #endif /* USE_MOTIF */ |
| 79 | 84 | ||
| 80 | #ifdef USG | 85 | #ifdef USG |
diff --git a/src/xmenu.c b/src/xmenu.c index 4390d9429af..a9e0d4be001 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 */ |