diff options
| author | Jan Djärv | 2013-06-02 21:14:25 +0200 |
|---|---|---|
| committer | Jan Djärv | 2013-06-02 21:14:25 +0200 |
| commit | c0342369acfbad2f0ea86b949a2f116304186353 (patch) | |
| tree | ee60679ec6f2c20b201ef8a71be515582e27c268 | |
| parent | a2d98946738ffd42f90b3f54d2a32be9d7b6429e (diff) | |
| download | emacs-c0342369acfbad2f0ea86b949a2f116304186353.tar.gz emacs-c0342369acfbad2f0ea86b949a2f116304186353.zip | |
Update the GNUStep port so it works OK. Redraw and sizing bugs remain.
* nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument.
* src/nsfns.m (x_set_foreground_color, x_set_background_color): Use
EmacsCGFloat.
(ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove
unused variables.
(Fns_read_file_name): Keep track if panel is for save. Use
ns_filename_from_panel/ns_directory_from_panel.
(Fns_list_services): delegate only used for COCOA.
(Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just
return the input if GNUStep.
(x_screen_planes): Remove.
(Fxw_color_values): Use EmacsCGFloat
(Fns_display_monitor_attributes_list): Only get screen number for
Cocoa.
(getDirectory, getFilename): Removed from EmacsOpenPanel and
EmacsSavePanel.
(EmacsOpenPanel:ok:): Use ns_filename_from_panel and
ns_directory_from_panel.
* src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor)
(ns_charset_covers, ns_get_covering_families, nsfont_open):
Use F suffix on floats.
(ns_char_width): Returns CGFloat.
(ns_ascii_average_width): w is CGFloat instead of float.
(nsfont_draw): cbuf and c are unsigned. Cast to char* in call to
DPSxshow.
(ns_glyph_metrics): CGFloat instead of float.
* src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat.
* src/nsmenu.m (ns_update_menubar): Make static.
(x_activate_menubar): Surround with ifdef NS_IMPL_COCOA
(fillWithWidgetValue:): Add cast to SEL for setAction.
(addSubmenuWithTitle:forFrame:): Add cast to SEL for action.
(update_frame_tool_bar): Update code for GNUStep.
(clearAll): New method.
(addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag
argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move
identifierToItem setObject and activeIdentifiers addObject before
call to insertItemWithItemIdentifier.
(validateVisibleItems): Fix indentation.
(toolbarAllowedItemIdentifiers:): Return activeIdentifiers.
(initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and
UtilityWindow to aStyle, remove call to setStyleMask.
* src/nsselect.m (ns_get_local_selection): Remove unused variable type.
* src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size
of CGFloat differs.
(EmacsApp): New variable nextappdefined. Declare sendFromMainThread
when NS_IMPL_GNUSTEP.
(EmacsDocument): Declare when NS_IMPL_GNUSTEP.
(EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove.
(EmacsToolbar): Add clearAll. Add tag argument to
addDisplayItemWithImage.
(EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory.
* src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP.
(ns_menu_bar_is_hidden, menu_will_open_state): Define only if
NS_IMPL_COCOA.
(x_set_cursor_type): Remove declaration.
(ns_update_begin): Only use r and bp if NS_IMPL_COCOA.
(ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code.
(x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP.
(ns_get_color): Use F suffix on float.
(ns_color_to_lisp, ns_query_color): Use EmacsCGFloat.
(ns_get_rgb_color): Remove.
(x_set_frame_alpha): Move view inside NS_IMPL_COCOA.
(note_mouse_movement): x and y are CGFloat.
(ns_draw_fringe_bitmap): Remove unused rowY.
Change #if to COCOA && >= 10_6.
(ns_draw_window_cursor): Remove unused overspill.
(ns_draw_underwave): width and x are EamcsCGFloat.
(ns_draw_box): thickness is CGFloat.
(ns_dumpglyphs_image): Change #if to COCOA && >= 10_6.
(ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread
if not in main thread.
(ns_get_pending_menu_title, ns_check_menu_open)
(ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5.
(ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD.
(sendFromMainThread:): New method.
(changeFont:): size is CGFloat.
(keyDown:): Check for Delete when NS_IMPL_GNUSTEP.
Disable warning about permanent text.
(characterIndexForPoint:): Adjust return type depending on GNUStep
version.
(mouseDown:): delta is CGFloat.
(updateFrameSize): Remove unised variable f.
(initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA.
Cast float to EmacsCGFloat.
(windowWillUseStandardFrame:defaultFrame:): Set maximized_height
also to -1 when restoring.
(windowDidExitFullScreen:): Put call to updateCollectionBehaviour
inside NS_IMPL_COCOA.
(toggleFullScreen:): Put call to toggleFullScreen inside
NS_IMPL_COCOA. Cast float to EmacsCGFloat.
(setPosition:portion:whole:): por is CGFloat.
(getMouseMotionPart:window:x:y:): Add F suffix to float.
(mouseDown:): Use CGFloat.
(mouseDragged:): Remove unised variable edge.
(EmacsDocument): Implement for NS_IMPL_GNUSTEP.
* src/process.c (catch_child_signal): New function.
(init_process_emacs): Call it.
* src/process.h (catch_child_signal): Declare.
| -rw-r--r-- | nextstep/ChangeLog | 4 | ||||
| -rw-r--r-- | nextstep/templates/Info-gnustep.plist.in | 14 | ||||
| -rw-r--r-- | src/ChangeLog | 108 | ||||
| -rw-r--r-- | src/nsfns.m | 71 | ||||
| -rw-r--r-- | src/nsfont.m | 42 | ||||
| -rw-r--r-- | src/nsimage.m | 4 | ||||
| -rw-r--r-- | src/nsmenu.m | 70 | ||||
| -rw-r--r-- | src/nsselect.m | 3 | ||||
| -rw-r--r-- | src/nsterm.h | 44 | ||||
| -rw-r--r-- | src/nsterm.m | 206 | ||||
| -rw-r--r-- | src/process.c | 14 | ||||
| -rw-r--r-- | src/process.h | 1 |
12 files changed, 371 insertions, 210 deletions
diff --git a/nextstep/ChangeLog b/nextstep/ChangeLog index 909580296e1..d76d832555c 100644 --- a/nextstep/ChangeLog +++ b/nextstep/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-06-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument. | ||
| 4 | |||
| 1 | 2013-03-16 Jan Djärv <jan.h.d@swipnet.se> | 5 | 2013-03-16 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 6 | ||
| 3 | * Makefile.in (${ns_appdir}): Add touch. | 7 | * Makefile.in (${ns_appdir}): Add touch. |
diff --git a/nextstep/templates/Info-gnustep.plist.in b/nextstep/templates/Info-gnustep.plist.in index 4ac97e5cde6..42abc235761 100644 --- a/nextstep/templates/Info-gnustep.plist.in +++ b/nextstep/templates/Info-gnustep.plist.in | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | NSRole = Application; | 20 | NSRole = Application; |
| 21 | NSTypes = ( | 21 | NSTypes = ( |
| 22 | { | 22 | { |
| 23 | NSDocumentClass = ""; | 23 | NSDocumentClass = "EmacsDocument"; |
| 24 | NSHumanReadableName = ""; | 24 | NSHumanReadableName = ""; |
| 25 | NSIcon = ""; | 25 | NSIcon = ""; |
| 26 | NSName = ""; | 26 | NSName = ""; |
| @@ -30,7 +30,7 @@ | |||
| 30 | ); | 30 | ); |
| 31 | }, | 31 | }, |
| 32 | { | 32 | { |
| 33 | NSDocumentClass = ""; | 33 | NSDocumentClass = "EmacsDocument"; |
| 34 | NSHumanReadableName = ""; | 34 | NSHumanReadableName = ""; |
| 35 | NSIcon = ""; | 35 | NSIcon = ""; |
| 36 | NSName = ""; | 36 | NSName = ""; |
| @@ -41,7 +41,7 @@ | |||
| 41 | ); | 41 | ); |
| 42 | }, | 42 | }, |
| 43 | { | 43 | { |
| 44 | NSDocumentClass = ""; | 44 | NSDocumentClass = "EmacsDocument"; |
| 45 | NSHumanReadableName = ""; | 45 | NSHumanReadableName = ""; |
| 46 | NSIcon = ""; | 46 | NSIcon = ""; |
| 47 | NSName = ""; | 47 | NSName = ""; |
| @@ -51,7 +51,7 @@ | |||
| 51 | ); | 51 | ); |
| 52 | }, | 52 | }, |
| 53 | { | 53 | { |
| 54 | NSDocumentClass = ""; | 54 | NSDocumentClass = "EmacsDocument"; |
| 55 | NSHumanReadableName = ""; | 55 | NSHumanReadableName = ""; |
| 56 | NSIcon = ""; | 56 | NSIcon = ""; |
| 57 | NSName = ""; | 57 | NSName = ""; |
| @@ -64,7 +64,7 @@ | |||
| 64 | ); | 64 | ); |
| 65 | }, | 65 | }, |
| 66 | { | 66 | { |
| 67 | NSDocumentClass = ""; | 67 | NSDocumentClass = "EmacsDocument"; |
| 68 | NSHumanReadableName = ""; | 68 | NSHumanReadableName = ""; |
| 69 | NSIcon = ""; | 69 | NSIcon = ""; |
| 70 | NSName = ""; | 70 | NSName = ""; |
| @@ -74,7 +74,7 @@ | |||
| 74 | ); | 74 | ); |
| 75 | }, | 75 | }, |
| 76 | { | 76 | { |
| 77 | NSDocumentClass = ""; | 77 | NSDocumentClass = "EmacsDocument"; |
| 78 | NSHumanReadableName = ""; | 78 | NSHumanReadableName = ""; |
| 79 | NSIcon = ""; | 79 | NSIcon = ""; |
| 80 | NSName = ""; | 80 | NSName = ""; |
| @@ -84,7 +84,7 @@ | |||
| 84 | ); | 84 | ); |
| 85 | }, | 85 | }, |
| 86 | { | 86 | { |
| 87 | NSDocumentClass = ""; | 87 | NSDocumentClass = "EmacsDocument"; |
| 88 | NSHumanReadableName = ""; | 88 | NSHumanReadableName = ""; |
| 89 | NSIcon = ""; | 89 | NSIcon = ""; |
| 90 | NSName = ""; | 90 | NSName = ""; |
diff --git a/src/ChangeLog b/src/ChangeLog index 65a49bae1dc..a7791444e09 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,111 @@ | |||
| 1 | 2013-06-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * process.h (catch_child_signal): Declare. | ||
| 4 | |||
| 5 | * process.c (catch_child_signal): New function. | ||
| 6 | (init_process_emacs): Call it. | ||
| 7 | |||
| 8 | * nsterm.m: Include process.h if NS_IMPL_GNUSTEP. | ||
| 9 | (ns_menu_bar_is_hidden, menu_will_open_state): Define only if | ||
| 10 | NS_IMPL_COCOA. | ||
| 11 | (x_set_cursor_type): Remove declaration. | ||
| 12 | (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. | ||
| 13 | (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. | ||
| 14 | (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. | ||
| 15 | (ns_get_color): Use F suffix on float. | ||
| 16 | (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. | ||
| 17 | (ns_get_rgb_color): Remove. | ||
| 18 | (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. | ||
| 19 | (note_mouse_movement): x and y are CGFloat. | ||
| 20 | (ns_draw_fringe_bitmap): Remove unused rowY. | ||
| 21 | Change #if to COCOA && >= 10_6. | ||
| 22 | (ns_draw_window_cursor): Remove unused overspill. | ||
| 23 | (ns_draw_underwave): width and x are EamcsCGFloat. | ||
| 24 | (ns_draw_box): thickness is CGFloat. | ||
| 25 | (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. | ||
| 26 | (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread | ||
| 27 | if not in main thread. | ||
| 28 | (ns_get_pending_menu_title, ns_check_menu_open) | ||
| 29 | (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. | ||
| 30 | (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. | ||
| 31 | (sendFromMainThread:): New method. | ||
| 32 | (changeFont:): size is CGFloat. | ||
| 33 | (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. | ||
| 34 | Disable warning about permanent text. | ||
| 35 | (characterIndexForPoint:): Adjust return type depending on GNUStep | ||
| 36 | version. | ||
| 37 | (mouseDown:): delta is CGFloat. | ||
| 38 | (updateFrameSize): Remove unised variable f. | ||
| 39 | (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. | ||
| 40 | Cast float to EmacsCGFloat. | ||
| 41 | (windowWillUseStandardFrame:defaultFrame:): Set maximized_height | ||
| 42 | also to -1 when restoring. | ||
| 43 | (windowDidExitFullScreen:): Put call to updateCollectionBehaviour | ||
| 44 | inside NS_IMPL_COCOA. | ||
| 45 | (toggleFullScreen:): Put call to toggleFullScreen inside | ||
| 46 | NS_IMPL_COCOA. Cast float to EmacsCGFloat. | ||
| 47 | (setPosition:portion:whole:): por is CGFloat. | ||
| 48 | (getMouseMotionPart:window:x:y:): Add F suffix to float. | ||
| 49 | (mouseDown:): Use CGFloat. | ||
| 50 | (mouseDragged:): Remove unised variable edge. | ||
| 51 | (EmacsDocument): Implement for NS_IMPL_GNUSTEP. | ||
| 52 | |||
| 53 | * nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size | ||
| 54 | of CGFloat differs. | ||
| 55 | (EmacsApp): New variable nextappdefined. Declare sendFromMainThread | ||
| 56 | when NS_IMPL_GNUSTEP. | ||
| 57 | (EmacsDocument): Declare when NS_IMPL_GNUSTEP. | ||
| 58 | (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. | ||
| 59 | (EmacsToolbar): Add clearAll. Add tag argument to | ||
| 60 | addDisplayItemWithImage. | ||
| 61 | (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. | ||
| 62 | |||
| 63 | * nsselect.m (ns_get_local_selection): Remove unused variable type. | ||
| 64 | |||
| 65 | * nsmenu.m (ns_update_menubar): Make static. | ||
| 66 | (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA | ||
| 67 | (fillWithWidgetValue:): Add cast to SEL for setAction. | ||
| 68 | (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. | ||
| 69 | (update_frame_tool_bar): Update code for GNUStep. | ||
| 70 | (clearAll): New method. | ||
| 71 | (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag | ||
| 72 | argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move | ||
| 73 | identifierToItem setObject and activeIdentifiers addObject before | ||
| 74 | call to insertItemWithItemIdentifier. | ||
| 75 | (validateVisibleItems): Fix indentation. | ||
| 76 | (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. | ||
| 77 | (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and | ||
| 78 | UtilityWindow to aStyle, remove call to setStyleMask. | ||
| 79 | |||
| 80 | * nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. | ||
| 81 | |||
| 82 | * nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) | ||
| 83 | (ns_charset_covers, ns_get_covering_families, nsfont_open): | ||
| 84 | Use F suffix on floats. | ||
| 85 | (ns_char_width): Returns CGFloat. | ||
| 86 | (ns_ascii_average_width): w is CGFloat instead of float. | ||
| 87 | (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to | ||
| 88 | DPSxshow. | ||
| 89 | (ns_glyph_metrics): CGFloat instead of float. | ||
| 90 | |||
| 91 | * nsfns.m (x_set_foreground_color, x_set_background_color): Use | ||
| 92 | EmacsCGFloat. | ||
| 93 | (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove | ||
| 94 | unused variables. | ||
| 95 | (Fns_read_file_name): Keep track if panel is for save. Use | ||
| 96 | ns_filename_from_panel/ns_directory_from_panel. | ||
| 97 | (Fns_list_services): delegate only used for COCOA. | ||
| 98 | (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just | ||
| 99 | return the input if GNUStep. | ||
| 100 | (x_screen_planes): Remove. | ||
| 101 | (Fxw_color_values): Use EmacsCGFloat | ||
| 102 | (Fns_display_monitor_attributes_list): Only get screen number for | ||
| 103 | Cocoa. | ||
| 104 | (getDirectory, getFilename): Removed from EmacsOpenPanel and | ||
| 105 | EmacsSavePanel. | ||
| 106 | (EmacsOpenPanel:ok:): Use ns_filename_from_panel and | ||
| 107 | ns_directory_from_panel. | ||
| 108 | |||
| 1 | 2013-06-01 Paul Eggert <eggert@cs.ucla.edu> | 109 | 2013-06-01 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 110 | ||
| 3 | * process.c (handle_child_signal): Also use WCONTINUED. | 111 | * process.c (handle_child_signal): Also use WCONTINUED. |
diff --git a/src/nsfns.m b/src/nsfns.m index 1170472573e..94339183159 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -287,7 +287,7 @@ static void | |||
| 287 | x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | 287 | x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) |
| 288 | { | 288 | { |
| 289 | NSColor *col; | 289 | NSColor *col; |
| 290 | CGFloat r, g, b, alpha; | 290 | EmacsCGFloat r, g, b, alpha; |
| 291 | 291 | ||
| 292 | if (ns_lisp_to_color (arg, &col)) | 292 | if (ns_lisp_to_color (arg, &col)) |
| 293 | { | 293 | { |
| @@ -319,7 +319,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 319 | struct face *face; | 319 | struct face *face; |
| 320 | NSColor *col; | 320 | NSColor *col; |
| 321 | NSView *view = FRAME_NS_VIEW (f); | 321 | NSView *view = FRAME_NS_VIEW (f); |
| 322 | CGFloat r, g, b, alpha; | 322 | EmacsCGFloat r, g, b, alpha; |
| 323 | 323 | ||
| 324 | if (ns_lisp_to_color (arg, &col)) | 324 | if (ns_lisp_to_color (arg, &col)) |
| 325 | { | 325 | { |
| @@ -344,7 +344,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 344 | { | 344 | { |
| 345 | [[view window] setBackgroundColor: col]; | 345 | [[view window] setBackgroundColor: col]; |
| 346 | 346 | ||
| 347 | if (alpha != 1.0) | 347 | if (alpha != (EmacsCGFloat) 1.0) |
| 348 | [[view window] setOpaque: NO]; | 348 | [[view window] setOpaque: NO]; |
| 349 | else | 349 | else |
| 350 | [[view window] setOpaque: YES]; | 350 | [[view window] setOpaque: YES]; |
| @@ -714,7 +714,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 714 | } | 714 | } |
| 715 | 715 | ||
| 716 | 716 | ||
| 717 | void | 717 | static void |
| 718 | ns_implicitly_set_icon_type (struct frame *f) | 718 | ns_implicitly_set_icon_type (struct frame *f) |
| 719 | { | 719 | { |
| 720 | Lisp_Object tem; | 720 | Lisp_Object tem; |
| @@ -859,7 +859,7 @@ ns_cursor_type_to_lisp (int arg) | |||
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | /* This is the same as the xfns.c definition. */ | 861 | /* This is the same as the xfns.c definition. */ |
| 862 | void | 862 | static void |
| 863 | x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) | 863 | x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) |
| 864 | { | 864 | { |
| 865 | set_frame_cursor_types (f, arg); | 865 | set_frame_cursor_types (f, arg); |
| @@ -1082,7 +1082,6 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1082 | struct ns_display_info *dpyinfo = NULL; | 1082 | struct ns_display_info *dpyinfo = NULL; |
| 1083 | Lisp_Object parent; | 1083 | Lisp_Object parent; |
| 1084 | struct kboard *kb; | 1084 | struct kboard *kb; |
| 1085 | Lisp_Object tfont, tfontsize; | ||
| 1086 | static int desc_ctr = 1; | 1085 | static int desc_ctr = 1; |
| 1087 | 1086 | ||
| 1088 | /* x_get_arg modifies parms. */ | 1087 | /* x_get_arg modifies parms. */ |
| @@ -1189,10 +1188,10 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1189 | { | 1188 | { |
| 1190 | /* use for default font name */ | 1189 | /* use for default font name */ |
| 1191 | id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */ | 1190 | id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */ |
| 1192 | tfontsize = x_default_parameter (f, parms, Qfontsize, | 1191 | x_default_parameter (f, parms, Qfontsize, |
| 1193 | make_number (0 /*(int)[font pointSize]*/), | 1192 | make_number (0 /*(int)[font pointSize]*/), |
| 1194 | "fontSize", "FontSize", RES_TYPE_NUMBER); | 1193 | "fontSize", "FontSize", RES_TYPE_NUMBER); |
| 1195 | tfont = x_default_parameter (f, parms, Qfont, | 1194 | x_default_parameter (f, parms, Qfont, |
| 1196 | build_string ([[font fontName] UTF8String]), | 1195 | build_string ([[font fontName] UTF8String]), |
| 1197 | "font", "Font", RES_TYPE_STRING); | 1196 | "font", "Font", RES_TYPE_STRING); |
| 1198 | } | 1197 | } |
| @@ -1410,6 +1409,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1410 | { | 1409 | { |
| 1411 | static id fileDelegate = nil; | 1410 | static id fileDelegate = nil; |
| 1412 | BOOL ret; | 1411 | BOOL ret; |
| 1412 | BOOL isSave = NILP (mustmatch) && NILP (dir_only_p); | ||
| 1413 | id panel; | 1413 | id panel; |
| 1414 | Lisp_Object fname; | 1414 | Lisp_Object fname; |
| 1415 | 1415 | ||
| @@ -1431,7 +1431,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1431 | if ([dirS characterAtIndex: 0] == '~') | 1431 | if ([dirS characterAtIndex: 0] == '~') |
| 1432 | dirS = [dirS stringByExpandingTildeInPath]; | 1432 | dirS = [dirS stringByExpandingTildeInPath]; |
| 1433 | 1433 | ||
| 1434 | panel = NILP (mustmatch) && NILP (dir_only_p) ? | 1434 | panel = isSave ? |
| 1435 | (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel]; | 1435 | (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel]; |
| 1436 | 1436 | ||
| 1437 | [panel setTitle: promptS]; | 1437 | [panel setTitle: promptS]; |
| @@ -1446,7 +1446,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1446 | [panel setCanChooseDirectories: YES]; | 1446 | [panel setCanChooseDirectories: YES]; |
| 1447 | [panel setCanChooseFiles: NO]; | 1447 | [panel setCanChooseFiles: NO]; |
| 1448 | } | 1448 | } |
| 1449 | else | 1449 | else if (! isSave) |
| 1450 | { | 1450 | { |
| 1451 | /* This is not quite what the documentation says, but it is compatible | 1451 | /* This is not quite what the documentation says, but it is compatible |
| 1452 | with the Gtk+ code. Also, the menu entry says "Open File...". */ | 1452 | with the Gtk+ code. Also, the menu entry says "Open File...". */ |
| @@ -1481,8 +1481,8 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1481 | 1481 | ||
| 1482 | if (ret) | 1482 | if (ret) |
| 1483 | { | 1483 | { |
| 1484 | NSString *str = [panel getFilename]; | 1484 | NSString *str = ns_filename_from_panel (panel); |
| 1485 | if (! str) str = [panel getDirectory]; | 1485 | if (! str) str = ns_directory_from_panel (panel); |
| 1486 | if (! str) ret = NO; | 1486 | if (! str) ret = NO; |
| 1487 | else fname = build_string ([str UTF8String]); | 1487 | else fname = build_string ([str UTF8String]); |
| 1488 | } | 1488 | } |
| @@ -1909,7 +1909,9 @@ DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0, | |||
| 1909 | #else | 1909 | #else |
| 1910 | Lisp_Object ret = Qnil; | 1910 | Lisp_Object ret = Qnil; |
| 1911 | NSMenu *svcs; | 1911 | NSMenu *svcs; |
| 1912 | #ifdef NS_IMPL_COCOA | ||
| 1912 | id delegate; | 1913 | id delegate; |
| 1914 | #endif | ||
| 1913 | 1915 | ||
| 1914 | check_window_system (NULL); | 1916 | check_window_system (NULL); |
| 1915 | svcs = [[NSMenu alloc] initWithTitle: @"Services"]; | 1917 | svcs = [[NSMenu alloc] initWithTitle: @"Services"]; |
| @@ -1992,15 +1994,9 @@ DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc, | |||
| 1992 | 1994 | ||
| 1993 | CHECK_STRING (str); | 1995 | CHECK_STRING (str); |
| 1994 | utfStr = [NSString stringWithUTF8String: SSDATA (str)]; | 1996 | utfStr = [NSString stringWithUTF8String: SSDATA (str)]; |
| 1995 | if (![utfStr respondsToSelector: | 1997 | #ifdef NS_IMPL_COCOA |
| 1996 | @selector (precomposedStringWithCanonicalMapping)]) | ||
| 1997 | { | ||
| 1998 | message1 | ||
| 1999 | ("Warning: ns-convert-utf8-nfd-to-nfc unsupported under GNUstep.\n"); | ||
| 2000 | return Qnil; | ||
| 2001 | } | ||
| 2002 | else | ||
| 2003 | utfStr = [utfStr precomposedStringWithCanonicalMapping]; | 1998 | utfStr = [utfStr precomposedStringWithCanonicalMapping]; |
| 1999 | #endif | ||
| 2004 | return build_string ([utfStr UTF8String]); | 2000 | return build_string ([utfStr UTF8String]); |
| 2005 | } | 2001 | } |
| 2006 | 2002 | ||
| @@ -2155,6 +2151,9 @@ x_set_scroll_bar_default_width (struct frame *f) | |||
| 2155 | } | 2151 | } |
| 2156 | 2152 | ||
| 2157 | 2153 | ||
| 2154 | extern const char *x_get_string_resource (XrmDatabase, char *, char *); | ||
| 2155 | |||
| 2156 | |||
| 2158 | /* terms impl this instead of x-get-resource directly */ | 2157 | /* terms impl this instead of x-get-resource directly */ |
| 2159 | const char * | 2158 | const char * |
| 2160 | x_get_string_resource (XrmDatabase rdb, char *name, char *class) | 2159 | x_get_string_resource (XrmDatabase rdb, char *name, char *class) |
| @@ -2203,13 +2202,6 @@ x_pixel_height (struct frame *f) | |||
| 2203 | } | 2202 | } |
| 2204 | 2203 | ||
| 2205 | 2204 | ||
| 2206 | int | ||
| 2207 | x_screen_planes (struct frame *f) | ||
| 2208 | { | ||
| 2209 | return FRAME_NS_DISPLAY_INFO (f)->n_planes; | ||
| 2210 | } | ||
| 2211 | |||
| 2212 | |||
| 2213 | void | 2205 | void |
| 2214 | x_sync (struct frame *f) | 2206 | x_sync (struct frame *f) |
| 2215 | { | 2207 | { |
| @@ -2242,7 +2234,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, | |||
| 2242 | (Lisp_Object color, Lisp_Object frame) | 2234 | (Lisp_Object color, Lisp_Object frame) |
| 2243 | { | 2235 | { |
| 2244 | NSColor * col; | 2236 | NSColor * col; |
| 2245 | CGFloat red, green, blue, alpha; | 2237 | EmacsCGFloat red, green, blue, alpha; |
| 2246 | 2238 | ||
| 2247 | check_window_system (NULL); | 2239 | check_window_system (NULL); |
| 2248 | CHECK_STRING (color); | 2240 | CHECK_STRING (color); |
| @@ -2434,11 +2426,10 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 2434 | struct MonitorInfo *m = &monitors[i]; | 2426 | struct MonitorInfo *m = &monitors[i]; |
| 2435 | NSRect fr = [s frame]; | 2427 | NSRect fr = [s frame]; |
| 2436 | NSRect vfr = [s visibleFrame]; | 2428 | NSRect vfr = [s visibleFrame]; |
| 2437 | NSDictionary *dict = [s deviceDescription]; | ||
| 2438 | NSValue *resval = [dict valueForKey:NSDeviceResolution]; | ||
| 2439 | short y, vy; | 2429 | short y, vy; |
| 2440 | 2430 | ||
| 2441 | #ifdef NS_IMPL_COCOA | 2431 | #ifdef NS_IMPL_COCOA |
| 2432 | NSDictionary *dict = [s deviceDescription]; | ||
| 2442 | NSNumber *nid = [dict objectForKey:@"NSScreenNumber"]; | 2433 | NSNumber *nid = [dict objectForKey:@"NSScreenNumber"]; |
| 2443 | CGDirectDisplayID did = [nid unsignedIntValue]; | 2434 | CGDirectDisplayID did = [nid unsignedIntValue]; |
| 2444 | #endif | 2435 | #endif |
| @@ -2776,14 +2767,6 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | |||
| 2776 | [NSApp stop: self]; | 2767 | [NSApp stop: self]; |
| 2777 | } | 2768 | } |
| 2778 | #endif | 2769 | #endif |
| 2779 | - (NSString *) getFilename | ||
| 2780 | { | ||
| 2781 | return ns_filename_from_panel (self); | ||
| 2782 | } | ||
| 2783 | - (NSString *) getDirectory | ||
| 2784 | { | ||
| 2785 | return ns_directory_from_panel (self); | ||
| 2786 | } | ||
| 2787 | 2770 | ||
| 2788 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent | 2771 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent |
| 2789 | { | 2772 | { |
| @@ -2807,8 +2790,8 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | |||
| 2807 | [super ok: sender]; | 2790 | [super ok: sender]; |
| 2808 | 2791 | ||
| 2809 | // If not choosing directories, and Open is pressed on a directory, return. | 2792 | // If not choosing directories, and Open is pressed on a directory, return. |
| 2810 | if (! [self canChooseDirectories] && [self getDirectory] && | 2793 | if (! [self canChooseDirectories] && ns_directory_from_panel (self) && |
| 2811 | ! [self getFilename]) | 2794 | ! ns_filename_from_panel (self)) |
| 2812 | return; | 2795 | return; |
| 2813 | 2796 | ||
| 2814 | panelOK = 1; | 2797 | panelOK = 1; |
| @@ -2821,14 +2804,6 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | |||
| 2821 | } | 2804 | } |
| 2822 | 2805 | ||
| 2823 | #endif | 2806 | #endif |
| 2824 | - (NSString *) getFilename | ||
| 2825 | { | ||
| 2826 | return ns_filename_from_panel (self); | ||
| 2827 | } | ||
| 2828 | - (NSString *) getDirectory | ||
| 2829 | { | ||
| 2830 | return ns_directory_from_panel (self); | ||
| 2831 | } | ||
| 2832 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent | 2807 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent |
| 2833 | { | 2808 | { |
| 2834 | // NSOpenPanel inherits NSSavePanel, so passing self is OK. | 2809 | // NSOpenPanel inherits NSSavePanel, so passing self is OK. |
diff --git a/src/nsfont.m b/src/nsfont.m index 9ab369d1fcd..709f2cb0d86 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -119,7 +119,7 @@ ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait) | |||
| 119 | { | 119 | { |
| 120 | NSDictionary *tdict = [fdesc objectForKey: NSFontTraitsAttribute]; | 120 | NSDictionary *tdict = [fdesc objectForKey: NSFontTraitsAttribute]; |
| 121 | NSNumber *val = [tdict objectForKey: trait]; | 121 | NSNumber *val = [tdict objectForKey: trait]; |
| 122 | return val == nil ? 0.0 : [val floatValue]; | 122 | return val == nil ? 0.0F : [val floatValue]; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | 125 | ||
| @@ -138,15 +138,15 @@ ns_spec_to_descriptor (Lisp_Object font_spec) | |||
| 138 | /* add each attr in font_spec to fdAttrs.. */ | 138 | /* add each attr in font_spec to fdAttrs.. */ |
| 139 | n = min (FONT_WEIGHT_NUMERIC (font_spec), 200); | 139 | n = min (FONT_WEIGHT_NUMERIC (font_spec), 200); |
| 140 | if (n != -1 && n != STYLE_REF) | 140 | if (n != -1 && n != STYLE_REF) |
| 141 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0) / 100.0] | 141 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0F) / 100.0F] |
| 142 | forKey: NSFontWeightTrait]; | 142 | forKey: NSFontWeightTrait]; |
| 143 | n = min (FONT_SLANT_NUMERIC (font_spec), 200); | 143 | n = min (FONT_SLANT_NUMERIC (font_spec), 200); |
| 144 | if (n != -1 && n != STYLE_REF) | 144 | if (n != -1 && n != STYLE_REF) |
| 145 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0) / 100.0] | 145 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0F) / 100.0F] |
| 146 | forKey: NSFontSlantTrait]; | 146 | forKey: NSFontSlantTrait]; |
| 147 | n = min (FONT_WIDTH_NUMERIC (font_spec), 200); | 147 | n = min (FONT_WIDTH_NUMERIC (font_spec), 200); |
| 148 | if (n > -1 && (n > STYLE_REF + 10 || n < STYLE_REF - 10)) | 148 | if (n > -1 && (n > STYLE_REF + 10 || n < STYLE_REF - 10)) |
| 149 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0) / 100.0] | 149 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0F) / 100.0F] |
| 150 | forKey: NSFontWidthTrait]; | 150 | forKey: NSFontWidthTrait]; |
| 151 | if ([tdict count] > 0) | 151 | if ([tdict count] > 0) |
| 152 | [fdAttrs setObject: tdict forKey: NSFontTraitsAttribute]; | 152 | [fdAttrs setObject: tdict forKey: NSFontTraitsAttribute]; |
| @@ -240,10 +240,10 @@ ns_fallback_entity (void) | |||
| 240 | 240 | ||
| 241 | 241 | ||
| 242 | /* Utility: get width of a char c in screen font SFONT */ | 242 | /* Utility: get width of a char c in screen font SFONT */ |
| 243 | static float | 243 | static CGFloat |
| 244 | ns_char_width (NSFont *sfont, int c) | 244 | ns_char_width (NSFont *sfont, int c) |
| 245 | { | 245 | { |
| 246 | float w = -1.0; | 246 | CGFloat w = -1.0; |
| 247 | NSString *cstr = [NSString stringWithFormat: @"%c", c]; | 247 | NSString *cstr = [NSString stringWithFormat: @"%c", c]; |
| 248 | 248 | ||
| 249 | #ifdef NS_IMPL_COCOA | 249 | #ifdef NS_IMPL_COCOA |
| @@ -269,7 +269,7 @@ static NSString *ascii_printable; | |||
| 269 | static int | 269 | static int |
| 270 | ns_ascii_average_width (NSFont *sfont) | 270 | ns_ascii_average_width (NSFont *sfont) |
| 271 | { | 271 | { |
| 272 | float w = -1.0; | 272 | CGFloat w = -1.0; |
| 273 | 273 | ||
| 274 | if (!ascii_printable) | 274 | if (!ascii_printable) |
| 275 | { | 275 | { |
| @@ -288,14 +288,14 @@ ns_ascii_average_width (NSFont *sfont) | |||
| 288 | w = [sfont advancementForGlyph: glyph].width; | 288 | w = [sfont advancementForGlyph: glyph].width; |
| 289 | #endif | 289 | #endif |
| 290 | 290 | ||
| 291 | if (w < 0.0) | 291 | if (w < (CGFloat) 0.0) |
| 292 | { | 292 | { |
| 293 | NSDictionary *attrsDictionary = | 293 | NSDictionary *attrsDictionary = |
| 294 | [NSDictionary dictionaryWithObject: sfont forKey: NSFontAttributeName]; | 294 | [NSDictionary dictionaryWithObject: sfont forKey: NSFontAttributeName]; |
| 295 | w = [ascii_printable sizeWithAttributes: attrsDictionary].width; | 295 | w = [ascii_printable sizeWithAttributes: attrsDictionary].width; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | return lrint (w / 95.0); | 298 | return lrint (w / (CGFloat) 95.0); |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | 301 | ||
| @@ -323,7 +323,7 @@ ns_charset_covers(NSCharacterSet *set1, NSCharacterSet *set2, float pct) | |||
| 323 | off++; | 323 | off++; |
| 324 | } | 324 | } |
| 325 | //fprintf(stderr, "off = %d\ttot = %d\n", off,tot); | 325 | //fprintf(stderr, "off = %d\ttot = %d\n", off,tot); |
| 326 | return (float)off / tot < 1.0 - pct; | 326 | return (float)off / tot < 1.0F - pct; |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | 329 | ||
| @@ -514,8 +514,8 @@ static NSSet | |||
| 514 | if (ns_charset_covers(fset, charset, pct)) | 514 | if (ns_charset_covers(fset, charset, pct)) |
| 515 | [families addObject: family]; | 515 | [families addObject: family]; |
| 516 | } | 516 | } |
| 517 | pct -= 0.2; | 517 | pct -= 0.2F; |
| 518 | if ([families count] > 0 || pct < 0.05) | 518 | if ([families count] > 0 || pct < 0.05F) |
| 519 | break; | 519 | break; |
| 520 | } | 520 | } |
| 521 | [charset release]; | 521 | [charset release]; |
| @@ -763,9 +763,9 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 763 | family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; | 763 | family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; |
| 764 | /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that | 764 | /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that |
| 765 | when setting family in ns_spec_to_descriptor(). */ | 765 | when setting family in ns_spec_to_descriptor(). */ |
| 766 | if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50) | 766 | if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50F) |
| 767 | traits |= NSBoldFontMask; | 767 | traits |= NSBoldFontMask; |
| 768 | if (fabs (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05)) | 768 | if (fabs (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05F)) |
| 769 | traits |= NSItalicFontMask; | 769 | traits |= NSItalicFontMask; |
| 770 | 770 | ||
| 771 | /* see http://cocoadev.com/forums/comments.php?DiscussionID=74 */ | 771 | /* see http://cocoadev.com/forums/comments.php?DiscussionID=74 */ |
| @@ -880,7 +880,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 880 | font_info->max_bounds.width = lrint (font_info->width); | 880 | font_info->max_bounds.width = lrint (font_info->width); |
| 881 | font_info->max_bounds.lbearing = lrint (brect.origin.x); | 881 | font_info->max_bounds.lbearing = lrint (brect.origin.x); |
| 882 | font_info->max_bounds.rbearing = | 882 | font_info->max_bounds.rbearing = |
| 883 | lrint (brect.size.width - font_info->width); | 883 | lrint (brect.size.width - (CGFloat) font_info->width); |
| 884 | 884 | ||
| 885 | #ifdef NS_IMPL_COCOA | 885 | #ifdef NS_IMPL_COCOA |
| 886 | /* set up synthItal and the CG font */ | 886 | /* set up synthItal and the CG font */ |
| @@ -1041,8 +1041,8 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1041 | /* NOTE: focus and clip must be set | 1041 | /* NOTE: focus and clip must be set |
| 1042 | also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */ | 1042 | also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */ |
| 1043 | { | 1043 | { |
| 1044 | static char cbuf[1024]; | 1044 | static unsigned char cbuf[1024]; |
| 1045 | char *c = cbuf; | 1045 | unsigned char *c = cbuf; |
| 1046 | #ifdef NS_IMPL_GNUSTEP | 1046 | #ifdef NS_IMPL_GNUSTEP |
| 1047 | static float advances[1024]; | 1047 | static float advances[1024]; |
| 1048 | float *adv = advances; | 1048 | float *adv = advances; |
| @@ -1209,7 +1209,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1209 | [bgCol set]; | 1209 | [bgCol set]; |
| 1210 | DPSmoveto (context, r.origin.x, r.origin.y); | 1210 | DPSmoveto (context, r.origin.x, r.origin.y); |
| 1211 | /*[context GSSetTextDrawingMode: GSTextFillStroke]; /// not implemented yet */ | 1211 | /*[context GSSetTextDrawingMode: GSTextFillStroke]; /// not implemented yet */ |
| 1212 | DPSxshow (context, cbuf, advances, len); | 1212 | DPSxshow (context, (const char *) cbuf, advances, len); |
| 1213 | DPSstroke (context); | 1213 | DPSstroke (context); |
| 1214 | [col set]; | 1214 | [col set]; |
| 1215 | /*[context GSSetTextDrawingMode: GSTextFill]; /// not implemented yet */ | 1215 | /*[context GSSetTextDrawingMode: GSTextFill]; /// not implemented yet */ |
| @@ -1219,7 +1219,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1219 | 1219 | ||
| 1220 | /* draw with DPSxshow () */ | 1220 | /* draw with DPSxshow () */ |
| 1221 | DPSmoveto (context, r.origin.x, r.origin.y); | 1221 | DPSmoveto (context, r.origin.x, r.origin.y); |
| 1222 | DPSxshow (context, cbuf, advances, len); | 1222 | DPSxshow (context, (const char *) cbuf, advances, len); |
| 1223 | DPSstroke (context); | 1223 | DPSstroke (context); |
| 1224 | 1224 | ||
| 1225 | DPSgrestore (context); | 1225 | DPSgrestore (context); |
| @@ -1407,7 +1407,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) | |||
| 1407 | metrics = font_info->metrics[block]; | 1407 | metrics = font_info->metrics[block]; |
| 1408 | for (g = block<<8, i =0; i<0x100 && g < numGlyphs; g++, i++, metrics++) | 1408 | for (g = block<<8, i =0; i<0x100 && g < numGlyphs; g++, i++, metrics++) |
| 1409 | { | 1409 | { |
| 1410 | float w, lb, rb; | 1410 | CGFloat w, lb, rb; |
| 1411 | NSRect r = [sfont boundingRectForGlyph: g]; | 1411 | NSRect r = [sfont boundingRectForGlyph: g]; |
| 1412 | 1412 | ||
| 1413 | w = max ([sfont advancementForGlyph: g].width, 2.0); | 1413 | w = max ([sfont advancementForGlyph: g].width, 2.0); |
| @@ -1419,7 +1419,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) | |||
| 1419 | if (lb < 0) | 1419 | if (lb < 0) |
| 1420 | metrics->lbearing = round (lb - LCD_SMOOTHING_MARGIN); | 1420 | metrics->lbearing = round (lb - LCD_SMOOTHING_MARGIN); |
| 1421 | if (font_info->ital) | 1421 | if (font_info->ital) |
| 1422 | rb += 0.22 * font_info->height; | 1422 | rb += (CGFloat) (0.22F * font_info->height); |
| 1423 | metrics->rbearing = lrint (w + rb + LCD_SMOOTHING_MARGIN); | 1423 | metrics->rbearing = lrint (w + rb + LCD_SMOOTHING_MARGIN); |
| 1424 | 1424 | ||
| 1425 | metrics->descent = r.origin.y < 0 ? -r.origin.y : 0; | 1425 | metrics->descent = r.origin.y < 0 ? -r.origin.y : 0; |
diff --git a/src/nsimage.m b/src/nsimage.m index 9d21ba8afca..a1703272ad2 100644 --- a/src/nsimage.m +++ b/src/nsimage.m | |||
| @@ -334,7 +334,7 @@ static EmacsImage *ImageList = nil; | |||
| 334 | { | 334 | { |
| 335 | NSSize s = [self size]; | 335 | NSSize s = [self size]; |
| 336 | unsigned char *planes[5]; | 336 | unsigned char *planes[5]; |
| 337 | CGFloat r, g, b, a; | 337 | EmacsCGFloat r, g, b, a; |
| 338 | NSColor *rgbColor; | 338 | NSColor *rgbColor; |
| 339 | 339 | ||
| 340 | if (bmRep == nil || color == nil) | 340 | if (bmRep == nil || color == nil) |
| @@ -437,7 +437,7 @@ static EmacsImage *ImageList = nil; | |||
| 437 | else | 437 | else |
| 438 | { | 438 | { |
| 439 | NSColor *color = [bmRep colorAtX: x y: y]; | 439 | NSColor *color = [bmRep colorAtX: x y: y]; |
| 440 | CGFloat r, g, b, a; | 440 | EmacsCGFloat r, g, b, a; |
| 441 | [color getRed: &r green: &g blue: &b alpha: &a]; | 441 | [color getRed: &r green: &g blue: &b alpha: &a]; |
| 442 | return ((int)(a * 255.0) << 24) | 442 | return ((int)(a * 255.0) << 24) |
| 443 | | ((int)(r * 255.0) << 16) | ((int)(g * 255.0) << 8) | 443 | | ((int)(r * 255.0) << 16) | ((int)(g * 255.0) << 8) |
diff --git a/src/nsmenu.m b/src/nsmenu.m index baa683941f8..1d3d111e9a1 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -45,8 +45,6 @@ Carbon version by Yamamoto Mitsuharu. */ | |||
| 45 | #include <sys/types.h> | 45 | #include <sys/types.h> |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | #define MenuStagger 10.0 | ||
| 49 | |||
| 50 | #if 0 | 48 | #if 0 |
| 51 | int menu_trace_num = 0; | 49 | int menu_trace_num = 0; |
| 52 | #define NSTRACE(x) fprintf (stderr, "%s:%d: [%d] " #x "\n", \ | 50 | #define NSTRACE(x) fprintf (stderr, "%s:%d: [%d] " #x "\n", \ |
| @@ -112,7 +110,7 @@ popup_activated (void) | |||
| 112 | 2) deep_p, submenu = nil: Recompute all submenus. | 110 | 2) deep_p, submenu = nil: Recompute all submenus. |
| 113 | 3) deep_p, submenu = non-nil: Update contents of a single submenu. | 111 | 3) deep_p, submenu = non-nil: Update contents of a single submenu. |
| 114 | -------------------------------------------------------------------------- */ | 112 | -------------------------------------------------------------------------- */ |
| 115 | void | 113 | static void |
| 116 | ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | 114 | ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) |
| 117 | { | 115 | { |
| 118 | NSAutoreleasePool *pool; | 116 | NSAutoreleasePool *pool; |
| @@ -505,6 +503,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | |||
| 505 | void | 503 | void |
| 506 | x_activate_menubar (struct frame *f) | 504 | x_activate_menubar (struct frame *f) |
| 507 | { | 505 | { |
| 506 | #ifdef NS_IMPL_COCOA | ||
| 508 | NSArray *a = [[NSApp mainMenu] itemArray]; | 507 | NSArray *a = [[NSApp mainMenu] itemArray]; |
| 509 | /* Update each submenu separately so ns_update_menubar doesn't reset | 508 | /* Update each submenu separately so ns_update_menubar doesn't reset |
| 510 | the delegate. */ | 509 | the delegate. */ |
| @@ -521,6 +520,7 @@ x_activate_menubar (struct frame *f) | |||
| 521 | ++i; | 520 | ++i; |
| 522 | } | 521 | } |
| 523 | ns_check_pending_open_menu (); | 522 | ns_check_pending_open_menu (); |
| 523 | #endif | ||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | 526 | ||
| @@ -740,7 +740,7 @@ extern NSString *NSMenuDidBeginTrackingNotification; | |||
| 740 | [self setSubmenu: submenu forItem: item]; | 740 | [self setSubmenu: submenu forItem: item]; |
| 741 | [submenu fillWithWidgetValue: wv->contents]; | 741 | [submenu fillWithWidgetValue: wv->contents]; |
| 742 | [submenu release]; | 742 | [submenu release]; |
| 743 | [item setAction: nil]; | 743 | [item setAction: (SEL)nil]; |
| 744 | } | 744 | } |
| 745 | } | 745 | } |
| 746 | 746 | ||
| @@ -757,7 +757,7 @@ extern NSString *NSMenuDidBeginTrackingNotification; | |||
| 757 | { | 757 | { |
| 758 | NSString *titleStr = [NSString stringWithUTF8String: title]; | 758 | NSString *titleStr = [NSString stringWithUTF8String: title]; |
| 759 | NSMenuItem *item = [self addItemWithTitle: titleStr | 759 | NSMenuItem *item = [self addItemWithTitle: titleStr |
| 760 | action: nil /*@selector (menuDown:) */ | 760 | action: (SEL)nil /*@selector (menuDown:) */ |
| 761 | keyEquivalent: @""]; | 761 | keyEquivalent: @""]; |
| 762 | EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; | 762 | EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; |
| 763 | [self setSubmenu: submenu forItem: item]; | 763 | [self setSubmenu: submenu forItem: item]; |
| @@ -1045,13 +1045,18 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1045 | Update toolbar contents | 1045 | Update toolbar contents |
| 1046 | -------------------------------------------------------------------------- */ | 1046 | -------------------------------------------------------------------------- */ |
| 1047 | { | 1047 | { |
| 1048 | int i; | 1048 | int i, k = 0; |
| 1049 | EmacsView *view = FRAME_NS_VIEW (f); | 1049 | EmacsView *view = FRAME_NS_VIEW (f); |
| 1050 | NSWindow *window = [view window]; | 1050 | NSWindow *window = [view window]; |
| 1051 | EmacsToolbar *toolbar = [view toolbar]; | 1051 | EmacsToolbar *toolbar = [view toolbar]; |
| 1052 | 1052 | ||
| 1053 | block_input (); | 1053 | block_input (); |
| 1054 | |||
| 1055 | #ifdef NS_IMPL_COCOA | ||
| 1054 | [toolbar clearActive]; | 1056 | [toolbar clearActive]; |
| 1057 | #else | ||
| 1058 | [toolbar clearAll]; | ||
| 1059 | #endif | ||
| 1055 | 1060 | ||
| 1056 | /* update EmacsToolbar as in GtkUtils, build items list */ | 1061 | /* update EmacsToolbar as in GtkUtils, build items list */ |
| 1057 | for (i = 0; i < f->n_tool_bar_items; ++i) | 1062 | for (i = 0; i < f->n_tool_bar_items; ++i) |
| @@ -1067,6 +1072,15 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1067 | Lisp_Object helpObj; | 1072 | Lisp_Object helpObj; |
| 1068 | const char *helpText; | 1073 | const char *helpText; |
| 1069 | 1074 | ||
| 1075 | /* Check if this is a separator. */ | ||
| 1076 | if (EQ (TOOLPROP (TOOL_BAR_ITEM_TYPE), Qt)) | ||
| 1077 | { | ||
| 1078 | /* Skip separators. Newer OSX don't show them, and on GNUStep they | ||
| 1079 | are wide as a button, thus overflowing the toolbar most of | ||
| 1080 | the time. */ | ||
| 1081 | continue; | ||
| 1082 | } | ||
| 1083 | |||
| 1070 | /* If image is a vector, choose the image according to the | 1084 | /* If image is a vector, choose the image according to the |
| 1071 | button state. */ | 1085 | button state. */ |
| 1072 | image = TOOLPROP (TOOL_BAR_ITEM_IMAGES); | 1086 | image = TOOLPROP (TOOL_BAR_ITEM_IMAGES); |
| @@ -1103,7 +1117,10 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1103 | continue; | 1117 | continue; |
| 1104 | } | 1118 | } |
| 1105 | 1119 | ||
| 1106 | [toolbar addDisplayItemWithImage: img->pixmap idx: i helpText: helpText | 1120 | [toolbar addDisplayItemWithImage: img->pixmap |
| 1121 | idx: k++ | ||
| 1122 | tag: i | ||
| 1123 | helpText: helpText | ||
| 1107 | enabled: enabled_p]; | 1124 | enabled: enabled_p]; |
| 1108 | #undef TOOLPROP | 1125 | #undef TOOLPROP |
| 1109 | } | 1126 | } |
| @@ -1111,6 +1128,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1111 | if (![toolbar isVisible]) | 1128 | if (![toolbar isVisible]) |
| 1112 | [toolbar setVisible: YES]; | 1129 | [toolbar setVisible: YES]; |
| 1113 | 1130 | ||
| 1131 | #ifdef NS_IMPL_COCOA | ||
| 1114 | if ([toolbar changed]) | 1132 | if ([toolbar changed]) |
| 1115 | { | 1133 | { |
| 1116 | /* inform app that toolbar has changed */ | 1134 | /* inform app that toolbar has changed */ |
| @@ -1132,6 +1150,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1132 | [toolbar setConfigurationFromDictionary: newDict]; | 1150 | [toolbar setConfigurationFromDictionary: newDict]; |
| 1133 | [newDict release]; | 1151 | [newDict release]; |
| 1134 | } | 1152 | } |
| 1153 | #endif | ||
| 1135 | 1154 | ||
| 1136 | FRAME_TOOLBAR_HEIGHT (f) = | 1155 | FRAME_TOOLBAR_HEIGHT (f) = |
| 1137 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) | 1156 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) |
| @@ -1159,6 +1178,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1159 | [self setDelegate: self]; | 1178 | [self setDelegate: self]; |
| 1160 | identifierToItem = [[NSMutableDictionary alloc] initWithCapacity: 10]; | 1179 | identifierToItem = [[NSMutableDictionary alloc] initWithCapacity: 10]; |
| 1161 | activeIdentifiers = [[NSMutableArray alloc] initWithCapacity: 8]; | 1180 | activeIdentifiers = [[NSMutableArray alloc] initWithCapacity: 8]; |
| 1181 | prevIdentifiers = nil; | ||
| 1162 | prevEnablement = enablement = 0L; | 1182 | prevEnablement = enablement = 0L; |
| 1163 | return self; | 1183 | return self; |
| 1164 | } | 1184 | } |
| @@ -1180,18 +1200,29 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1180 | enablement = 0L; | 1200 | enablement = 0L; |
| 1181 | } | 1201 | } |
| 1182 | 1202 | ||
| 1203 | - (void) clearAll | ||
| 1204 | { | ||
| 1205 | [self clearActive]; | ||
| 1206 | while ([[self items] count] > 0) | ||
| 1207 | [self removeItemAtIndex: 0]; | ||
| 1208 | } | ||
| 1209 | |||
| 1183 | - (BOOL) changed | 1210 | - (BOOL) changed |
| 1184 | { | 1211 | { |
| 1185 | return [activeIdentifiers isEqualToArray: prevIdentifiers] && | 1212 | return [activeIdentifiers isEqualToArray: prevIdentifiers] && |
| 1186 | enablement == prevEnablement ? NO : YES; | 1213 | enablement == prevEnablement ? NO : YES; |
| 1187 | } | 1214 | } |
| 1188 | 1215 | ||
| 1189 | - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx | 1216 | - (void) addDisplayItemWithImage: (EmacsImage *)img |
| 1190 | helpText: (const char *)help enabled: (BOOL)enabled | 1217 | idx: (int)idx |
| 1218 | tag: (int)tag | ||
| 1219 | helpText: (const char *)help | ||
| 1220 | enabled: (BOOL)enabled | ||
| 1191 | { | 1221 | { |
| 1192 | /* 1) come up w/identifier */ | 1222 | /* 1) come up w/identifier */ |
| 1193 | NSString *identifier | 1223 | NSString *identifier |
| 1194 | = [NSString stringWithFormat: @"%u", [img hash]]; | 1224 | = [NSString stringWithFormat: @"%u", [img hash]]; |
| 1225 | [activeIdentifiers addObject: identifier]; | ||
| 1195 | 1226 | ||
| 1196 | /* 2) create / reuse item */ | 1227 | /* 2) create / reuse item */ |
| 1197 | NSToolbarItem *item = [identifierToItem objectForKey: identifier]; | 1228 | NSToolbarItem *item = [identifierToItem objectForKey: identifier]; |
| @@ -1203,20 +1234,25 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1203 | [item setToolTip: [NSString stringWithUTF8String: help]]; | 1234 | [item setToolTip: [NSString stringWithUTF8String: help]]; |
| 1204 | [item setTarget: emacsView]; | 1235 | [item setTarget: emacsView]; |
| 1205 | [item setAction: @selector (toolbarClicked:)]; | 1236 | [item setAction: @selector (toolbarClicked:)]; |
| 1237 | [identifierToItem setObject: item forKey: identifier]; | ||
| 1206 | } | 1238 | } |
| 1207 | 1239 | ||
| 1208 | [item setTag: idx]; | 1240 | #ifdef NS_IMPL_GNUSTEP |
| 1241 | [self insertItemWithItemIdentifier: identifier atIndex: idx]; | ||
| 1242 | #endif | ||
| 1243 | |||
| 1244 | [item setTag: tag]; | ||
| 1209 | [item setEnabled: enabled]; | 1245 | [item setEnabled: enabled]; |
| 1210 | 1246 | ||
| 1211 | /* 3) update state */ | 1247 | /* 3) update state */ |
| 1212 | [identifierToItem setObject: item forKey: identifier]; | ||
| 1213 | [activeIdentifiers addObject: identifier]; | ||
| 1214 | enablement = (enablement << 1) | (enabled == YES); | 1248 | enablement = (enablement << 1) | (enabled == YES); |
| 1215 | } | 1249 | } |
| 1216 | 1250 | ||
| 1217 | /* This overrides super's implementation, which automatically sets | 1251 | /* This overrides super's implementation, which automatically sets |
| 1218 | all items to enabled state (for some reason). */ | 1252 | all items to enabled state (for some reason). */ |
| 1219 | - (void)validateVisibleItems { } | 1253 | - (void)validateVisibleItems |
| 1254 | { | ||
| 1255 | } | ||
| 1220 | 1256 | ||
| 1221 | 1257 | ||
| 1222 | /* delegate methods */ | 1258 | /* delegate methods */ |
| @@ -1239,7 +1275,8 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1239 | - (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar | 1275 | - (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar |
| 1240 | { | 1276 | { |
| 1241 | /* return entire set... */ | 1277 | /* return entire set... */ |
| 1242 | return [identifierToItem allKeys]; | 1278 | return activeIdentifiers; |
| 1279 | //return [identifierToItem allKeys]; | ||
| 1243 | } | 1280 | } |
| 1244 | 1281 | ||
| 1245 | /* optional and unneeded */ | 1282 | /* optional and unneeded */ |
| @@ -1531,7 +1568,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1531 | [img autorelease]; | 1568 | [img autorelease]; |
| 1532 | [imgView autorelease]; | 1569 | [imgView autorelease]; |
| 1533 | 1570 | ||
| 1534 | aStyle = NSTitledWindowMask; | 1571 | aStyle = NSTitledWindowMask|NSClosableWindowMask|NSUtilityWindowMask; |
| 1535 | flag = YES; | 1572 | flag = YES; |
| 1536 | rows = 0; | 1573 | rows = 0; |
| 1537 | cols = 1; | 1574 | cols = 1; |
| @@ -1599,9 +1636,6 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1599 | [self setOneShot: YES]; | 1636 | [self setOneShot: YES]; |
| 1600 | [self setReleasedWhenClosed: YES]; | 1637 | [self setReleasedWhenClosed: YES]; |
| 1601 | [self setHidesOnDeactivate: YES]; | 1638 | [self setHidesOnDeactivate: YES]; |
| 1602 | [self setStyleMask: | ||
| 1603 | NSTitledWindowMask|NSClosableWindowMask|NSUtilityWindowMask]; | ||
| 1604 | |||
| 1605 | return self; | 1639 | return self; |
| 1606 | } | 1640 | } |
| 1607 | 1641 | ||
diff --git a/src/nsselect.m b/src/nsselect.m index bb9eacd23cd..6053ee9ceb2 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -182,7 +182,7 @@ ns_get_local_selection (Lisp_Object selection_name, | |||
| 182 | Lisp_Object target_type) | 182 | Lisp_Object target_type) |
| 183 | { | 183 | { |
| 184 | Lisp_Object local_value; | 184 | Lisp_Object local_value; |
| 185 | Lisp_Object handler_fn, value, type, check; | 185 | Lisp_Object handler_fn, value, check; |
| 186 | ptrdiff_t count; | 186 | ptrdiff_t count; |
| 187 | 187 | ||
| 188 | local_value = assq_no_quit (selection_name, Vselection_alist); | 188 | local_value = assq_no_quit (selection_name, Vselection_alist); |
| @@ -203,7 +203,6 @@ ns_get_local_selection (Lisp_Object selection_name, | |||
| 203 | check = value; | 203 | check = value; |
| 204 | if (CONSP (value) && SYMBOLP (XCAR (value))) | 204 | if (CONSP (value) && SYMBOLP (XCAR (value))) |
| 205 | { | 205 | { |
| 206 | type = XCAR (value); | ||
| 207 | check = XCDR (value); | 206 | check = XCDR (value); |
| 208 | } | 207 | } |
| 209 | 208 | ||
diff --git a/src/nsterm.h b/src/nsterm.h index 07cfc2e022e..fd8c9baa3e4 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -51,6 +51,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 51 | 51 | ||
| 52 | #ifdef __OBJC__ | 52 | #ifdef __OBJC__ |
| 53 | 53 | ||
| 54 | /* CGFloat on GNUStep may be 4 or 8 byte, but functions expect float* for some | ||
| 55 | versions. | ||
| 56 | On Cocoa, functions expect CGFloat*. Make compatible type. */ | ||
| 57 | #if defined (NS_IMPL_COCOA) || GNUSTEP_GUI_MAJOR_VERSION > 0 || \ | ||
| 58 | GNUSTEP_GUI_MINOR_VERSION >= 22 | ||
| 59 | typedef CGFloat EmacsCGFloat; | ||
| 60 | #else | ||
| 61 | typedef float EmacsCGFloat; | ||
| 62 | #endif | ||
| 63 | |||
| 54 | /* ========================================================================== | 64 | /* ========================================================================== |
| 55 | 65 | ||
| 56 | The Emacs application | 66 | The Emacs application |
| @@ -60,6 +70,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 60 | /* We override sendEvent: as a means to stop/start the event loop */ | 70 | /* We override sendEvent: as a means to stop/start the event loop */ |
| 61 | @interface EmacsApp : NSApplication | 71 | @interface EmacsApp : NSApplication |
| 62 | { | 72 | { |
| 73 | #ifdef NS_IMPL_GNUSTEP | ||
| 74 | @public | ||
| 75 | int nextappdefined; | ||
| 76 | #endif | ||
| 63 | } | 77 | } |
| 64 | - (void)logNotification: (NSNotification *)notification; | 78 | - (void)logNotification: (NSNotification *)notification; |
| 65 | - (void)sendEvent: (NSEvent *)theEvent; | 79 | - (void)sendEvent: (NSEvent *)theEvent; |
| @@ -68,8 +82,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 68 | - (void)fd_handler: (id)unused; | 82 | - (void)fd_handler: (id)unused; |
| 69 | - (void)timeout_handler: (NSTimer *)timedEntry; | 83 | - (void)timeout_handler: (NSTimer *)timedEntry; |
| 70 | - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg; | 84 | - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg; |
| 85 | #ifdef NS_IMPL_GNUSTEP | ||
| 86 | - (void)sendFromMainThread:(id)unused; | ||
| 87 | #endif | ||
| 71 | @end | 88 | @end |
| 72 | 89 | ||
| 90 | #ifdef NS_IMPL_GNUSTEP | ||
| 91 | /* Dummy class to get rid of startup warnings. */ | ||
| 92 | @interface EmacsDocument : NSDocument | ||
| 93 | { | ||
| 94 | } | ||
| 95 | @end | ||
| 96 | #endif | ||
| 73 | 97 | ||
| 74 | /* ========================================================================== | 98 | /* ========================================================================== |
| 75 | 99 | ||
| @@ -128,8 +152,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 128 | #endif | 152 | #endif |
| 129 | 153 | ||
| 130 | #ifdef NS_IMPL_GNUSTEP | 154 | #ifdef NS_IMPL_GNUSTEP |
| 131 | /* Not declared, but useful. */ | 155 | - (void)windowDidMove: (id)sender; |
| 132 | - (void) unlockFocusNeedsFlush: (BOOL)needs; | ||
| 133 | #endif | 156 | #endif |
| 134 | @end | 157 | @end |
| 135 | 158 | ||
| @@ -199,10 +222,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 199 | } | 222 | } |
| 200 | - initForView: (EmacsView *)view withIdentifier: (NSString *)identifier; | 223 | - initForView: (EmacsView *)view withIdentifier: (NSString *)identifier; |
| 201 | - (void) clearActive; | 224 | - (void) clearActive; |
| 225 | - (void) clearAll; | ||
| 202 | - (BOOL) changed; | 226 | - (BOOL) changed; |
| 203 | - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx | 227 | - (void) addDisplayItemWithImage: (EmacsImage *)img |
| 228 | idx: (int)idx | ||
| 229 | tag: (int)tag | ||
| 204 | helpText: (const char *)help | 230 | helpText: (const char *)help |
| 205 | enabled: (BOOL)enabled; | 231 | enabled: (BOOL)enabled; |
| 232 | |||
| 206 | /* delegate methods */ | 233 | /* delegate methods */ |
| 207 | - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar | 234 | - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar |
| 208 | itemForItemIdentifier: (NSString *)itemIdentifier | 235 | itemForItemIdentifier: (NSString *)itemIdentifier |
| @@ -267,14 +294,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 267 | @interface EmacsSavePanel : NSSavePanel | 294 | @interface EmacsSavePanel : NSSavePanel |
| 268 | { | 295 | { |
| 269 | } | 296 | } |
| 270 | - (NSString *) getFilename; | ||
| 271 | - (NSString *) getDirectory; | ||
| 272 | @end | 297 | @end |
| 273 | @interface EmacsOpenPanel : NSOpenPanel | 298 | @interface EmacsOpenPanel : NSOpenPanel |
| 274 | { | 299 | { |
| 275 | } | 300 | } |
| 276 | - (NSString *) getFilename; | ||
| 277 | - (NSString *) getDirectory; | ||
| 278 | @end | 301 | @end |
| 279 | 302 | ||
| 280 | @interface EmacsFileDelegate : NSObject | 303 | @interface EmacsFileDelegate : NSObject |
| @@ -335,7 +358,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 335 | NSResponder *prevResponder; | 358 | NSResponder *prevResponder; |
| 336 | 359 | ||
| 337 | /* offset to the bottom of knob of last mouse down */ | 360 | /* offset to the bottom of knob of last mouse down */ |
| 338 | float last_mouse_offset; | 361 | CGFloat last_mouse_offset; |
| 339 | float min_portion; | 362 | float min_portion; |
| 340 | int pixel_height; | 363 | int pixel_height; |
| 341 | int last_hit_part; | 364 | int last_hit_part; |
| @@ -789,9 +812,9 @@ extern int ns_lisp_to_color (Lisp_Object color, NSColor **col); | |||
| 789 | extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); | 812 | extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); |
| 790 | extern unsigned long ns_index_color (NSColor *color, struct frame *f); | 813 | extern unsigned long ns_index_color (NSColor *color, struct frame *f); |
| 791 | extern void ns_free_indexed_color (unsigned long idx, struct frame *f); | 814 | extern void ns_free_indexed_color (unsigned long idx, struct frame *f); |
| 792 | extern const char *ns_get_pending_menu_title (); | 815 | extern const char *ns_get_pending_menu_title (void); |
| 793 | extern void ns_check_menu_open (NSMenu *menu); | 816 | extern void ns_check_menu_open (NSMenu *menu); |
| 794 | extern void ns_check_pending_open_menu (); | 817 | extern void ns_check_pending_open_menu (void); |
| 795 | #endif | 818 | #endif |
| 796 | 819 | ||
| 797 | /* C access to ObjC functionality */ | 820 | /* C access to ObjC functionality */ |
| @@ -840,6 +863,7 @@ extern int x_display_pixel_height (struct ns_display_info *); | |||
| 840 | extern int x_display_pixel_width (struct ns_display_info *); | 863 | extern int x_display_pixel_width (struct ns_display_info *); |
| 841 | 864 | ||
| 842 | /* This in nsterm.m */ | 865 | /* This in nsterm.m */ |
| 866 | extern void x_destroy_window (struct frame *f); | ||
| 843 | extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds, | 867 | extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds, |
| 844 | fd_set *exceptfds, EMACS_TIME *timeout, | 868 | fd_set *exceptfds, EMACS_TIME *timeout, |
| 845 | sigset_t *sigmask); | 869 | sigset_t *sigmask); |
diff --git a/src/nsterm.m b/src/nsterm.m index e882f00e977..9cf138837f6 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -60,6 +60,10 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 60 | #include "buffer.h" | 60 | #include "buffer.h" |
| 61 | #include "font.h" | 61 | #include "font.h" |
| 62 | 62 | ||
| 63 | #ifdef NS_IMPL_GNUSTEP | ||
| 64 | #include "process.h" | ||
| 65 | #endif | ||
| 66 | |||
| 63 | /* call tracing */ | 67 | /* call tracing */ |
| 64 | #if 0 | 68 | #if 0 |
| 65 | int term_trace_num = 0; | 69 | int term_trace_num = 0; |
| @@ -196,7 +200,9 @@ static BOOL gsaved = NO; | |||
| 196 | static BOOL ns_fake_keydown = NO; | 200 | static BOOL ns_fake_keydown = NO; |
| 197 | int ns_tmp_flags; /* FIXME */ | 201 | int ns_tmp_flags; /* FIXME */ |
| 198 | struct nsfont_info *ns_tmp_font; /* FIXME */ | 202 | struct nsfont_info *ns_tmp_font; /* FIXME */ |
| 203 | #ifdef NS_IMPL_COCOA | ||
| 199 | static BOOL ns_menu_bar_is_hidden = NO; | 204 | static BOOL ns_menu_bar_is_hidden = NO; |
| 205 | #endif | ||
| 200 | /*static int debug_lock = 0; */ | 206 | /*static int debug_lock = 0; */ |
| 201 | 207 | ||
| 202 | /* event loop */ | 208 | /* event loop */ |
| @@ -228,6 +234,7 @@ static struct { | |||
| 228 | NULL, 0, 0 | 234 | NULL, 0, 0 |
| 229 | }; | 235 | }; |
| 230 | 236 | ||
| 237 | #ifdef NS_IMPL_COCOA | ||
| 231 | /* | 238 | /* |
| 232 | * State for pending menu activation: | 239 | * State for pending menu activation: |
| 233 | * MENU_NONE Normal state | 240 | * MENU_NONE Normal state |
| @@ -246,6 +253,7 @@ static CGPoint menu_mouse_point; | |||
| 246 | 253 | ||
| 247 | /* Title for the menu to open. */ | 254 | /* Title for the menu to open. */ |
| 248 | static char *menu_pending_title = 0; | 255 | static char *menu_pending_title = 0; |
| 256 | #endif | ||
| 249 | 257 | ||
| 250 | /* Convert modifiers in a NeXTstep event to emacs style modifiers. */ | 258 | /* Convert modifiers in a NeXTstep event to emacs style modifiers. */ |
| 251 | #define NS_FUNCTION_KEY_MASK 0x800000 | 259 | #define NS_FUNCTION_KEY_MASK 0x800000 |
| @@ -317,8 +325,6 @@ static char *menu_pending_title = 0; | |||
| 317 | ns_send_appdefined (-1); \ | 325 | ns_send_appdefined (-1); \ |
| 318 | } | 326 | } |
| 319 | 327 | ||
| 320 | void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object); | ||
| 321 | |||
| 322 | /* TODO: get rid of need for these forward declarations */ | 328 | /* TODO: get rid of need for these forward declarations */ |
| 323 | static void ns_condemn_scroll_bars (struct frame *f); | 329 | static void ns_condemn_scroll_bars (struct frame *f); |
| 324 | static void ns_judge_scroll_bars (struct frame *f); | 330 | static void ns_judge_scroll_bars (struct frame *f); |
| @@ -670,8 +676,6 @@ ns_update_begin (struct frame *f) | |||
| 670 | -------------------------------------------------------------------------- */ | 676 | -------------------------------------------------------------------------- */ |
| 671 | { | 677 | { |
| 672 | NSView *view = FRAME_NS_VIEW (f); | 678 | NSView *view = FRAME_NS_VIEW (f); |
| 673 | NSRect r = [view frame]; | ||
| 674 | NSBezierPath *bp; | ||
| 675 | NSTRACE (ns_update_begin); | 679 | NSTRACE (ns_update_begin); |
| 676 | 680 | ||
| 677 | ns_update_auto_hide_menu_bar (); | 681 | ns_update_auto_hide_menu_bar (); |
| @@ -683,9 +687,15 @@ ns_update_begin (struct frame *f) | |||
| 683 | is for the minibuffer. But the display engine may draw more because | 687 | is for the minibuffer. But the display engine may draw more because |
| 684 | we have set the frame as garbaged. So reset clip path to the whole | 688 | we have set the frame as garbaged. So reset clip path to the whole |
| 685 | view. */ | 689 | view. */ |
| 690 | #ifdef NS_IMPL_COCOA | ||
| 691 | { | ||
| 692 | NSBezierPath *bp; | ||
| 693 | NSRect r = [view frame]; | ||
| 686 | bp = [[NSBezierPath bezierPathWithRect: r] retain]; | 694 | bp = [[NSBezierPath bezierPathWithRect: r] retain]; |
| 687 | [bp setClip]; | 695 | [bp setClip]; |
| 688 | [bp release]; | 696 | [bp release]; |
| 697 | } | ||
| 698 | #endif | ||
| 689 | 699 | ||
| 690 | #ifdef NS_IMPL_GNUSTEP | 700 | #ifdef NS_IMPL_GNUSTEP |
| 691 | uRect = NSMakeRect (0, 0, 0, 0); | 701 | uRect = NSMakeRect (0, 0, 0, 0); |
| @@ -772,20 +782,13 @@ ns_update_end (struct frame *f) | |||
| 772 | external (RIF) call; for whole frame, called after update_window_end | 782 | external (RIF) call; for whole frame, called after update_window_end |
| 773 | -------------------------------------------------------------------------- */ | 783 | -------------------------------------------------------------------------- */ |
| 774 | { | 784 | { |
| 775 | NSView *view = FRAME_NS_VIEW (f); | 785 | EmacsView *view = FRAME_NS_VIEW (f); |
| 776 | 786 | ||
| 777 | /* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ | 787 | /* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ |
| 778 | MOUSE_HL_INFO (f)->mouse_face_defer = 0; | 788 | MOUSE_HL_INFO (f)->mouse_face_defer = 0; |
| 779 | 789 | ||
| 780 | block_input (); | 790 | block_input (); |
| 781 | 791 | ||
| 782 | #ifdef NS_IMPL_GNUSTEP | ||
| 783 | /* trigger flush only in the rectangle we tracked as being drawn */ | ||
| 784 | [view unlockFocusNeedsFlush: NO]; | ||
| 785 | /*fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", uRect.origin.x, uRect.origin.y, uRect.size.width, uRect.size.height); */ | ||
| 786 | [view lockFocusInRect: uRect]; | ||
| 787 | #endif | ||
| 788 | |||
| 789 | [view unlockFocus]; | 792 | [view unlockFocus]; |
| 790 | [[view window] flushWindow]; | 793 | [[view window] flushWindow]; |
| 791 | 794 | ||
| @@ -818,13 +821,6 @@ ns_focus (struct frame *f, NSRect *r, int n) | |||
| 818 | -------------------------------------------------------------------------- */ | 821 | -------------------------------------------------------------------------- */ |
| 819 | { | 822 | { |
| 820 | // NSTRACE (ns_focus); | 823 | // NSTRACE (ns_focus); |
| 821 | #ifdef NS_IMPL_GNUSTEP | ||
| 822 | NSRect u; | ||
| 823 | if (n == 2) | ||
| 824 | u = NSUnionRect (r[0], r[1]); | ||
| 825 | else if (r) | ||
| 826 | u = *r; | ||
| 827 | #endif | ||
| 828 | /* static int c =0; | 824 | /* static int c =0; |
| 829 | fprintf (stderr, "focus: %d", c++); | 825 | fprintf (stderr, "focus: %d", c++); |
| 830 | if (r) fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", r->origin.x, r->origin.y, r->size.width, r->size.height); | 826 | if (r) fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", r->origin.x, r->origin.y, r->size.width, r->size.height); |
| @@ -843,33 +839,11 @@ ns_focus (struct frame *f, NSRect *r, int n) | |||
| 843 | } | 839 | } |
| 844 | 840 | ||
| 845 | if (view) | 841 | if (view) |
| 846 | #ifdef NS_IMPL_GNUSTEP | ||
| 847 | r ? [view lockFocusInRect: u] : [view lockFocus]; | ||
| 848 | #else | ||
| 849 | [view lockFocus]; | 842 | [view lockFocus]; |
| 850 | #endif | ||
| 851 | focus_view = view; | 843 | focus_view = view; |
| 852 | /*if (view) debug_lock++; */ | 844 | /*if (view) debug_lock++; */ |
| 853 | } | 845 | } |
| 854 | #ifdef NS_IMPL_GNUSTEP | ||
| 855 | else | ||
| 856 | { | ||
| 857 | /* more than one rect being drawn into */ | ||
| 858 | if (view && r) | ||
| 859 | { | ||
| 860 | [view unlockFocus]; /* add prev rect to redraw list */ | ||
| 861 | [view lockFocusInRect: u]; /* focus for draw in new rect */ | ||
| 862 | } | ||
| 863 | } | ||
| 864 | #endif | ||
| 865 | } | ||
| 866 | #ifdef NS_IMPL_GNUSTEP | ||
| 867 | else | ||
| 868 | { | ||
| 869 | /* in batch mode, but in GNUstep must still track rectangles explicitly */ | ||
| 870 | uRect = (r ? NSUnionRect (uRect, u) : [FRAME_NS_VIEW (f) visibleRect]); | ||
| 871 | } | 846 | } |
| 872 | #endif | ||
| 873 | 847 | ||
| 874 | /* clipping */ | 848 | /* clipping */ |
| 875 | if (r) | 849 | if (r) |
| @@ -1317,12 +1291,17 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) | |||
| 1317 | 1291 | ||
| 1318 | /* If we have a toolbar, take its height into account. */ | 1292 | /* If we have a toolbar, take its height into account. */ |
| 1319 | if (tb && ! [view isFullscreen]) | 1293 | if (tb && ! [view isFullscreen]) |
| 1294 | { | ||
| 1320 | /* NOTE: previously this would generate wrong result if toolbar not | 1295 | /* NOTE: previously this would generate wrong result if toolbar not |
| 1321 | yet displayed and fixing toolbar_height=32 helped, but | 1296 | yet displayed and fixing toolbar_height=32 helped, but |
| 1322 | now (200903) seems no longer needed */ | 1297 | now (200903) seems no longer needed */ |
| 1323 | FRAME_TOOLBAR_HEIGHT (f) = | 1298 | FRAME_TOOLBAR_HEIGHT (f) = |
| 1324 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) | 1299 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) |
| 1325 | - FRAME_NS_TITLEBAR_HEIGHT (f); | 1300 | - FRAME_NS_TITLEBAR_HEIGHT (f); |
| 1301 | #ifdef NS_IMPL_GNUSTEP | ||
| 1302 | FRAME_TOOLBAR_HEIGHT (f) -= 3; | ||
| 1303 | #endif | ||
| 1304 | } | ||
| 1326 | else | 1305 | else |
| 1327 | FRAME_TOOLBAR_HEIGHT (f) = 0; | 1306 | FRAME_TOOLBAR_HEIGHT (f) = 0; |
| 1328 | 1307 | ||
| @@ -1548,7 +1527,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 1548 | } | 1527 | } |
| 1549 | } | 1528 | } |
| 1550 | 1529 | ||
| 1551 | if (r >= 0.0) | 1530 | if (r >= 0.0F) |
| 1552 | { | 1531 | { |
| 1553 | *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0]; | 1532 | *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0]; |
| 1554 | unblock_input (); | 1533 | unblock_input (); |
| @@ -1609,7 +1588,7 @@ ns_color_to_lisp (NSColor *col) | |||
| 1609 | Convert a color to a lisp string with the RGB equivalent | 1588 | Convert a color to a lisp string with the RGB equivalent |
| 1610 | -------------------------------------------------------------------------- */ | 1589 | -------------------------------------------------------------------------- */ |
| 1611 | { | 1590 | { |
| 1612 | CGFloat red, green, blue, alpha, gray; | 1591 | EmacsCGFloat red, green, blue, alpha, gray; |
| 1613 | char buf[1024]; | 1592 | char buf[1024]; |
| 1614 | const char *str; | 1593 | const char *str; |
| 1615 | NSTRACE (ns_color_to_lisp); | 1594 | NSTRACE (ns_color_to_lisp); |
| @@ -1651,7 +1630,7 @@ ns_query_color(void *col, XColor *color_def, int setPixel) | |||
| 1651 | and set color_def pixel to the resulting index. | 1630 | and set color_def pixel to the resulting index. |
| 1652 | -------------------------------------------------------------------------- */ | 1631 | -------------------------------------------------------------------------- */ |
| 1653 | { | 1632 | { |
| 1654 | CGFloat r, g, b, a; | 1633 | EmacsCGFloat r, g, b, a; |
| 1655 | 1634 | ||
| 1656 | [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a]; | 1635 | [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a]; |
| 1657 | color_def->red = r * 65535; | 1636 | color_def->red = r * 65535; |
| @@ -1696,26 +1675,6 @@ ns_defined_color (struct frame *f, | |||
| 1696 | } | 1675 | } |
| 1697 | 1676 | ||
| 1698 | 1677 | ||
| 1699 | unsigned long | ||
| 1700 | ns_get_rgb_color (struct frame *f, float r, float g, float b, float a) | ||
| 1701 | /* -------------------------------------------------------------------------- | ||
| 1702 | return an autoreleased RGB color | ||
| 1703 | -------------------------------------------------------------------------- */ | ||
| 1704 | { | ||
| 1705 | /*static int c = 1; fprintf (stderr, "color request %d\n", c++); */ | ||
| 1706 | if (r < 0.0) r = 0.0; | ||
| 1707 | else if (r > 1.0) r = 1.0; | ||
| 1708 | if (g < 0.0) g = 0.0; | ||
| 1709 | else if (g > 1.0) g = 1.0; | ||
| 1710 | if (b < 0.0) b = 0.0; | ||
| 1711 | else if (b > 1.0) b = 1.0; | ||
| 1712 | if (a < 0.0) a = 0.0; | ||
| 1713 | else if (a > 1.0) a = 1.0; | ||
| 1714 | return (unsigned long) ns_index_color( | ||
| 1715 | [NSColor colorWithCalibratedRed: r green: g blue: b alpha: a], f); | ||
| 1716 | } | ||
| 1717 | |||
| 1718 | |||
| 1719 | void | 1678 | void |
| 1720 | x_set_frame_alpha (struct frame *f) | 1679 | x_set_frame_alpha (struct frame *f) |
| 1721 | /* -------------------------------------------------------------------------- | 1680 | /* -------------------------------------------------------------------------- |
| @@ -1723,7 +1682,6 @@ x_set_frame_alpha (struct frame *f) | |||
| 1723 | -------------------------------------------------------------------------- */ | 1682 | -------------------------------------------------------------------------- */ |
| 1724 | { | 1683 | { |
| 1725 | struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); | 1684 | struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); |
| 1726 | EmacsView *view = FRAME_NS_VIEW (f); | ||
| 1727 | double alpha = 1.0; | 1685 | double alpha = 1.0; |
| 1728 | double alpha_min = 1.0; | 1686 | double alpha_min = 1.0; |
| 1729 | 1687 | ||
| @@ -1745,7 +1703,10 @@ x_set_frame_alpha (struct frame *f) | |||
| 1745 | alpha = alpha_min; | 1703 | alpha = alpha_min; |
| 1746 | 1704 | ||
| 1747 | #ifdef NS_IMPL_COCOA | 1705 | #ifdef NS_IMPL_COCOA |
| 1706 | { | ||
| 1707 | EmacsView *view = FRAME_NS_VIEW (f); | ||
| 1748 | [[view window] setAlphaValue: alpha]; | 1708 | [[view window] setAlphaValue: alpha]; |
| 1709 | } | ||
| 1749 | #endif | 1710 | #endif |
| 1750 | } | 1711 | } |
| 1751 | 1712 | ||
| @@ -1798,7 +1759,7 @@ x_set_mouse_position (struct frame *f, int h, int v) | |||
| 1798 | 1759 | ||
| 1799 | 1760 | ||
| 1800 | static int | 1761 | static int |
| 1801 | note_mouse_movement (struct frame *frame, float x, float y) | 1762 | note_mouse_movement (struct frame *frame, CGFloat x, CGFloat y) |
| 1802 | /* ------------------------------------------------------------------------ | 1763 | /* ------------------------------------------------------------------------ |
| 1803 | Called by EmacsView on mouseMovement events. Passes on | 1764 | Called by EmacsView on mouseMovement events. Passes on |
| 1804 | to emacs mainstream code if we moved off of a rect of interest | 1765 | to emacs mainstream code if we moved off of a rect of interest |
| @@ -2257,7 +2218,6 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2257 | { | 2218 | { |
| 2258 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 2219 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 2259 | struct face *face = p->face; | 2220 | struct face *face = p->face; |
| 2260 | int rowY; | ||
| 2261 | static EmacsImage **bimgs = NULL; | 2221 | static EmacsImage **bimgs = NULL; |
| 2262 | static int nBimgs = 0; | 2222 | static int nBimgs = 0; |
| 2263 | 2223 | ||
| @@ -2271,7 +2231,6 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2271 | } | 2231 | } |
| 2272 | 2232 | ||
| 2273 | /* Must clip because of partially visible lines. */ | 2233 | /* Must clip because of partially visible lines. */ |
| 2274 | rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | ||
| 2275 | ns_clip_to_row (w, row, -1, YES); | 2234 | ns_clip_to_row (w, row, -1, YES); |
| 2276 | 2235 | ||
| 2277 | if (!p->overlay_p) | 2236 | if (!p->overlay_p) |
| @@ -2359,7 +2318,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2359 | [ns_lookup_indexed_color(face->background, f) set]; | 2318 | [ns_lookup_indexed_color(face->background, f) set]; |
| 2360 | NSRectFill (r); | 2319 | NSRectFill (r); |
| 2361 | [img setXBMColor: ns_lookup_indexed_color(face->foreground, f)]; | 2320 | [img setXBMColor: ns_lookup_indexed_color(face->foreground, f)]; |
| 2362 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | 2321 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 2363 | [img drawInRect: r | 2322 | [img drawInRect: r |
| 2364 | fromRect: NSZeroRect | 2323 | fromRect: NSZeroRect |
| 2365 | operation: NSCompositeSourceOver | 2324 | operation: NSCompositeSourceOver |
| @@ -2391,7 +2350,6 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2391 | int fx, fy, h, cursor_height; | 2350 | int fx, fy, h, cursor_height; |
| 2392 | struct frame *f = WINDOW_XFRAME (w); | 2351 | struct frame *f = WINDOW_XFRAME (w); |
| 2393 | struct glyph *phys_cursor_glyph; | 2352 | struct glyph *phys_cursor_glyph; |
| 2394 | int overspill; | ||
| 2395 | struct glyph *cursor_glyph; | 2353 | struct glyph *cursor_glyph; |
| 2396 | struct face *face; | 2354 | struct face *face; |
| 2397 | NSColor *hollow_color = FRAME_BACKGROUND_COLOR (f); | 2355 | NSColor *hollow_color = FRAME_BACKGROUND_COLOR (f); |
| @@ -2598,7 +2556,7 @@ ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) | |||
| 2598 | --------------------------------------------------------------------- */ | 2556 | --------------------------------------------------------------------- */ |
| 2599 | 2557 | ||
| 2600 | static void | 2558 | static void |
| 2601 | ns_draw_underwave (struct glyph_string *s, CGFloat width, CGFloat x) | 2559 | ns_draw_underwave (struct glyph_string *s, EmacsCGFloat width, EmacsCGFloat x) |
| 2602 | { | 2560 | { |
| 2603 | int wave_height = 3, wave_length = 2; | 2561 | int wave_height = 3, wave_length = 2; |
| 2604 | int y, dx, dy, odd, xmax; | 2562 | int y, dx, dy, odd, xmax; |
| @@ -2616,7 +2574,7 @@ ns_draw_underwave (struct glyph_string *s, CGFloat width, CGFloat x) | |||
| 2616 | NSRectClip (waveClip); | 2574 | NSRectClip (waveClip); |
| 2617 | 2575 | ||
| 2618 | /* Draw the waves */ | 2576 | /* Draw the waves */ |
| 2619 | a.x = x - ((int)(x) % dx) + 0.5; | 2577 | a.x = x - ((int)(x) % dx) + (EmacsCGFloat) 0.5; |
| 2620 | b.x = a.x + dx; | 2578 | b.x = a.x + dx; |
| 2621 | odd = (int)(a.x/dx) % 2; | 2579 | odd = (int)(a.x/dx) % 2; |
| 2622 | a.y = b.y = y + 0.5; | 2580 | a.y = b.y = y + 0.5; |
| @@ -2756,7 +2714,8 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, | |||
| 2756 | } | 2714 | } |
| 2757 | 2715 | ||
| 2758 | static void | 2716 | static void |
| 2759 | ns_draw_box (NSRect r, float thickness, NSColor *col, char left_p, char right_p) | 2717 | ns_draw_box (NSRect r, CGFloat thickness, NSColor *col, |
| 2718 | char left_p, char right_p) | ||
| 2760 | /* -------------------------------------------------------------------------- | 2719 | /* -------------------------------------------------------------------------- |
| 2761 | Draw an unfilled rect inside r, optionally leaving left and/or right open. | 2720 | Draw an unfilled rect inside r, optionally leaving left and/or right open. |
| 2762 | Note we can't just use an NSDrawRect command, because of the possibility | 2721 | Note we can't just use an NSDrawRect command, because of the possibility |
| @@ -3033,7 +2992,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) | |||
| 3033 | /* Draw the image.. do we need to draw placeholder if img ==nil? */ | 2992 | /* Draw the image.. do we need to draw placeholder if img ==nil? */ |
| 3034 | if (img != nil) | 2993 | if (img != nil) |
| 3035 | { | 2994 | { |
| 3036 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | 2995 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 3037 | NSRect dr = NSMakeRect (x, y, s->slice.width, s->slice.height); | 2996 | NSRect dr = NSMakeRect (x, y, s->slice.width, s->slice.height); |
| 3038 | NSRect ir = NSMakeRect (s->slice.x, s->slice.y, | 2997 | NSRect ir = NSMakeRect (s->slice.x, s->slice.y, |
| 3039 | s->slice.width, s->slice.height); | 2998 | s->slice.width, s->slice.height); |
| @@ -3358,6 +3317,19 @@ ns_send_appdefined (int value) | |||
| 3358 | { | 3317 | { |
| 3359 | /*NSTRACE (ns_send_appdefined); */ | 3318 | /*NSTRACE (ns_send_appdefined); */ |
| 3360 | 3319 | ||
| 3320 | #ifdef NS_IMPL_GNUSTEP | ||
| 3321 | // GNUStep needs postEvent to happen on the main thread. | ||
| 3322 | if (! [[NSThread currentThread] isMainThread]) | ||
| 3323 | { | ||
| 3324 | EmacsApp *app = (EmacsApp *)NSApp; | ||
| 3325 | app->nextappdefined = value; | ||
| 3326 | [app performSelectorOnMainThread:@selector (sendFromMainThread:) | ||
| 3327 | withObject:nil | ||
| 3328 | waitUntilDone:YES]; | ||
| 3329 | return; | ||
| 3330 | } | ||
| 3331 | #endif | ||
| 3332 | |||
| 3361 | /* Only post this event if we haven't already posted one. This will end | 3333 | /* Only post this event if we haven't already posted one. This will end |
| 3362 | the [NXApp run] main loop after having processed all events queued at | 3334 | the [NXApp run] main loop after having processed all events queued at |
| 3363 | this moment. */ | 3335 | this moment. */ |
| @@ -3417,6 +3389,9 @@ check_native_fs () | |||
| 3417 | } | 3389 | } |
| 3418 | #endif | 3390 | #endif |
| 3419 | 3391 | ||
| 3392 | /* GNUStep and OSX <= 10.4 does not have cancelTracking. */ | ||
| 3393 | #if defined (NS_IMPL_COCOA) && \ | ||
| 3394 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | ||
| 3420 | const char * | 3395 | const char * |
| 3421 | ns_get_pending_menu_title () | 3396 | ns_get_pending_menu_title () |
| 3422 | { | 3397 | { |
| @@ -3427,10 +3402,6 @@ ns_get_pending_menu_title () | |||
| 3427 | void | 3402 | void |
| 3428 | ns_check_menu_open (NSMenu *menu) | 3403 | ns_check_menu_open (NSMenu *menu) |
| 3429 | { | 3404 | { |
| 3430 | /* GNUStep and OSX <= 10.4 does not have cancelTracking. */ | ||
| 3431 | #if defined(NS_IMPL_COCOA) && \ | ||
| 3432 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | ||
| 3433 | |||
| 3434 | /* Click in menu bar? */ | 3405 | /* Click in menu bar? */ |
| 3435 | NSArray *a = [[NSApp mainMenu] itemArray]; | 3406 | NSArray *a = [[NSApp mainMenu] itemArray]; |
| 3436 | int i; | 3407 | int i; |
| @@ -3460,14 +3431,12 @@ ns_check_menu_open (NSMenu *menu) | |||
| 3460 | menu_will_open_state = MENU_NONE; | 3431 | menu_will_open_state = MENU_NONE; |
| 3461 | } | 3432 | } |
| 3462 | } | 3433 | } |
| 3463 | #endif | ||
| 3464 | } | 3434 | } |
| 3465 | 3435 | ||
| 3466 | /* Redo saved menu click if state is MENU_PENDING. */ | 3436 | /* Redo saved menu click if state is MENU_PENDING. */ |
| 3467 | void | 3437 | void |
| 3468 | ns_check_pending_open_menu () | 3438 | ns_check_pending_open_menu () |
| 3469 | { | 3439 | { |
| 3470 | #ifdef NS_IMPL_COCOA | ||
| 3471 | if (menu_will_open_state == MENU_PENDING) | 3440 | if (menu_will_open_state == MENU_PENDING) |
| 3472 | { | 3441 | { |
| 3473 | CGEventSourceRef source | 3442 | CGEventSourceRef source |
| @@ -3484,9 +3453,8 @@ ns_check_pending_open_menu () | |||
| 3484 | 3453 | ||
| 3485 | menu_will_open_state = MENU_OPENING; | 3454 | menu_will_open_state = MENU_OPENING; |
| 3486 | } | 3455 | } |
| 3487 | #endif | ||
| 3488 | } | 3456 | } |
| 3489 | 3457 | #endif /* NS_IMPL_COCOA) && >= MAC_OS_X_VERSION_10_5 */ | |
| 3490 | 3458 | ||
| 3491 | static int | 3459 | static int |
| 3492 | ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) | 3460 | ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) |
| @@ -4392,6 +4360,12 @@ ns_term_init (Lisp_Object display_name) | |||
| 4392 | 4360 | ||
| 4393 | [NSApp run]; | 4361 | [NSApp run]; |
| 4394 | ns_do_open_file = YES; | 4362 | ns_do_open_file = YES; |
| 4363 | |||
| 4364 | #if defined (NS_IMPL_GNUSTEP) && defined (SIGCHLD) | ||
| 4365 | /* GNUstep steals SIGCHLD for use in NSTask, but we don't use NSTask. | ||
| 4366 | We must re-catch it so subprocess works. */ | ||
| 4367 | catch_child_signal (); | ||
| 4368 | #endif | ||
| 4395 | return dpyinfo; | 4369 | return dpyinfo; |
| 4396 | } | 4370 | } |
| 4397 | 4371 | ||
| @@ -4699,6 +4673,13 @@ not_in_argv (NSString *arg) | |||
| 4699 | ns_send_appdefined (-2); | 4673 | ns_send_appdefined (-2); |
| 4700 | } | 4674 | } |
| 4701 | 4675 | ||
| 4676 | #ifdef NS_IMPL_GNUSTEP | ||
| 4677 | - (void)sendFromMainThread:(id)unused | ||
| 4678 | { | ||
| 4679 | ns_send_appdefined (nextappdefined); | ||
| 4680 | } | ||
| 4681 | #endif | ||
| 4682 | |||
| 4702 | - (void)fd_handler:(id)unused | 4683 | - (void)fd_handler:(id)unused |
| 4703 | /* -------------------------------------------------------------------------- | 4684 | /* -------------------------------------------------------------------------- |
| 4704 | Check data waiting on file descriptors and terminate if so | 4685 | Check data waiting on file descriptors and terminate if so |
| @@ -4863,7 +4844,7 @@ not_in_argv (NSString *arg) | |||
| 4863 | NSEvent *e =[[self window] currentEvent]; | 4844 | NSEvent *e =[[self window] currentEvent]; |
| 4864 | struct face *face =FRAME_DEFAULT_FACE (emacsframe); | 4845 | struct face *face =FRAME_DEFAULT_FACE (emacsframe); |
| 4865 | id newFont; | 4846 | id newFont; |
| 4866 | float size; | 4847 | CGFloat size; |
| 4867 | 4848 | ||
| 4868 | NSTRACE (changeFont); | 4849 | NSTRACE (changeFont); |
| 4869 | if (!emacs_event) | 4850 | if (!emacs_event) |
| @@ -4982,7 +4963,16 @@ not_in_argv (NSString *arg) | |||
| 4982 | { | 4963 | { |
| 4983 | /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', | 4964 | /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', |
| 4984 | because Emacs treats Delete and KP-Delete same (in simple.el). */ | 4965 | because Emacs treats Delete and KP-Delete same (in simple.el). */ |
| 4985 | if (fnKeysym == 0xFFFF && [theEvent keyCode] == 0x33) | 4966 | if ((fnKeysym == 0xFFFF && [theEvent keyCode] == 0x33) |
| 4967 | #ifdef NS_IMPL_GNUSTEP | ||
| 4968 | /* GNUstep uses incompatible keycodes, even for those that are | ||
| 4969 | supposed to be hardware independent. Just check for delete. | ||
| 4970 | Keypad delete does not have keysym 0xFFFF. | ||
| 4971 | See http://savannah.gnu.org/bugs/?25395 | ||
| 4972 | */ | ||
| 4973 | || (fnKeysym == 0xFFFF && code == 127) | ||
| 4974 | #endif | ||
| 4975 | ) | ||
| 4986 | code = 0xFF08; /* backspace */ | 4976 | code = 0xFF08; /* backspace */ |
| 4987 | else | 4977 | else |
| 4988 | code = fnKeysym; | 4978 | code = fnKeysym; |
| @@ -5135,10 +5125,14 @@ not_in_argv (NSString *arg) | |||
| 5135 | 5125 | ||
| 5136 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | 5126 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 |
| 5137 | /* if we get here we should send the key for input manager processing */ | 5127 | /* if we get here we should send the key for input manager processing */ |
| 5128 | /* Disable warning, there is nothing a user can do about it anyway, and | ||
| 5129 | it does not seem to matter. */ | ||
| 5130 | #if 0 | ||
| 5138 | if (firstTime && [[NSInputManager currentInputManager] | 5131 | if (firstTime && [[NSInputManager currentInputManager] |
| 5139 | wantsToDelayTextChangeNotifications] == NO) | 5132 | wantsToDelayTextChangeNotifications] == NO) |
| 5140 | fprintf (stderr, | 5133 | fprintf (stderr, |
| 5141 | "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n"); | 5134 | "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n"); |
| 5135 | #endif | ||
| 5142 | firstTime = NO; | 5136 | firstTime = NO; |
| 5143 | #endif | 5137 | #endif |
| 5144 | if (NS_KEYLOG && !processingCompose) | 5138 | if (NS_KEYLOG && !processingCompose) |
| @@ -5346,7 +5340,12 @@ not_in_argv (NSString *arg) | |||
| 5346 | return NSMakeRange (NSNotFound, 0); | 5340 | return NSMakeRange (NSNotFound, 0); |
| 5347 | } | 5341 | } |
| 5348 | 5342 | ||
| 5343 | #if defined (NS_IMPL_COCOA) || GNUSTEP_GUI_MAJOR_VERSION > 0 || \ | ||
| 5344 | GNUSTEP_GUI_MINOR_VERSION > 22 | ||
| 5349 | - (NSUInteger)characterIndexForPoint: (NSPoint)thePoint | 5345 | - (NSUInteger)characterIndexForPoint: (NSPoint)thePoint |
| 5346 | #else | ||
| 5347 | - (unsigned int)characterIndexForPoint: (NSPoint)thePoint | ||
| 5348 | #endif | ||
| 5350 | { | 5349 | { |
| 5351 | if (NS_KEYLOG) | 5350 | if (NS_KEYLOG) |
| 5352 | NSLog (@"characterIndexForPoint request"); | 5351 | NSLog (@"characterIndexForPoint request"); |
| @@ -5385,7 +5384,7 @@ not_in_argv (NSString *arg) | |||
| 5385 | 5384 | ||
| 5386 | if ([theEvent type] == NSScrollWheel) | 5385 | if ([theEvent type] == NSScrollWheel) |
| 5387 | { | 5386 | { |
| 5388 | float delta = [theEvent deltaY]; | 5387 | CGFloat delta = [theEvent deltaY]; |
| 5389 | /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ | 5388 | /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ |
| 5390 | if (delta == 0) | 5389 | if (delta == 0) |
| 5391 | return; | 5390 | return; |
| @@ -5569,7 +5568,6 @@ not_in_argv (NSString *arg) | |||
| 5569 | 5568 | ||
| 5570 | if (oldr != rows || oldc != cols || neww != oldw || newh != oldh) | 5569 | if (oldr != rows || oldc != cols || neww != oldw || newh != oldh) |
| 5571 | { | 5570 | { |
| 5572 | struct frame *f = emacsframe; | ||
| 5573 | NSView *view = FRAME_NS_VIEW (emacsframe); | 5571 | NSView *view = FRAME_NS_VIEW (emacsframe); |
| 5574 | NSWindow *win = [view window]; | 5572 | NSWindow *win = [view window]; |
| 5575 | NSSize sz = [win resizeIncrements]; | 5573 | NSSize sz = [win resizeIncrements]; |
| @@ -5778,7 +5776,6 @@ not_in_argv (NSString *arg) | |||
| 5778 | NSRect r, wr; | 5776 | NSRect r, wr; |
| 5779 | Lisp_Object tem; | 5777 | Lisp_Object tem; |
| 5780 | NSWindow *win; | 5778 | NSWindow *win; |
| 5781 | NSButton *toggleButton; | ||
| 5782 | NSSize sz; | 5779 | NSSize sz; |
| 5783 | NSColor *col; | 5780 | NSColor *col; |
| 5784 | NSString *name; | 5781 | NSString *name; |
| @@ -5854,9 +5851,12 @@ not_in_argv (NSString *arg) | |||
| 5854 | [win setToolbar: toolbar]; | 5851 | [win setToolbar: toolbar]; |
| 5855 | [toolbar setVisible: NO]; | 5852 | [toolbar setVisible: NO]; |
| 5856 | #ifdef NS_IMPL_COCOA | 5853 | #ifdef NS_IMPL_COCOA |
| 5854 | { | ||
| 5855 | NSButton *toggleButton; | ||
| 5857 | toggleButton = [win standardWindowButton: NSWindowToolbarButton]; | 5856 | toggleButton = [win standardWindowButton: NSWindowToolbarButton]; |
| 5858 | [toggleButton setTarget: self]; | 5857 | [toggleButton setTarget: self]; |
| 5859 | [toggleButton setAction: @selector (toggleToolbar: )]; | 5858 | [toggleButton setAction: @selector (toggleToolbar: )]; |
| 5859 | } | ||
| 5860 | #endif | 5860 | #endif |
| 5861 | FRAME_TOOLBAR_HEIGHT (f) = 0; | 5861 | FRAME_TOOLBAR_HEIGHT (f) = 0; |
| 5862 | 5862 | ||
| @@ -5880,7 +5880,7 @@ not_in_argv (NSString *arg) | |||
| 5880 | col = ns_lookup_indexed_color (NS_FACE_BACKGROUND | 5880 | col = ns_lookup_indexed_color (NS_FACE_BACKGROUND |
| 5881 | (FRAME_DEFAULT_FACE (emacsframe)), emacsframe); | 5881 | (FRAME_DEFAULT_FACE (emacsframe)), emacsframe); |
| 5882 | [win setBackgroundColor: col]; | 5882 | [win setBackgroundColor: col]; |
| 5883 | if ([col alphaComponent] != 1.0) | 5883 | if ([col alphaComponent] != (EmacsCGFloat) 1.0) |
| 5884 | [win setOpaque: NO]; | 5884 | [win setOpaque: NO]; |
| 5885 | 5885 | ||
| 5886 | [self allocateGState]; | 5886 | [self allocateGState]; |
| @@ -5973,7 +5973,7 @@ not_in_argv (NSString *arg) | |||
| 5973 | result = ns_userRect.size.height ? ns_userRect : result; | 5973 | result = ns_userRect.size.height ? ns_userRect : result; |
| 5974 | ns_userRect = NSMakeRect (0, 0, 0, 0); | 5974 | ns_userRect = NSMakeRect (0, 0, 0, 0); |
| 5975 | [self setFSValue: FULLSCREEN_NONE]; | 5975 | [self setFSValue: FULLSCREEN_NONE]; |
| 5976 | maximized_width = maximized_width = -1; | 5976 | maximized_width = maximized_height = -1; |
| 5977 | } | 5977 | } |
| 5978 | 5978 | ||
| 5979 | if (fs_before_fs == -1) next_maximized = -1; | 5979 | if (fs_before_fs == -1) next_maximized = -1; |
| @@ -6066,7 +6066,9 @@ not_in_argv (NSString *arg) | |||
| 6066 | { | 6066 | { |
| 6067 | [self setFSValue: fs_before_fs]; | 6067 | [self setFSValue: fs_before_fs]; |
| 6068 | fs_before_fs = -1; | 6068 | fs_before_fs = -1; |
| 6069 | #ifdef NS_IMPL_COCOA | ||
| 6069 | [self updateCollectionBehaviour]; | 6070 | [self updateCollectionBehaviour]; |
| 6071 | #endif | ||
| 6070 | if (FRAME_EXTERNAL_TOOL_BAR (emacsframe)) | 6072 | if (FRAME_EXTERNAL_TOOL_BAR (emacsframe)) |
| 6071 | { | 6073 | { |
| 6072 | [toolbar setVisible:YES]; | 6074 | [toolbar setVisible:YES]; |
| @@ -6125,7 +6127,9 @@ not_in_argv (NSString *arg) | |||
| 6125 | 6127 | ||
| 6126 | if (fs_is_native) | 6128 | if (fs_is_native) |
| 6127 | { | 6129 | { |
| 6130 | #ifdef NS_IMPL_COCOA | ||
| 6128 | [[self window] toggleFullScreen:sender]; | 6131 | [[self window] toggleFullScreen:sender]; |
| 6132 | #endif | ||
| 6129 | return; | 6133 | return; |
| 6130 | } | 6134 | } |
| 6131 | 6135 | ||
| @@ -6171,7 +6175,7 @@ not_in_argv (NSString *arg) | |||
| 6171 | [fw useOptimizedDrawing: YES]; | 6175 | [fw useOptimizedDrawing: YES]; |
| 6172 | [fw setResizeIncrements: sz]; | 6176 | [fw setResizeIncrements: sz]; |
| 6173 | [fw setBackgroundColor: col]; | 6177 | [fw setBackgroundColor: col]; |
| 6174 | if ([col alphaComponent] != 1.0) | 6178 | if ([col alphaComponent] != (EmacsCGFloat) 1.0) |
| 6175 | [fw setOpaque: NO]; | 6179 | [fw setOpaque: NO]; |
| 6176 | 6180 | ||
| 6177 | f->border_width = 0; | 6181 | f->border_width = 0; |
| @@ -6209,7 +6213,7 @@ not_in_argv (NSString *arg) | |||
| 6209 | [w setContentView:[fw contentView]]; | 6213 | [w setContentView:[fw contentView]]; |
| 6210 | [w setResizeIncrements: sz]; | 6214 | [w setResizeIncrements: sz]; |
| 6211 | [w setBackgroundColor: col]; | 6215 | [w setBackgroundColor: col]; |
| 6212 | if ([col alphaComponent] != 1.0) | 6216 | if ([col alphaComponent] != (EmacsCGFloat) 1.0) |
| 6213 | [w setOpaque: NO]; | 6217 | [w setOpaque: NO]; |
| 6214 | 6218 | ||
| 6215 | f->border_width = bwidth; | 6219 | f->border_width = bwidth; |
| @@ -6903,10 +6907,11 @@ not_in_argv (NSString *arg) | |||
| 6903 | } | 6907 | } |
| 6904 | else | 6908 | else |
| 6905 | { | 6909 | { |
| 6906 | float pos, por; | 6910 | float pos; |
| 6911 | CGFloat por; | ||
| 6907 | portion = max ((float)whole*min_portion/pixel_height, portion); | 6912 | portion = max ((float)whole*min_portion/pixel_height, portion); |
| 6908 | pos = (float)position / (whole - portion); | 6913 | pos = (float)position / (whole - portion); |
| 6909 | por = (float)portion/whole; | 6914 | por = (CGFloat)portion/whole; |
| 6910 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 | 6915 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 |
| 6911 | [self setKnobProportion: por]; | 6916 | [self setKnobProportion: por]; |
| 6912 | [self setDoubleValue: pos]; | 6917 | [self setDoubleValue: pos]; |
| @@ -6931,7 +6936,7 @@ not_in_argv (NSString *arg) | |||
| 6931 | *part = last_hit_part; | 6936 | *part = last_hit_part; |
| 6932 | *window = win; | 6937 | *window = win; |
| 6933 | XSETINT (*y, pixel_height); | 6938 | XSETINT (*y, pixel_height); |
| 6934 | if ([self floatValue] > 0.999) | 6939 | if ([self floatValue] > 0.999F) |
| 6935 | XSETINT (*x, pixel_height); | 6940 | XSETINT (*x, pixel_height); |
| 6936 | else | 6941 | else |
| 6937 | XSETINT (*x, pixel_height * [self floatValue]); | 6942 | XSETINT (*x, pixel_height * [self floatValue]); |
| @@ -7005,7 +7010,7 @@ not_in_argv (NSString *arg) | |||
| 7005 | NSRect sr, kr; | 7010 | NSRect sr, kr; |
| 7006 | /* hitPart is only updated AFTER event is passed on */ | 7011 | /* hitPart is only updated AFTER event is passed on */ |
| 7007 | NSScrollerPart part = [self testPart: [e locationInWindow]]; | 7012 | NSScrollerPart part = [self testPart: [e locationInWindow]]; |
| 7008 | double inc = 0.0, loc, kloc, pos; | 7013 | CGFloat inc = 0.0, loc, kloc, pos; |
| 7009 | int edge = 0; | 7014 | int edge = 0; |
| 7010 | 7015 | ||
| 7011 | NSTRACE (EmacsScroller_mouseDown); | 7016 | NSTRACE (EmacsScroller_mouseDown); |
| @@ -7104,7 +7109,6 @@ not_in_argv (NSString *arg) | |||
| 7104 | { | 7109 | { |
| 7105 | NSRect sr; | 7110 | NSRect sr; |
| 7106 | double loc, pos; | 7111 | double loc, pos; |
| 7107 | int edge = 0; | ||
| 7108 | 7112 | ||
| 7109 | NSTRACE (EmacsScroller_mouseDragged); | 7113 | NSTRACE (EmacsScroller_mouseDragged); |
| 7110 | 7114 | ||
| @@ -7115,15 +7119,13 @@ not_in_argv (NSString *arg) | |||
| 7115 | if (loc <= 0.0) | 7119 | if (loc <= 0.0) |
| 7116 | { | 7120 | { |
| 7117 | loc = 0.0; | 7121 | loc = 0.0; |
| 7118 | edge = -1; | ||
| 7119 | } | 7122 | } |
| 7120 | else if (loc >= NSHeight (sr) + last_mouse_offset) | 7123 | else if (loc >= NSHeight (sr) + last_mouse_offset) |
| 7121 | { | 7124 | { |
| 7122 | loc = NSHeight (sr) + last_mouse_offset; | 7125 | loc = NSHeight (sr) + last_mouse_offset; |
| 7123 | edge = 1; | ||
| 7124 | } | 7126 | } |
| 7125 | 7127 | ||
| 7126 | pos = /*(edge ? loc :*/ (loc - last_mouse_offset) / NSHeight (sr); | 7128 | pos = (loc - last_mouse_offset) / NSHeight (sr); |
| 7127 | [self sendScrollEventAtLoc: pos fromEvent: e]; | 7129 | [self sendScrollEventAtLoc: pos fromEvent: e]; |
| 7128 | } | 7130 | } |
| 7129 | 7131 | ||
| @@ -7150,6 +7152,12 @@ not_in_argv (NSString *arg) | |||
| 7150 | @end /* EmacsScroller */ | 7152 | @end /* EmacsScroller */ |
| 7151 | 7153 | ||
| 7152 | 7154 | ||
| 7155 | #ifdef NS_IMPL_GNUSTEP | ||
| 7156 | /* Dummy class to get rid of startup warnings. */ | ||
| 7157 | @implementation EmacsDocument | ||
| 7158 | |||
| 7159 | @end | ||
| 7160 | #endif | ||
| 7153 | 7161 | ||
| 7154 | 7162 | ||
| 7155 | /* ========================================================================== | 7163 | /* ========================================================================== |
diff --git a/src/process.c b/src/process.c index 45e8afdd22c..9df003fa3a3 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -7029,6 +7029,16 @@ integer or floating point values. | |||
| 7029 | return system_process_attributes (pid); | 7029 | return system_process_attributes (pid); |
| 7030 | } | 7030 | } |
| 7031 | 7031 | ||
| 7032 | void | ||
| 7033 | catch_child_signal (void) | ||
| 7034 | { | ||
| 7035 | #ifdef SIGCHLD | ||
| 7036 | struct sigaction action; | ||
| 7037 | emacs_sigaction_init (&action, deliver_child_signal); | ||
| 7038 | sigaction (SIGCHLD, &action, 0); | ||
| 7039 | #endif | ||
| 7040 | } | ||
| 7041 | |||
| 7032 | 7042 | ||
| 7033 | /* This is not called "init_process" because that is the name of a | 7043 | /* This is not called "init_process" because that is the name of a |
| 7034 | Mach system call, so it would cause problems on Darwin systems. */ | 7044 | Mach system call, so it would cause problems on Darwin systems. */ |
| @@ -7044,9 +7054,7 @@ init_process_emacs (void) | |||
| 7044 | if (! noninteractive || initialized) | 7054 | if (! noninteractive || initialized) |
| 7045 | #endif | 7055 | #endif |
| 7046 | { | 7056 | { |
| 7047 | struct sigaction action; | 7057 | catch_child_signal (); |
| 7048 | emacs_sigaction_init (&action, deliver_child_signal); | ||
| 7049 | sigaction (SIGCHLD, &action, 0); | ||
| 7050 | } | 7058 | } |
| 7051 | 7059 | ||
| 7052 | FD_ZERO (&input_wait_mask); | 7060 | FD_ZERO (&input_wait_mask); |
diff --git a/src/process.h b/src/process.h index 765e5d82567..9455df18beb 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -217,5 +217,6 @@ extern void add_read_fd (int fd, fd_callback func, void *data); | |||
| 217 | extern void delete_read_fd (int fd); | 217 | extern void delete_read_fd (int fd); |
| 218 | extern void add_write_fd (int fd, fd_callback func, void *data); | 218 | extern void add_write_fd (int fd, fd_callback func, void *data); |
| 219 | extern void delete_write_fd (int fd); | 219 | extern void delete_write_fd (int fd); |
| 220 | extern void catch_child_signal (void); | ||
| 220 | 221 | ||
| 221 | INLINE_HEADER_END | 222 | INLINE_HEADER_END |