diff options
author | Vincent Sanders <vince@kyllikki.org> | 2018-08-18 23:30:12 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2018-08-18 23:30:12 +0100 |
commit | a6c595f4f305c43d9da825ad31c0011fe02d0684 (patch) | |
tree | fbf00062ed627e21d3c0217e77f6cc341078ce68 /frontends/windows/gui.c | |
parent | c938d1962bed31f0723707fc978bb65ab5a47ef2 (diff) | |
download | netsurf-a6c595f4f305c43d9da825ad31c0011fe02d0684.tar.gz netsurf-a6c595f4f305c43d9da825ad31c0011fe02d0684.tar.bz2 |
add win32 http authentication dialog
Diffstat (limited to 'frontends/windows/gui.c')
-rw-r--r-- | frontends/windows/gui.c | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c index 890bfae42..674484fea 100644 --- a/frontends/windows/gui.c +++ b/frontends/windows/gui.c @@ -52,6 +52,74 @@ HINSTANCE hinst; static bool win32_quit = false; +struct dialog_list_entry { + struct dialog_list_entry *next; + HWND hwnd; +}; + +static struct dialog_list_entry *dlglist = NULL; + +/* exported interface documented in gui.h */ +nserror nsw32_add_dialog(HWND hwndDlg) +{ + struct dialog_list_entry *nentry; + nentry = malloc(sizeof(struct dialog_list_entry)); + if (nentry == NULL) { + return NSERROR_NOMEM; + } + + nentry->hwnd = hwndDlg; + nentry->next = dlglist; + dlglist = nentry; + + return NSERROR_OK; +} + +/* exported interface documented in gui.h */ +nserror nsw32_del_dialog(HWND hwndDlg) +{ + struct dialog_list_entry **prev; + struct dialog_list_entry *cur; + + prev = &dlglist; + cur = *prev; + + while (cur != NULL) { + if (cur->hwnd == hwndDlg) { + /* found match */ + *prev = cur->next; + NSLOG(netsurf, DEBUG, + "removed hwnd %p entry %p", cur->hwnd, cur); + free(cur); + return NSERROR_OK; + } + prev = &cur->next; + cur = *prev; + } + NSLOG(netsurf, INFO, "did not find hwnd %p", hwndDlg); + + return NSERROR_NOT_FOUND; +} + +/** + * walks dialog list and attempts to process any messages for them + */ +static nserror handle_dialog_message(LPMSG lpMsg) +{ + struct dialog_list_entry *cur; + cur = dlglist; + while (cur != NULL) { + if (IsDialogMessage(cur->hwnd, lpMsg)) { + NSLOG(netsurf, DEBUG, + "dispatched dialog hwnd %p", cur->hwnd); + return NSERROR_OK; + } + cur = cur->next; + } + + return NSERROR_NOT_FOUND; +} + /* exported interface documented in gui.h */ void win32_set_quit(bool q) { @@ -92,7 +160,8 @@ void win32_run(void) } } - if (bRet > 0) { + if ((bRet > 0) && + (handle_dialog_message(&Msg) != NSERROR_OK)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } |