comparison mac/dw.m @ 2626:401a3b9f21ba

Massive continuation of code style standardization. Only tested on Mac and iOS, may require follow up commits to get things building again as I test on various platforms.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 01 Aug 2021 12:17:07 +0000
parents e63c1373c010
children cff8f6b6e302
comparison
equal deleted inserted replaced
2625:2e804b4db81e 2626:401a3b9f21ba
467 NSColor *fgcolor = [[NSColor grayColor] retain]; 467 NSColor *fgcolor = [[NSColor grayColor] retain];
468 pthread_setspecific(_dw_fg_color_key, fgcolor); 468 pthread_setspecific(_dw_fg_color_key, fgcolor);
469 pthread_setspecific(_dw_bg_color_key, NULL); 469 pthread_setspecific(_dw_bg_color_key, NULL);
470 } 470 }
471 471
472 typedef struct _sighandler 472 typedef struct _dwsighandler
473 { 473 {
474 struct _sighandler *next; 474 struct _dwsighandler *next;
475 ULONG message; 475 ULONG message;
476 HWND window; 476 HWND window;
477 int id; 477 int id;
478 void *signalfunction; 478 void *signalfunction;
479 void *discfunction; 479 void *discfunction;
480 void *data; 480 void *data;
481 481
482 } SignalHandler; 482 } DWSignalHandler;
483 483
484 static SignalHandler *DWRoot = NULL; 484 static DWSignalHandler *DWRoot = NULL;
485 485
486 /* Some internal prototypes */ 486 /* Some internal prototypes */
487 static void _dw_do_resize(Box *thisbox, int x, int y); 487 static void _dw_do_resize(Box *thisbox, int x, int y);
488 void _dw_handle_resize_events(Box *thisbox); 488 void _dw_handle_resize_events(Box *thisbox);
489 int _dw_remove_userdata(UserData **root, const char *varname, int all); 489 int _dw_remove_userdata(UserData **root, const char *varname, int all);
505 { 505 {
506 dw_window_redraw(redraw); 506 dw_window_redraw(redraw);
507 } 507 }
508 } 508 }
509 509
510 SignalHandler *_dw_get_handler(HWND window, int messageid) 510 DWSignalHandler *_dw_get_handler(HWND window, int messageid)
511 { 511 {
512 SignalHandler *tmp = DWRoot; 512 DWSignalHandler *tmp = DWRoot;
513 513
514 /* Find any callbacks for this function */ 514 /* Find any callbacks for this function */
515 while(tmp) 515 while(tmp)
516 { 516 {
517 if(tmp->message == messageid && window == tmp->window) 517 if(tmp->message == messageid && window == tmp->window)
555 { _DW_EVENT_HTML_CHANGED, DW_SIGNAL_HTML_CHANGED } 555 { _DW_EVENT_HTML_CHANGED, DW_SIGNAL_HTML_CHANGED }
556 }; 556 };
557 557
558 int _dw_event_handler1(id object, NSEvent *event, int message) 558 int _dw_event_handler1(id object, NSEvent *event, int message)
559 { 559 {
560 SignalHandler *handler = _dw_get_handler(object, message); 560 DWSignalHandler *handler = _dw_get_handler(object, message);
561 /* NSLog(@"Event handler - type %d\n", message); */ 561 /* NSLog(@"Event handler - type %d\n", message); */
562 562
563 if(handler) 563 if(handler)
564 { 564 {
565 switch(message) 565 switch(message)
3585 3585
3586 /* This function adds a signal handler callback into the linked list. 3586 /* This function adds a signal handler callback into the linked list.
3587 */ 3587 */
3588 void _dw_new_signal(ULONG message, HWND window, int msgid, void *signalfunction, void *discfunc, void *data) 3588 void _dw_new_signal(ULONG message, HWND window, int msgid, void *signalfunction, void *discfunc, void *data)
3589 { 3589 {
3590 SignalHandler *new = malloc(sizeof(SignalHandler)); 3590 DWSignalHandler *new = malloc(sizeof(DWSignalHandler));
3591 3591
3592 new->message = message; 3592 new->message = message;
3593 new->window = window; 3593 new->window = window;
3594 new->id = msgid; 3594 new->id = msgid;
3595 new->signalfunction = signalfunction; 3595 new->signalfunction = signalfunction;
3599 3599
3600 if (!DWRoot) 3600 if (!DWRoot)
3601 DWRoot = new; 3601 DWRoot = new;
3602 else 3602 else
3603 { 3603 {
3604 SignalHandler *prev = NULL, *tmp = DWRoot; 3604 DWSignalHandler *prev = NULL, *tmp = DWRoot;
3605 while(tmp) 3605 while(tmp)
3606 { 3606 {
3607 if(tmp->message == message && 3607 if(tmp->message == message &&
3608 tmp->window == window && 3608 tmp->window == window &&
3609 tmp->id == msgid && 3609 tmp->id == msgid &&
11553 * Parameters: 11553 * Parameters:
11554 * id: Timer ID returned by dw_timer_connect(). 11554 * id: Timer ID returned by dw_timer_connect().
11555 */ 11555 */
11556 void API dw_timer_disconnect(HTIMER timerid) 11556 void API dw_timer_disconnect(HTIMER timerid)
11557 { 11557 {
11558 SignalHandler *prev = NULL, *tmp = DWRoot; 11558 DWSignalHandler *prev = NULL, *tmp = DWRoot;
11559 NSTimer *thistimer; 11559 NSTimer *thistimer;
11560 11560
11561 /* 0 is an invalid timer ID */ 11561 /* 0 is an invalid timer ID */
11562 if(timerid < 1 || !DWTimers[timerid-1]) 11562 if(timerid < 1 || !DWTimers[timerid-1])
11563 return; 11563 return;
11638 * Parameters: 11638 * Parameters:
11639 * window: Window handle of callback to be removed. 11639 * window: Window handle of callback to be removed.
11640 */ 11640 */
11641 void API dw_signal_disconnect_by_name(HWND window, const char *signame) 11641 void API dw_signal_disconnect_by_name(HWND window, const char *signame)
11642 { 11642 {
11643 SignalHandler *prev = NULL, *tmp = DWRoot; 11643 DWSignalHandler *prev = NULL, *tmp = DWRoot;
11644 ULONG message; 11644 ULONG message;
11645 11645
11646 if(!window || !signame || (message = _dw_findsigmessage(signame)) == 0) 11646 if(!window || !signame || (message = _dw_findsigmessage(signame)) == 0)
11647 return; 11647 return;
11648 11648
11683 * Parameters: 11683 * Parameters:
11684 * window: Window handle of callback to be removed. 11684 * window: Window handle of callback to be removed.
11685 */ 11685 */
11686 void API dw_signal_disconnect_by_window(HWND window) 11686 void API dw_signal_disconnect_by_window(HWND window)
11687 { 11687 {
11688 SignalHandler *prev = NULL, *tmp = DWRoot; 11688 DWSignalHandler *prev = NULL, *tmp = DWRoot;
11689 11689
11690 while(tmp) 11690 while(tmp)
11691 { 11691 {
11692 if(tmp->window == window) 11692 if(tmp->window == window)
11693 { 11693 {
11725 * window: Window handle of callback to be removed. 11725 * window: Window handle of callback to be removed.
11726 * data: Pointer to the data to be compared against. 11726 * data: Pointer to the data to be compared against.
11727 */ 11727 */
11728 void API dw_signal_disconnect_by_data(HWND window, void *data) 11728 void API dw_signal_disconnect_by_data(HWND window, void *data)
11729 { 11729 {
11730 SignalHandler *prev = NULL, *tmp = DWRoot; 11730 DWSignalHandler *prev = NULL, *tmp = DWRoot;
11731 11731
11732 while(tmp) 11732 while(tmp)
11733 { 11733 {
11734 if(tmp->window == window && tmp->data == data) 11734 if(tmp->window == window && tmp->data == data)
11735 { 11735 {