AmendHub

Download:

jcs

/

wifi_da

/

amendments

/

4

window: Position in the upper right based on screen size


jcs made amendment 4 11 months ago
--- wi-fi.h Tue Aug 22 23:09:56 2023 +++ wi-fi.h Thu Sep 21 10:20:21 2023 @@ -115,11 +115,11 @@ void CenterDialog(DialogPtr dp, bool titlebar); void window_mousedown(Point p); short scsi_find_wifi(void); -short scsi_wifi_scan(short lun); +bool scsi_wifi_scan(short lun); bool scsi_wifi_scan_finished(short lun); -short scsi_wifi_info(short lun, struct wifi_network_entry *resp); +bool scsi_wifi_info(short lun, struct wifi_network_entry *resp); short scsi_wifi_scan_results(short scsi_id, struct wifi_network_entry *resp, short count); -short scsi_wifi_join(short scsi_id, struct wifi_join_request *wjr); +bool scsi_wifi_join(short scsi_id, struct wifi_join_request *wjr); #endif --- window.c Fri Sep 8 16:37:24 2023 +++ window.c Thu Sep 21 13:26:54 2023 @@ -21,6 +21,9 @@ #define NO_DEVICE_TEXT "\pNo Device Found" #define NO_NETWORK_TEXT "(No Network)" +#define DA_HEIGHT 25 +#define DA_WIDTH 180 + SICNHandle signal_icons; ControlHandle ssid_list; MenuHandle ssid_menu; @@ -29,10 +32,20 @@ Rect ssid_menu_rect; WindowPtr create_window(short ctlrefnum) { - GrafPtr savePort; - Rect bounds = { 50, 320, 75, 500 }; /* tlbr */ - + GrafPtr savePort, tport; + Rect bounds; + GetPort(&savePort); + + /* screenBits is not available from a DA */ + tport = (GrafPtr)NewPtr(sizeof(GrafPort)); + OpenPort(tport); + /* upper right corner, but leave space for desktop icon */ + bounds.top = 45; + bounds.bottom = bounds.top + DA_HEIGHT; + bounds.left = tport->portRect.right - DA_WIDTH - 70; + bounds.right = bounds.left + DA_WIDTH; + ClosePort(tport); win = NewWindow(0L, &bounds, "\pWi-Fi", true, rDocProc, 0L, true, 0L); ((WindowPeek)win)->windowKind = ctlrefnum;