comparison ios/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 07c504257e42
children 3ec675648cf5
comparison
equal deleted inserted replaced
2625:2e804b4db81e 2626:401a3b9f21ba
246 UIColor *fgcolor = [[UIColor grayColor] retain]; 246 UIColor *fgcolor = [[UIColor grayColor] retain];
247 pthread_setspecific(_dw_fg_color_key, fgcolor); 247 pthread_setspecific(_dw_fg_color_key, fgcolor);
248 pthread_setspecific(_dw_bg_color_key, NULL); 248 pthread_setspecific(_dw_bg_color_key, NULL);
249 } 249 }
250 250
251 typedef struct _sighandler 251 typedef struct _dwsighandler
252 { 252 {
253 struct _sighandler *next; 253 struct _dwsighandler *next;
254 ULONG message; 254 ULONG message;
255 HWND window; 255 HWND window;
256 int id; 256 int id;
257 void *signalfunction; 257 void *signalfunction;
258 void *discfunction; 258 void *discfunction;
259 void *data; 259 void *data;
260 260
261 } SignalHandler; 261 } DWSignalHandler;
262 262
263 static SignalHandler *DWRoot = NULL; 263 static DWSignalHandler *DWRoot = NULL;
264 264
265 /* Some internal prototypes */ 265 /* Some internal prototypes */
266 static void _dw_do_resize(Box *thisbox, int x, int y); 266 static void _dw_do_resize(Box *thisbox, int x, int y);
267 void _dw_handle_resize_events(Box *thisbox); 267 void _dw_handle_resize_events(Box *thisbox);
268 int _dw_remove_userdata(UserData **root, const char *varname, int all); 268 int _dw_remove_userdata(UserData **root, const char *varname, int all);
284 { 284 {
285 dw_window_redraw(redraw); 285 dw_window_redraw(redraw);
286 } 286 }
287 } 287 }
288 288
289 SignalHandler *_dw_get_handler(HWND window, int messageid) 289 DWSignalHandler *_dw_get_handler(HWND window, int messageid)
290 { 290 {
291 SignalHandler *tmp = DWRoot; 291 DWSignalHandler *tmp = DWRoot;
292 292
293 /* Find any callbacks for this function */ 293 /* Find any callbacks for this function */
294 while(tmp) 294 while(tmp)
295 { 295 {
296 if(tmp->message == messageid && window == tmp->window) 296 if(tmp->message == messageid && window == tmp->window)
334 { _DW_EVENT_HTML_CHANGED, DW_SIGNAL_HTML_CHANGED } 334 { _DW_EVENT_HTML_CHANGED, DW_SIGNAL_HTML_CHANGED }
335 }; 335 };
336 336
337 int _dw_event_handler1(id object, id event, int message) 337 int _dw_event_handler1(id object, id event, int message)
338 { 338 {
339 SignalHandler *handler = _dw_get_handler(object, message); 339 DWSignalHandler *handler = _dw_get_handler(object, message);
340 /* NSLog(@"Event handler - type %d\n", message); */ 340 /* NSLog(@"Event handler - type %d\n", message); */
341 341
342 if(handler) 342 if(handler)
343 { 343 {
344 switch(message) 344 switch(message)
2737 2737
2738 /* This function adds a signal handler callback into the linked list. 2738 /* This function adds a signal handler callback into the linked list.
2739 */ 2739 */
2740 void _dw_new_signal(ULONG message, HWND window, int msgid, void *signalfunction, void *discfunc, void *data) 2740 void _dw_new_signal(ULONG message, HWND window, int msgid, void *signalfunction, void *discfunc, void *data)
2741 { 2741 {
2742 SignalHandler *new = malloc(sizeof(SignalHandler)); 2742 DWSignalHandler *new = malloc(sizeof(DWSignalHandler));
2743 2743
2744 new->message = message; 2744 new->message = message;
2745 new->window = window; 2745 new->window = window;
2746 new->id = msgid; 2746 new->id = msgid;
2747 new->signalfunction = signalfunction; 2747 new->signalfunction = signalfunction;
2751 2751
2752 if (!DWRoot) 2752 if (!DWRoot)
2753 DWRoot = new; 2753 DWRoot = new;
2754 else 2754 else
2755 { 2755 {
2756 SignalHandler *prev = NULL, *tmp = DWRoot; 2756 DWSignalHandler *prev = NULL, *tmp = DWRoot;
2757 while(tmp) 2757 while(tmp)
2758 { 2758 {
2759 if(tmp->message == message && 2759 if(tmp->message == message &&
2760 tmp->window == window && 2760 tmp->window == window &&
2761 tmp->id == msgid && 2761 tmp->id == msgid &&
9493 DW_FUNCTION_DEFINITION(dw_timer_disconnect, void, HTIMER timerid) 9493 DW_FUNCTION_DEFINITION(dw_timer_disconnect, void, HTIMER timerid)
9494 DW_FUNCTION_ADD_PARAM1(timerid) 9494 DW_FUNCTION_ADD_PARAM1(timerid)
9495 DW_FUNCTION_NO_RETURN(dw_timer_disconnect) 9495 DW_FUNCTION_NO_RETURN(dw_timer_disconnect)
9496 DW_FUNCTION_RESTORE_PARAM1(timerid, HTIMER) 9496 DW_FUNCTION_RESTORE_PARAM1(timerid, HTIMER)
9497 { 9497 {
9498 SignalHandler *prev = NULL, *tmp = DWRoot; 9498 DWSignalHandler *prev = NULL, *tmp = DWRoot;
9499 9499
9500 /* 0 is an invalid timer ID */ 9500 /* 0 is an invalid timer ID */
9501 if(timerid) 9501 if(timerid)
9502 { 9502 {
9503 NSTimer *thistimer = timerid; 9503 NSTimer *thistimer = timerid;
9577 * Parameters: 9577 * Parameters:
9578 * window: Window handle of callback to be removed. 9578 * window: Window handle of callback to be removed.
9579 */ 9579 */
9580 void API dw_signal_disconnect_by_name(HWND window, const char *signame) 9580 void API dw_signal_disconnect_by_name(HWND window, const char *signame)
9581 { 9581 {
9582 SignalHandler *prev = NULL, *tmp = DWRoot; 9582 DWSignalHandler *prev = NULL, *tmp = DWRoot;
9583 ULONG message; 9583 ULONG message;
9584 9584
9585 if(!window || !signame || (message = _dw_findsigmessage(signame)) == 0) 9585 if(!window || !signame || (message = _dw_findsigmessage(signame)) == 0)
9586 return; 9586 return;
9587 9587
9622 * Parameters: 9622 * Parameters:
9623 * window: Window handle of callback to be removed. 9623 * window: Window handle of callback to be removed.
9624 */ 9624 */
9625 void API dw_signal_disconnect_by_window(HWND window) 9625 void API dw_signal_disconnect_by_window(HWND window)
9626 { 9626 {
9627 SignalHandler *prev = NULL, *tmp = DWRoot; 9627 DWSignalHandler *prev = NULL, *tmp = DWRoot;
9628 9628
9629 while(tmp) 9629 while(tmp)
9630 { 9630 {
9631 if(tmp->window == window) 9631 if(tmp->window == window)
9632 { 9632 {
9664 * window: Window handle of callback to be removed. 9664 * window: Window handle of callback to be removed.
9665 * data: Pointer to the data to be compared against. 9665 * data: Pointer to the data to be compared against.
9666 */ 9666 */
9667 void API dw_signal_disconnect_by_data(HWND window, void *data) 9667 void API dw_signal_disconnect_by_data(HWND window, void *data)
9668 { 9668 {
9669 SignalHandler *prev = NULL, *tmp = DWRoot; 9669 DWSignalHandler *prev = NULL, *tmp = DWRoot;
9670 9670
9671 while(tmp) 9671 while(tmp)
9672 { 9672 {
9673 if(tmp->window == window && tmp->data == data) 9673 if(tmp->window == window && tmp->data == data)
9674 { 9674 {