diff options
| author | Alan Third | 2018-06-23 15:26:26 +0100 |
|---|---|---|
| committer | Alan Third | 2020-03-22 15:31:45 +0000 |
| commit | 3316e78c120f69aa3ac12ff7345a79dd09654c9a (patch) | |
| tree | 95dab41336265e82d71bc45c621733bfdbe06a74 /src/nsterm.h | |
| parent | 41f54289058ec42829cd19f7c469b2e4e325b830 (diff) | |
| download | emacs-scratch/ns/next.tar.gz emacs-scratch/ns/next.zip | |
Run NSApp loop in its own threadscratch/ns/next
* src/emacs.c (main) [HAVE_NS]: Rename to emacs_main.
* src/lisp.h (emacs_main) [HAVE_NS]: Define function.
* src/nsfns.m (Fns_do_applescript): Remove runloop.
(Fx_create_frame): Initialize the frame on the main thread.
* src/nsterm.h ([EmacsApp initLispThread:withArgv:]): New method.
([EmacsApp fd_handler:]):
([EmacsApp timeout_handler:]):
([EmacsApp sendFromMainThread:]): Remove function definitions.
([EmacsApp initLispThread:]): New function.
([EmacsThread initWithArgc:Argv:]):
([EmacsThread sendEmacsEvent:NSEvent:frameOrWindow:]): New functions.
* src/nsterm.m (EV_TRAILER): Reduce to a single function.
(EV_TRAILER2): Remove.
(ns_init_events):
(ns_finish_events):
(hold_event):
(ns_send_appdefined):
(ns_run_loop_break):
([EmacsApp timeout_handler:]):
([EmacsApp sendFromMainThread:]):
([EmacsApp fd_handler:]): Remove functions.
(ns_check_menu_open):
([EmacsApp newFrame:]):
([EmacsApp openFile:]):
([EmacsApp terminate:]):
([EmacsApp fulfillService:withArg:]):
([EmacsView changeFont:]):
([EmacsView keyDown:]):
([EmacsView insertText:]):
([EmacsView setmarkedtext:selectedRange:]):
([EmacsView deleteWorkingText:]):
([EmacsView doCommandBySelector:]):
([EmacsView mouseDown:]):
([EmacsView mouseMoved:]):
([EmacsView windowShouldClose:]):
([EmacsView windowDidResize:]):
([EmacsView windowDidBecomeKey]):
([EmacsView windowDidResignKey:]):
([EmacsView windowDidMove:]):
([EmacsView windowDidDeminiaturize:]):
([EmacsView windowDidExpose:]):
([EmacsView windowDidMiniaturize:]):
([EmacsView menuDown:]):
([EmacsView toolbarClicked:]):
([EmacsView toggleToolbar:]):
([EmacsView performDragOperation:]):
([EmacsScroller sendScrollEventAtLoc:fromEvent:]): Change event handling.
([EmacsApp applicationDidFinishLaunching:]):
([EmacsApp applicationDidResignActive:]): Remove call to ns_send_appdefined.
(ns_read_socket): Change event handling, use thread local runloop.
(ns_select): Remove unused fd_handler and runloop related code.
(ns_term_init): Move some NS initialisation code to new
main function and remove fd_handler related code.
([EmacsApp sendEvent:]): Stop run loop from exiting.
([EmacsApp initLispThread:withArgv:]): New method.
([EmacsThread initWithArgc:Argv:]):
([EmacsThread processEmacsEvent:]):
([EmacsThread sendEmacsEvent:NSEvent:frameOrWindow:]): New functions.
(main): New function to initialise NS stuff and run emacs_main in its
own thread.
* src/systhread.c (sys_cond_broadcast): Remove NS runloop related
code.
Diffstat (limited to 'src/nsterm.h')
| -rw-r--r-- | src/nsterm.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/nsterm.h b/src/nsterm.h index 1aff5ad1c96..1eb5ac92a70 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -391,12 +391,8 @@ typedef id instancetype; | |||
| 391 | - (void)sendEvent: (NSEvent *)theEvent; | 391 | - (void)sendEvent: (NSEvent *)theEvent; |
| 392 | - (void)showPreferencesWindow: (id)sender; | 392 | - (void)showPreferencesWindow: (id)sender; |
| 393 | - (BOOL) openFile: (NSString *)fileName; | 393 | - (BOOL) openFile: (NSString *)fileName; |
| 394 | - (void)fd_handler: (id)unused; | ||
| 395 | - (void)timeout_handler: (NSTimer *)timedEntry; | ||
| 396 | - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg; | 394 | - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg; |
| 397 | #ifdef NS_IMPL_GNUSTEP | 395 | - (void)initLispThread: (int)argc withArgv: (char **)argv; |
| 398 | - (void)sendFromMainThread:(id)unused; | ||
| 399 | #endif | ||
| 400 | @end | 396 | @end |
| 401 | 397 | ||
| 402 | #ifdef NS_IMPL_GNUSTEP | 398 | #ifdef NS_IMPL_GNUSTEP |
| @@ -758,6 +754,14 @@ typedef id instancetype; | |||
| 758 | + (CGFloat)scrollerWidth; | 754 | + (CGFloat)scrollerWidth; |
| 759 | @end | 755 | @end |
| 760 | 756 | ||
| 757 | @interface EmacsThread: NSThread | ||
| 758 | { | ||
| 759 | } | ||
| 760 | - (instancetype) initWithArgc: (int)argc Argv: (char **)argv; | ||
| 761 | - (void) sendEmacsEvent: (struct input_event *)emacs_event | ||
| 762 | NSEvent: (NSEvent *)e | ||
| 763 | frameOrWindow: (void *)frame_or_window; | ||
| 764 | @end | ||
| 761 | 765 | ||
| 762 | /* ========================================================================== | 766 | /* ========================================================================== |
| 763 | 767 | ||