AmendHub

Download:

jcs

/

wifi_da

/

amendments

/

33

window: Make clicking on the signal icon toggle

We can't get a separate close event for each window so we don't know
what was supposed to be closed (I guess we could look up the mouse
position). Just make the logger window have goAwayFlag=false and
close it ourselves.

jcs made amendment 33 about 1 month ago
--- main.c Tue Dec 3 16:50:05 2024 +++ main.c Tue Dec 3 17:31:02 2024 @@ -37,7 +37,7 @@ Cursor watch; short main(cntrlParam *p, DCtlPtr d, short n); void da_open(void); -void da_control(short code, short *parm); +void da_control(short code, short *param); void da_close(void); bool handle_menu(short i); void handle_event(EventRecord *e); @@ -152,6 +152,8 @@ da_control(short code, short *param) void da_close(void) { + WindowPtr win; + if (!ON_SYSTEM_7) { DeleteMenu(dce->dCtlMenu); DrawMenuBar(); --- window.c Tue Dec 3 17:08:58 2024 +++ window.c Tue Dec 3 17:37:52 2024 @@ -105,7 +105,7 @@ create_logger(void) bounds.left = 20; bounds.right = 400; wifi_da.logger = NewWindow(0L, &bounds, "\pLogger", true, rDocProc, 0L, - true, 0L); + false, 0L); ((WindowPeek)wifi_da.logger)->windowKind = dce->dCtlRefNum; } @@ -123,7 +123,7 @@ update_window(bool force) GetPort(&savePort); SetPort(wifi_da.win); - logger_printf("redrawing window"); + //logger_printf("redrawing window"); cur_bits = wifi_da.win->portBits; SetPortBits(&wifi_da.win_shadow); @@ -373,7 +373,10 @@ window_mousedown(Point p) if (p.h >= icon_r.left && p.h <= icon_r.left + icon_r.right && p.v >= icon_r.top && p.v <= icon_r.top + icon_r.bottom) { - if (!wifi_da.logger) + if (wifi_da.logger) { + DisposeWindow(wifi_da.logger); + wifi_da.logger = 0; + } else create_logger(); return; }