diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/.gitignore | 1 | ||||
| -rw-r--r-- | src/ChangeLog | 32 | ||||
| -rw-r--r-- | src/Makefile.in | 8 | ||||
| -rw-r--r-- | src/frame.h | 9 | ||||
| -rw-r--r-- | src/menu.c | 3 | ||||
| -rw-r--r-- | src/menu.h | 2 | ||||
| -rw-r--r-- | src/nsfns.m | 139 | ||||
| -rw-r--r-- | src/nsfont.m | 8 | ||||
| -rw-r--r-- | src/nsmenu.m | 46 | ||||
| -rw-r--r-- | src/nsselect.m | 49 | ||||
| -rw-r--r-- | src/nsterm.h | 11 | ||||
| -rw-r--r-- | src/nsterm.m | 168 |
12 files changed, 266 insertions, 210 deletions
diff --git a/src/.gitignore b/src/.gitignore index 950ce883e76..bb195398ff8 100644 --- a/src/.gitignore +++ b/src/.gitignore | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | *-spd | 1 | *-spd |
| 2 | *.core | 2 | *.core |
| 3 | *.d | ||
| 3 | *.pdb | 4 | *.pdb |
| 4 | .gdb_history | 5 | .gdb_history |
| 5 | Makefile | 6 | Makefile |
diff --git a/src/ChangeLog b/src/ChangeLog index a47586e08c3..205a6a108f2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,35 @@ | |||
| 1 | 2008-07-17 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | Use SDATA. Follow coding convention of placing operators at | ||
| 4 | beginning of next line rather than end of previous line, and placing | ||
| 5 | spaces around infix operators. | ||
| 6 | |||
| 7 | * Makefile.in: Undef LIB_STANDARD before defining it to silence warning | ||
| 8 | in case it was defined already. | ||
| 9 | USE @GNUSTEP_MAKEFILES@ rather than envvars. | ||
| 10 | * nsterm.m (ns_term_init): Pass Qt and Qnil rather than YES/NO to | ||
| 11 | ns_default. | ||
| 12 | (applicationShouldTerminate, setValuesFromPanel): Use EQ to compare | ||
| 13 | Lisp_Objects. | ||
| 14 | * nsterm.h (Fx_display_grayscale_p, Fx_display_planes) | ||
| 15 | (ns_defined_color, ns_color_to_lisp): Declare. | ||
| 16 | * nsselect.m (ns_handle_selection_request, ns_handle_selection_clear) | ||
| 17 | (Fns_own_selection_internal): Make the big ugly hack more explicit, so | ||
| 18 | it's accepted even with USE_LISP_UNION_TYPE. | ||
| 19 | * nsmenu.m (ns_update_menubar): Use EQ to compare Lisp_Objects. | ||
| 20 | (update_frame_tool_bar): Remove apparently obsolete tests for | ||
| 21 | non-integerness of f->tool_bar_lines. | ||
| 22 | (windowShouldClose, addButton, clicked, runDialogAt): Make the big ugly | ||
| 23 | hack more explicit, so it's accepted even with USE_LISP_UNION_TYPE. | ||
| 24 | * nsfont.m (nsfont_driver): Use just 0 rather than an invalid cast. | ||
| 25 | (nsfont_open): Don't confuse NULL for Qnil. | ||
| 26 | * nsfns.m (ns_implicitly_set_icon_type): Use EQ to compare Lisp_Objects. | ||
| 27 | * menu.h (find_and_call_menu_selection): | ||
| 28 | * menu.c (find_and_call_menu_selection): Use just int for vector size. | ||
| 29 | (find_and_return_menu_selection): Always return something. | ||
| 30 | * frame.h: Include dispextern.h for Display_Info. | ||
| 31 | (display_x_get_resource): Declare. | ||
| 32 | |||
| 1 | 2008-07-16 Adrian Robert <Adrian.B.Robert@gmail.com> | 33 | 2008-07-16 Adrian Robert <Adrian.B.Robert@gmail.com> |
| 2 | 34 | ||
| 3 | * syntax.c: Remove stdio.h include accidentally introduced in | 35 | * syntax.c: Remove stdio.h include accidentally introduced in |
diff --git a/src/Makefile.in b/src/Makefile.in index a715b83be28..cba9dffddc8 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -114,6 +114,7 @@ SHELL=/bin/sh | |||
| 114 | 114 | ||
| 115 | /* Under GNUstep, putting libc on the link line causes problems. */ | 115 | /* Under GNUstep, putting libc on the link line causes problems. */ |
| 116 | #ifdef NS_IMPL_GNUSTEP | 116 | #ifdef NS_IMPL_GNUSTEP |
| 117 | #undef LIB_STANDARD | ||
| 117 | #define LIB_STANDARD | 118 | #define LIB_STANDARD |
| 118 | #endif | 119 | #endif |
| 119 | 120 | ||
| @@ -238,8 +239,8 @@ STARTFILES = START_FILES | |||
| 238 | /* Pull in stuff from GNUstep-make. */ | 239 | /* Pull in stuff from GNUstep-make. */ |
| 239 | FOUNDATION_LIB=gnu | 240 | FOUNDATION_LIB=gnu |
| 240 | GUI_LIB=gnu | 241 | GUI_LIB=gnu |
| 241 | include $(GNUSTEP_MAKEFILES)/Additional/base.make | 242 | include @GNUSTEP_MAKEFILES@/Additional/base.make |
| 242 | include $(GNUSTEP_MAKEFILES)/Additional/gui.make | 243 | include @GNUSTEP_MAKEFILES@/Additional/gui.make |
| 243 | shared=no | 244 | shared=no |
| 244 | #endif | 245 | #endif |
| 245 | 246 | ||
| @@ -899,8 +900,7 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \ | |||
| 899 | ../lisp/mouse.elc \ | 900 | ../lisp/mouse.elc \ |
| 900 | ../lisp/term/x-win.elc \ | 901 | ../lisp/term/x-win.elc \ |
| 901 | ../lisp/term/ns-win.elc \ | 902 | ../lisp/term/ns-win.elc \ |
| 902 | ../lisp/ns-carbon-compat.elc \ | 903 | ../lisp/ns-carbon-compat.elc |
| 903 | ../lisp/emacs-lisp/easymenu.elc | ||
| 904 | 904 | ||
| 905 | /* Construct full set of libraries to be linked. | 905 | /* Construct full set of libraries to be linked. |
| 906 | Note that SunOS needs -lm to come before -lc; otherwise, you get | 906 | Note that SunOS needs -lm to come before -lc; otherwise, you get |
diff --git a/src/frame.h b/src/frame.h index b744c9e56b6..d070feeaef8 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -24,6 +24,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 24 | #ifndef EMACS_FRAME_H | 24 | #ifndef EMACS_FRAME_H |
| 25 | #define EMACS_FRAME_H | 25 | #define EMACS_FRAME_H |
| 26 | 26 | ||
| 27 | #include "dispextern.h" | ||
| 28 | |||
| 27 | 29 | ||
| 28 | /* Miscellanea. */ | 30 | /* Miscellanea. */ |
| 29 | 31 | ||
| @@ -1114,6 +1116,13 @@ extern void x_set_alpha P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |||
| 1114 | 1116 | ||
| 1115 | extern void validate_x_resource_name P_ ((void)); | 1117 | extern void validate_x_resource_name P_ ((void)); |
| 1116 | 1118 | ||
| 1119 | extern Lisp_Object display_x_get_resource (Display_Info *, | ||
| 1120 | Lisp_Object attribute, | ||
| 1121 | Lisp_Object class, | ||
| 1122 | Lisp_Object component, | ||
| 1123 | Lisp_Object subclass); | ||
| 1124 | |||
| 1125 | |||
| 1117 | #endif /* HAVE_WINDOW_SYSTEM */ | 1126 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 1118 | 1127 | ||
| 1119 | #endif /* not EMACS_FRAME_H */ | 1128 | #endif /* not EMACS_FRAME_H */ |
diff --git a/src/menu.c b/src/menu.c index 969225d4c72..e3882dbd965 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -881,7 +881,7 @@ update_submenu_strings (first_wv) | |||
| 881 | void | 881 | void |
| 882 | find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) | 882 | find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) |
| 883 | FRAME_PTR f; | 883 | FRAME_PTR f; |
| 884 | EMACS_INT menu_bar_items_used; | 884 | int menu_bar_items_used; |
| 885 | Lisp_Object vector; | 885 | Lisp_Object vector; |
| 886 | void *client_data; | 886 | void *client_data; |
| 887 | { | 887 | { |
| @@ -1023,6 +1023,7 @@ find_and_return_menu_selection (FRAME_PTR f, int keymaps, void *client_data) | |||
| 1023 | i += MENU_ITEMS_ITEM_LENGTH; | 1023 | i += MENU_ITEMS_ITEM_LENGTH; |
| 1024 | } | 1024 | } |
| 1025 | } | 1025 | } |
| 1026 | return Qnil; | ||
| 1026 | } | 1027 | } |
| 1027 | #endif | 1028 | #endif |
| 1028 | 1029 | ||
diff --git a/src/menu.h b/src/menu.h index 2bf912f9f72..b91f2891a77 100644 --- a/src/menu.h +++ b/src/menu.h | |||
| @@ -29,7 +29,7 @@ extern void list_of_panes P_ ((Lisp_Object)); | |||
| 29 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) | 29 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) |
| 30 | extern void free_menubar_widget_value_tree P_ ((widget_value *)); | 30 | extern void free_menubar_widget_value_tree P_ ((widget_value *)); |
| 31 | extern void update_submenu_strings P_ ((widget_value *)); | 31 | extern void update_submenu_strings P_ ((widget_value *)); |
| 32 | extern void find_and_call_menu_selection P_ ((FRAME_PTR, EMACS_INT, | 32 | extern void find_and_call_menu_selection P_ ((FRAME_PTR, int, |
| 33 | Lisp_Object, void *)); | 33 | Lisp_Object, void *)); |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
diff --git a/src/nsfns.m b/src/nsfns.m index b996ecf89ad..8ec6518aead 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -268,7 +268,7 @@ ns_display_info_for_name (name) | |||
| 268 | dpyinfo = ns_display_list; | 268 | dpyinfo = ns_display_list; |
| 269 | 269 | ||
| 270 | if (dpyinfo == 0) | 270 | if (dpyinfo == 0) |
| 271 | error ("OpenStep on %s not responding.\n", XSTRING (name)->data); | 271 | error ("OpenStep on %s not responding.\n", SDATA (name)); |
| 272 | 272 | ||
| 273 | return dpyinfo; | 273 | return dpyinfo; |
| 274 | } | 274 | } |
| @@ -401,8 +401,8 @@ ns_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 401 | if (face) | 401 | if (face) |
| 402 | { | 402 | { |
| 403 | col = NS_FACE_BACKGROUND (face); | 403 | col = NS_FACE_BACKGROUND (face); |
| 404 | face->background = | 404 | face->background |
| 405 | (EMACS_UINT) [[col colorWithAlphaComponent: alpha] retain]; | 405 | = (EMACS_UINT) [[col colorWithAlphaComponent: alpha] retain]; |
| 406 | [col release]; | 406 | [col release]; |
| 407 | 407 | ||
| 408 | update_face_from_frame_parameter (f, Qbackground_color, arg); | 408 | update_face_from_frame_parameter (f, Qbackground_color, arg); |
| @@ -478,11 +478,11 @@ ns_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 478 | if ([[view window] miniwindowTitle] && | 478 | if ([[view window] miniwindowTitle] && |
| 479 | ([[[view window] miniwindowTitle] | 479 | ([[[view window] miniwindowTitle] |
| 480 | isEqualToString: [NSString stringWithUTF8String: | 480 | isEqualToString: [NSString stringWithUTF8String: |
| 481 | XSTRING (arg)->data]])) | 481 | SDATA (arg)]])) |
| 482 | return; | 482 | return; |
| 483 | 483 | ||
| 484 | [[view window] setMiniwindowTitle: | 484 | [[view window] setMiniwindowTitle: |
| 485 | [NSString stringWithUTF8String: XSTRING (arg)->data]]; | 485 | [NSString stringWithUTF8String: SDATA (arg)]]; |
| 486 | } | 486 | } |
| 487 | 487 | ||
| 488 | 488 | ||
| @@ -527,11 +527,11 @@ ns_set_name_iconic (struct frame *f, Lisp_Object name, int explicit) | |||
| 527 | if ([[view window] miniwindowTitle] && | 527 | if ([[view window] miniwindowTitle] && |
| 528 | ([[[view window] miniwindowTitle] | 528 | ([[[view window] miniwindowTitle] |
| 529 | isEqualToString: [NSString stringWithUTF8String: | 529 | isEqualToString: [NSString stringWithUTF8String: |
| 530 | XSTRING (name)->data]])) | 530 | SDATA (name)]])) |
| 531 | return; | 531 | return; |
| 532 | 532 | ||
| 533 | [[view window] setMiniwindowTitle: | 533 | [[view window] setMiniwindowTitle: |
| 534 | [NSString stringWithUTF8String: XSTRING (name)->data]]; | 534 | [NSString stringWithUTF8String: SDATA (name)]]; |
| 535 | } | 535 | } |
| 536 | 536 | ||
| 537 | 537 | ||
| @@ -573,10 +573,10 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit) | |||
| 573 | /* Don't change the name if it's already NAME. */ | 573 | /* Don't change the name if it's already NAME. */ |
| 574 | if ([[[view window] title] | 574 | if ([[[view window] title] |
| 575 | isEqualToString: [NSString stringWithUTF8String: | 575 | isEqualToString: [NSString stringWithUTF8String: |
| 576 | XSTRING (name)->data]]) | 576 | SDATA (name)]]) |
| 577 | return; | 577 | return; |
| 578 | [[view window] setTitle: [NSString stringWithUTF8String: | 578 | [[view window] setTitle: [NSString stringWithUTF8String: |
| 579 | XSTRING (name)->data]]; | 579 | SDATA (name)]]; |
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | 582 | ||
| @@ -660,7 +660,7 @@ ns_set_name_as_filename (struct frame *f) | |||
| 660 | title = FRAME_ICONIFIED_P (f) ? [[[view window] miniwindowTitle] UTF8String] | 660 | title = FRAME_ICONIFIED_P (f) ? [[[view window] miniwindowTitle] UTF8String] |
| 661 | : [[[view window] title] UTF8String]; | 661 | : [[[view window] title] UTF8String]; |
| 662 | 662 | ||
| 663 | if (title && (! strcmp (title, XSTRING (name)->data))) | 663 | if (title && (! strcmp (title, SDATA (name)))) |
| 664 | { | 664 | { |
| 665 | [pool release]; | 665 | [pool release]; |
| 666 | UNBLOCK_INPUT; | 666 | UNBLOCK_INPUT; |
| @@ -673,7 +673,7 @@ ns_set_name_as_filename (struct frame *f) | |||
| 673 | /* work around a bug observed on 10.3 where | 673 | /* work around a bug observed on 10.3 where |
| 674 | setTitleWithRepresentedFilename does not clear out previous state | 674 | setTitleWithRepresentedFilename does not clear out previous state |
| 675 | if given filename does not exist */ | 675 | if given filename does not exist */ |
| 676 | NSString *str = [NSString stringWithUTF8String: XSTRING (name)->data]; | 676 | NSString *str = [NSString stringWithUTF8String: SDATA (name)]; |
| 677 | if (![[NSFileManager defaultManager] fileExistsAtPath: str]) | 677 | if (![[NSFileManager defaultManager] fileExistsAtPath: str]) |
| 678 | { | 678 | { |
| 679 | [[view window] setTitleWithRepresentedFilename: @""]; | 679 | [[view window] setTitleWithRepresentedFilename: @""]; |
| @@ -685,14 +685,14 @@ ns_set_name_as_filename (struct frame *f) | |||
| 685 | } | 685 | } |
| 686 | #else | 686 | #else |
| 687 | [[view window] setTitleWithRepresentedFilename: | 687 | [[view window] setTitleWithRepresentedFilename: |
| 688 | [NSString stringWithUTF8String: XSTRING (name)->data]]; | 688 | [NSString stringWithUTF8String: SDATA (name)]]; |
| 689 | #endif | 689 | #endif |
| 690 | f->name = name; | 690 | f->name = name; |
| 691 | } | 691 | } |
| 692 | else | 692 | else |
| 693 | { | 693 | { |
| 694 | [[view window] setMiniwindowTitle: | 694 | [[view window] setMiniwindowTitle: |
| 695 | [NSString stringWithUTF8String: XSTRING (name)->data]]; | 695 | [NSString stringWithUTF8String: SDATA (name)]]; |
| 696 | } | 696 | } |
| 697 | [pool release]; | 697 | [pool release]; |
| 698 | UNBLOCK_INPUT; | 698 | UNBLOCK_INPUT; |
| @@ -806,7 +806,7 @@ ns_implicitly_set_icon_type (struct frame *f) | |||
| 806 | BLOCK_INPUT; | 806 | BLOCK_INPUT; |
| 807 | pool = [[NSAutoreleasePool alloc] init]; | 807 | pool = [[NSAutoreleasePool alloc] init]; |
| 808 | if (f->output_data.ns->miniimage | 808 | if (f->output_data.ns->miniimage |
| 809 | && [[NSString stringWithUTF8String: XSTRING (f->name)->data] | 809 | && [[NSString stringWithUTF8String: SDATA (f->name)] |
| 810 | isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]]) | 810 | isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]]) |
| 811 | { | 811 | { |
| 812 | [pool release]; | 812 | [pool release]; |
| @@ -828,10 +828,10 @@ ns_implicitly_set_icon_type (struct frame *f) | |||
| 828 | { | 828 | { |
| 829 | elt = XCAR (chain); | 829 | elt = XCAR (chain); |
| 830 | /* special case: 't' means go by file type */ | 830 | /* special case: 't' means go by file type */ |
| 831 | if (SYMBOLP (elt) && elt == Qt && XSTRING (f->name)->data[0] == '/') | 831 | if (SYMBOLP (elt) && EQ (elt, Qt) && SDATA (f->name)[0] == '/') |
| 832 | { | 832 | { |
| 833 | NSString *str = | 833 | NSString *str |
| 834 | [NSString stringWithUTF8String: XSTRING (f->name)->data]; | 834 | = [NSString stringWithUTF8String: SDATA (f->name)]; |
| 835 | if ([[NSFileManager defaultManager] fileExistsAtPath: str]) | 835 | if ([[NSFileManager defaultManager] fileExistsAtPath: str]) |
| 836 | image = [[[NSWorkspace sharedWorkspace] iconForFile: str] retain]; | 836 | image = [[[NSWorkspace sharedWorkspace] iconForFile: str] retain]; |
| 837 | } | 837 | } |
| @@ -844,7 +844,7 @@ ns_implicitly_set_icon_type (struct frame *f) | |||
| 844 | if (image == nil) | 844 | if (image == nil) |
| 845 | image = [[NSImage imageNamed: | 845 | image = [[NSImage imageNamed: |
| 846 | [NSString stringWithUTF8String: | 846 | [NSString stringWithUTF8String: |
| 847 | XSTRING (XCDR (elt))->data]] retain]; | 847 | SDATA (XCDR (elt))]] retain]; |
| 848 | } | 848 | } |
| 849 | } | 849 | } |
| 850 | 850 | ||
| @@ -873,7 +873,7 @@ ns_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 873 | 873 | ||
| 874 | if (!NILP (arg) && SYMBOLP (arg)) | 874 | if (!NILP (arg) && SYMBOLP (arg)) |
| 875 | { | 875 | { |
| 876 | arg =build_string (XSTRING (XSYMBOL (arg)->xname)->data); | 876 | arg =build_string (SDATA (SYMBOL_NAME (arg))); |
| 877 | store_frame_param (f, Qicon_type, arg); | 877 | store_frame_param (f, Qicon_type, arg); |
| 878 | } | 878 | } |
| 879 | 879 | ||
| @@ -889,7 +889,7 @@ ns_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 889 | image = [EmacsImage allocInitFromFile: arg]; | 889 | image = [EmacsImage allocInitFromFile: arg]; |
| 890 | if (image == nil) | 890 | if (image == nil) |
| 891 | image =[NSImage imageNamed: [NSString stringWithUTF8String: | 891 | image =[NSImage imageNamed: [NSString stringWithUTF8String: |
| 892 | XSTRING (arg)->data]]; | 892 | SDATA (arg)]]; |
| 893 | 893 | ||
| 894 | if (image == nil) | 894 | if (image == nil) |
| 895 | { | 895 | { |
| @@ -918,9 +918,9 @@ ns_lisp_to_cursor_type (Lisp_Object arg) | |||
| 918 | { | 918 | { |
| 919 | char *str; | 919 | char *str; |
| 920 | if (XTYPE (arg) == Lisp_String) | 920 | if (XTYPE (arg) == Lisp_String) |
| 921 | str =XSTRING (arg)->data; | 921 | str = SDATA (arg); |
| 922 | else if (XTYPE (arg) == Lisp_Symbol) | 922 | else if (XTYPE (arg) == Lisp_Symbol) |
| 923 | str =XSTRING (XSYMBOL (arg)->xname)->data; | 923 | str = SDATA (SYMBOL_NAME (arg)); |
| 924 | else return -1; | 924 | else return -1; |
| 925 | if (!strcmp (str, "box")) return filled_box; | 925 | if (!strcmp (str, "box")) return filled_box; |
| 926 | if (!strcmp (str, "hollow")) return hollow_box; | 926 | if (!strcmp (str, "hollow")) return hollow_box; |
| @@ -1125,8 +1125,8 @@ be shared by the new frame.") | |||
| 1125 | be set. */ | 1125 | be set. */ |
| 1126 | if (EQ (name, Qunbound) || NILP (name) || (XTYPE (name) != Lisp_String)) | 1126 | if (EQ (name, Qunbound) || NILP (name) || (XTYPE (name) != Lisp_String)) |
| 1127 | { | 1127 | { |
| 1128 | f->name = | 1128 | f->name |
| 1129 | build_string ([[[NSProcessInfo processInfo] processName] UTF8String]); | 1129 | = build_string ([[[NSProcessInfo processInfo] processName] UTF8String]); |
| 1130 | f->explicit_name =0; | 1130 | f->explicit_name =0; |
| 1131 | } | 1131 | } |
| 1132 | else | 1132 | else |
| @@ -1197,15 +1197,15 @@ be shared by the new frame.") | |||
| 1197 | 1197 | ||
| 1198 | /* default scrollbars on right on Mac */ | 1198 | /* default scrollbars on right on Mac */ |
| 1199 | { | 1199 | { |
| 1200 | Lisp_Object spos = | 1200 | Lisp_Object spos |
| 1201 | #ifdef NS_IMPL_GNUSTEP | 1201 | #ifdef NS_IMPL_GNUSTEP |
| 1202 | Qt; | 1202 | = Qt; |
| 1203 | #else | 1203 | #else |
| 1204 | Qright; | 1204 | = Qright; |
| 1205 | #endif | 1205 | #endif |
| 1206 | x_default_parameter (f, parms, Qvertical_scroll_bars, spos, | 1206 | x_default_parameter (f, parms, Qvertical_scroll_bars, spos, |
| 1207 | "verticalScrollBars", "VerticalScrollBars", | 1207 | "verticalScrollBars", "VerticalScrollBars", |
| 1208 | RES_TYPE_SYMBOL); | 1208 | RES_TYPE_SYMBOL); |
| 1209 | } | 1209 | } |
| 1210 | x_default_parameter (f, parms, Qforeground_color, build_string ("Black"), | 1210 | x_default_parameter (f, parms, Qforeground_color, build_string ("Black"), |
| 1211 | "foreground", "Foreground", RES_TYPE_STRING); | 1211 | "foreground", "Foreground", RES_TYPE_STRING); |
| @@ -1236,30 +1236,31 @@ be shared by the new frame.") | |||
| 1236 | /*PENDING: other terms seem to get away w/o this complexity.. */ | 1236 | /*PENDING: other terms seem to get away w/o this complexity.. */ |
| 1237 | if (NILP (Fassq (Qwidth, parms))) | 1237 | if (NILP (Fassq (Qwidth, parms))) |
| 1238 | { | 1238 | { |
| 1239 | Lisp_Object value = | 1239 | Lisp_Object value |
| 1240 | x_get_arg (dpyinfo, parms, Qwidth, "width", "Width", RES_TYPE_NUMBER); | 1240 | = x_get_arg (dpyinfo, parms, Qwidth, "width", "Width", |
| 1241 | RES_TYPE_NUMBER); | ||
| 1241 | if (! EQ (value, Qunbound)) | 1242 | if (! EQ (value, Qunbound)) |
| 1242 | parms = Fcons (Fcons (Qwidth, value), parms); | 1243 | parms = Fcons (Fcons (Qwidth, value), parms); |
| 1243 | } | 1244 | } |
| 1244 | if (NILP (Fassq (Qheight, parms))) | 1245 | if (NILP (Fassq (Qheight, parms))) |
| 1245 | { | 1246 | { |
| 1246 | Lisp_Object value = | 1247 | Lisp_Object value |
| 1247 | x_get_arg (dpyinfo, parms, Qheight, "height", "Height", | 1248 | = x_get_arg (dpyinfo, parms, Qheight, "height", "Height", |
| 1248 | RES_TYPE_NUMBER); | 1249 | RES_TYPE_NUMBER); |
| 1249 | if (! EQ (value, Qunbound)) | 1250 | if (! EQ (value, Qunbound)) |
| 1250 | parms = Fcons (Fcons (Qheight, value), parms); | 1251 | parms = Fcons (Fcons (Qheight, value), parms); |
| 1251 | } | 1252 | } |
| 1252 | if (NILP (Fassq (Qleft, parms))) | 1253 | if (NILP (Fassq (Qleft, parms))) |
| 1253 | { | 1254 | { |
| 1254 | Lisp_Object value = | 1255 | Lisp_Object value |
| 1255 | x_get_arg (dpyinfo, parms, Qleft, "left", "Left", RES_TYPE_NUMBER); | 1256 | = x_get_arg (dpyinfo, parms, Qleft, "left", "Left", RES_TYPE_NUMBER); |
| 1256 | if (! EQ (value, Qunbound)) | 1257 | if (! EQ (value, Qunbound)) |
| 1257 | parms = Fcons (Fcons (Qleft, value), parms); | 1258 | parms = Fcons (Fcons (Qleft, value), parms); |
| 1258 | } | 1259 | } |
| 1259 | if (NILP (Fassq (Qtop, parms))) | 1260 | if (NILP (Fassq (Qtop, parms))) |
| 1260 | { | 1261 | { |
| 1261 | Lisp_Object value = | 1262 | Lisp_Object value |
| 1262 | x_get_arg (dpyinfo, parms, Qtop, "top", "Top", RES_TYPE_NUMBER); | 1263 | = x_get_arg (dpyinfo, parms, Qtop, "top", "Top", RES_TYPE_NUMBER); |
| 1263 | if (! EQ (value, Qunbound)) | 1264 | if (! EQ (value, Qunbound)) |
| 1264 | parms = Fcons (Fcons (Qtop, value), parms); | 1265 | parms = Fcons (Fcons (Qtop, value), parms); |
| 1265 | } | 1266 | } |
| @@ -1277,8 +1278,8 @@ be shared by the new frame.") | |||
| 1277 | f->output_data.ns->hand_cursor = [NSCursor pointingHandCursor]; | 1278 | f->output_data.ns->hand_cursor = [NSCursor pointingHandCursor]; |
| 1278 | f->output_data.ns->hourglass_cursor = [NSCursor disappearingItemCursor]; | 1279 | f->output_data.ns->hourglass_cursor = [NSCursor disappearingItemCursor]; |
| 1279 | f->output_data.ns->horizontal_drag_cursor = [NSCursor resizeLeftRightCursor]; | 1280 | f->output_data.ns->horizontal_drag_cursor = [NSCursor resizeLeftRightCursor]; |
| 1280 | FRAME_NS_DISPLAY_INFO (f)->vertical_scroll_bar_cursor = | 1281 | FRAME_NS_DISPLAY_INFO (f)->vertical_scroll_bar_cursor |
| 1281 | [NSCursor arrowCursor]; | 1282 | = [NSCursor arrowCursor]; |
| 1282 | f->output_data.ns->current_pointer = f->output_data.ns->text_cursor; | 1283 | f->output_data.ns->current_pointer = f->output_data.ns->text_cursor; |
| 1283 | 1284 | ||
| 1284 | [[EmacsView alloc] initFrameFromEmacs: f]; | 1285 | [[EmacsView alloc] initFrameFromEmacs: f]; |
| @@ -1435,12 +1436,12 @@ Set ISLOAD non-nil if file being read for a save.") | |||
| 1435 | NSString *fname; | 1436 | NSString *fname; |
| 1436 | 1437 | ||
| 1437 | NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil : | 1438 | NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil : |
| 1438 | [NSString stringWithUTF8String: XSTRING (prompt)->data]; | 1439 | [NSString stringWithUTF8String: SDATA (prompt)]; |
| 1439 | NSString *dirS = NILP (dir) || !STRINGP (dir) ? | 1440 | NSString *dirS = NILP (dir) || !STRINGP (dir) ? |
| 1440 | [NSString stringWithUTF8String: XSTRING (current_buffer->directory)->data] : | 1441 | [NSString stringWithUTF8String: SDATA (current_buffer->directory)] : |
| 1441 | [NSString stringWithUTF8String: XSTRING (dir)->data]; | 1442 | [NSString stringWithUTF8String: SDATA (dir)]; |
| 1442 | NSString *initS = NILP (init) || !STRINGP (init) ? nil : | 1443 | NSString *initS = NILP (init) || !STRINGP (init) ? nil : |
| 1443 | [NSString stringWithUTF8String: XSTRING (init)->data]; | 1444 | [NSString stringWithUTF8String: SDATA (init)]; |
| 1444 | 1445 | ||
| 1445 | check_ns (); | 1446 | check_ns (); |
| 1446 | 1447 | ||
| @@ -1502,12 +1503,12 @@ If OWNER is nil, Emacs is assumed.") | |||
| 1502 | /*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SDATA (name)); */ | 1503 | /*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SDATA (name)); */ |
| 1503 | 1504 | ||
| 1504 | value =[[[NSUserDefaults standardUserDefaults] | 1505 | value =[[[NSUserDefaults standardUserDefaults] |
| 1505 | objectForKey: [NSString stringWithUTF8String: XSTRING (name)->data]] | 1506 | objectForKey: [NSString stringWithUTF8String: SDATA (name)]] |
| 1506 | UTF8String]; | 1507 | UTF8String]; |
| 1507 | 1508 | ||
| 1508 | if (value) | 1509 | if (value) |
| 1509 | return build_string (value); | 1510 | return build_string (value); |
| 1510 | /*fprintf (stderr, "Nothing found for NS resource '%s'.\n", XSTRING (name)->data); */ | 1511 | /*fprintf (stderr, "Nothing found for NS resource '%s'.\n", SDATA (name)); */ |
| 1511 | return Qnil; | 1512 | return Qnil; |
| 1512 | } | 1513 | } |
| 1513 | 1514 | ||
| @@ -1521,22 +1522,22 @@ If VALUE is nil, the default is removed.") | |||
| 1521 | { | 1522 | { |
| 1522 | check_ns (); | 1523 | check_ns (); |
| 1523 | if (NILP (owner)) | 1524 | if (NILP (owner)) |
| 1524 | owner = | 1525 | owner |
| 1525 | build_string ([[[NSProcessInfo processInfo] processName] UTF8String]); | 1526 | = build_string ([[[NSProcessInfo processInfo] processName] UTF8String]); |
| 1526 | CHECK_STRING (owner); | 1527 | CHECK_STRING (owner); |
| 1527 | CHECK_STRING (name); | 1528 | CHECK_STRING (name); |
| 1528 | if (NILP (value)) | 1529 | if (NILP (value)) |
| 1529 | { | 1530 | { |
| 1530 | [[NSUserDefaults standardUserDefaults] removeObjectForKey: | 1531 | [[NSUserDefaults standardUserDefaults] removeObjectForKey: |
| 1531 | [NSString stringWithUTF8String: XSTRING (name)->data]]; | 1532 | [NSString stringWithUTF8String: SDATA (name)]]; |
| 1532 | } | 1533 | } |
| 1533 | else | 1534 | else |
| 1534 | { | 1535 | { |
| 1535 | CHECK_STRING (value); | 1536 | CHECK_STRING (value); |
| 1536 | [[NSUserDefaults standardUserDefaults] setObject: | 1537 | [[NSUserDefaults standardUserDefaults] setObject: |
| 1537 | [NSString stringWithUTF8String: XSTRING (value)->data] | 1538 | [NSString stringWithUTF8String: SDATA (value)] |
| 1538 | forKey: [NSString stringWithUTF8String: | 1539 | forKey: [NSString stringWithUTF8String: |
| 1539 | XSTRING (name)->data]]; | 1540 | SDATA (name)]]; |
| 1540 | } | 1541 | } |
| 1541 | 1542 | ||
| 1542 | return Qnil; | 1543 | return Qnil; |
| @@ -1763,10 +1764,10 @@ Optional arguments XRM-STRING and MUST-SUCCEED are currently ignored.") | |||
| 1763 | { | 1764 | { |
| 1764 | if (!NILP (must_succeed)) | 1765 | if (!NILP (must_succeed)) |
| 1765 | fatal ("OpenStep on %s not responding.\n", | 1766 | fatal ("OpenStep on %s not responding.\n", |
| 1766 | XSTRING (display)->data); | 1767 | SDATA (display)); |
| 1767 | else | 1768 | else |
| 1768 | error ("OpenStep on %s not responding.\n", | 1769 | error ("OpenStep on %s not responding.\n", |
| 1769 | XSTRING (display)->data); | 1770 | SDATA (display)); |
| 1770 | } | 1771 | } |
| 1771 | 1772 | ||
| 1772 | /* Register our external input/output types, used for determining | 1773 | /* Register our external input/output types, used for determining |
| @@ -1858,17 +1859,17 @@ DEFUN ("ns-emacs-info-panel", Fns_emacs_info_panel, Sns_emacs_info_panel, | |||
| 1858 | 1859 | ||
| 1859 | 1860 | ||
| 1860 | DEFUN ("x-list-fonts", Fns_list_fonts, Sns_list_fonts, 1, 4, 0, | 1861 | DEFUN ("x-list-fonts", Fns_list_fonts, Sns_list_fonts, 1, 4, 0, |
| 1861 | "Return a list of the names of available fonts matching PATTERN.\n\ | 1862 | doc: /* Return a list of the names of available fonts matching PATTERN. |
| 1862 | If optional arguments FACE and FRAME are specified, return only fonts\n\ | 1863 | If optional arguments FACE and FRAME are specified, return only fonts |
| 1863 | the same size as FACE on FRAME.\n\ | 1864 | the same size as FACE on FRAME. |
| 1864 | If optional argument MAX is specified, return at most MAX matches.\n\ | 1865 | If optional argument MAX is specified, return at most MAX matches. |
| 1865 | \n\ | 1866 | |
| 1866 | PATTERN is a regular expression; FACE is a face name - a symbol.\n\ | 1867 | PATTERN is a regular expression; FACE is a face name - a symbol. |
| 1867 | \n\ | 1868 | |
| 1868 | The return value is a list of strings, suitable as arguments to\n\ | 1869 | The return value is a list of strings, suitable as arguments to |
| 1869 | set-face-font.\n\ | 1870 | set-face-font. |
| 1870 | \n\ | 1871 | |
| 1871 | The font names are _NOT_ X names.") | 1872 | The font names are _NOT_ X names. */) |
| 1872 | (pattern, face, frame, max) | 1873 | (pattern, face, frame, max) |
| 1873 | Lisp_Object pattern, face, frame, max; | 1874 | Lisp_Object pattern, face, frame, max; |
| 1874 | { | 1875 | { |
| @@ -1906,7 +1907,7 @@ The font names are _NOT_ X names.") | |||
| 1906 | for (tem = flist; CONSP (tem); tem = XCDR (tem)) | 1907 | for (tem = flist; CONSP (tem); tem = XCDR (tem)) |
| 1907 | { | 1908 | { |
| 1908 | Lisp_Object fname = XCAR (tem); | 1909 | Lisp_Object fname = XCAR (tem); |
| 1909 | olist = Fcons (build_string (ns_xlfd_to_fontname (XSTRING (fname)->data)), | 1910 | olist = Fcons (build_string (ns_xlfd_to_fontname (SDATA (fname))), |
| 1910 | olist); | 1911 | olist); |
| 1911 | } | 1912 | } |
| 1912 | 1913 | ||
| @@ -2039,7 +2040,7 @@ Returns result of service as string or nil if no result.") | |||
| 2039 | CHECK_STRING (service); | 2040 | CHECK_STRING (service); |
| 2040 | check_ns (); | 2041 | check_ns (); |
| 2041 | 2042 | ||
| 2042 | utfStr = XSTRING (service)->data; | 2043 | utfStr = SDATA (service); |
| 2043 | svcName = [NSString stringWithUTF8String: utfStr]; | 2044 | svcName = [NSString stringWithUTF8String: utfStr]; |
| 2044 | 2045 | ||
| 2045 | pb =[NSPasteboard pasteboardWithUniqueName]; | 2046 | pb =[NSPasteboard pasteboardWithUniqueName]; |
| @@ -2063,7 +2064,7 @@ DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc, | |||
| 2063 | NSString *utfStr; | 2064 | NSString *utfStr; |
| 2064 | 2065 | ||
| 2065 | CHECK_STRING (str); | 2066 | CHECK_STRING (str); |
| 2066 | utfStr = [[NSString stringWithUTF8String: XSTRING (str)->data] | 2067 | utfStr = [[NSString stringWithUTF8String: SDATA (str)] |
| 2067 | precomposedStringWithCanonicalMapping]; | 2068 | precomposedStringWithCanonicalMapping]; |
| 2068 | return build_string ([utfStr UTF8String]); | 2069 | return build_string ([utfStr UTF8String]); |
| 2069 | } | 2070 | } |
| @@ -2448,7 +2449,7 @@ Text larger than the specified size is clipped. */) | |||
| 2448 | GCPRO4 (string, parms, frame, timeout); | 2449 | GCPRO4 (string, parms, frame, timeout); |
| 2449 | 2450 | ||
| 2450 | CHECK_STRING (string); | 2451 | CHECK_STRING (string); |
| 2451 | str = XSTRING (string)->data; | 2452 | str = SDATA (string); |
| 2452 | f = check_x_frame (frame); | 2453 | f = check_x_frame (frame); |
| 2453 | if (NILP (timeout)) | 2454 | if (NILP (timeout)) |
| 2454 | timeout = make_number (5); | 2455 | timeout = make_number (5); |
diff --git a/src/nsfont.m b/src/nsfont.m index 55c71a54c00..bbf991e7d49 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -234,7 +234,7 @@ static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 234 | 234 | ||
| 235 | struct font_driver nsfont_driver = | 235 | struct font_driver nsfont_driver = |
| 236 | { | 236 | { |
| 237 | (Lisp_Object) NULL, /* Qns */ | 237 | 0, /* Qns */ |
| 238 | 1, /* case sensitive */ | 238 | 1, /* case sensitive */ |
| 239 | nsfont_get_cache, | 239 | nsfont_get_cache, |
| 240 | nsfont_list, | 240 | nsfont_list, |
| @@ -518,7 +518,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 518 | font_info = (struct nsfont_info *) XFONT_OBJECT (font_object); | 518 | font_info = (struct nsfont_info *) XFONT_OBJECT (font_object); |
| 519 | font = (struct font *)font_info; | 519 | font = (struct font *)font_info; |
| 520 | if (!font) | 520 | if (!font) |
| 521 | return NULL; /*PENDING: this copies w32, but causes a segfault */ | 521 | return Qnil; /*PENDING: this copies w32, but causes a segfault */ |
| 522 | 522 | ||
| 523 | if (NSFONT_TRACE) | 523 | if (NSFONT_TRACE) |
| 524 | { | 524 | { |
| @@ -571,7 +571,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 571 | if (!nsfont) | 571 | if (!nsfont) |
| 572 | { | 572 | { |
| 573 | fprintf (stderr, "*** Emacs.app: unable to load backup font\n"); | 573 | fprintf (stderr, "*** Emacs.app: unable to load backup font\n"); |
| 574 | return NULL; | 574 | return Qnil; |
| 575 | } | 575 | } |
| 576 | } | 576 | } |
| 577 | 577 | ||
| @@ -601,7 +601,7 @@ fprintf (stderr, "*** CACHE HIT!\n"); | |||
| 601 | font_info->metrics = (struct font_metrics *) | 601 | font_info->metrics = (struct font_metrics *) |
| 602 | xmalloc (0x100 * sizeof (struct font_metrics *)); | 602 | xmalloc (0x100 * sizeof (struct font_metrics *)); |
| 603 | if (!font_info->glyphs || !font_info->metrics) | 603 | if (!font_info->glyphs || !font_info->metrics) |
| 604 | return NULL; | 604 | return Qnil; |
| 605 | bzero (font_info->glyphs, 0x100 * sizeof (unsigned short *)); | 605 | bzero (font_info->glyphs, 0x100 * sizeof (unsigned short *)); |
| 606 | bzero (font_info->metrics, 0x100 * sizeof (struct font_metrics *)); | 606 | bzero (font_info->metrics, 0x100 * sizeof (struct font_metrics *)); |
| 607 | 607 | ||
diff --git a/src/nsmenu.m b/src/nsmenu.m index e48a82b7d2d..7fbc1b10c0a 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -401,9 +401,9 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 401 | { | 401 | { |
| 402 | for (i = 0; i<n; i++) | 402 | for (i = 0; i<n; i++) |
| 403 | { | 403 | { |
| 404 | string = XVECTOR (items)->contents[4*i+1]; | 404 | string = AREF (items, 4*i+1); |
| 405 | 405 | ||
| 406 | if (!string) | 406 | if (EQ (string, make_number (0))) // FIXME: Why??? --Stef |
| 407 | continue; | 407 | continue; |
| 408 | if (NILP (string)) | 408 | if (NILP (string)) |
| 409 | if (previous_strings[i][0]) | 409 | if (previous_strings[i][0]) |
| @@ -691,10 +691,10 @@ name_is_separator (name) | |||
| 691 | - (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f | 691 | - (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f |
| 692 | { | 692 | { |
| 693 | NSString *titleStr = [NSString stringWithUTF8String: title]; | 693 | NSString *titleStr = [NSString stringWithUTF8String: title]; |
| 694 | id <NSMenuItem> item = | 694 | id <NSMenuItem> item |
| 695 | [self addItemWithTitle: titleStr | 695 | = [self addItemWithTitle: titleStr |
| 696 | action: nil /*@selector (menuDown:) */ | 696 | action: nil /*@selector (menuDown:) */ |
| 697 | keyEquivalent: @""]; | 697 | keyEquivalent: @""]; |
| 698 | EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; | 698 | EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; |
| 699 | [self setSubmenu: submenu forItem: item]; | 699 | [self setSubmenu: submenu forItem: item]; |
| 700 | [submenu release]; | 700 | [submenu release]; |
| @@ -724,8 +724,9 @@ name_is_separator (name) | |||
| 724 | [NSMenu popUpContextMenu: self withEvent: event forView: view]; | 724 | [NSMenu popUpContextMenu: self withEvent: event forView: view]; |
| 725 | retVal = context_menu_value; | 725 | retVal = context_menu_value; |
| 726 | context_menu_value = 0; | 726 | context_menu_value = 0; |
| 727 | return retVal > 0 ? | 727 | return retVal > 0 |
| 728 | find_and_return_menu_selection (f, keymaps, (void *)retVal) : Qnil; | 728 | ? find_and_return_menu_selection (f, keymaps, (void *)retVal) |
| 729 | : Qnil; | ||
| 729 | } | 730 | } |
| 730 | 731 | ||
| 731 | @end /* EmacsMenu */ | 732 | @end /* EmacsMenu */ |
| @@ -1061,8 +1062,8 @@ ns_popup_menu (Lisp_Object position, Lisp_Object menu) | |||
| 1061 | /* If this item has a null value, | 1062 | /* If this item has a null value, |
| 1062 | make the call_data null so that it won't display a box | 1063 | make the call_data null so that it won't display a box |
| 1063 | when the mouse is on it. */ | 1064 | when the mouse is on it. */ |
| 1064 | wv->call_data = | 1065 | wv->call_data |
| 1065 | !NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0; | 1066 | = !NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0; |
| 1066 | wv->enabled = !NILP (enable); | 1067 | wv->enabled = !NILP (enable); |
| 1067 | 1068 | ||
| 1068 | if (NILP (type)) | 1069 | if (NILP (type)) |
| @@ -1157,9 +1158,6 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1157 | int i; | 1158 | int i; |
| 1158 | EmacsToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; | 1159 | EmacsToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; |
| 1159 | 1160 | ||
| 1160 | if (NILP (f->tool_bar_lines) || !INTEGERP (f->tool_bar_lines)) | ||
| 1161 | return; | ||
| 1162 | |||
| 1163 | [toolbar clearActive]; | 1161 | [toolbar clearActive]; |
| 1164 | 1162 | ||
| 1165 | /* update EmacsToolbar as in GtkUtils, build items list */ | 1163 | /* update EmacsToolbar as in GtkUtils, build items list */ |
| @@ -1294,8 +1292,8 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1294 | helpText: (char *)help enabled: (BOOL)enabled | 1292 | helpText: (char *)help enabled: (BOOL)enabled |
| 1295 | { | 1293 | { |
| 1296 | /* 1) come up w/identifier */ | 1294 | /* 1) come up w/identifier */ |
| 1297 | NSString *identifier = | 1295 | NSString *identifier |
| 1298 | [NSString stringWithFormat: @"%u", [img hash]]; | 1296 | = [NSString stringWithFormat: @"%u", [img hash]]; |
| 1299 | 1297 | ||
| 1300 | /* 2) create / reuse item */ | 1298 | /* 2) create / reuse item */ |
| 1301 | NSToolbarItem *item = [identifierToItem objectForKey: identifier]; | 1299 | NSToolbarItem *item = [identifierToItem objectForKey: identifier]; |
| @@ -1557,7 +1555,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1557 | NSSize spacing = {SPACER, SPACER}; | 1555 | NSSize spacing = {SPACER, SPACER}; |
| 1558 | NSRect area; | 1556 | NSRect area; |
| 1559 | char this_cmd_name[80]; | 1557 | char this_cmd_name[80]; |
| 1560 | id cell, tem; | 1558 | id cell; |
| 1561 | static NSImageView *imgView; | 1559 | static NSImageView *imgView; |
| 1562 | static FlippedView *contentView; | 1560 | static FlippedView *contentView; |
| 1563 | 1561 | ||
| @@ -1649,7 +1647,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1649 | 1647 | ||
| 1650 | - (BOOL)windowShouldClose: (id)sender | 1648 | - (BOOL)windowShouldClose: (id)sender |
| 1651 | { | 1649 | { |
| 1652 | [NSApp stopModalWithCode: Qnil]; | 1650 | [NSApp stopModalWithCode: XHASH (Qnil)]; // FIXME: BIG UGLY HACK!! |
| 1653 | return NO; | 1651 | return NO; |
| 1654 | } | 1652 | } |
| 1655 | 1653 | ||
| @@ -1693,7 +1691,7 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1693 | [cell setTarget: self]; | 1691 | [cell setTarget: self]; |
| 1694 | [cell setAction: @selector (clicked: )]; | 1692 | [cell setAction: @selector (clicked: )]; |
| 1695 | [cell setTitle: [NSString stringWithUTF8String: str]]; | 1693 | [cell setTitle: [NSString stringWithUTF8String: str]]; |
| 1696 | [cell setTag: (int)val]; | 1694 | [cell setTag: XHASH (val)]; // FIXME: BIG UGLY HACK!! |
| 1697 | [cell setBordered: YES]; | 1695 | [cell setBordered: YES]; |
| 1698 | [cell setEnabled: YES]; | 1696 | [cell setEnabled: YES]; |
| 1699 | 1697 | ||
| @@ -1730,14 +1728,14 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1730 | - clicked: sender | 1728 | - clicked: sender |
| 1731 | { | 1729 | { |
| 1732 | NSArray *sellist = nil; | 1730 | NSArray *sellist = nil; |
| 1733 | Lisp_Object seltag; | 1731 | EMACS_INT seltag; |
| 1734 | 1732 | ||
| 1735 | sellist = [sender selectedCells]; | 1733 | sellist = [sender selectedCells]; |
| 1736 | if ([sellist count]<1) | 1734 | if ([sellist count]<1) |
| 1737 | return self; | 1735 | return self; |
| 1738 | 1736 | ||
| 1739 | seltag = (Lisp_Object)[[sellist objectAtIndex: 0] tag]; | 1737 | seltag = [[sellist objectAtIndex: 0] tag]; |
| 1740 | if (! EQ (seltag, Qundefined)) | 1738 | if (seltag == XHASH (Qundefined)) // FIXME: BIG UGLY HACK!! |
| 1741 | [NSApp stopModalWithCode: seltag]; | 1739 | [NSApp stopModalWithCode: seltag]; |
| 1742 | return self; | 1740 | return self; |
| 1743 | } | 1741 | } |
| @@ -1844,7 +1842,11 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1844 | } | 1842 | } |
| 1845 | [NSApp endModalSession: session]; | 1843 | [NSApp endModalSession: session]; |
| 1846 | 1844 | ||
| 1847 | return (Lisp_Object)ret; | 1845 | { // FIXME: BIG UGLY HACK!!! |
| 1846 | Lisp_Object tmp; | ||
| 1847 | *(EMACS_INT*)(&tmp) = ret; | ||
| 1848 | return tmp; | ||
| 1849 | } | ||
| 1848 | } | 1850 | } |
| 1849 | 1851 | ||
| 1850 | @end | 1852 | @end |
diff --git a/src/nsselect.m b/src/nsselect.m index 0b9927dbb52..4a7729d12d5 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -108,15 +108,14 @@ clean_local_selection_data (Lisp_Object obj) | |||
| 108 | if (VECTORP (obj)) | 108 | if (VECTORP (obj)) |
| 109 | { | 109 | { |
| 110 | int i; | 110 | int i; |
| 111 | int size = XVECTOR (obj)->size; | 111 | int size = ASIZE (obj); |
| 112 | Lisp_Object copy; | 112 | Lisp_Object copy; |
| 113 | 113 | ||
| 114 | if (size == 1) | 114 | if (size == 1) |
| 115 | return clean_local_selection_data (XVECTOR (obj)->contents [0]); | 115 | return clean_local_selection_data (AREF (obj, 0)); |
| 116 | copy = Fmake_vector (size, Qnil); | 116 | copy = Fmake_vector (make_number (size), Qnil); |
| 117 | for (i = 0; i < size; i++) | 117 | for (i = 0; i < size; i++) |
| 118 | XVECTOR (copy)->contents [i] | 118 | AREF (copy, i) = clean_local_selection_data (AREF (obj, i)); |
| 119 | = clean_local_selection_data (XVECTOR (obj)->contents [i]); | ||
| 120 | return copy; | 119 | return copy; |
| 121 | } | 120 | } |
| 122 | 121 | ||
| @@ -188,13 +187,13 @@ ns_get_local_selection (Lisp_Object selection_name, | |||
| 188 | CHECK_SYMBOL (target_type); | 187 | CHECK_SYMBOL (target_type); |
| 189 | handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); | 188 | handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); |
| 190 | if (!NILP (handler_fn)) | 189 | if (!NILP (handler_fn)) |
| 191 | value =call3 (handler_fn, selection_name, target_type, | 190 | value = call3 (handler_fn, selection_name, target_type, |
| 192 | XCAR (XCDR (local_value))); | 191 | XCAR (XCDR (local_value))); |
| 193 | else | 192 | else |
| 194 | value =Qnil; | 193 | value = Qnil; |
| 195 | unbind_to (count, Qnil); | 194 | unbind_to (count, Qnil); |
| 196 | 195 | ||
| 197 | check =value; | 196 | check = value; |
| 198 | if (CONSP (value) && SYMBOLP (XCAR (value))) | 197 | if (CONSP (value) && SYMBOLP (XCAR (value))) |
| 199 | { | 198 | { |
| 200 | type = XCAR (value); | 199 | type = XCAR (value); |
| @@ -213,9 +212,12 @@ ns_get_local_selection (Lisp_Object selection_name, | |||
| 213 | && NILP (XCDR (XCDR (check)))))) | 212 | && NILP (XCDR (XCDR (check)))))) |
| 214 | return value; | 213 | return value; |
| 215 | 214 | ||
| 215 | // FIXME: Why `quit' rather than `error'? | ||
| 216 | Fsignal (Qquit, Fcons (build_string ( | 216 | Fsignal (Qquit, Fcons (build_string ( |
| 217 | "invalid data returned by selection-conversion function"), | 217 | "invalid data returned by selection-conversion function"), |
| 218 | Fcons (handler_fn, Fcons (value, Qnil)))); | 218 | Fcons (handler_fn, Fcons (value, Qnil)))); |
| 219 | // FIXME: Beware, `quit' can return!! | ||
| 220 | return Qnil; | ||
| 219 | } | 221 | } |
| 220 | 222 | ||
| 221 | 223 | ||
| @@ -231,15 +233,16 @@ ns_get_foreign_selection (Lisp_Object symbol, Lisp_Object target) | |||
| 231 | static void | 233 | static void |
| 232 | ns_handle_selection_request (struct input_event *event) | 234 | ns_handle_selection_request (struct input_event *event) |
| 233 | { | 235 | { |
| 234 | id pb =(id)event->x; | 236 | // FIXME: BIG UGLY HACK!!! |
| 235 | NSString *type =(NSString *)event->y; | 237 | id pb = (id)*(EMACS_INT*)&(event->x); |
| 238 | NSString *type = (NSString *)*(EMACS_INT*)&(event->y); | ||
| 236 | Lisp_Object selection_name, selection_data, target_symbol, data; | 239 | Lisp_Object selection_name, selection_data, target_symbol, data; |
| 237 | Lisp_Object successful_p, rest; | 240 | Lisp_Object successful_p, rest; |
| 238 | 241 | ||
| 239 | selection_name =ns_string_to_symbol ([(NSPasteboard *)pb name]); | 242 | selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]); |
| 240 | target_symbol =ns_string_to_symbol (type); | 243 | target_symbol = ns_string_to_symbol (type); |
| 241 | selection_data = assq_no_quit (selection_name, Vselection_alist); | 244 | selection_data = assq_no_quit (selection_name, Vselection_alist); |
| 242 | successful_p =Qnil; | 245 | successful_p = Qnil; |
| 243 | 246 | ||
| 244 | if (!NILP (selection_data)) | 247 | if (!NILP (selection_data)) |
| 245 | { | 248 | { |
| @@ -248,13 +251,13 @@ ns_handle_selection_request (struct input_event *event) | |||
| 248 | { | 251 | { |
| 249 | if (STRINGP (data)) | 252 | if (STRINGP (data)) |
| 250 | ns_string_to_pasteboard_internal (pb, data, type); | 253 | ns_string_to_pasteboard_internal (pb, data, type); |
| 251 | successful_p =Qt; | 254 | successful_p = Qt; |
| 252 | } | 255 | } |
| 253 | } | 256 | } |
| 254 | 257 | ||
| 255 | if (!EQ (Vns_sent_selection_hooks, Qunbound)) | 258 | if (!EQ (Vns_sent_selection_hooks, Qunbound)) |
| 256 | { | 259 | { |
| 257 | for (rest =Vns_sent_selection_hooks;CONSP (rest); rest =Fcdr (rest)) | 260 | for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest)) |
| 258 | call3 (Fcar (rest), selection_name, target_symbol, successful_p); | 261 | call3 (Fcar (rest), selection_name, target_symbol, successful_p); |
| 259 | } | 262 | } |
| 260 | } | 263 | } |
| @@ -263,11 +266,11 @@ ns_handle_selection_request (struct input_event *event) | |||
| 263 | static void | 266 | static void |
| 264 | ns_handle_selection_clear (struct input_event *event) | 267 | ns_handle_selection_clear (struct input_event *event) |
| 265 | { | 268 | { |
| 266 | id pb = (id)event->x; | 269 | id pb = (id)*(EMACS_INT*)&(event->x); |
| 267 | Lisp_Object selection_name, selection_data, rest; | 270 | Lisp_Object selection_name, selection_data, rest; |
| 268 | 271 | ||
| 269 | selection_name =ns_string_to_symbol ([(NSPasteboard *)pb name]); | 272 | selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]); |
| 270 | selection_data =assq_no_quit (selection_name, Vselection_alist); | 273 | selection_data = assq_no_quit (selection_name, Vselection_alist); |
| 271 | if (NILP (selection_data)) return; | 274 | if (NILP (selection_data)) return; |
| 272 | 275 | ||
| 273 | if (EQ (selection_data, Fcar (Vselection_alist))) | 276 | if (EQ (selection_data, Fcar (Vselection_alist))) |
| @@ -281,7 +284,7 @@ ns_handle_selection_clear (struct input_event *event) | |||
| 281 | 284 | ||
| 282 | if (!EQ (Vns_lost_selection_hooks, Qunbound)) | 285 | if (!EQ (Vns_lost_selection_hooks, Qunbound)) |
| 283 | { | 286 | { |
| 284 | for (rest =Vns_lost_selection_hooks;CONSP (rest); rest =Fcdr (rest)) | 287 | for (rest = Vns_lost_selection_hooks;CONSP (rest); rest = Fcdr (rest)) |
| 285 | call1 (Fcar (rest), selection_name); | 288 | call1 (Fcar (rest), selection_name); |
| 286 | } | 289 | } |
| 287 | } | 290 | } |
| @@ -384,10 +387,10 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal, | |||
| 384 | error ("selection-value may not be nil."); | 387 | error ("selection-value may not be nil."); |
| 385 | pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)]; | 388 | pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)]; |
| 386 | ns_declare_pasteboard (pb); | 389 | ns_declare_pasteboard (pb); |
| 387 | old_value =assq_no_quit (selection_name, Vselection_alist); | 390 | old_value = assq_no_quit (selection_name, Vselection_alist); |
| 388 | new_value = Fcons (selection_name, Fcons (selection_value, Qnil)); | 391 | new_value = Fcons (selection_name, Fcons (selection_value, Qnil)); |
| 389 | if (NILP (old_value)) | 392 | if (NILP (old_value)) |
| 390 | Vselection_alist =Fcons (new_value, Vselection_alist); | 393 | Vselection_alist = Fcons (new_value, Vselection_alist); |
| 391 | else | 394 | else |
| 392 | Fsetcdr (old_value, Fcdr (new_value)); | 395 | Fsetcdr (old_value, Fcdr (new_value)); |
| 393 | /* XXX An evil hack, but a necessary one I fear XXX */ | 396 | /* XXX An evil hack, but a necessary one I fear XXX */ |
| @@ -396,8 +399,8 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal, | |||
| 396 | ev.kind = SELECTION_REQUEST_EVENT; | 399 | ev.kind = SELECTION_REQUEST_EVENT; |
| 397 | ev.modifiers = 0; | 400 | ev.modifiers = 0; |
| 398 | ev.code = 0; | 401 | ev.code = 0; |
| 399 | ev.x = (int)pb; | 402 | *(EMACS_INT*)(&(ev.x)) = (EMACS_INT)pb; // FIXME: BIG UGLY HACK!! |
| 400 | ev.y = (int)NSStringPboardType; | 403 | *(EMACS_INT*)(&(ev.y)) = (EMACS_INT)NSStringPboardType; |
| 401 | ns_handle_selection_request (&ev); | 404 | ns_handle_selection_request (&ev); |
| 402 | } | 405 | } |
| 403 | return selection_value; | 406 | return selection_value; |
diff --git a/src/nsterm.h b/src/nsterm.h index c934ed8e792..260263549b6 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -717,6 +717,9 @@ extern void ns_term_shutdown (int sig); | |||
| 717 | #define NS_DUMPGLYPH_MOUSEFACE 3 | 717 | #define NS_DUMPGLYPH_MOUSEFACE 3 |
| 718 | 718 | ||
| 719 | 719 | ||
| 720 | EXFUN (Fx_display_grayscale_p, 1); | ||
| 721 | EXFUN (Fx_display_planes, 1); | ||
| 722 | |||
| 720 | /* In nsfont, called from fontset.c */ | 723 | /* In nsfont, called from fontset.c */ |
| 721 | extern void nsfont_make_fontset_for_font (Lisp_Object name, | 724 | extern void nsfont_make_fontset_for_font (Lisp_Object name, |
| 722 | Lisp_Object font_object); | 725 | Lisp_Object font_object); |
| @@ -747,11 +750,13 @@ extern Lisp_Object ns_cursor_type_to_lisp (int arg); | |||
| 747 | extern Lisp_Object Qnone; | 750 | extern Lisp_Object Qnone; |
| 748 | 751 | ||
| 749 | /* XColor defined in dispextern.h (we use color_def->pixel = NSColor id), but | 752 | /* XColor defined in dispextern.h (we use color_def->pixel = NSColor id), but |
| 750 | this causes an #include snafu, so we can't declare it. | 753 | this causes an #include snafu, so we can't declare it. */ |
| 751 | extern int ns_defined_color (struct frame *f, char *name, XColor *color_def, | 754 | extern int |
| 752 | int alloc); */ | 755 | ns_defined_color (struct frame *f, char *name, XColor *color_def, int alloc, |
| 756 | char makeIndex); | ||
| 753 | 757 | ||
| 754 | #ifdef __OBJC__ | 758 | #ifdef __OBJC__ |
| 759 | extern Lisp_Object ns_color_to_lisp (NSColor *col); | ||
| 755 | extern int ns_lisp_to_color (Lisp_Object color, NSColor **col); | 760 | extern int ns_lisp_to_color (Lisp_Object color, NSColor **col); |
| 756 | extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); | 761 | extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); |
| 757 | extern unsigned long ns_index_color (NSColor *color, struct frame *f); | 762 | extern unsigned long ns_index_color (NSColor *color, struct frame *f); |
diff --git a/src/nsterm.m b/src/nsterm.m index 81506be6517..60763645144 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -367,10 +367,10 @@ ns_init_paths () | |||
| 367 | if (isDir) | 367 | if (isDir) |
| 368 | { | 368 | { |
| 369 | if ([resourcePaths length] > 0) | 369 | if ([resourcePaths length] > 0) |
| 370 | resourcePaths = | 370 | resourcePaths |
| 371 | [resourcePaths stringByAppendingString: pathSeparator]; | 371 | = [resourcePaths stringByAppendingString: pathSeparator]; |
| 372 | resourcePaths = | 372 | resourcePaths |
| 373 | [resourcePaths stringByAppendingString: resourcePath]; | 373 | = [resourcePaths stringByAppendingString: resourcePath]; |
| 374 | } | 374 | } |
| 375 | } | 375 | } |
| 376 | if ([resourcePaths length] > 0) | 376 | if ([resourcePaths length] > 0) |
| @@ -391,10 +391,10 @@ ns_init_paths () | |||
| 391 | if (isDir) | 391 | if (isDir) |
| 392 | { | 392 | { |
| 393 | if ([resourcePaths length] > 0) | 393 | if ([resourcePaths length] > 0) |
| 394 | resourcePaths = | 394 | resourcePaths |
| 395 | [resourcePaths stringByAppendingString: pathSeparator]; | 395 | = [resourcePaths stringByAppendingString: pathSeparator]; |
| 396 | resourcePaths = | 396 | resourcePaths |
| 397 | [resourcePaths stringByAppendingString: resourcePath]; | 397 | = [resourcePaths stringByAppendingString: resourcePath]; |
| 398 | } | 398 | } |
| 399 | } | 399 | } |
| 400 | if ([resourcePaths length] > 0) | 400 | if ([resourcePaths length] > 0) |
| @@ -949,8 +949,8 @@ ns_frame_rehighlight (struct frame *frame) | |||
| 949 | NSTRACE (ns_frame_rehighlight); | 949 | NSTRACE (ns_frame_rehighlight); |
| 950 | if (dpyinfo->ns_focus_frame) | 950 | if (dpyinfo->ns_focus_frame) |
| 951 | { | 951 | { |
| 952 | dpyinfo->ns_highlight_frame = | 952 | dpyinfo->ns_highlight_frame |
| 953 | (FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) | 953 | = (FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) |
| 954 | ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) | 954 | ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->ns_focus_frame)) |
| 955 | : dpyinfo->ns_focus_frame); | 955 | : dpyinfo->ns_focus_frame); |
| 956 | if (!FRAME_LIVE_P (dpyinfo->ns_highlight_frame)) | 956 | if (!FRAME_LIVE_P (dpyinfo->ns_highlight_frame)) |
| @@ -1161,10 +1161,10 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) | |||
| 1161 | /* PENDING: GNUstep has not yet implemented the first method below, added | 1161 | /* PENDING: GNUstep has not yet implemented the first method below, added |
| 1162 | in Panther, however the second is incorrect under Cocoa. */ | 1162 | in Panther, however the second is incorrect under Cocoa. */ |
| 1163 | #ifdef NS_IMPL_GNUSTEP | 1163 | #ifdef NS_IMPL_GNUSTEP |
| 1164 | FRAME_NS_TOOLBAR_HEIGHT (f) = | 1164 | FRAME_NS_TOOLBAR_HEIGHT (f) |
| 1165 | NSHeight ([NSWindow frameRectForContentRect: NSMakeRect (0, 0, 0, 0) | 1165 | = NSHeight ([NSWindow frameRectForContentRect: NSMakeRect (0, 0, 0, 0) |
| 1166 | styleMask: [window styleMask]]) | 1166 | styleMask: [window styleMask]]) |
| 1167 | - FRAME_NS_TITLEBAR_HEIGHT (f); | 1167 | - FRAME_NS_TITLEBAR_HEIGHT (f); |
| 1168 | #else | 1168 | #else |
| 1169 | FRAME_NS_TOOLBAR_HEIGHT (f) = 32; | 1169 | FRAME_NS_TOOLBAR_HEIGHT (f) = 32; |
| 1170 | /* actually get wrong result here if toolbar not yet displayed | 1170 | /* actually get wrong result here if toolbar not yet displayed |
| @@ -1260,8 +1260,8 @@ ns_index_color (NSColor *color, struct frame *f) | |||
| 1260 | { | 1260 | { |
| 1261 | color_table->size = NS_COLOR_CAPACITY; | 1261 | color_table->size = NS_COLOR_CAPACITY; |
| 1262 | color_table->avail = 1; /* skip idx=0 as marker */ | 1262 | color_table->avail = 1; /* skip idx=0 as marker */ |
| 1263 | color_table->colors = | 1263 | color_table->colors |
| 1264 | (NSColor **)xmalloc (color_table->size * sizeof (NSColor *)); | 1264 | = (NSColor **)xmalloc (color_table->size * sizeof (NSColor *)); |
| 1265 | color_table->empty_indices = [[NSMutableSet alloc] init]; | 1265 | color_table->empty_indices = [[NSMutableSet alloc] init]; |
| 1266 | } | 1266 | } |
| 1267 | 1267 | ||
| @@ -1289,9 +1289,9 @@ ns_index_color (NSColor *color, struct frame *f) | |||
| 1289 | if (color_table->avail == color_table->size) | 1289 | if (color_table->avail == color_table->size) |
| 1290 | { | 1290 | { |
| 1291 | color_table->size += NS_COLOR_CAPACITY; | 1291 | color_table->size += NS_COLOR_CAPACITY; |
| 1292 | color_table->colors = | 1292 | color_table->colors |
| 1293 | (NSColor **)xrealloc (color_table->colors, | 1293 | = (NSColor **)xrealloc (color_table->colors, |
| 1294 | color_table->size * sizeof (NSColor *)); | 1294 | color_table->size * sizeof (NSColor *)); |
| 1295 | } | 1295 | } |
| 1296 | idx = color_table->avail++; | 1296 | idx = color_table->avail++; |
| 1297 | index = [NSNumber numberWithUnsignedInt: idx]; | 1297 | index = [NSNumber numberWithUnsignedInt: idx]; |
| @@ -1590,9 +1590,9 @@ ns_defined_color (struct frame *f, char *name, XColor *color_def, int alloc, | |||
| 1590 | color_def->blue = b * 256; | 1590 | color_def->blue = b * 256; |
| 1591 | 1591 | ||
| 1592 | if (!makeIndex) | 1592 | if (!makeIndex) |
| 1593 | color_def->pixel = | 1593 | color_def->pixel |
| 1594 | ARGB_TO_ULONG((int)(a*256), | 1594 | = ARGB_TO_ULONG((int)(a*256), |
| 1595 | color_def->red, color_def->green, color_def->blue); | 1595 | color_def->red, color_def->green, color_def->blue); |
| 1596 | 1596 | ||
| 1597 | return 1; | 1597 | return 1; |
| 1598 | } | 1598 | } |
| @@ -1945,8 +1945,8 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height) | |||
| 1945 | { | 1945 | { |
| 1946 | /* clip out the resize handle */ | 1946 | /* clip out the resize handle */ |
| 1947 | NSWindow *window = [FRAME_NS_VIEW (f) window]; | 1947 | NSWindow *window = [FRAME_NS_VIEW (f) window]; |
| 1948 | NSRect ir = | 1948 | NSRect ir |
| 1949 | [view convertRect: ns_resize_handle_rect (window) fromView: nil]; | 1949 | = [view convertRect: ns_resize_handle_rect (window) fromView: nil]; |
| 1950 | 1950 | ||
| 1951 | ir = NSIntersectionRect (r, ir); | 1951 | ir = NSIntersectionRect (r, ir); |
| 1952 | if (NSIsEmptyRect (ir)) | 1952 | if (NSIsEmptyRect (ir)) |
| @@ -2137,8 +2137,9 @@ ns_compute_glyph_string_overhangs (struct glyph_string *s) | |||
| 2137 | 2137 | ||
| 2138 | font->driver->text_extents (font, codes, 2, &metrics); | 2138 | font->driver->text_extents (font, codes, 2, &metrics); |
| 2139 | s->left_overhang = -metrics.lbearing; | 2139 | s->left_overhang = -metrics.lbearing; |
| 2140 | s->right_overhang = | 2140 | s->right_overhang |
| 2141 | metrics.rbearing > metrics.width ? metrics.rbearing - metrics.width : 0; | 2141 | = metrics.rbearing > metrics.width |
| 2142 | ? metrics.rbearing - metrics.width : 0; | ||
| 2142 | } | 2143 | } |
| 2143 | else | 2144 | else |
| 2144 | { | 2145 | { |
| @@ -2173,11 +2174,11 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2173 | /* NS-specific: move internal border inside fringe */ | 2174 | /* NS-specific: move internal border inside fringe */ |
| 2174 | int x = p->bx < 0 ? p->x : p->bx; | 2175 | int x = p->bx < 0 ? p->x : p->bx; |
| 2175 | int wd = p->bx < 0 ? p->wd : p->nx; | 2176 | int wd = p->bx < 0 ? p->wd : p->nx; |
| 2176 | BOOL fringeOnVeryLeft = | 2177 | BOOL fringeOnVeryLeft |
| 2177 | x - WINDOW_LEFT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) | 2178 | = x - WINDOW_LEFT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) |
| 2178 | - FRAME_INTERNAL_BORDER_WIDTH (f) < 10; | 2179 | - FRAME_INTERNAL_BORDER_WIDTH (f) < 10; |
| 2179 | BOOL fringeOnVeryRight = | 2180 | BOOL fringeOnVeryRight |
| 2180 | FRAME_PIXEL_WIDTH (f) - x - wd - FRAME_INTERNAL_BORDER_WIDTH (f) | 2181 | = FRAME_PIXEL_WIDTH (f) - x - wd - FRAME_INTERNAL_BORDER_WIDTH (f) |
| 2181 | - WINDOW_RIGHT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) < 10; | 2182 | - WINDOW_RIGHT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) < 10; |
| 2182 | int xAdjust = FRAME_INTERNAL_BORDER_WIDTH (f) * | 2183 | int xAdjust = FRAME_INTERNAL_BORDER_WIDTH (f) * |
| 2183 | (fringeOnVeryLeft ? -1 : (fringeOnVeryRight ? 1 : 0)); | 2184 | (fringeOnVeryLeft ? -1 : (fringeOnVeryRight ? 1 : 0)); |
| @@ -2185,8 +2186,8 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2185 | /* grow bimgs if needed */ | 2186 | /* grow bimgs if needed */ |
| 2186 | if (nBimgs < max_used_fringe_bitmap) | 2187 | if (nBimgs < max_used_fringe_bitmap) |
| 2187 | { | 2188 | { |
| 2188 | EmacsImage **newBimgs = | 2189 | EmacsImage **newBimgs |
| 2189 | xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *)); | 2190 | = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *)); |
| 2190 | bzero (newBimgs, max_used_fringe_bitmap * sizeof (EmacsImage *)); | 2191 | bzero (newBimgs, max_used_fringe_bitmap * sizeof (EmacsImage *)); |
| 2191 | 2192 | ||
| 2192 | if (nBimgs) | 2193 | if (nBimgs) |
| @@ -2321,8 +2322,8 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2321 | /* PENDING: 23: use emacs stored f->cursor_type instead of ns-specific */ | 2322 | /* PENDING: 23: use emacs stored f->cursor_type instead of ns-specific */ |
| 2322 | oldCursorType = FRAME_CURSOR (f); | 2323 | oldCursorType = FRAME_CURSOR (f); |
| 2323 | cursorType = FRAME_CURSOR (f) = FRAME_NEW_CURSOR (f); | 2324 | cursorType = FRAME_CURSOR (f) = FRAME_NEW_CURSOR (f); |
| 2324 | f->output_data.ns->current_cursor_color = | 2325 | f->output_data.ns->current_cursor_color |
| 2325 | f->output_data.ns->desired_cursor_color; | 2326 | = f->output_data.ns->desired_cursor_color; |
| 2326 | 2327 | ||
| 2327 | /* PENDING: only needed in rare cases with last-resort font in HELLO.. | 2328 | /* PENDING: only needed in rare cases with last-resort font in HELLO.. |
| 2328 | should we do this more efficiently? */ | 2329 | should we do this more efficiently? */ |
| @@ -3192,10 +3193,10 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 3192 | cursor_blink_entry = 0; | 3193 | cursor_blink_entry = 0; |
| 3193 | if (dpyinfo->ns_highlight_frame) | 3194 | if (dpyinfo->ns_highlight_frame) |
| 3194 | { | 3195 | { |
| 3195 | Lisp_Object tem = | 3196 | Lisp_Object tem |
| 3196 | get_frame_param (dpyinfo->ns_highlight_frame, Qcursor_type); | 3197 | = get_frame_param (dpyinfo->ns_highlight_frame, Qcursor_type); |
| 3197 | dpyinfo->ns_highlight_frame->output_data.ns->desired_cursor = | 3198 | dpyinfo->ns_highlight_frame->output_data.ns->desired_cursor |
| 3198 | ns_lisp_to_cursor_type (tem); | 3199 | = ns_lisp_to_cursor_type (tem); |
| 3199 | } | 3200 | } |
| 3200 | } | 3201 | } |
| 3201 | 3202 | ||
| @@ -3543,8 +3544,8 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) | |||
| 3543 | NSColorSpaceFromDepth (depth)]; | 3544 | NSColorSpaceFromDepth (depth)]; |
| 3544 | dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); | 3545 | dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); |
| 3545 | dpyinfo->image_cache = make_image_cache (); | 3546 | dpyinfo->image_cache = make_image_cache (); |
| 3546 | dpyinfo->color_table = | 3547 | dpyinfo->color_table |
| 3547 | (struct ns_color_table *)xmalloc (sizeof (struct ns_color_table)); | 3548 | = (struct ns_color_table *)xmalloc (sizeof (struct ns_color_table)); |
| 3548 | dpyinfo->color_table->colors = NULL; | 3549 | dpyinfo->color_table->colors = NULL; |
| 3549 | dpyinfo->root_window = 42; /* a placeholder.. */ | 3550 | dpyinfo->root_window = 42; /* a placeholder.. */ |
| 3550 | 3551 | ||
| @@ -3799,15 +3800,15 @@ handling_signal = 0; | |||
| 3799 | ns_default ("ExpandSpace", &ns_expand_space, | 3800 | ns_default ("ExpandSpace", &ns_expand_space, |
| 3800 | make_float (0.5), make_float (0.0), YES, NO); | 3801 | make_float (0.5), make_float (0.0), YES, NO); |
| 3801 | ns_default ("GSFontAntiAlias", &ns_antialias_text, | 3802 | ns_default ("GSFontAntiAlias", &ns_antialias_text, |
| 3802 | YES, NO, NO, NO); | 3803 | Qt, Qnil, NO, NO); |
| 3803 | tmp = Qnil; | 3804 | tmp = Qnil; |
| 3804 | ns_default ("AppleAntiAliasingThreshold", &tmp, | 3805 | ns_default ("AppleAntiAliasingThreshold", &tmp, |
| 3805 | make_float (10.0), make_float (6.0), YES, NO); | 3806 | make_float (10.0), make_float (6.0), YES, NO); |
| 3806 | ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp); | 3807 | ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp); |
| 3807 | ns_default ("UseQuickdrawSmoothing", &ns_use_qd_smoothing, | 3808 | ns_default ("UseQuickdrawSmoothing", &ns_use_qd_smoothing, |
| 3808 | YES, NO, NO, NO); | 3809 | Qt, Qnil, NO, NO); |
| 3809 | ns_default ("UseSystemHighlightColor", &ns_use_system_highlight_color, | 3810 | ns_default ("UseSystemHighlightColor", &ns_use_system_highlight_color, |
| 3810 | YES, NO, NO, NO); | 3811 | Qt, Qnil, NO, NO); |
| 3811 | if (ns_use_system_highlight_color == YES) | 3812 | if (ns_use_system_highlight_color == YES) |
| 3812 | { | 3813 | { |
| 3813 | ns_selection_color = [[NSUserDefaults standardUserDefaults] | 3814 | ns_selection_color = [[NSUserDefaults standardUserDefaults] |
| @@ -3829,17 +3830,17 @@ handling_signal = 0; | |||
| 3829 | { | 3830 | { |
| 3830 | /* first try data_dir, then invocation-dir | 3831 | /* first try data_dir, then invocation-dir |
| 3831 | and finally source-directory/etc */ | 3832 | and finally source-directory/etc */ |
| 3832 | tem1 = tem = | 3833 | tem1 = tem |
| 3833 | Fexpand_file_name (build_string ("Emacs.clr"), Vdata_directory); | 3834 | = Fexpand_file_name (build_string ("Emacs.clr"), Vdata_directory); |
| 3834 | if (NILP (Ffile_exists_p (tem))) | 3835 | if (NILP (Ffile_exists_p (tem))) |
| 3835 | { | 3836 | { |
| 3836 | tem = Fexpand_file_name (build_string ("Emacs.clr"), | 3837 | tem = Fexpand_file_name (build_string ("Emacs.clr"), |
| 3837 | Vinvocation_directory); | 3838 | Vinvocation_directory); |
| 3838 | if (NILP (Ffile_exists_p (tem))) | 3839 | if (NILP (Ffile_exists_p (tem))) |
| 3839 | { | 3840 | { |
| 3840 | Lisp_Object newdir = | 3841 | Lisp_Object newdir |
| 3841 | Fexpand_file_name (build_string ("etc/"), | 3842 | = Fexpand_file_name (build_string ("etc/"), |
| 3842 | Vsource_directory); | 3843 | Vsource_directory); |
| 3843 | tem = Fexpand_file_name (build_string ("Emacs.clr"), | 3844 | tem = Fexpand_file_name (build_string ("Emacs.clr"), |
| 3844 | newdir); | 3845 | newdir); |
| 3845 | } | 3846 | } |
| @@ -4211,8 +4212,8 @@ baseline level. The default value is nil. */); | |||
| 4211 | Fcons (build_string ("Cancel"), Qnil), | 4212 | Fcons (build_string ("Cancel"), Qnil), |
| 4212 | Fcons (build_string ("Save and Exit"), Qt)); | 4213 | Fcons (build_string ("Save and Exit"), Qt)); |
| 4213 | Lisp_Object res = ns_popup_dialog (Qt, contents, Qnil); | 4214 | Lisp_Object res = ns_popup_dialog (Qt, contents, Qnil); |
| 4214 | fprintf (stderr, "res = %d\n", res ==Qt); | 4215 | fprintf (stderr, "res = %d\n", EQ (res, Qt)); // FIXME |
| 4215 | if (res == Qt) | 4216 | if (EQ (res, Qt)) |
| 4216 | { | 4217 | { |
| 4217 | Feval (Fcons (intern ("save-buffers-kill-emacs"), Qnil)); | 4218 | Feval (Fcons (intern ("save-buffers-kill-emacs"), Qnil)); |
| 4218 | return NSTerminateNow; | 4219 | return NSTerminateNow; |
| @@ -4671,8 +4672,8 @@ if (NS_KEYLOG) NSLog (@"insertText '%@'\tlen = %d", aString, len); | |||
| 4671 | if (code == 0x2DC) | 4672 | if (code == 0x2DC) |
| 4672 | code = '~'; /* 0x7E */ | 4673 | code = '~'; /* 0x7E */ |
| 4673 | emacs_event->modifiers = 0; | 4674 | emacs_event->modifiers = 0; |
| 4674 | emacs_event->kind = | 4675 | emacs_event->kind |
| 4675 | code > 0xFF ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; | 4676 | = code > 0xFF ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; |
| 4676 | emacs_event->code = code; | 4677 | emacs_event->code = code; |
| 4677 | EV_TRAILER ((id)nil); | 4678 | EV_TRAILER ((id)nil); |
| 4678 | } | 4679 | } |
| @@ -4920,8 +4921,8 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request"); | |||
| 4920 | NSTRACE (mouseMoved); | 4921 | NSTRACE (mouseMoved); |
| 4921 | 4922 | ||
| 4922 | last_mouse_movement_time = EV_TIMESTAMP (e); | 4923 | last_mouse_movement_time = EV_TIMESTAMP (e); |
| 4923 | last_mouse_motion_position = | 4924 | last_mouse_motion_position |
| 4924 | [self convertPoint: [e locationInWindow] fromView: nil]; | 4925 | = [self convertPoint: [e locationInWindow] fromView: nil]; |
| 4925 | 4926 | ||
| 4926 | /* update any mouse face */ | 4927 | /* update any mouse face */ |
| 4927 | if (dpyinfo->mouse_face_hidden) | 4928 | if (dpyinfo->mouse_face_hidden) |
| @@ -5361,8 +5362,8 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request"); | |||
| 5361 | { | 5362 | { |
| 5362 | NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; | 5363 | NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; |
| 5363 | NSRect r; | 5364 | NSRect r; |
| 5364 | struct ns_display_info *dpyinfo = | 5365 | struct ns_display_info *dpyinfo |
| 5365 | emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL; | 5366 | = emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL; |
| 5366 | 5367 | ||
| 5367 | NSTRACE (mouseExited); | 5368 | NSTRACE (mouseExited); |
| 5368 | 5369 | ||
| @@ -5924,14 +5925,14 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request"); | |||
| 5924 | if (inKnob) | 5925 | if (inKnob) |
| 5925 | return self; | 5926 | return self; |
| 5926 | 5927 | ||
| 5927 | scroll_repeat_entry = | 5928 | scroll_repeat_entry |
| 5928 | [[NSTimer scheduledTimerWithTimeInterval: | 5929 | = [[NSTimer scheduledTimerWithTimeInterval: |
| 5929 | SCROLL_BAR_CONTINUOUS_DELAY | 5930 | SCROLL_BAR_CONTINUOUS_DELAY |
| 5930 | target: self | 5931 | target: self |
| 5931 | selector: @selector (repeatScroll:) | 5932 | selector: @selector (repeatScroll:) |
| 5932 | userInfo: 0 | 5933 | userInfo: 0 |
| 5933 | repeats: YES] | 5934 | repeats: YES] |
| 5934 | retain]; | 5935 | retain]; |
| 5935 | } | 5936 | } |
| 5936 | 5937 | ||
| 5937 | [self sendScrollEventAtLoc: 0 fromEvent: e]; | 5938 | [self sendScrollEventAtLoc: 0 fromEvent: e]; |
| @@ -5975,13 +5976,13 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request"); | |||
| 5975 | pos = 0; /* ignored */ | 5976 | pos = 0; /* ignored */ |
| 5976 | 5977 | ||
| 5977 | /* set a timer to repeat, as we can't let superclass do this modally */ | 5978 | /* set a timer to repeat, as we can't let superclass do this modally */ |
| 5978 | scroll_repeat_entry = | 5979 | scroll_repeat_entry |
| 5979 | [[NSTimer scheduledTimerWithTimeInterval: 0.5 | 5980 | = [[NSTimer scheduledTimerWithTimeInterval: 0.5 |
| 5980 | target: self | 5981 | target: self |
| 5981 | selector: @selector (repeatScroll:) | 5982 | selector: @selector (repeatScroll:) |
| 5982 | userInfo: 0 | 5983 | userInfo: 0 |
| 5983 | repeats: YES] | 5984 | repeats: YES] |
| 5984 | retain]; | 5985 | retain]; |
| 5985 | } | 5986 | } |
| 5986 | else | 5987 | else |
| 5987 | { | 5988 | { |
| @@ -6133,8 +6134,8 @@ static void selectItemWithTag (NSPopUpButton *popup, int tag) | |||
| 6133 | 6134 | ||
| 6134 | - (void) setPanelFromValues | 6135 | - (void) setPanelFromValues |
| 6135 | { | 6136 | { |
| 6136 | int cursorType = | 6137 | int cursorType |
| 6137 | ns_lisp_to_cursor_type (get_frame_param (frame, Qcursor_type)); | 6138 | = ns_lisp_to_cursor_type (get_frame_param (frame, Qcursor_type)); |
| 6138 | prevExpandSpace = XFLOATINT (ns_expand_space); | 6139 | prevExpandSpace = XFLOATINT (ns_expand_space); |
| 6139 | prevBlinkRate = NILP (ns_cursor_blink_rate) | 6140 | prevBlinkRate = NILP (ns_cursor_blink_rate) |
| 6140 | ? 0 : XFLOATINT (ns_cursor_blink_rate); | 6141 | ? 0 : XFLOATINT (ns_cursor_blink_rate); |
| @@ -6199,7 +6200,7 @@ static void selectItemWithTag (NSPopUpButton *popup, int tag) | |||
| 6199 | ns_cursor_blink_rate = make_float (blinkRate); | 6200 | ns_cursor_blink_rate = make_float (blinkRate); |
| 6200 | ns_cursor_blink_mode = Qt; | 6201 | ns_cursor_blink_mode = Qt; |
| 6201 | } | 6202 | } |
| 6202 | if (ns_cursor_blink_mode != old_cursor_blink_mode) | 6203 | if (!EQ (ns_cursor_blink_mode, old_cursor_blink_mode)) |
| 6203 | Feval (Fcons (intern ("blink-cursor-mode"), Qnil)); | 6204 | Feval (Fcons (intern ("blink-cursor-mode"), Qnil)); |
| 6204 | 6205 | ||
| 6205 | if (blinkRate != 0.0 && prevBlinkRate != 0.0) | 6206 | if (blinkRate != 0.0 && prevBlinkRate != 0.0) |
| @@ -6210,18 +6211,18 @@ static void selectItemWithTag (NSPopUpButton *popup, int tag) | |||
| 6210 | cursor_blink_entry = 0; | 6211 | cursor_blink_entry = 0; |
| 6211 | if (dpyinfo->ns_highlight_frame) | 6212 | if (dpyinfo->ns_highlight_frame) |
| 6212 | { | 6213 | { |
| 6213 | Lisp_Object tem = | 6214 | Lisp_Object tem |
| 6214 | get_frame_param (dpyinfo->ns_highlight_frame, Qcursor_type); | 6215 | = get_frame_param (dpyinfo->ns_highlight_frame, Qcursor_type); |
| 6215 | dpyinfo->ns_highlight_frame->output_data.ns->desired_cursor = | 6216 | dpyinfo->ns_highlight_frame->output_data.ns->desired_cursor |
| 6216 | ns_lisp_to_cursor_type (tem); | 6217 | = ns_lisp_to_cursor_type (tem); |
| 6217 | } | 6218 | } |
| 6218 | } | 6219 | } |
| 6219 | prevBlinkRate = blinkRate; | 6220 | prevBlinkRate = blinkRate; |
| 6220 | } | 6221 | } |
| 6221 | FRAME_NEW_CURSOR (frame) = | 6222 | FRAME_NEW_CURSOR (frame) |
| 6222 | (cursorTag == 1 ? filled_box : | 6223 | = (cursorTag == 1 ? filled_box |
| 6223 | (cursorTag == 2 ? bar : | 6224 | : cursorTag == 2 ? bar |
| 6224 | (cursorTag == 3 ? underscore : hollow_box))); | 6225 | : cursorTag == 3 ? underscore : hollow_box); |
| 6225 | store_frame_param (frame, Qcursor_type, | 6226 | store_frame_param (frame, Qcursor_type, |
| 6226 | ns_cursor_type_to_lisp (FRAME_NEW_CURSOR (frame))); | 6227 | ns_cursor_type_to_lisp (FRAME_NEW_CURSOR (frame))); |
| 6227 | ns_alternate_modifier = ns_mod_to_lisp (altTag); | 6228 | ns_alternate_modifier = ns_mod_to_lisp (altTag); |
| @@ -6446,14 +6447,15 @@ ns_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames) | |||
| 6446 | synthItalFont = NULL; | 6447 | synthItalFont = NULL; |
| 6447 | while (membInfo = [senum nextObject]) | 6448 | while (membInfo = [senum nextObject]) |
| 6448 | { | 6449 | { |
| 6449 | xlfdName = | 6450 | xlfdName |
| 6450 | ns_fontname_to_xlfd ([[membInfo objectAtIndex: 0] UTF8String]); | 6451 | = ns_fontname_to_xlfd ([[membInfo objectAtIndex: 0] |
| 6452 | UTF8String]); | ||
| 6451 | list = Fcons (build_string (xlfdName), list); | 6453 | list = Fcons (build_string (xlfdName), list); |
| 6452 | if (!synthItalFont) | 6454 | if (!synthItalFont) |
| 6453 | { | 6455 | { |
| 6454 | NSString *synthName = | 6456 | NSString *synthName |
| 6455 | [[membInfo objectAtIndex: 0] | 6457 | = [[membInfo objectAtIndex: 0] |
| 6456 | stringByAppendingString: @"-synthItal"]; | 6458 | stringByAppendingString: @"-synthItal"]; |
| 6457 | synthItalFont = [synthName UTF8String]; | 6459 | synthItalFont = [synthName UTF8String]; |
| 6458 | } | 6460 | } |
| 6459 | else if ([[membInfo objectAtIndex: 3] intValue] | 6461 | else if ([[membInfo objectAtIndex: 3] intValue] |