diff options
| author | Miles Bader | 2008-04-23 05:55:42 +0000 |
|---|---|---|
| committer | Miles Bader | 2008-04-23 05:55:42 +0000 |
| commit | a113b3ca322fd73d97d0d9d69c9f48dc13fb326a (patch) | |
| tree | 37b3ad22a198a83f68738ef86aec187bb6d926d9 /src | |
| parent | e96a8d6dc0ffc35cf6c02924de2453c69fa8f6fe (diff) | |
| parent | 81fe843b5a3cc7708e0800aeb5bc0dbe448e800a (diff) | |
| download | emacs-a113b3ca322fd73d97d0d9d69c9f48dc13fb326a.tar.gz emacs-a113b3ca322fd73d97d0d9d69c9f48dc13fb326a.zip | |
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1121
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 61 | ||||
| -rw-r--r-- | src/alloc.c | 6 | ||||
| -rw-r--r-- | src/mac.c | 151 | ||||
| -rw-r--r-- | src/macgui.h | 5 | ||||
| -rw-r--r-- | src/macterm.c | 122 | ||||
| -rw-r--r-- | src/macterm.h | 15 | ||||
| -rw-r--r-- | src/mactoolbox.c | 85 | ||||
| -rw-r--r-- | src/w32.c | 5 | ||||
| -rw-r--r-- | src/w32proc.c | 10 |
9 files changed, 283 insertions, 177 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 378718dfc81..c346bb9f31d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,64 @@ | |||
| 1 | 2008-04-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * mac.c (create_apple_event) [TARGET_API_MAC_CARBON]: | ||
| 4 | Make function non-static. | ||
| 5 | (create_apple_event_from_event_ref) [TARGET_API_MAC_CARBON]: | ||
| 6 | Remove function. | ||
| 7 | (create_apple_event_from_drag_ref) [TARGET_API_MAC_CARBON]: | ||
| 8 | Move to mactoolbox.c. | ||
| 9 | (mac_event_parameters_to_lisp) [TARGET_API_MAC_CARBON]: New function. | ||
| 10 | |||
| 11 | * macgui.h (CGFloat) [!CGFLOAT_DEFINED]: New typedef. | ||
| 12 | (mac_rect_make): New macro. | ||
| 13 | |||
| 14 | * macterm.c (mac_draw_image_string_atsui) [MAC_OSX]: Use CGFloat | ||
| 15 | instead of float. | ||
| 16 | (mac_draw_image_string_cg) [USE_CG_TEXT_DRAWING]: Likewise. | ||
| 17 | (init_cg_color, mac_draw_line, mac_draw_cg_image, XSetForeground) | ||
| 18 | (XSetBackground) [USE_CG_DRAWING]: Likewise. | ||
| 19 | (mac_draw_image_string_atsui) [MAC_OSX]: Use mac_rect_make instead of | ||
| 20 | CGRectMake. | ||
| 21 | (mac_draw_image_string_cg) [USE_CG_TEXT_DRAWING]: Likewise. | ||
| 22 | (mac_erase_rectangle, mac_draw_cg_image, mac_fill_rectangle) | ||
| 23 | (mac_set_clip_rectangles) [USE_CG_DRAWING]: Likewise. | ||
| 24 | (XCreatePixmap, XCreatePixmapFromBitmapData): Use Window | ||
| 25 | instead of WindowRef in argument type. | ||
| 26 | (XCreatePixmap) [!MAC_OS8]: Don't call SetPortWindowPort. | ||
| 27 | (mac_invert_rectangle): Use CGContextSetBlendMode if available. | ||
| 28 | (mac_set_clip_rectangles, mac_reset_clip_rectangles): Take argument F | ||
| 29 | instead of DISPLAY. All uses changed. | ||
| 30 | (mac_handle_size_change): Don't call SET_FRAME_GARBAGED. | ||
| 31 | (x_calc_absolute_position): Simplify so as not to use | ||
| 32 | FRAME_PIXEL_WIDTH/FRAME_PIXEL_HEIGHT. | ||
| 33 | |||
| 34 | * macterm.h (XCreatePixmap, XCreatePixmapFromBitmapData): Use Window | ||
| 35 | instead of WindowRef in argument type. | ||
| 36 | (create_apple_event_from_event_ref, create_apple_event_from_drag_ref) | ||
| 37 | [TARGET_API_MAC_CARBON]: Remove externs. | ||
| 38 | (create_apple_event, mac_event_parameters_to_lisp) | ||
| 39 | [TARGET_API_MAC_CARBON]: Add externs. | ||
| 40 | |||
| 41 | * mactoolbox.c: (Vmac_ts_script_language_on_focus) | ||
| 42 | (saved_ts_script_language_on_focus) [USE_MAC_TSM]: Remove externs. | ||
| 43 | (XTread_socket) [USE_MAC_TOOLBAR]: Select window if its structure part | ||
| 44 | is clicked. | ||
| 45 | (x_activate_menubar): Remove extern for saved_menu_event_location. | ||
| 46 | (create_apple_event_from_drag_ref) [TARGET_API_MAC_CARBON]: | ||
| 47 | Move from mac.c. | ||
| 48 | |||
| 49 | 2008-04-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 50 | |||
| 51 | * alloc.c [!SYSTEM_MALLOC && !SYNC_INPUT] (uninterrupt_malloc) | ||
| 52 | [HAVE_GTK_AND_PTHREAD && !DOUG_LEA_MALLOC]: Don't use recursive mutex. | ||
| 53 | |||
| 54 | 2008-04-10 Jason Rumney <jasonr@gnu.org> | ||
| 55 | |||
| 56 | * w32.c (stat): When Vw32_get_true_file_attributes is Qlocal, get | ||
| 57 | attributes only for local files. | ||
| 58 | |||
| 59 | * w32proc.c (syms_of_ntproc): Change Vw32_get_true_file attributes | ||
| 60 | default to Qlocal. | ||
| 61 | |||
| 1 | 2008-04-22 Juri Linkov <juri@jurta.org> | 62 | 2008-04-22 Juri Linkov <juri@jurta.org> |
| 2 | 63 | ||
| 3 | * buffer.c (Fswitch_to_buffer): Change interactive spec to call | 64 | * buffer.c (Fswitch_to_buffer): Change interactive spec to call |
diff --git a/src/alloc.c b/src/alloc.c index fe37eec9379..64c8cc8264e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1366,6 +1366,7 @@ void | |||
| 1366 | uninterrupt_malloc () | 1366 | uninterrupt_malloc () |
| 1367 | { | 1367 | { |
| 1368 | #ifdef HAVE_GTK_AND_PTHREAD | 1368 | #ifdef HAVE_GTK_AND_PTHREAD |
| 1369 | #ifdef DOUG_LEA_MALLOC | ||
| 1369 | pthread_mutexattr_t attr; | 1370 | pthread_mutexattr_t attr; |
| 1370 | 1371 | ||
| 1371 | /* GLIBC has a faster way to do this, but lets keep it portable. | 1372 | /* GLIBC has a faster way to do this, but lets keep it portable. |
| @@ -1373,6 +1374,11 @@ uninterrupt_malloc () | |||
| 1373 | pthread_mutexattr_init (&attr); | 1374 | pthread_mutexattr_init (&attr); |
| 1374 | pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); | 1375 | pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); |
| 1375 | pthread_mutex_init (&alloc_mutex, &attr); | 1376 | pthread_mutex_init (&alloc_mutex, &attr); |
| 1377 | #else /* !DOUG_LEA_MALLOC */ | ||
| 1378 | /* Some systems such as Solaris 2.6 doesn't have a recursive mutex, | ||
| 1379 | and the bundled gmalloc.c doesn't require it. */ | ||
| 1380 | pthread_mutex_init (&alloc_mutex, NULL); | ||
| 1381 | #endif /* !DOUG_LEA_MALLOC */ | ||
| 1376 | #endif /* HAVE_GTK_AND_PTHREAD */ | 1382 | #endif /* HAVE_GTK_AND_PTHREAD */ |
| 1377 | 1383 | ||
| 1378 | if (__free_hook != emacs_blocked_free) | 1384 | if (__free_hook != emacs_blocked_free) |
| @@ -817,7 +817,7 @@ init_coercion_handler () | |||
| 817 | } | 817 | } |
| 818 | 818 | ||
| 819 | #if TARGET_API_MAC_CARBON | 819 | #if TARGET_API_MAC_CARBON |
| 820 | static OSErr | 820 | OSErr |
| 821 | create_apple_event (class, id, result) | 821 | create_apple_event (class, id, result) |
| 822 | AEEventClass class; | 822 | AEEventClass class; |
| 823 | AEEventID id; | 823 | AEEventID id; |
| @@ -842,129 +842,76 @@ create_apple_event (class, id, result) | |||
| 842 | return err; | 842 | return err; |
| 843 | } | 843 | } |
| 844 | 844 | ||
| 845 | OSStatus | 845 | Lisp_Object |
| 846 | create_apple_event_from_event_ref (event, num_params, names, types, result) | 846 | mac_event_parameters_to_lisp (event, num_params, names, types) |
| 847 | EventRef event; | 847 | EventRef event; |
| 848 | UInt32 num_params; | 848 | UInt32 num_params; |
| 849 | const EventParamName *names; | 849 | const EventParamName *names; |
| 850 | const EventParamType *types; | 850 | const EventParamType *types; |
| 851 | AppleEvent *result; | ||
| 852 | { | 851 | { |
| 853 | OSStatus err; | 852 | OSStatus err; |
| 854 | UInt32 i, size; | 853 | Lisp_Object result = Qnil; |
| 854 | UInt32 i; | ||
| 855 | ByteCount size; | ||
| 856 | #ifdef MAC_OSX | ||
| 855 | CFStringRef string; | 857 | CFStringRef string; |
| 856 | CFDataRef data; | 858 | CFDataRef data; |
| 857 | char *buf = NULL; | ||
| 858 | |||
| 859 | err = create_apple_event (0, 0, result); /* Dummy class and ID. */ | ||
| 860 | if (err != noErr) | ||
| 861 | return err; | ||
| 862 | |||
| 863 | for (i = 0; i < num_params; i++) | ||
| 864 | switch (types[i]) | ||
| 865 | { | ||
| 866 | #ifdef MAC_OSX | ||
| 867 | case typeCFStringRef: | ||
| 868 | err = GetEventParameter (event, names[i], typeCFStringRef, NULL, | ||
| 869 | sizeof (CFStringRef), NULL, &string); | ||
| 870 | if (err != noErr) | ||
| 871 | break; | ||
| 872 | data = CFStringCreateExternalRepresentation (NULL, string, | ||
| 873 | kCFStringEncodingUTF8, | ||
| 874 | '?'); | ||
| 875 | if (data == NULL) | ||
| 876 | break; | ||
| 877 | AEPutParamPtr (result, names[i], typeUTF8Text, | ||
| 878 | CFDataGetBytePtr (data), CFDataGetLength (data)); | ||
| 879 | CFRelease (data); | ||
| 880 | break; | ||
| 881 | #endif | 859 | #endif |
| 882 | |||
| 883 | default: | ||
| 884 | err = GetEventParameter (event, names[i], types[i], NULL, | ||
| 885 | 0, &size, NULL); | ||
| 886 | if (err != noErr) | ||
| 887 | break; | ||
| 888 | buf = xrealloc (buf, size); | ||
| 889 | err = GetEventParameter (event, names[i], types[i], NULL, | ||
| 890 | size, NULL, buf); | ||
| 891 | if (err == noErr) | ||
| 892 | AEPutParamPtr (result, names[i], types[i], buf, size); | ||
| 893 | break; | ||
| 894 | } | ||
| 895 | if (buf) | ||
| 896 | xfree (buf); | ||
| 897 | |||
| 898 | return noErr; | ||
| 899 | } | ||
| 900 | |||
| 901 | OSErr | ||
| 902 | create_apple_event_from_drag_ref (drag, num_types, types, result) | ||
| 903 | DragRef drag; | ||
| 904 | UInt32 num_types; | ||
| 905 | const FlavorType *types; | ||
| 906 | AppleEvent *result; | ||
| 907 | { | ||
| 908 | OSErr err; | ||
| 909 | UInt16 num_items; | ||
| 910 | AppleEvent items; | ||
| 911 | long index; | ||
| 912 | char *buf = NULL; | 860 | char *buf = NULL; |
| 913 | 861 | ||
| 914 | err = CountDragItems (drag, &num_items); | 862 | for (i = 0; i < num_params; i++) |
| 915 | if (err != noErr) | ||
| 916 | return err; | ||
| 917 | err = AECreateList (NULL, 0, false, &items); | ||
| 918 | if (err != noErr) | ||
| 919 | return err; | ||
| 920 | |||
| 921 | for (index = 1; index <= num_items; index++) | ||
| 922 | { | 863 | { |
| 923 | ItemReference item; | 864 | EventParamName name = names[i]; |
| 924 | DescType desc_type = typeNull; | 865 | EventParamType type = types[i]; |
| 925 | Size size; | ||
| 926 | 866 | ||
| 927 | err = GetDragItemReferenceNumber (drag, index, &item); | 867 | switch (type) |
| 928 | if (err == noErr) | ||
| 929 | { | 868 | { |
| 930 | int i; | 869 | #ifdef MAC_OSX |
| 870 | case typeCFStringRef: | ||
| 871 | err = GetEventParameter (event, name, typeCFStringRef, NULL, | ||
| 872 | sizeof (CFStringRef), NULL, &string); | ||
| 873 | if (err != noErr) | ||
| 874 | break; | ||
| 875 | data = CFStringCreateExternalRepresentation (NULL, string, | ||
| 876 | kCFStringEncodingUTF8, | ||
| 877 | '?'); | ||
| 878 | if (data == NULL) | ||
| 879 | break; | ||
| 880 | name = EndianU32_NtoB (name); | ||
| 881 | type = EndianU32_NtoB (typeUTF8Text); | ||
| 882 | result = | ||
| 883 | Fcons (Fcons (make_unibyte_string ((char *) &name, 4), | ||
| 884 | Fcons (make_unibyte_string ((char *) &type, 4), | ||
| 885 | make_unibyte_string (CFDataGetBytePtr (data), | ||
| 886 | CFDataGetLength (data)))), | ||
| 887 | result); | ||
| 888 | CFRelease (data); | ||
| 889 | break; | ||
| 890 | #endif | ||
| 931 | 891 | ||
| 932 | for (i = 0; i < num_types; i++) | 892 | default: |
| 893 | err = GetEventParameter (event, name, type, NULL, 0, &size, NULL); | ||
| 894 | if (err != noErr) | ||
| 895 | break; | ||
| 896 | buf = xrealloc (buf, size); | ||
| 897 | err = GetEventParameter (event, name, type, NULL, size, NULL, buf); | ||
| 898 | if (err == noErr) | ||
| 933 | { | 899 | { |
| 934 | err = GetFlavorDataSize (drag, item, types[i], &size); | 900 | name = EndianU32_NtoB (name); |
| 935 | if (err == noErr) | 901 | type = EndianU32_NtoB (type); |
| 936 | { | 902 | result = |
| 937 | buf = xrealloc (buf, size); | 903 | Fcons (Fcons (make_unibyte_string ((char *) &name, 4), |
| 938 | err = GetFlavorData (drag, item, types[i], buf, &size, 0); | 904 | Fcons (make_unibyte_string ((char *) &type, 4), |
| 939 | } | 905 | make_unibyte_string (buf, size))), |
| 940 | if (err == noErr) | 906 | result); |
| 941 | { | ||
| 942 | desc_type = types[i]; | ||
| 943 | break; | ||
| 944 | } | ||
| 945 | } | 907 | } |
| 908 | break; | ||
| 946 | } | 909 | } |
| 947 | err = AEPutPtr (&items, index, desc_type, | ||
| 948 | desc_type != typeNull ? buf : NULL, | ||
| 949 | desc_type != typeNull ? size : 0); | ||
| 950 | if (err != noErr) | ||
| 951 | break; | ||
| 952 | } | 910 | } |
| 953 | if (buf) | 911 | if (buf) |
| 954 | xfree (buf); | 912 | xfree (buf); |
| 955 | 913 | ||
| 956 | if (err == noErr) | 914 | return result; |
| 957 | { | ||
| 958 | err = create_apple_event (0, 0, result); /* Dummy class and ID. */ | ||
| 959 | if (err == noErr) | ||
| 960 | err = AEPutParamDesc (result, keyDirectObject, &items); | ||
| 961 | if (err != noErr) | ||
| 962 | AEDisposeDesc (result); | ||
| 963 | } | ||
| 964 | |||
| 965 | AEDisposeDesc (&items); | ||
| 966 | |||
| 967 | return err; | ||
| 968 | } | 915 | } |
| 969 | #endif /* TARGET_API_MAC_CARBON */ | 916 | #endif /* TARGET_API_MAC_CARBON */ |
| 970 | 917 | ||
diff --git a/src/macgui.h b/src/macgui.h index c549a885f48..41ac28f49ec 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -126,6 +126,10 @@ typedef unsigned long Time; | |||
| 126 | #endif | 126 | #endif |
| 127 | #endif | 127 | #endif |
| 128 | 128 | ||
| 129 | #ifndef CGFLOAT_DEFINED | ||
| 130 | typedef float CGFloat; | ||
| 131 | #endif | ||
| 132 | |||
| 129 | typedef WindowRef Window; | 133 | typedef WindowRef Window; |
| 130 | #if TARGET_API_MAC_CARBON | 134 | #if TARGET_API_MAC_CARBON |
| 131 | typedef ScrapRef Selection; | 135 | typedef ScrapRef Selection; |
| @@ -149,6 +153,7 @@ typedef int Selection; | |||
| 149 | #define mac_size_window SizeWindow | 153 | #define mac_size_window SizeWindow |
| 150 | #define mac_get_global_mouse GetGlobalMouse | 154 | #define mac_get_global_mouse GetGlobalMouse |
| 151 | #define mac_is_window_toolbar_visible IsWindowToolbarVisible | 155 | #define mac_is_window_toolbar_visible IsWindowToolbarVisible |
| 156 | #define mac_rect_make(f, x, y, w, h) CGRectMake (x, y, w, h) | ||
| 152 | typedef GWorldPtr Pixmap; | 157 | typedef GWorldPtr Pixmap; |
| 153 | 158 | ||
| 154 | #define Cursor ThemeCursor | 159 | #define Cursor ThemeCursor |
diff --git a/src/macterm.c b/src/macterm.c index 842e1844f50..f4715c7f772 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -351,7 +351,7 @@ init_cg_color () | |||
| 351 | if (CGColorGetTypeID != NULL) | 351 | if (CGColorGetTypeID != NULL) |
| 352 | #endif | 352 | #endif |
| 353 | { | 353 | { |
| 354 | float rgba[] = {0.0f, 0.0f, 0.0f, 1.0f}; | 354 | CGFloat rgba[] = {0.0f, 0.0f, 0.0f, 1.0f}; |
| 355 | 355 | ||
| 356 | mac_cg_color_black = CGColorCreate (mac_cg_color_space_rgb, rgba); | 356 | mac_cg_color_black = CGColorCreate (mac_cg_color_space_rgb, rgba); |
| 357 | } | 357 | } |
| @@ -460,7 +460,7 @@ mac_draw_line (f, gc, x1, y1, x2, y2) | |||
| 460 | { | 460 | { |
| 461 | #if USE_CG_DRAWING | 461 | #if USE_CG_DRAWING |
| 462 | CGContextRef context; | 462 | CGContextRef context; |
| 463 | float gx1 = x1, gy1 = y1, gx2 = x2, gy2 = y2; | 463 | CGFloat gx1 = x1, gy1 = y1, gx2 = x2, gy2 = y2; |
| 464 | 464 | ||
| 465 | if (y1 != y2) | 465 | if (y1 != y2) |
| 466 | gx1 += 0.5f, gx2 += 0.5f; | 466 | gx1 += 0.5f, gx2 += 0.5f; |
| @@ -553,7 +553,7 @@ mac_erase_rectangle (f, gc, x, y, width, height) | |||
| 553 | 553 | ||
| 554 | context = mac_begin_cg_clip (f, gc); | 554 | context = mac_begin_cg_clip (f, gc); |
| 555 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); | 555 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); |
| 556 | CGContextFillRect (context, CGRectMake (x, y, width, height)); | 556 | CGContextFillRect (context, mac_rect_make (f, x, y, width, height)); |
| 557 | mac_end_cg_clip (f); | 557 | mac_end_cg_clip (f); |
| 558 | } | 558 | } |
| 559 | #else | 559 | #else |
| @@ -632,8 +632,8 @@ mac_draw_cg_image (image, f, gc, src_x, src_y, width, height, | |||
| 632 | int dest_x, dest_y, overlay_p; | 632 | int dest_x, dest_y, overlay_p; |
| 633 | { | 633 | { |
| 634 | CGContextRef context; | 634 | CGContextRef context; |
| 635 | float port_height = FRAME_PIXEL_HEIGHT (f); | 635 | CGFloat port_height = FRAME_PIXEL_HEIGHT (f); |
| 636 | CGRect dest_rect = CGRectMake (dest_x, dest_y, width, height); | 636 | CGRect dest_rect = mac_rect_make (f, dest_x, dest_y, width, height); |
| 637 | 637 | ||
| 638 | context = mac_begin_cg_clip (f, gc); | 638 | context = mac_begin_cg_clip (f, gc); |
| 639 | if (!overlay_p) | 639 | if (!overlay_p) |
| @@ -647,11 +647,11 @@ mac_draw_cg_image (image, f, gc, src_x, src_y, width, height, | |||
| 647 | if (CGImageIsMask (image)) | 647 | if (CGImageIsMask (image)) |
| 648 | CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); | 648 | CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); |
| 649 | CGContextDrawImage (context, | 649 | CGContextDrawImage (context, |
| 650 | CGRectMake (dest_x - src_x, | 650 | mac_rect_make (f, dest_x - src_x, |
| 651 | port_height - (dest_y - src_y | 651 | port_height - (dest_y - src_y |
| 652 | + CGImageGetHeight (image)), | 652 | + CGImageGetHeight (image)), |
| 653 | CGImageGetWidth (image), | 653 | CGImageGetWidth (image), |
| 654 | CGImageGetHeight (image)), | 654 | CGImageGetHeight (image)), |
| 655 | image); | 655 | image); |
| 656 | mac_end_cg_clip (f); | 656 | mac_end_cg_clip (f); |
| 657 | } | 657 | } |
| @@ -744,7 +744,7 @@ mac_free_bitmap (bitmap) | |||
| 744 | Pixmap | 744 | Pixmap |
| 745 | XCreatePixmap (display, w, width, height, depth) | 745 | XCreatePixmap (display, w, width, height, depth) |
| 746 | Display *display; | 746 | Display *display; |
| 747 | WindowRef w; | 747 | Window w; |
| 748 | unsigned int width, height; | 748 | unsigned int width, height; |
| 749 | unsigned int depth; | 749 | unsigned int depth; |
| 750 | { | 750 | { |
| @@ -752,8 +752,9 @@ XCreatePixmap (display, w, width, height, depth) | |||
| 752 | Rect r; | 752 | Rect r; |
| 753 | QDErr err; | 753 | QDErr err; |
| 754 | 754 | ||
| 755 | #ifdef MAC_OS8 | ||
| 755 | SetPortWindowPort (w); | 756 | SetPortWindowPort (w); |
| 756 | 757 | #endif | |
| 757 | SetRect (&r, 0, 0, width, height); | 758 | SetRect (&r, 0, 0, width, height); |
| 758 | #if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING | 759 | #if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING |
| 759 | if (depth == 1) | 760 | if (depth == 1) |
| @@ -773,7 +774,7 @@ XCreatePixmap (display, w, width, height, depth) | |||
| 773 | Pixmap | 774 | Pixmap |
| 774 | XCreatePixmapFromBitmapData (display, w, data, width, height, fg, bg, depth) | 775 | XCreatePixmapFromBitmapData (display, w, data, width, height, fg, bg, depth) |
| 775 | Display *display; | 776 | Display *display; |
| 776 | WindowRef w; | 777 | Window w; |
| 777 | char *data; | 778 | char *data; |
| 778 | unsigned int width, height; | 779 | unsigned int width, height; |
| 779 | unsigned long fg, bg; | 780 | unsigned long fg, bg; |
| @@ -838,7 +839,7 @@ mac_fill_rectangle (f, gc, x, y, width, height) | |||
| 838 | 839 | ||
| 839 | context = mac_begin_cg_clip (f, gc); | 840 | context = mac_begin_cg_clip (f, gc); |
| 840 | CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); | 841 | CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); |
| 841 | CGContextFillRect (context, CGRectMake (x, y, width, height)); | 842 | CGContextFillRect (context, mac_rect_make (f, x, y, width, height)); |
| 842 | mac_end_cg_clip (f); | 843 | mac_end_cg_clip (f); |
| 843 | #else | 844 | #else |
| 844 | Rect r; | 845 | Rect r; |
| @@ -887,7 +888,26 @@ mac_invert_rectangle (f, x, y, width, height) | |||
| 887 | int x, y; | 888 | int x, y; |
| 888 | unsigned int width, height; | 889 | unsigned int width, height; |
| 889 | { | 890 | { |
| 890 | Rect r; | 891 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 |
| 892 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1040 && MAC_OS_X_VERSION_MIN_REQUIRED >= 1020 | ||
| 893 | if (CGContextSetBlendMode != NULL) | ||
| 894 | #endif | ||
| 895 | { | ||
| 896 | CGContextRef context; | ||
| 897 | |||
| 898 | context = mac_begin_cg_clip (f, NULL); | ||
| 899 | CGContextSetRGBFillColor (context, 1.0f, 1.0f, 1.0f, 1.0f); | ||
| 900 | CGContextSetBlendMode (context, kCGBlendModeDifference); | ||
| 901 | CGContextFillRect (context, mac_rect_make (f, x, y, width, height)); | ||
| 902 | mac_end_cg_clip (f); | ||
| 903 | } | ||
| 904 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1040 && MAC_OS_X_VERSION_MIN_REQUIRED >= 1020 | ||
| 905 | else /* CGContextSetBlendMode == NULL */ | ||
| 906 | #endif | ||
| 907 | #endif /* USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ | ||
| 908 | #if !USE_CG_DRAWING || MAC_OS_X_VERSION_MAX_ALLOWED < 1040 || (MAC_OS_X_VERSION_MIN_REQUIRED < 1040 && MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) | ||
| 909 | { | ||
| 910 | Rect r; | ||
| 891 | 911 | ||
| 892 | #if USE_CG_DRAWING | 912 | #if USE_CG_DRAWING |
| 893 | mac_prepare_for_quickdraw (f); | 913 | mac_prepare_for_quickdraw (f); |
| @@ -1018,7 +1038,7 @@ mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width, | |||
| 1018 | else | 1038 | else |
| 1019 | { | 1039 | { |
| 1020 | static CGContextRef context; | 1040 | static CGContextRef context; |
| 1021 | float port_height = FRAME_PIXEL_HEIGHT (f); | 1041 | CGFloat port_height = FRAME_PIXEL_HEIGHT (f); |
| 1022 | static const ATSUAttributeTag tags[] = {kATSUCGContextTag}; | 1042 | static const ATSUAttributeTag tags[] = {kATSUCGContextTag}; |
| 1023 | static const ByteCount sizes[] = {sizeof (CGContextRef)}; | 1043 | static const ByteCount sizes[] = {sizeof (CGContextRef)}; |
| 1024 | static const ATSUAttributeValuePtr values[] = {&context}; | 1044 | static const ATSUAttributeValuePtr values[] = {&context}; |
| @@ -1042,9 +1062,10 @@ mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width, | |||
| 1042 | { | 1062 | { |
| 1043 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); | 1063 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); |
| 1044 | CGContextFillRect (context, | 1064 | CGContextFillRect (context, |
| 1045 | CGRectMake (x, y - FONT_BASE (GC_FONT (gc)), | 1065 | mac_rect_make (f, |
| 1046 | bg_width, | 1066 | x, y - FONT_BASE (GC_FONT (gc)), |
| 1047 | FONT_HEIGHT (GC_FONT (gc)))); | 1067 | bg_width, |
| 1068 | FONT_HEIGHT (GC_FONT (gc)))); | ||
| 1048 | } | 1069 | } |
| 1049 | CGContextScaleCTM (context, 1, -1); | 1070 | CGContextScaleCTM (context, 1, -1); |
| 1050 | CGContextTranslateCTM (context, 0, -port_height); | 1071 | CGContextTranslateCTM (context, 0, -port_height); |
| @@ -1388,7 +1409,7 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) | |||
| 1388 | XChar2b *buf; | 1409 | XChar2b *buf; |
| 1389 | int nchars, bg_width, overstrike_p; | 1410 | int nchars, bg_width, overstrike_p; |
| 1390 | { | 1411 | { |
| 1391 | float port_height, gx, gy; | 1412 | CGFloat port_height, gx, gy; |
| 1392 | int i; | 1413 | int i; |
| 1393 | CGContextRef context; | 1414 | CGContextRef context; |
| 1394 | CGGlyph *glyphs; | 1415 | CGGlyph *glyphs; |
| @@ -1430,8 +1451,8 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) | |||
| 1430 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); | 1451 | CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); |
| 1431 | CGContextFillRect | 1452 | CGContextFillRect |
| 1432 | (context, | 1453 | (context, |
| 1433 | CGRectMake (gx, y - FONT_BASE (GC_FONT (gc)), | 1454 | mac_rect_make (f, gx, y - FONT_BASE (GC_FONT (gc)), |
| 1434 | bg_width, FONT_HEIGHT (GC_FONT (gc)))); | 1455 | bg_width, FONT_HEIGHT (GC_FONT (gc)))); |
| 1435 | } | 1456 | } |
| 1436 | CGContextScaleCTM (context, 1, -1); | 1457 | CGContextScaleCTM (context, 1, -1); |
| 1437 | CGContextTranslateCTM (context, 0, -port_height); | 1458 | CGContextTranslateCTM (context, 0, -port_height); |
| @@ -1733,7 +1754,7 @@ XSetForeground (display, gc, color) | |||
| 1733 | } | 1754 | } |
| 1734 | else | 1755 | else |
| 1735 | { | 1756 | { |
| 1736 | float rgba[4]; | 1757 | CGFloat rgba[4]; |
| 1737 | 1758 | ||
| 1738 | rgba[0] = gc->fore_color.red / 65535.0f; | 1759 | rgba[0] = gc->fore_color.red / 65535.0f; |
| 1739 | rgba[1] = gc->fore_color.green / 65535.0f; | 1760 | rgba[1] = gc->fore_color.green / 65535.0f; |
| @@ -1774,7 +1795,7 @@ XSetBackground (display, gc, color) | |||
| 1774 | } | 1795 | } |
| 1775 | else | 1796 | else |
| 1776 | { | 1797 | { |
| 1777 | float rgba[4]; | 1798 | CGFloat rgba[4]; |
| 1778 | 1799 | ||
| 1779 | rgba[0] = gc->back_color.red / 65535.0f; | 1800 | rgba[0] = gc->back_color.red / 65535.0f; |
| 1780 | rgba[1] = gc->back_color.green / 65535.0f; | 1801 | rgba[1] = gc->back_color.green / 65535.0f; |
| @@ -1803,8 +1824,8 @@ XSetFont (display, gc, font) | |||
| 1803 | /* Mac replacement for XSetClipRectangles. */ | 1824 | /* Mac replacement for XSetClipRectangles. */ |
| 1804 | 1825 | ||
| 1805 | static void | 1826 | static void |
| 1806 | mac_set_clip_rectangles (display, gc, rectangles, n) | 1827 | mac_set_clip_rectangles (f, gc, rectangles, n) |
| 1807 | Display *display; | 1828 | struct frame *f; |
| 1808 | GC gc; | 1829 | GC gc; |
| 1809 | Rect *rectangles; | 1830 | Rect *rectangles; |
| 1810 | int n; | 1831 | int n; |
| @@ -1836,9 +1857,9 @@ mac_set_clip_rectangles (display, gc, rectangles, n) | |||
| 1836 | { | 1857 | { |
| 1837 | Rect *rect = rectangles + i; | 1858 | Rect *rect = rectangles + i; |
| 1838 | 1859 | ||
| 1839 | gc->clip_rects[i] = CGRectMake (rect->left, rect->top, | 1860 | gc->clip_rects[i] = mac_rect_make (f, rect->left, rect->top, |
| 1840 | rect->right - rect->left, | 1861 | rect->right - rect->left, |
| 1841 | rect->bottom - rect->top); | 1862 | rect->bottom - rect->top); |
| 1842 | } | 1863 | } |
| 1843 | #endif | 1864 | #endif |
| 1844 | } | 1865 | } |
| @@ -1847,8 +1868,8 @@ mac_set_clip_rectangles (display, gc, rectangles, n) | |||
| 1847 | /* Mac replacement for XSetClipMask. */ | 1868 | /* Mac replacement for XSetClipMask. */ |
| 1848 | 1869 | ||
| 1849 | static INLINE void | 1870 | static INLINE void |
| 1850 | mac_reset_clip_rectangles (display, gc) | 1871 | mac_reset_clip_rectangles (f, gc) |
| 1851 | Display *display; | 1872 | struct frame *f; |
| 1852 | GC gc; | 1873 | GC gc; |
| 1853 | { | 1874 | { |
| 1854 | gc->n_clip_rects = 0; | 1875 | gc->n_clip_rects = 0; |
| @@ -2338,7 +2359,7 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 2338 | XSetForeground (display, face->gc, gcv.foreground); | 2359 | XSetForeground (display, face->gc, gcv.foreground); |
| 2339 | } | 2360 | } |
| 2340 | 2361 | ||
| 2341 | mac_reset_clip_rectangles (display, face->gc); | 2362 | mac_reset_clip_rectangles (f, face->gc); |
| 2342 | } | 2363 | } |
| 2343 | 2364 | ||
| 2344 | #if USE_CG_DRAWING | 2365 | #if USE_CG_DRAWING |
| @@ -2852,7 +2873,7 @@ x_set_glyph_string_clipping (s) | |||
| 2852 | int n; | 2873 | int n; |
| 2853 | 2874 | ||
| 2854 | n = get_glyph_string_clip_rects (s, rects, MAX_CLIP_RECTS); | 2875 | n = get_glyph_string_clip_rects (s, rects, MAX_CLIP_RECTS); |
| 2855 | mac_set_clip_rectangles (s->display, s->gc, rects, n); | 2876 | mac_set_clip_rectangles (s->f, s->gc, rects, n); |
| 2856 | } | 2877 | } |
| 2857 | 2878 | ||
| 2858 | 2879 | ||
| @@ -3442,7 +3463,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 3442 | gc = f->output_data.mac->white_relief.gc; | 3463 | gc = f->output_data.mac->white_relief.gc; |
| 3443 | else | 3464 | else |
| 3444 | gc = f->output_data.mac->black_relief.gc; | 3465 | gc = f->output_data.mac->black_relief.gc; |
| 3445 | mac_set_clip_rectangles (dpy, gc, clip_rect, 1); | 3466 | mac_set_clip_rectangles (f, gc, clip_rect, 1); |
| 3446 | 3467 | ||
| 3447 | /* Top. */ | 3468 | /* Top. */ |
| 3448 | if (top_p) | 3469 | if (top_p) |
| @@ -3457,12 +3478,12 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 3457 | mac_draw_line (f, gc, | 3478 | mac_draw_line (f, gc, |
| 3458 | left_x + i, top_y + i, left_x + i, bottom_y - i + 1); | 3479 | left_x + i, top_y + i, left_x + i, bottom_y - i + 1); |
| 3459 | 3480 | ||
| 3460 | mac_reset_clip_rectangles (dpy, gc); | 3481 | mac_reset_clip_rectangles (f, gc); |
| 3461 | if (raised_p) | 3482 | if (raised_p) |
| 3462 | gc = f->output_data.mac->black_relief.gc; | 3483 | gc = f->output_data.mac->black_relief.gc; |
| 3463 | else | 3484 | else |
| 3464 | gc = f->output_data.mac->white_relief.gc; | 3485 | gc = f->output_data.mac->white_relief.gc; |
| 3465 | mac_set_clip_rectangles (dpy, gc, clip_rect, 1); | 3486 | mac_set_clip_rectangles (f, gc, clip_rect, 1); |
| 3466 | 3487 | ||
| 3467 | /* Bottom. */ | 3488 | /* Bottom. */ |
| 3468 | if (bot_p) | 3489 | if (bot_p) |
| @@ -3477,7 +3498,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 3477 | mac_draw_line (f, gc, | 3498 | mac_draw_line (f, gc, |
| 3478 | right_x - i, top_y + i + 1, right_x - i, bottom_y - i); | 3499 | right_x - i, top_y + i + 1, right_x - i, bottom_y - i); |
| 3479 | 3500 | ||
| 3480 | mac_reset_clip_rectangles (dpy, gc); | 3501 | mac_reset_clip_rectangles (f, gc); |
| 3481 | } | 3502 | } |
| 3482 | 3503 | ||
| 3483 | 3504 | ||
| @@ -3499,7 +3520,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, | |||
| 3499 | 3520 | ||
| 3500 | XGetGCValues (s->display, s->gc, GCForeground, &xgcv); | 3521 | XGetGCValues (s->display, s->gc, GCForeground, &xgcv); |
| 3501 | XSetForeground (s->display, s->gc, s->face->box_color); | 3522 | XSetForeground (s->display, s->gc, s->face->box_color); |
| 3502 | mac_set_clip_rectangles (s->display, s->gc, clip_rect, 1); | 3523 | mac_set_clip_rectangles (s->f, s->gc, clip_rect, 1); |
| 3503 | 3524 | ||
| 3504 | /* Top. */ | 3525 | /* Top. */ |
| 3505 | mac_fill_rectangle (s->f, s->gc, left_x, top_y, | 3526 | mac_fill_rectangle (s->f, s->gc, left_x, top_y, |
| @@ -3520,7 +3541,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, | |||
| 3520 | top_y, width, bottom_y - top_y + 1); | 3541 | top_y, width, bottom_y - top_y + 1); |
| 3521 | 3542 | ||
| 3522 | XSetForeground (s->display, s->gc, xgcv.foreground); | 3543 | XSetForeground (s->display, s->gc, xgcv.foreground); |
| 3523 | mac_reset_clip_rectangles (s->display, s->gc); | 3544 | mac_reset_clip_rectangles (s->f, s->gc); |
| 3524 | } | 3545 | } |
| 3525 | 3546 | ||
| 3526 | 3547 | ||
| @@ -3829,7 +3850,7 @@ x_draw_stretch_glyph_string (s) | |||
| 3829 | gc = s->face->gc; | 3850 | gc = s->face->gc; |
| 3830 | 3851 | ||
| 3831 | get_glyph_string_clip_rect (s, &r); | 3852 | get_glyph_string_clip_rect (s, &r); |
| 3832 | mac_set_clip_rectangles (s->display, gc, &r, 1); | 3853 | mac_set_clip_rectangles (s->f, gc, &r, 1); |
| 3833 | 3854 | ||
| 3834 | #if 0 /* MAC_TODO: stipple */ | 3855 | #if 0 /* MAC_TODO: stipple */ |
| 3835 | if (s->face->stipple) | 3856 | if (s->face->stipple) |
| @@ -4029,7 +4050,7 @@ x_draw_glyph_string (s) | |||
| 4029 | } | 4050 | } |
| 4030 | 4051 | ||
| 4031 | /* Reset clipping. */ | 4052 | /* Reset clipping. */ |
| 4032 | mac_reset_clip_rectangles (s->display, s->gc); | 4053 | mac_reset_clip_rectangles (s->f, s->gc); |
| 4033 | } | 4054 | } |
| 4034 | 4055 | ||
| 4035 | /* Shift display to make room for inserted glyphs. */ | 4056 | /* Shift display to make room for inserted glyphs. */ |
| @@ -6409,7 +6430,7 @@ x_draw_bar_cursor (w, row, width, kind) | |||
| 6409 | cursor_glyph->pixel_width, | 6430 | cursor_glyph->pixel_width, |
| 6410 | width); | 6431 | width); |
| 6411 | 6432 | ||
| 6412 | mac_reset_clip_rectangles (dpy, gc); | 6433 | mac_reset_clip_rectangles (f, gc); |
| 6413 | } | 6434 | } |
| 6414 | } | 6435 | } |
| 6415 | 6436 | ||
| @@ -6739,7 +6760,6 @@ mac_handle_size_change (f, pixelwidth, pixelheight) | |||
| 6739 | change_frame_size (f, rows, cols, 0, 1, 0); | 6760 | change_frame_size (f, rows, cols, 0, 1, 0); |
| 6740 | FRAME_PIXEL_WIDTH (f) = pixelwidth; | 6761 | FRAME_PIXEL_WIDTH (f) = pixelwidth; |
| 6741 | FRAME_PIXEL_HEIGHT (f) = pixelheight; | 6762 | FRAME_PIXEL_HEIGHT (f) = pixelheight; |
| 6742 | SET_FRAME_GARBAGED (f); | ||
| 6743 | 6763 | ||
| 6744 | /* If cursor was outside the new size, mark it as off. */ | 6764 | /* If cursor was outside the new size, mark it as off. */ |
| 6745 | mark_window_cursors_off (XWINDOW (f->root_window)); | 6765 | mark_window_cursors_off (XWINDOW (f->root_window)); |
| @@ -6772,7 +6792,6 @@ void | |||
| 6772 | x_calc_absolute_position (f) | 6792 | x_calc_absolute_position (f) |
| 6773 | struct frame *f; | 6793 | struct frame *f; |
| 6774 | { | 6794 | { |
| 6775 | int width_diff = 0, height_diff = 0; | ||
| 6776 | int flags = f->size_hint_flags; | 6795 | int flags = f->size_hint_flags; |
| 6777 | Rect inner, outer; | 6796 | Rect inner, outer; |
| 6778 | 6797 | ||
| @@ -6787,22 +6806,15 @@ x_calc_absolute_position (f) | |||
| 6787 | mac_get_window_bounds (f, &inner, &outer); | 6806 | mac_get_window_bounds (f, &inner, &outer); |
| 6788 | UNBLOCK_INPUT; | 6807 | UNBLOCK_INPUT; |
| 6789 | 6808 | ||
| 6790 | width_diff = (outer.right - outer.left) - (inner.right - inner.left); | ||
| 6791 | height_diff = (outer.bottom - outer.top) - (inner.bottom - inner.top); | ||
| 6792 | |||
| 6793 | /* Treat negative positions as relative to the leftmost bottommost | 6809 | /* Treat negative positions as relative to the leftmost bottommost |
| 6794 | position that fits on the screen. */ | 6810 | position that fits on the screen. */ |
| 6795 | if (flags & XNegative) | 6811 | if (flags & XNegative) |
| 6796 | f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width | 6812 | f->left_pos += (FRAME_MAC_DISPLAY_INFO (f)->width |
| 6797 | - width_diff | 6813 | - (outer.right - outer.left)); |
| 6798 | - FRAME_PIXEL_WIDTH (f) | ||
| 6799 | + f->left_pos); | ||
| 6800 | 6814 | ||
| 6801 | if (flags & YNegative) | 6815 | if (flags & YNegative) |
| 6802 | f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height | 6816 | f->top_pos += (FRAME_MAC_DISPLAY_INFO (f)->height |
| 6803 | - height_diff | 6817 | - (outer.bottom - outer.top)); |
| 6804 | - FRAME_PIXEL_HEIGHT (f) | ||
| 6805 | + f->top_pos); | ||
| 6806 | 6818 | ||
| 6807 | /* The left_pos and top_pos | 6819 | /* The left_pos and top_pos |
| 6808 | are now relative to the top and left screen edges, | 6820 | are now relative to the top and left screen edges, |
diff --git a/src/macterm.h b/src/macterm.h index 0a448484873..6a000451785 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -628,9 +628,9 @@ extern void x_destroy_window P_ ((struct frame *)); | |||
| 628 | extern void x_wm_set_size_hint P_ ((struct frame *, long, int)); | 628 | extern void x_wm_set_size_hint P_ ((struct frame *, long, int)); |
| 629 | extern void x_delete_display P_ ((struct x_display_info *)); | 629 | extern void x_delete_display P_ ((struct x_display_info *)); |
| 630 | extern void mac_initialize P_ ((void)); | 630 | extern void mac_initialize P_ ((void)); |
| 631 | extern Pixmap XCreatePixmap P_ ((Display *, WindowRef, unsigned int, | 631 | extern Pixmap XCreatePixmap P_ ((Display *, Window, unsigned int, |
| 632 | unsigned int, unsigned int)); | 632 | unsigned int, unsigned int)); |
| 633 | extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowRef, char *, | 633 | extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, Window, char *, |
| 634 | unsigned int, unsigned int, | 634 | unsigned int, unsigned int, |
| 635 | unsigned long, unsigned long, | 635 | unsigned long, unsigned long, |
| 636 | unsigned int)); | 636 | unsigned int)); |
| @@ -673,13 +673,10 @@ extern void mac_clear_font_name_table P_ ((void)); | |||
| 673 | extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *)); | 673 | extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *)); |
| 674 | extern OSErr mac_ae_put_lisp P_ ((AEDescList *, UInt32, Lisp_Object)); | 674 | extern OSErr mac_ae_put_lisp P_ ((AEDescList *, UInt32, Lisp_Object)); |
| 675 | #if TARGET_API_MAC_CARBON | 675 | #if TARGET_API_MAC_CARBON |
| 676 | extern OSStatus create_apple_event_from_event_ref P_ ((EventRef, UInt32, | 676 | extern OSErr create_apple_event P_ ((AEEventClass, AEEventID, AppleEvent *)); |
| 677 | const EventParamName *, | 677 | extern Lisp_Object mac_event_parameters_to_lisp P_ ((EventRef, UInt32, |
| 678 | const EventParamType *, | 678 | const EventParamName *, |
| 679 | AppleEvent *)); | 679 | const EventParamType *)); |
| 680 | extern OSErr create_apple_event_from_drag_ref P_ ((DragRef, UInt32, | ||
| 681 | const FlavorType *, | ||
| 682 | AppleEvent *)); | ||
| 683 | extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *)); | 680 | extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *)); |
| 684 | extern CFStringRef cfstring_create_with_string P_ ((Lisp_Object)); | 681 | extern CFStringRef cfstring_create_with_string P_ ((Lisp_Object)); |
| 685 | extern Lisp_Object cfdata_to_lisp P_ ((CFDataRef)); | 682 | extern Lisp_Object cfdata_to_lisp P_ ((CFDataRef)); |
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; | |||
| 120 | extern Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; | 120 | extern Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; |
| 121 | extern Lisp_Object Vmac_ts_active_input_overlay; | 121 | extern Lisp_Object Vmac_ts_active_input_overlay; |
| 122 | extern Lisp_Object Qbefore_string; | 122 | extern Lisp_Object Qbefore_string; |
| 123 | extern Lisp_Object Vmac_ts_script_language_on_focus; | ||
| 124 | extern Lisp_Object saved_ts_script_language_on_focus; | ||
| 125 | #endif | 123 | #endif |
| 126 | 124 | ||
| 127 | static int mac_event_to_emacs_modifiers P_ ((EventRef)); | 125 | static int mac_event_to_emacs_modifiers P_ ((EventRef)); |
| @@ -606,15 +604,15 @@ install_application_handler () | |||
| 606 | #if USE_MAC_TSM | 604 | #if USE_MAC_TSM |
| 607 | if (err == noErr) | 605 | if (err == noErr) |
| 608 | { | 606 | { |
| 609 | static const EventTypeSpec spec[] = | 607 | static const EventTypeSpec specs[] = |
| 610 | {{kEventClassTextInput, kEventTextInputUpdateActiveInputArea}, | 608 | {{kEventClassTextInput, kEventTextInputUpdateActiveInputArea}, |
| 611 | {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}, | 609 | {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}, |
| 612 | {kEventClassTextInput, kEventTextInputOffsetToPos}}; | 610 | {kEventClassTextInput, kEventTextInputOffsetToPos}}; |
| 613 | 611 | ||
| 614 | err = InstallApplicationEventHandler (NewEventHandlerUPP | 612 | err = InstallApplicationEventHandler (NewEventHandlerUPP |
| 615 | (mac_handle_text_input_event), | 613 | (mac_handle_text_input_event), |
| 616 | GetEventTypeCount (spec), | 614 | GetEventTypeCount (specs), |
| 617 | spec, NULL, NULL); | 615 | specs, NULL, NULL); |
| 618 | } | 616 | } |
| 619 | #endif | 617 | #endif |
| 620 | 618 | ||
| @@ -3009,8 +3007,8 @@ mac_event_to_emacs_modifiers (EventRef eventRef) | |||
| 3009 | GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, | 3007 | GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, |
| 3010 | sizeof (UInt32), NULL, &mods); | 3008 | sizeof (UInt32), NULL, &mods); |
| 3011 | class = GetEventClass (eventRef); | 3009 | class = GetEventClass (eventRef); |
| 3012 | if (!NILP (Vmac_emulate_three_button_mouse) && | 3010 | if (!NILP (Vmac_emulate_three_button_mouse) |
| 3013 | (class == kEventClassMouse || class == kEventClassCommand)) | 3011 | && (class == kEventClassMouse || class == kEventClassCommand)) |
| 3014 | { | 3012 | { |
| 3015 | mods &= ~(optionKey | cmdKey); | 3013 | mods &= ~(optionKey | cmdKey); |
| 3016 | } | 3014 | } |
| @@ -3560,6 +3558,9 @@ XTread_socket (sd, expected, hold_quit) | |||
| 3560 | OSStatus err; | 3558 | OSStatus err; |
| 3561 | HIViewRef ch; | 3559 | HIViewRef ch; |
| 3562 | 3560 | ||
| 3561 | if (FrontNonFloatingWindow () != window_ptr) | ||
| 3562 | SelectWindow (window_ptr); | ||
| 3563 | |||
| 3563 | err = HIViewGetViewForMouseEvent (HIViewGetRoot (window_ptr), | 3564 | err = HIViewGetViewForMouseEvent (HIViewGetRoot (window_ptr), |
| 3564 | eventRef, &ch); | 3565 | eventRef, &ch); |
| 3565 | /* This doesn't work on Mac OS X 10.2. */ | 3566 | /* This doesn't work on Mac OS X 10.2. */ |
| @@ -4248,7 +4249,6 @@ x_activate_menubar (f) | |||
| 4248 | { | 4249 | { |
| 4249 | SInt32 menu_choice; | 4250 | SInt32 menu_choice; |
| 4250 | SInt16 menu_id, menu_item; | 4251 | SInt16 menu_id, menu_item; |
| 4251 | extern Point saved_menu_event_location; | ||
| 4252 | 4252 | ||
| 4253 | set_frame_menubar (f, 0, 1); | 4253 | set_frame_menubar (f, 0, 1); |
| 4254 | BLOCK_INPUT; | 4254 | BLOCK_INPUT; |
| @@ -5704,6 +5704,75 @@ static pascal OSErr mac_do_receive_drag P_ ((WindowRef, void *, DragRef)); | |||
| 5704 | static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL; | 5704 | static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL; |
| 5705 | static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; | 5705 | static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; |
| 5706 | 5706 | ||
| 5707 | static OSErr | ||
| 5708 | create_apple_event_from_drag_ref (drag, num_types, types, result) | ||
| 5709 | DragRef drag; | ||
| 5710 | UInt32 num_types; | ||
| 5711 | const FlavorType *types; | ||
| 5712 | AppleEvent *result; | ||
| 5713 | { | ||
| 5714 | OSErr err; | ||
| 5715 | UInt16 num_items; | ||
| 5716 | AppleEvent items; | ||
| 5717 | long index; | ||
| 5718 | char *buf = NULL; | ||
| 5719 | |||
| 5720 | err = CountDragItems (drag, &num_items); | ||
| 5721 | if (err != noErr) | ||
| 5722 | return err; | ||
| 5723 | err = AECreateList (NULL, 0, false, &items); | ||
| 5724 | if (err != noErr) | ||
| 5725 | return err; | ||
| 5726 | |||
| 5727 | for (index = 1; index <= num_items; index++) | ||
| 5728 | { | ||
| 5729 | ItemReference item; | ||
| 5730 | DescType desc_type = typeNull; | ||
| 5731 | Size size; | ||
| 5732 | |||
| 5733 | err = GetDragItemReferenceNumber (drag, index, &item); | ||
| 5734 | if (err == noErr) | ||
| 5735 | { | ||
| 5736 | int i; | ||
| 5737 | |||
| 5738 | for (i = 0; i < num_types; i++) | ||
| 5739 | { | ||
| 5740 | err = GetFlavorDataSize (drag, item, types[i], &size); | ||
| 5741 | if (err == noErr) | ||
| 5742 | { | ||
| 5743 | buf = xrealloc (buf, size); | ||
| 5744 | err = GetFlavorData (drag, item, types[i], buf, &size, 0); | ||
| 5745 | } | ||
| 5746 | if (err == noErr) | ||
| 5747 | { | ||
| 5748 | desc_type = types[i]; | ||
| 5749 | break; | ||
| 5750 | } | ||
| 5751 | } | ||
| 5752 | } | ||
| 5753 | err = AEPutPtr (&items, index, desc_type, | ||
| 5754 | desc_type != typeNull ? buf : NULL, | ||
| 5755 | desc_type != typeNull ? size : 0); | ||
| 5756 | if (err != noErr) | ||
| 5757 | break; | ||
| 5758 | } | ||
| 5759 | if (buf) | ||
| 5760 | xfree (buf); | ||
| 5761 | |||
| 5762 | if (err == noErr) | ||
| 5763 | { | ||
| 5764 | err = create_apple_event (0, 0, result); /* Dummy class and ID. */ | ||
| 5765 | if (err == noErr) | ||
| 5766 | err = AEPutParamDesc (result, keyDirectObject, &items); | ||
| 5767 | if (err != noErr) | ||
| 5768 | AEDisposeDesc (result); | ||
| 5769 | } | ||
| 5770 | |||
| 5771 | AEDisposeDesc (&items); | ||
| 5772 | |||
| 5773 | return err; | ||
| 5774 | } | ||
| 5775 | |||
| 5707 | static void | 5776 | static void |
| 5708 | mac_store_drag_event (window, mouse_pos, modifiers, desc) | 5777 | mac_store_drag_event (window, mouse_pos, modifiers, desc) |
| 5709 | WindowRef window; | 5778 | WindowRef window; |
| @@ -110,6 +110,9 @@ void globals_of_w32 (); | |||
| 110 | extern Lisp_Object Vw32_downcase_file_names; | 110 | extern Lisp_Object Vw32_downcase_file_names; |
| 111 | extern Lisp_Object Vw32_generate_fake_inodes; | 111 | extern Lisp_Object Vw32_generate_fake_inodes; |
| 112 | extern Lisp_Object Vw32_get_true_file_attributes; | 112 | extern Lisp_Object Vw32_get_true_file_attributes; |
| 113 | /* Defined in process.c for its own purpose. */ | ||
| 114 | extern Lisp_Object Qlocal; | ||
| 115 | |||
| 113 | extern int w32_num_mouse_buttons; | 116 | extern int w32_num_mouse_buttons; |
| 114 | 117 | ||
| 115 | 118 | ||
| @@ -2644,6 +2647,8 @@ stat (const char * path, struct stat * buf) | |||
| 2644 | } | 2647 | } |
| 2645 | 2648 | ||
| 2646 | if (!NILP (Vw32_get_true_file_attributes) | 2649 | if (!NILP (Vw32_get_true_file_attributes) |
| 2650 | && !(EQ (Vw32_get_true_file_attributes, Qlocal) && | ||
| 2651 | GetDriveType (name) == DRIVE_FIXED) | ||
| 2647 | /* No access rights required to get info. */ | 2652 | /* No access rights required to get info. */ |
| 2648 | && (fh = CreateFile (name, 0, 0, NULL, OPEN_EXISTING, | 2653 | && (fh = CreateFile (name, 0, 0, NULL, OPEN_EXISTING, |
| 2649 | FILE_FLAG_BACKUP_SEMANTICS, NULL)) | 2654 | FILE_FLAG_BACKUP_SEMANTICS, NULL)) |
diff --git a/src/w32proc.c b/src/w32proc.c index fbb4030e319..0665fa28f16 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -110,6 +110,7 @@ Lisp_Object Vw32_generate_fake_inodes; | |||
| 110 | exactly, at the expense of slower operation. Since true hard links | 110 | exactly, at the expense of slower operation. Since true hard links |
| 111 | are supported on NTFS volumes, this is only relevant on NT. */ | 111 | are supported on NTFS volumes, this is only relevant on NT. */ |
| 112 | Lisp_Object Vw32_get_true_file_attributes; | 112 | Lisp_Object Vw32_get_true_file_attributes; |
| 113 | extern Lisp_Object Qlocal; | ||
| 113 | 114 | ||
| 114 | Lisp_Object Qhigh, Qlow; | 115 | Lisp_Object Qhigh, Qlow; |
| 115 | 116 | ||
| @@ -2353,9 +2354,12 @@ the truename of a file can be slow. */); | |||
| 2353 | 2354 | ||
| 2354 | DEFVAR_LISP ("w32-get-true-file-attributes", &Vw32_get_true_file_attributes, | 2355 | DEFVAR_LISP ("w32-get-true-file-attributes", &Vw32_get_true_file_attributes, |
| 2355 | doc: /* Non-nil means determine accurate link count in `file-attributes'. | 2356 | doc: /* Non-nil means determine accurate link count in `file-attributes'. |
| 2356 | Note that this option is only useful for files on NTFS volumes, where hard links | 2357 | This option is only useful for files on NTFS volumes, where |
| 2357 | are supported. Moreover, it slows down `file-attributes' noticeably. */); | 2358 | hard links are supported. The default value `local' means only do |
| 2358 | Vw32_get_true_file_attributes = Qt; | 2359 | this for files on local harddrives. Any other non-nil value means do |
| 2360 | this even on remote and removable drives where the performance impact | ||
| 2361 | may be noticeable even on modern hardware. */); | ||
| 2362 | Vw32_get_true_file_attributes = Qlocal; | ||
| 2359 | 2363 | ||
| 2360 | staticpro (&Vw32_valid_locale_ids); | 2364 | staticpro (&Vw32_valid_locale_ids); |
| 2361 | staticpro (&Vw32_valid_codepages); | 2365 | staticpro (&Vw32_valid_codepages); |