summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2008-04-19 01:25:50 +0000
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2008-04-19 01:25:50 +0000
commit81fe843b5a3cc7708e0800aeb5bc0dbe448e800a (patch)
tree3a7c09fdc590b3e2830382ccff4e4d4f46cb90eb
parente4aae3c83758bef69969b9d1cb6379fe2f1143ec (diff)
downloademacs-81fe843b5a3cc7708e0800aeb5bc0dbe448e800a.tar.gz
emacs-81fe843b5a3cc7708e0800aeb5bc0dbe448e800a.tar.bz2
emacs-81fe843b5a3cc7708e0800aeb5bc0dbe448e800a.zip
(Vmac_ts_script_language_on_focus)
(saved_ts_script_language_on_focus) [USE_MAC_TSM]: Remove externs. (XTread_socket) [USE_MAC_TOOLBAR]: Select window if its structure part is clicked. (x_activate_menubar): Remove extern for saved_menu_event_location. (create_apple_event_from_drag_ref) [TARGET_API_MAC_CARBON]: Move from mac.c.
-rw-r--r--src/ChangeLog53
-rw-r--r--src/mactoolbox.c85
2 files changed, 130 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 56676ea95d6..aaa49be146d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,56 @@
+2008-04-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * mac.c (create_apple_event) [TARGET_API_MAC_CARBON]:
+ Make function non-static.
+ (create_apple_event_from_event_ref) [TARGET_API_MAC_CARBON]:
+ Remove function.
+ (create_apple_event_from_drag_ref) [TARGET_API_MAC_CARBON]:
+ Move to mactoolbox.c.
+ (mac_event_parameters_to_lisp) [TARGET_API_MAC_CARBON]: New function.
+
+ * macgui.h (CGFloat) [!CGFLOAT_DEFINED]: New typedef.
+ (mac_rect_make): New macro.
+
+ * macterm.c (mac_draw_image_string_atsui) [MAC_OSX]: Use CGFloat
+ instead of float.
+ (mac_draw_image_string_cg) [USE_CG_TEXT_DRAWING]: Likewise.
+ (init_cg_color, mac_draw_line, mac_draw_cg_image, XSetForeground)
+ (XSetBackground) [USE_CG_DRAWING]: Likewise.
+ (mac_draw_image_string_atsui) [MAC_OSX]: Use mac_rect_make instead of
+ CGRectMake.
+ (mac_draw_image_string_cg) [USE_CG_TEXT_DRAWING]: Likewise.
+ (mac_erase_rectangle, mac_draw_cg_image, mac_fill_rectangle)
+ (mac_set_clip_rectangles) [USE_CG_DRAWING]: Likewise.
+ (XCreatePixmap, XCreatePixmapFromBitmapData): Use Window
+ instead of WindowRef in argument type.
+ (XCreatePixmap) [!MAC_OS8]: Don't call SetPortWindowPort.
+ (mac_invert_rectangle): Use CGContextSetBlendMode if available.
+ (mac_set_clip_rectangles, mac_reset_clip_rectangles): Take argument F
+ instead of DISPLAY. All uses changed.
+ (mac_handle_size_change): Don't call SET_FRAME_GARBAGED.
+ (x_calc_absolute_position): Simplify so as not to use
+ FRAME_PIXEL_WIDTH/FRAME_PIXEL_HEIGHT.
+ (Vmac_ts_script_language_on_focus, saved_ts_script_language_on_focus)
+ [USE_MAC_TSM]: Make variables static.
+ (mac_store_event_ref_as_apple_event) [TARGET_API_MAC_CARBON]:
+ Don't use create_apple_event_from_event_ref.
+ Use mac_event_parameters_to_lisp.
+
+ * macterm.h (XCreatePixmap, XCreatePixmapFromBitmapData): Use Window
+ instead of WindowRef in argument type.
+ (create_apple_event_from_event_ref, create_apple_event_from_drag_ref)
+ [TARGET_API_MAC_CARBON]: Remove externs.
+ (create_apple_event, mac_event_parameters_to_lisp)
+ [TARGET_API_MAC_CARBON]: Add externs.
+
+ * mactoolbox.c: (Vmac_ts_script_language_on_focus)
+ (saved_ts_script_language_on_focus) [USE_MAC_TSM]: Remove externs.
+ (XTread_socket) [USE_MAC_TOOLBAR]: Select window if its structure part
+ is clicked.
+ (x_activate_menubar): Remove extern for saved_menu_event_location.
+ (create_apple_event_from_drag_ref) [TARGET_API_MAC_CARBON]:
+ Move from mac.c.
+
2008-04-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* alloc.c [!SYSTEM_MALLOC && !SYNC_INPUT] (uninterrupt_malloc)
diff --git a/src/mactoolbox.c b/src/mactoolbox.c
index 6b4d22049a9..71abce23fe0 100644
--- a/src/mactoolbox.c
+++ b/src/mactoolbox.c
@@ -120,8 +120,6 @@ extern Lisp_Object Qtext_input;
extern Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event;
extern Lisp_Object Vmac_ts_active_input_overlay;
extern Lisp_Object Qbefore_string;
-extern Lisp_Object Vmac_ts_script_language_on_focus;
-extern Lisp_Object saved_ts_script_language_on_focus;
#endif
static int mac_event_to_emacs_modifiers P_ ((EventRef));
@@ -606,15 +604,15 @@ install_application_handler ()
#if USE_MAC_TSM
if (err == noErr)
{
- static const EventTypeSpec spec[] =
+ static const EventTypeSpec specs[] =
{{kEventClassTextInput, kEventTextInputUpdateActiveInputArea},
{kEventClassTextInput, kEventTextInputUnicodeForKeyEvent},
{kEventClassTextInput, kEventTextInputOffsetToPos}};
err = InstallApplicationEventHandler (NewEventHandlerUPP
(mac_handle_text_input_event),
- GetEventTypeCount (spec),
- spec, NULL, NULL);
+ GetEventTypeCount (specs),
+ specs, NULL, NULL);
}
#endif
@@ -3009,8 +3007,8 @@ mac_event_to_emacs_modifiers (EventRef eventRef)
GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL,
sizeof (UInt32), NULL, &mods);
class = GetEventClass (eventRef);
- if (!NILP (Vmac_emulate_three_button_mouse) &&
- (class == kEventClassMouse || class == kEventClassCommand))
+ if (!NILP (Vmac_emulate_three_button_mouse)
+ && (class == kEventClassMouse || class == kEventClassCommand))
{
mods &= ~(optionKey | cmdKey);
}
@@ -3560,6 +3558,9 @@ XTread_socket (sd, expected, hold_quit)
OSStatus err;
HIViewRef ch;
+ if (FrontNonFloatingWindow () != window_ptr)
+ SelectWindow (window_ptr);
+
err = HIViewGetViewForMouseEvent (HIViewGetRoot (window_ptr),
eventRef, &ch);
/* This doesn't work on Mac OS X 10.2. */
@@ -4248,7 +4249,6 @@ x_activate_menubar (f)
{
SInt32 menu_choice;
SInt16 menu_id, menu_item;
- extern Point saved_menu_event_location;
set_frame_menubar (f, 0, 1);
BLOCK_INPUT;
@@ -5704,6 +5704,75 @@ static pascal OSErr mac_do_receive_drag P_ ((WindowRef, void *, DragRef));
static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL;
static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL;
+static OSErr
+create_apple_event_from_drag_ref (drag, num_types, types, result)
+ DragRef drag;
+ UInt32 num_types;
+ const FlavorType *types;
+ AppleEvent *result;
+{
+ OSErr err;
+ UInt16 num_items;
+ AppleEvent items;
+ long index;
+ char *buf = NULL;
+
+ err = CountDragItems (drag, &num_items);
+ if (err != noErr)
+ return err;
+ err = AECreateList (NULL, 0, false, &items);
+ if (err != noErr)
+ return err;
+
+ for (index = 1; index <= num_items; index++)
+ {
+ ItemReference item;
+ DescType desc_type = typeNull;
+ Size size;
+
+ err = GetDragItemReferenceNumber (drag, index, &item);
+ if (err == noErr)
+ {
+ int i;
+
+ for (i = 0; i < num_types; i++)
+ {
+ err = GetFlavorDataSize (drag, item, types[i], &size);
+ if (err == noErr)
+ {
+ buf = xrealloc (buf, size);
+ err = GetFlavorData (drag, item, types[i], buf, &size, 0);
+ }
+ if (err == noErr)
+ {
+ desc_type = types[i];
+ break;
+ }
+ }
+ }
+ err = AEPutPtr (&items, index, desc_type,
+ desc_type != typeNull ? buf : NULL,
+ desc_type != typeNull ? size : 0);
+ if (err != noErr)
+ break;
+ }
+ if (buf)
+ xfree (buf);
+
+ if (err == noErr)
+ {
+ err = create_apple_event (0, 0, result); /* Dummy class and ID. */
+ if (err == noErr)
+ err = AEPutParamDesc (result, keyDirectObject, &items);
+ if (err != noErr)
+ AEDisposeDesc (result);
+ }
+
+ AEDisposeDesc (&items);
+
+ return err;
+}
+
static void
mac_store_drag_event (window, mouse_pos, modifiers, desc)
WindowRef window;