diff options
| author | Andrew Choi | 2002-08-12 04:33:59 +0000 |
|---|---|---|
| committer | Andrew Choi | 2002-08-12 04:33:59 +0000 |
| commit | 5883787cd6e7b35636ff9928c2c21022906bb8da (patch) | |
| tree | fcbc4e33dd4977b7138af7f8a43fd4dfc33638a6 /src | |
| parent | 068a9dbdf69bf0efe8ddf92ec1283e7b26894e43 (diff) | |
| download | emacs-5883787cd6e7b35636ff9928c2c21022906bb8da.tar.gz emacs-5883787cd6e7b35636ff9928c2c21022906bb8da.zip | |
2002-08-11 Andrew Choi <akochoi@shaw.ca>
* macterm.c (XTmouse_position): Check wp with is_emacs_window.
(Vmac_pass_command_to_system): New variable.
(Vmac_pass_control_to_system): New variable.
(do_mouse_moved): Check wp with is_emacs_window.
(XTread_socket): Check window_ptr with is_emacs_window. Call
FrontNonFloatingWindow instead of FrontWindow. Send keydown
events back to Mac Toolbox for processing, depending on values of
Vmac_pass_command_to_system and Vmac_pass_control_to_system.
(syms_of_macterm): DEFVAR_LISP Vmac_pass_command_to_system and
Vmac_pass_control_to_system.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/macterm.c | 82 |
2 files changed, 79 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4b69b3a8c15..9932f4272d6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2002-08-11 Andrew Choi <akochoi@shaw.ca> | ||
| 2 | |||
| 3 | * macterm.c (XTmouse_position): Check wp with is_emacs_window. | ||
| 4 | (Vmac_pass_command_to_system): New variable. | ||
| 5 | (Vmac_pass_control_to_system): New variable. | ||
| 6 | (do_mouse_moved): Check wp with is_emacs_window. | ||
| 7 | (XTread_socket): Check window_ptr with is_emacs_window. Call | ||
| 8 | FrontNonFloatingWindow instead of FrontWindow. Send keydown | ||
| 9 | events back to Mac Toolbox for processing, depending on values of | ||
| 10 | Vmac_pass_command_to_system and Vmac_pass_control_to_system. | ||
| 11 | (syms_of_macterm): DEFVAR_LISP Vmac_pass_command_to_system and | ||
| 12 | Vmac_pass_control_to_system. | ||
| 13 | |||
| 1 | 2002-08-10 Kenichi Handa <handa@etl.go.jp> | 14 | 2002-08-10 Kenichi Handa <handa@etl.go.jp> |
| 2 | 15 | ||
| 3 | * coding.c (unencodable_char_position): New function. | 16 | * coding.c (unencodable_char_position): New function. |
diff --git a/src/macterm.c b/src/macterm.c index a907425c391..e285480a9e9 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -475,6 +475,8 @@ static void x_produce_stretch_glyph P_ ((struct it *)); | |||
| 475 | static void activate_scroll_bars (FRAME_PTR); | 475 | static void activate_scroll_bars (FRAME_PTR); |
| 476 | static void deactivate_scroll_bars (FRAME_PTR); | 476 | static void deactivate_scroll_bars (FRAME_PTR); |
| 477 | 477 | ||
| 478 | static int is_emacs_window (WindowPtr); | ||
| 479 | |||
| 478 | extern int image_ascent (struct image *, struct face *); | 480 | extern int image_ascent (struct image *, struct face *); |
| 479 | void x_set_offset (struct frame *, int, int, int); | 481 | void x_set_offset (struct frame *, int, int, int); |
| 480 | int x_bitmap_icon (struct frame *, Lisp_Object); | 482 | int x_bitmap_icon (struct frame *, Lisp_Object); |
| @@ -8251,9 +8253,12 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 8251 | Point mouse_pos; | 8253 | Point mouse_pos; |
| 8252 | int ignore1, ignore2; | 8254 | int ignore1, ignore2; |
| 8253 | WindowPtr wp = FrontWindow (); | 8255 | WindowPtr wp = FrontWindow (); |
| 8254 | struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP; | 8256 | struct frame *f; |
| 8255 | Lisp_Object frame, tail; | 8257 | Lisp_Object frame, tail; |
| 8256 | 8258 | ||
| 8259 | if (is_emacs_window(wp)) | ||
| 8260 | f = ((mac_output *) GetWRefCon (wp))->mFP; | ||
| 8261 | |||
| 8257 | BLOCK_INPUT; | 8262 | BLOCK_INPUT; |
| 8258 | 8263 | ||
| 8259 | if (! NILP (last_mouse_scroll_bar) && insist == 0) | 8264 | if (! NILP (last_mouse_scroll_bar) && insist == 0) |
| @@ -11497,6 +11502,14 @@ Lisp_Object Vmac_reverse_ctrl_meta; | |||
| 11497 | /* True if the mouse wheel button (i.e. button 4) should map to | 11502 | /* True if the mouse wheel button (i.e. button 4) should map to |
| 11498 | mouse-2, instead of mouse-3. */ | 11503 | mouse-2, instead of mouse-3. */ |
| 11499 | Lisp_Object Vmac_wheel_button_is_mouse_2; | 11504 | Lisp_Object Vmac_wheel_button_is_mouse_2; |
| 11505 | |||
| 11506 | /* If Non-nil, the Mac "Command" key is passed on to the Mac Toolbox | ||
| 11507 | for processing before Emacs sees it. */ | ||
| 11508 | Lisp_Object Vmac_pass_command_to_system; | ||
| 11509 | |||
| 11510 | /* If Non-nil, the Mac "Control" key is passed on to the Mac Toolbox | ||
| 11511 | for processing before Emacs sees it. */ | ||
| 11512 | Lisp_Object Vmac_pass_control_to_system; | ||
| 11500 | #endif | 11513 | #endif |
| 11501 | 11514 | ||
| 11502 | /* convert input from Mac keyboard (assumed to be in Mac Roman coding) | 11515 | /* convert input from Mac keyboard (assumed to be in Mac Roman coding) |
| @@ -11840,17 +11853,22 @@ static void | |||
| 11840 | do_mouse_moved (Point mouse_pos) | 11853 | do_mouse_moved (Point mouse_pos) |
| 11841 | { | 11854 | { |
| 11842 | WindowPtr wp = FrontWindow (); | 11855 | WindowPtr wp = FrontWindow (); |
| 11843 | struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP; | 11856 | struct frame *f; |
| 11844 | 11857 | ||
| 11858 | if (is_emacs_window (wp)) | ||
| 11859 | { | ||
| 11860 | f = ((mac_output *) GetWRefCon (wp))->mFP; | ||
| 11861 | |||
| 11845 | #if TARGET_API_MAC_CARBON | 11862 | #if TARGET_API_MAC_CARBON |
| 11846 | SetPort (GetWindowPort (wp)); | 11863 | SetPort (GetWindowPort (wp)); |
| 11847 | #else | 11864 | #else |
| 11848 | SetPort (wp); | 11865 | SetPort (wp); |
| 11849 | #endif | 11866 | #endif |
| 11850 | 11867 | ||
| 11851 | GlobalToLocal (&mouse_pos); | 11868 | GlobalToLocal (&mouse_pos); |
| 11852 | 11869 | ||
| 11853 | note_mouse_movement (f, &mouse_pos); | 11870 | note_mouse_movement (f, &mouse_pos); |
| 11871 | } | ||
| 11854 | } | 11872 | } |
| 11855 | 11873 | ||
| 11856 | 11874 | ||
| @@ -12626,7 +12644,7 @@ XTread_socket (int sd, struct input_event *bufp, int numchars, int expected) | |||
| 12626 | { | 12644 | { |
| 12627 | SInt32 delta; | 12645 | SInt32 delta; |
| 12628 | Point point; | 12646 | Point point; |
| 12629 | WindowPtr window_ptr = FrontWindow (); | 12647 | WindowPtr window_ptr = FrontNonFloatingWindow (); |
| 12630 | struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr); | 12648 | struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr); |
| 12631 | GetEventParameter(eventRef, kEventParamMouseWheelDelta, | 12649 | GetEventParameter(eventRef, kEventParamMouseWheelDelta, |
| 12632 | typeSInt32, NULL, sizeof (SInt32), | 12650 | typeSInt32, NULL, sizeof (SInt32), |
| @@ -12666,8 +12684,14 @@ XTread_socket (int sd, struct input_event *bufp, int numchars, int expected) | |||
| 12666 | SInt16 part_code; | 12684 | SInt16 part_code; |
| 12667 | 12685 | ||
| 12668 | #if USE_CARBON_EVENTS | 12686 | #if USE_CARBON_EVENTS |
| 12669 | /* This is needed to correctly */ | 12687 | /* This is needed to send mouse events like aqua window buttons |
| 12670 | SendEventToEventTarget (eventRef, GetEventDispatcherTarget ()); | 12688 | to the correct handler. */ |
| 12689 | if (eventNotHandledErr != SendEventToEventTarget (eventRef, GetEventDispatcherTarget ())) { | ||
| 12690 | break; | ||
| 12691 | } | ||
| 12692 | |||
| 12693 | if (!is_emacs_window(window_ptr)) | ||
| 12694 | break; | ||
| 12671 | #endif | 12695 | #endif |
| 12672 | 12696 | ||
| 12673 | if (mouse_tracking_in_progress == mouse_tracking_scroll_bar | 12697 | if (mouse_tracking_in_progress == mouse_tracking_scroll_bar |
| @@ -12861,7 +12885,7 @@ XTread_socket (int sd, struct input_event *bufp, int numchars, int expected) | |||
| 12861 | case osEvt: | 12885 | case osEvt: |
| 12862 | case activateEvt: | 12886 | case activateEvt: |
| 12863 | #if USE_CARBON_EVENTS | 12887 | #if USE_CARBON_EVENTS |
| 12864 | SendEventToEventTarget (eventRef, GetEventDispatcherTarget ()); | 12888 | if (eventNotHandledErr == SendEventToEventTarget (eventRef, GetEventDispatcherTarget ())) |
| 12865 | #endif | 12889 | #endif |
| 12866 | do_events (&er); | 12890 | do_events (&er); |
| 12867 | break; | 12891 | break; |
| @@ -12872,6 +12896,24 @@ XTread_socket (int sd, struct input_event *bufp, int numchars, int expected) | |||
| 12872 | int keycode = (er.message & keyCodeMask) >> 8; | 12896 | int keycode = (er.message & keyCodeMask) >> 8; |
| 12873 | int xkeysym; | 12897 | int xkeysym; |
| 12874 | 12898 | ||
| 12899 | #if USE_CARBON_EVENTS | ||
| 12900 | /* When using Carbon Events, we need to pass raw keyboard events | ||
| 12901 | to the TSM ourselves. If TSM handles it, it will pass back | ||
| 12902 | noErr, otherwise it will pass back "eventNotHandledErr" and | ||
| 12903 | we can process it normally. */ | ||
| 12904 | if ((!NILP (Vmac_pass_command_to_system) | ||
| 12905 | || !(er.modifiers & cmdKey)) | ||
| 12906 | && (!NILP (Vmac_pass_control_to_system) | ||
| 12907 | || !(er.modifiers & controlKey))) | ||
| 12908 | { | ||
| 12909 | OSStatus err; | ||
| 12910 | err = SendEventToEventTarget (eventRef, | ||
| 12911 | GetEventDispatcherTarget ()); | ||
| 12912 | if (err != eventNotHandledErr) | ||
| 12913 | break; | ||
| 12914 | } | ||
| 12915 | #endif | ||
| 12916 | |||
| 12875 | if (!IsValidWindowPtr (FrontNonFloatingWindow ())) | 12917 | if (!IsValidWindowPtr (FrontNonFloatingWindow ())) |
| 12876 | { | 12918 | { |
| 12877 | SysBeep (1); | 12919 | SysBeep (1); |
| @@ -13011,16 +13053,14 @@ XTread_socket (int sd, struct input_event *bufp, int numchars, int expected) | |||
| 13011 | constuct_drag_n_drop in w32term.c. */ | 13053 | constuct_drag_n_drop in w32term.c. */ |
| 13012 | if (!NILP (drag_and_drop_file_list)) | 13054 | if (!NILP (drag_and_drop_file_list)) |
| 13013 | { | 13055 | { |
| 13014 | struct frame *f; | 13056 | struct frame *f = NULL; |
| 13015 | WindowPtr wp; | 13057 | WindowPtr wp; |
| 13016 | Lisp_Object frame; | 13058 | Lisp_Object frame; |
| 13017 | 13059 | ||
| 13018 | wp = FrontWindow (); | 13060 | wp = FrontNonFloatingWindow (); |
| 13019 | if (!wp) | 13061 | if (wp && is_emacs_window(wp)) |
| 13020 | f = NULL; | 13062 | f = ((mac_output *) GetWRefCon (wp))->mFP; |
| 13021 | else | 13063 | |
| 13022 | f = ((mac_output *) GetWRefCon (wp))->mFP; | ||
| 13023 | |||
| 13024 | bufp->kind = DRAG_N_DROP_EVENT; | 13064 | bufp->kind = DRAG_N_DROP_EVENT; |
| 13025 | bufp->code = 0; | 13065 | bufp->code = 0; |
| 13026 | bufp->timestamp = er.when * (1000 / 60); | 13066 | bufp->timestamp = er.when * (1000 / 60); |
| @@ -13610,6 +13650,16 @@ Otherwise the option key is used. */); | |||
| 13610 | the right click will be mouse-3. | 13650 | the right click will be mouse-3. |
| 13611 | Otherwise, the right click will be mouse-2 and the wheel button mouse-3.*/); | 13651 | Otherwise, the right click will be mouse-2 and the wheel button mouse-3.*/); |
| 13612 | Vmac_wheel_button_is_mouse_2 = Qt; | 13652 | Vmac_wheel_button_is_mouse_2 = Qt; |
| 13653 | |||
| 13654 | DEFVAR_LISP ("mac-pass-command-to-system", &Vmac_pass_command_to_system, | ||
| 13655 | doc: /* If non-nil, the Mac \"Command\" key is passed on to the Mac | ||
| 13656 | Toolbox for processing before Emacs sees it. */); | ||
| 13657 | Vmac_pass_command_to_system = Qt; | ||
| 13658 | |||
| 13659 | DEFVAR_LISP ("mac-pass-control-to-system", &Vmac_pass_control_to_system, | ||
| 13660 | doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac | ||
| 13661 | Toolbox for processing before Emacs sees it. */); | ||
| 13662 | Vmac_pass_control_to_system = Qt; | ||
| 13613 | #endif | 13663 | #endif |
| 13614 | 13664 | ||
| 13615 | DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding, | 13665 | DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding, |