diff options
Diffstat (limited to 'frontends/windows')
-rw-r--r-- | frontends/windows/Makefile | 2 | ||||
-rw-r--r-- | frontends/windows/about.c | 8 | ||||
-rw-r--r-- | frontends/windows/bitmap.c | 34 | ||||
-rw-r--r-- | frontends/windows/corewindow.c | 10 | ||||
-rw-r--r-- | frontends/windows/download.c | 8 | ||||
-rw-r--r-- | frontends/windows/drawable.c | 30 | ||||
-rw-r--r-- | frontends/windows/filetype.c | 2 | ||||
-rw-r--r-- | frontends/windows/findfile.c | 4 | ||||
-rw-r--r-- | frontends/windows/font.c | 9 | ||||
-rw-r--r-- | frontends/windows/gui.c | 4 | ||||
-rw-r--r-- | frontends/windows/main.c | 16 | ||||
-rw-r--r-- | frontends/windows/plot.c | 63 | ||||
-rw-r--r-- | frontends/windows/prefs.c | 3 | ||||
-rw-r--r-- | frontends/windows/schedule.c | 38 | ||||
-rw-r--r-- | frontends/windows/ssl_cert.c | 11 | ||||
-rw-r--r-- | frontends/windows/windbg.h | 14 | ||||
-rw-r--r-- | frontends/windows/window.c | 113 |
17 files changed, 208 insertions, 161 deletions
diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile index bd34b465e..50d0d4b44 100644 --- a/frontends/windows/Makefile +++ b/frontends/windows/Makefile @@ -15,7 +15,7 @@ $(eval $(call pkg_config_find_and_add,libcares,Cares)) $(eval $(call pkg_config_find_and_add,zlib,ZLib)) # libraries for windows API -LDFLAGS += -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 -lshlwapi -mwindows +LDFLAGS += -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 -lshlwapi -lcrypt32 -mwindows CFLAGS += -U__STRICT_ANSI__ -mwin32 # only windows versions after XP are supported diff --git a/frontends/windows/about.c b/frontends/windows/about.c index 65c81cd7d..2cd855b55 100644 --- a/frontends/windows/about.c +++ b/frontends/windows/about.c @@ -52,7 +52,7 @@ static BOOL init_about_dialog(HWND hwnd) hFont=CreateFont (26, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial"); if (hFont != NULL) { - LOG("Setting font object"); + NSLOG(netsurf, INFO, "Setting font object"); SendMessage(dlg_itm, WM_SETFONT, (WPARAM)hFont, 0); } @@ -85,7 +85,7 @@ static BOOL destroy_about_dialog(HWND hwnd) if (dlg_itm != NULL) { hFont = (HFONT)SendMessage(dlg_itm, WM_GETFONT, 0, 0); if (hFont != NULL) { - LOG("Destroyed font object"); + NSLOG(netsurf, INFO, "Destroyed font object"); DeleteObject(hFont); } } @@ -107,12 +107,12 @@ nsws_about_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) case WM_COMMAND: switch(LOWORD(wparam)) { case IDOK: - LOG("OK clicked"); + NSLOG(netsurf, INFO, "OK clicked"); EndDialog(hwnd, IDOK); break; case IDCANCEL: - LOG("Cancel clicked"); + NSLOG(netsurf, INFO, "Cancel clicked"); EndDialog(hwnd, IDOK); break; diff --git a/frontends/windows/bitmap.c b/frontends/windows/bitmap.c index f60dab613..eed3d3a15 100644 --- a/frontends/windows/bitmap.c +++ b/frontends/windows/bitmap.c @@ -52,7 +52,8 @@ void *win32_bitmap_create(int width, int height, unsigned int state) HBITMAP windib; uint8_t *pixdata; - LOG("width %d, height %d, state %u", width, height, state); + NSLOG(netsurf, INFO, "width %d, height %d, state %u", width, height, + state); pbmi = calloc(1, sizeof(BITMAPV5HEADER)); if (pbmi == NULL) { @@ -96,7 +97,7 @@ void *win32_bitmap_create(int width, int height, unsigned int state) bitmap->opaque = false; } - LOG("bitmap %p", bitmap); + NSLOG(netsurf, INFO, "bitmap %p", bitmap); return bitmap; } @@ -115,7 +116,7 @@ static unsigned char *bitmap_get_buffer(void *bitmap) { struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return NULL; } @@ -134,7 +135,7 @@ static size_t bitmap_get_rowstride(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return 0; } @@ -152,7 +153,7 @@ void win32_bitmap_destroy(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return; } @@ -195,11 +196,12 @@ static void bitmap_set_opaque(void *bitmap, bool opaque) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return; } - LOG("setting bitmap %p to %s", bm, opaque ? "opaque" : "transparent"); + NSLOG(netsurf, INFO, "setting bitmap %p to %s", bm, + opaque ? "opaque" : "transparent"); bm->opaque = opaque; } @@ -216,7 +218,7 @@ static bool bitmap_test_opaque(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return false; } @@ -224,11 +226,11 @@ static bool bitmap_test_opaque(void *bitmap) while (tst-- > 0) { if (bm->pixdata[(tst << 2) + 3] != 0xff) { - LOG("bitmap %p has transparency", bm); + NSLOG(netsurf, INFO, "bitmap %p has transparency", bm); return false; } } - LOG("bitmap %p is opaque", bm); + NSLOG(netsurf, INFO, "bitmap %p is opaque", bm); return true; } @@ -243,7 +245,7 @@ static bool bitmap_get_opaque(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return false; } @@ -255,7 +257,7 @@ static int bitmap_get_width(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return 0; } @@ -267,7 +269,7 @@ static int bitmap_get_height(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return 0; } @@ -324,12 +326,12 @@ bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content) .plot = &win_plotters }; - width = min(content_get_width(content), 1024); + width = min(max(content_get_width(content), bitmap->width), 1024); height = ((width * bitmap->height) + (bitmap->width / 2)) / bitmap->width; - LOG("bitmap %p for content %p width %d, height %d", - bitmap, content, width, height); + NSLOG(netsurf, INFO, "bitmap %p for content %p width %d, height %d", + bitmap, content, width, height); /* create two memory device contexts to put the bitmaps in */ bufferdc = CreateCompatibleDC(NULL); diff --git a/frontends/windows/corewindow.c b/frontends/windows/corewindow.c index 3c31c5e46..7d88ce7c4 100644 --- a/frontends/windows/corewindow.c +++ b/frontends/windows/corewindow.c @@ -155,7 +155,7 @@ nsw32_corewindow_vscroll(struct nsw32_corewindow *nsw32_cw, SCROLLINFO si; /* current scroll information */ SCROLLINFO usi; /* updated scroll infomation for scrollwindowex */ - LOG("VSCROLL"); + NSLOG(netsurf, INFO, "VSCROLL"); si.cbSize = sizeof(si); si.fMask = SIF_ALL; @@ -230,7 +230,7 @@ nsw32_corewindow_hscroll(struct nsw32_corewindow *nsw32_cw, SCROLLINFO si; /* current scroll information */ SCROLLINFO usi; /* updated scroll infomation for scrollwindowex */ - LOG("VSCROLL"); + NSLOG(netsurf, INFO, "VSCROLL"); si.cbSize = sizeof(si); si.fMask = SIF_ALL; @@ -450,7 +450,7 @@ nsw32_cw_update_size(struct core_window *cw, int width, int height) nsw32_cw->content_width = width; nsw32_cw->content_height = height; - LOG("new content size w:%d h:%d", width, height); + NSLOG(netsurf, INFO, "new content size w:%d h:%d", width, height); update_scrollbars(nsw32_cw); } @@ -527,7 +527,7 @@ nsw32_corewindow_init(HINSTANCE hInstance, CS_DBLCLKS; } - LOG("creating hInstance %p core window", hInstance); + NSLOG(netsurf, INFO, "creating hInstance %p core window", hInstance); nsw32_cw->hWnd = CreateWindowEx(0, windowclassname_corewindow, nsw32_cw->title, @@ -541,7 +541,7 @@ nsw32_corewindow_init(HINSTANCE hInstance, hInstance, NULL); if (nsw32_cw->hWnd == NULL) { - LOG("Window create failed"); + NSLOG(netsurf, INFO, "Window create failed"); return NSERROR_NOMEM; } diff --git a/frontends/windows/download.c b/frontends/windows/download.c index 3a969834e..dfcd2b5a4 100644 --- a/frontends/windows/download.c +++ b/frontends/windows/download.c @@ -253,7 +253,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui) strcat(destination, "/"); if (strlen(destination) + strlen(filename) < PATH_MAX - 1) strcat(destination, filename); - LOG("download %s [%s] from %s to %s", filename, size, domain, destination); + NSLOG(netsurf, INFO, "download %s [%s] from %s to %s", filename, + size, domain, destination); w->title = filename; w->domain = domain; w->size = total_size; @@ -313,7 +314,8 @@ gui_download_window_data(struct gui_download_window *w, const char *data, struct timeval val; res = fwrite((void *)data, 1, size, w->file); if (res != size) - LOG("file write error %d of %d", size - res, size); + NSLOG(netsurf, INFO, "file write error %d of %d", size - res, + size); w->downloaded += res; w->progress = (unsigned int)(((long long)(w->downloaded) * 10000) / w->size); @@ -327,7 +329,7 @@ gui_download_window_data(struct gui_download_window *w, const char *data, static void gui_download_window_error(struct gui_download_window *w, const char *error_msg) { - LOG("error %s", error_msg); + NSLOG(netsurf, INFO, "error %s", error_msg); } static void gui_download_window_done(struct gui_download_window *w) diff --git a/frontends/windows/drawable.c b/frontends/windows/drawable.c index 28a76cfe8..f491e0a2a 100644 --- a/frontends/windows/drawable.c +++ b/frontends/windows/drawable.c @@ -83,7 +83,7 @@ nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam) SCROLLINFO si; int mem; - LOG("VSCROLL %d", gw->requestscrolly); + NSLOG(netsurf, INFO, "VSCROLL %d", gw->requestscrolly); if (gw->requestscrolly != 0) return 0; @@ -157,7 +157,7 @@ nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam) SCROLLINFO si; int mem; - LOG("HSCROLL %d", gw->requestscrollx); + NSLOG(netsurf, INFO, "HSCROLL %d", gw->requestscrollx); if (gw->requestscrollx != 0) return 0; @@ -369,7 +369,8 @@ nsws_drawable_mouseup(struct gui_window *gw, (gw->bw == NULL)) return 0; - LOG("state 0x%x, press 0x%x", gw->mouse->state, press); + NSLOG(netsurf, INFO, "state 0x%x, press 0x%x", gw->mouse->state, + press); if ((gw->mouse->state & press) != 0) { gw->mouse->state &= ~press; gw->mouse->state |= click; @@ -383,10 +384,10 @@ nsws_drawable_mouseup(struct gui_window *gw, gw->mouse->state &= ~BROWSER_MOUSE_MOD_3; if ((gw->mouse->state & click) != 0) { - LOG("mouse click bw %p, state 0x%x, x %f, y %f", - gw->bw, gw->mouse->state, - (x + gw->scrollx) / gw->scale, - (y + gw->scrolly) / gw->scale); + NSLOG(netsurf, INFO, + "mouse click bw %p, state 0x%x, x %f, y %f", gw->bw, + gw->mouse->state, (x + gw->scrollx) / gw->scale, + (y + gw->scrolly) / gw->scale); browser_window_mouse_click(gw->bw, gw->mouse->state, @@ -430,10 +431,9 @@ nsws_drawable_mousedown(struct gui_window *gw, gw->mouse->pressed_x = (x + gw->scrollx) / gw->scale; gw->mouse->pressed_y = (y + gw->scrolly) / gw->scale; - LOG("mouse click bw %p, state %x, x %f, y %f", - gw->bw, gw->mouse->state, - (x + gw->scrollx) / gw->scale, - (y + gw->scrolly) / gw->scale); + NSLOG(netsurf, INFO, "mouse click bw %p, state %x, x %f, y %f", + gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, + (y + gw->scrolly) / gw->scale); browser_window_mouse_click(gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, @@ -466,7 +466,8 @@ nsws_drawable_mousemove(struct gui_window *gw, int x, int y) (abs(x - gw->mouse->pressed_x) >= 5) && (abs(y - gw->mouse->pressed_y) >= 5)) { - LOG("Drag start state 0x%x", gw->mouse->state); + NSLOG(netsurf, INFO, "Drag start state 0x%x", + gw->mouse->state); if ((gw->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) { browser_window_mouse_click(gw->bw, BROWSER_MOUSE_DRAG_1, @@ -515,7 +516,8 @@ nsws_window_drawable_event_callback(HWND hwnd, gw = nsws_get_gui_window(hwnd); if (gw == NULL) { - LOG("Unable to find gui window structure for hwnd %p", hwnd); + NSLOG(netsurf, INFO, + "Unable to find gui window structure for hwnd %p", hwnd); return DefWindowProc(hwnd, msg, wparam, lparam); } @@ -604,7 +606,7 @@ nsws_window_create_drawable(HINSTANCE hinstance, if (hwnd == NULL) { win_perror("WindowCreateDrawable"); - LOG("Window creation failed"); + NSLOG(netsurf, INFO, "Window creation failed"); return NULL; } diff --git a/frontends/windows/filetype.c b/frontends/windows/filetype.c index d31434aeb..a5fd9e95e 100644 --- a/frontends/windows/filetype.c +++ b/frontends/windows/filetype.c @@ -39,7 +39,7 @@ static const char *fetch_filetype(const char *unix_path) { int l; - LOG("unix path %s", unix_path); + NSLOG(netsurf, INFO, "unix path %s", unix_path); l = strlen(unix_path); if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0) return "text/css"; diff --git a/frontends/windows/findfile.c b/frontends/windows/findfile.c index e1c9595eb..e665530ba 100644 --- a/frontends/windows/findfile.c +++ b/frontends/windows/findfile.c @@ -99,7 +99,7 @@ char *nsws_find_resource(char *buf, const char *filename, const char *def) char t[PATH_MAX]; if (cdir != NULL) { - LOG("Found Home %s", cdir); + NSLOG(netsurf, INFO, "Found Home %s", cdir); strcpy(t, cdir); strcat(t, "/.netsurf/"); strcat(t, filename); @@ -126,7 +126,7 @@ char *nsws_find_resource(char *buf, const char *filename, const char *def) getcwd(t, PATH_MAX - SLEN("\\res\\") - strlen(filename)); strcat(t, "\\res\\"); strcat(t, filename); - LOG("looking in %s", t); + NSLOG(netsurf, INFO, "looking in %s", t); if ((realpath(t, buf) != NULL) && (access(buf, R_OK) == 0)) return buf; diff --git a/frontends/windows/font.c b/frontends/windows/font.c index 75464f992..37ccf23fe 100644 --- a/frontends/windows/font.c +++ b/frontends/windows/font.c @@ -309,10 +309,11 @@ win32_font_split(const plot_font_style_t *style, } } -/* - LOG("ret %d Split %u chars at %ipx: Split at char %i (%ipx) - %.*s", - ret, length, x, *char_offset, *actual_x, *char_offset, string); -*/ + + NSLOG(netsurf, DEEPDEBUG, + "ret %d Split %u chars at %ipx: Split at char %i (%ipx) - %.*s", + ret, length, x, *char_offset, *actual_x, *char_offset, string); + return ret; } diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c index 602dcd445..890bfae42 100644 --- a/frontends/windows/gui.c +++ b/frontends/windows/gui.c @@ -66,7 +66,7 @@ void win32_run(void) int timeout; /* timeout in miliseconds */ UINT timer_id = 0; - LOG("Starting messgae dispatcher"); + NSLOG(netsurf, INFO, "Starting messgae dispatcher"); while (!win32_quit) { /* run the scheduler and discover how long to wait for @@ -128,7 +128,7 @@ static void gui_get_clipboard(char **buffer, size_t *length) clipboard_handle = GetClipboardData(CF_TEXT); if (clipboard_handle != NULL) { content = GlobalLock(clipboard_handle); - LOG("pasting %s", content); + NSLOG(netsurf, INFO, "pasting %s", content); GlobalUnlock(clipboard_handle); } } diff --git a/frontends/windows/main.c b/frontends/windows/main.c index d019f10c7..a3a7c2b39 100644 --- a/frontends/windows/main.c +++ b/frontends/windows/main.c @@ -99,7 +99,7 @@ static nserror get_config_home(char **config_home_out) *config_home_out = strdup(adPath); - LOG("using config path \"%s\"", *config_home_out); + NSLOG(netsurf, INFO, "using config path \"%s\"", *config_home_out); return NSERROR_OK; } @@ -343,15 +343,16 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) /* Locate the correct user configuration directory path */ ret = get_config_home(&nsw32_config_home); if (ret != NSERROR_OK) { - LOG("Unable to locate a configuration directory."); + NSLOG(netsurf, INFO, + "Unable to locate a configuration directory."); nsw32_config_home = NULL; } /* Initialise user options */ ret = nsw32_option_init(&argc, argv); if (ret != NSERROR_OK) { - LOG("Options failed to initialise (%s)\n", - messages_get_errorcode(ret)); + NSLOG(netsurf, INFO, "Options failed to initialise (%s)\n", + messages_get_errorcode(ret)); return 1; } @@ -365,7 +366,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) /* common initialisation */ ret = netsurf_init(NULL); if (ret != NSERROR_OK) { - LOG("NetSurf failed to initialise"); + NSLOG(netsurf, INFO, "NetSurf failed to initialise"); return 1; } @@ -392,7 +393,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) addr = NETSURF_HOMEPAGE; } - LOG("calling browser_window_create"); + NSLOG(netsurf, INFO, "calling browser_window_create"); ret = nsurl_create(addr, &url); if (ret == NSERROR_OK) { @@ -418,5 +419,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) /* finalise options */ nsoption_finalise(nsoptions, nsoptions_default); + /* finalise logging */ + nslog_finalise(); + return 0; } diff --git a/frontends/windows/plot.c b/frontends/windows/plot.c index 1bd0ba4a0..3668e4bb6 100644 --- a/frontends/windows/plot.c +++ b/frontends/windows/plot.c @@ -41,16 +41,6 @@ #include "windows/gui.h" #include "windows/plot.h" - -/* set NSWS_PLOT_DEBUG to 0 for no debugging, 1 for debugging */ -/* #define NSWS_PLOT_DEBUG */ - -#ifdef NSWS_PLOT_DEBUG -#define PLOT_LOG(x...) LOG(x) -#else -#define PLOT_LOG(x...) ((void) 0) -#endif - HDC plot_hdc; /** currently set clipping rectangle */ @@ -84,7 +74,7 @@ plot_block(COLORREF col, int x, int y, int width, int height) /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -159,9 +149,9 @@ plot_alpha_bitmap(HDC hdc, BITMAPINFO *bmi; HBITMAP MemBMh; - PLOT_LOG("%p bitmap %d,%d width %d height %d", + NSLOG(plot, DEEPDEBUG, "%p bitmap %d,%d width %d height %d", bitmap, x, y, width, height); - PLOT_LOG("clipped %ld,%ld to %ld,%ld", + NSLOG(plot, DEEPDEBUG, "clipped %ld,%ld to %ld,%ld", plot_clip.left, plot_clip.top, plot_clip.right, plot_clip.bottom); @@ -172,7 +162,7 @@ plot_alpha_bitmap(HDC hdc, if ((bitmap->width != width) || (bitmap->height != height)) { - PLOT_LOG("scaling from %d,%d to %d,%d", + NSLOG(plot, DEEPDEBUG, "scaling from %d,%d to %d,%d", bitmap->width, bitmap->height, width, height); bitmap = bitmap_scale(bitmap, width, height); if (bitmap == NULL) { @@ -299,7 +289,7 @@ plot_bitmap(struct bitmap *bitmap, int x, int y, int width, int height) /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -344,7 +334,7 @@ plot_bitmap(struct bitmap *bitmap, int x, int y, int width, int height) if (bltres == 0) { res = NSERROR_INVALID; } - PLOT_LOG("bltres = %d", bltres); + NSLOG(plot, DEEPDEBUG, "bltres = %d", bltres); } else { /* Bitmap with alpha.*/ res = plot_alpha_bitmap(plot_hdc, bitmap, x, y, width, height); @@ -366,7 +356,7 @@ plot_bitmap(struct bitmap *bitmap, int x, int y, int width, int height) */ static nserror clip(const struct redraw_context *ctx, const struct rect *clip) { - PLOT_LOG("clip %d,%d to %d,%d", clip->x0, clip->y0, clip->x1, clip->y1); + NSLOG(plot, DEEPDEBUG, "clip %d,%d to %d,%d", clip->x0, clip->y0, clip->x1, clip->y1); plot_clip.left = clip->x0; plot_clip.top = clip->y0; @@ -399,12 +389,12 @@ arc(const struct redraw_context *ctx, int x, int y, int radius, int angle1, int angle2) { - PLOT_LOG("arc centre %d,%d radius %d from %d to %d", x, y, radius, + NSLOG(plot, DEEPDEBUG, "arc centre %d,%d radius %d from %d to %d", x, y, radius, angle1, angle2); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -511,11 +501,11 @@ disc(const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius) { - PLOT_LOG("disc at %d,%d radius %d", x, y, radius); + NSLOG(plot, DEEPDEBUG, "disc at %d,%d radius %d", x, y, radius); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -590,11 +580,12 @@ line(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line) { - PLOT_LOG("from %d,%d to %d,%d", x0, y0, x1, y1); + NSLOG(plot, DEEPDEBUG, "from %d,%d to %d,%d", + line->x0, line->y0, line->x1, line->y1); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -656,12 +647,12 @@ rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect) { - PLOT_LOG("rectangle from %d,%d to %d,%d", + NSLOG(plot, DEEPDEBUG, "rectangle from %d,%d to %d,%d", rect->x0, rect->y0, rect->x1, rect->y1); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -740,11 +731,11 @@ polygon(const struct redraw_context *ctx, const int *p, unsigned int n) { - PLOT_LOG("polygon %d points", n); + NSLOG(plot, DEEPDEBUG, "polygon %d points", n); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -788,7 +779,7 @@ polygon(const struct redraw_context *ctx, points[i].x = (long) p[2 * i]; points[i].y = (long) p[2 * i + 1]; - PLOT_LOG("%ld,%ld ", points[i].x, points[i].y); + NSLOG(plot, DEEPDEBUG, "%ld,%ld ", points[i].x, points[i].y); } SelectClipRgn(plot_hdc, clipregion); @@ -831,7 +822,7 @@ path(const struct redraw_context *ctx, float width, const float transform[6]) { - PLOT_LOG("path unimplemented"); + NSLOG(plot, DEEPDEBUG, "path unimplemented"); return NSERROR_OK; } @@ -875,10 +866,10 @@ bitmap(const struct redraw_context *ctx, /* Bail early if we can */ - PLOT_LOG("Plotting %p at %d,%d by %d,%d",bitmap, x,y,width,height); + NSLOG(plot, DEEPDEBUG, "Plotting %p at %d,%d by %d,%d",bitmap, x,y,width,height); if (bitmap == NULL) { - LOG("Passed null bitmap!"); + NSLOG(netsurf, INFO, "Passed null bitmap!"); return NSERROR_OK; } @@ -937,8 +928,8 @@ bitmap(const struct redraw_context *ctx, } } - PLOT_LOG("Tiled plotting %d,%d by %d,%d", x, y, width, height); - PLOT_LOG("clipped %ld,%ld to %ld,%ld", + NSLOG(plot, DEEPDEBUG, "Tiled plotting %d,%d by %d,%d", x, y, width, height); + NSLOG(plot, DEEPDEBUG, "clipped %ld,%ld to %ld,%ld", plot_clip.left, plot_clip.top, plot_clip.right, plot_clip.bottom); @@ -952,7 +943,7 @@ bitmap(const struct redraw_context *ctx, for (; y > plot_clip.top; y -= height); } - PLOT_LOG("repeat from %d,%d to %ld,%ld", + NSLOG(plot, DEEPDEBUG, "repeat from %d,%d to %ld,%ld", x, y, plot_clip.right, plot_clip.bottom); /* tile down and across to extents */ @@ -989,11 +980,11 @@ text(const struct redraw_context *ctx, const char *text, size_t length) { - PLOT_LOG("words %s at %d,%d", text, x, y); + NSLOG(plot, DEEPDEBUG, "words %s at %d,%d", text, x, y); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } diff --git a/frontends/windows/prefs.c b/frontends/windows/prefs.c index f84ee1c96..591b57426 100644 --- a/frontends/windows/prefs.c +++ b/frontends/windows/prefs.c @@ -304,7 +304,8 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd, case WM_COMMAND: - LOG("WM_COMMAND Identifier 0x%x",LOWORD(wparam)); + NSLOG(netsurf, INFO, "WM_COMMAND Identifier 0x%x", + LOWORD(wparam)); switch(LOWORD(wparam)) { case IDC_PREFS_PROXYTYPE: diff --git a/frontends/windows/schedule.c b/frontends/windows/schedule.c index eae6c1d63..76358ec68 100644 --- a/frontends/windows/schedule.c +++ b/frontends/windows/schedule.c @@ -25,12 +25,6 @@ #include "windows/schedule.h" -#ifdef DEBUG_SCHEDULER -#define SRLOG(x...) LOG(x) -#else -#define SRLOG(x...) ((void) 0) -#endif - /* linked list of scheduled callbacks */ static struct nscallback *schedule_list = NULL; @@ -66,7 +60,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p) return NSERROR_OK; } - SRLOG("removing %p, %p", callback, p); + NSLOG(schedule, DEBUG, "removing %p, %p", callback, p); cur_nscb = schedule_list; prev_nscb = NULL; @@ -76,8 +70,11 @@ static nserror schedule_remove(void (*callback)(void *p), void *p) (cur_nscb->p == p)) { /* item to remove */ - SRLOG("callback entry %p removing %p(%p)", - cur_nscb, cur_nscb->callback, cur_nscb->p); + NSLOG(schedule, DEBUG, + "callback entry %p removing %p(%p)", + cur_nscb, + cur_nscb->callback, + cur_nscb->p); /* remove callback */ unlnk_nscb = cur_nscb; @@ -118,7 +115,8 @@ nserror win32_schedule(int ival, void (*callback)(void *p), void *p) return NSERROR_NOMEM; } - SRLOG("adding callback %p for %p(%p) at %d cs", + NSLOG(schedule, DEBUG, + "adding callback %p for %p(%p) at %d cs", nscb, callback, p, ival); gettimeofday(&nscb->tv, NULL); @@ -168,8 +166,11 @@ schedule_run(void) prev_nscb->next = unlnk_nscb->next; } - SRLOG("callback entry %p running %p(%p)", - unlnk_nscb, unlnk_nscb->callback, unlnk_nscb->p); + NSLOG(schedule, DEBUG, + "callback entry %p running %p(%p)", + unlnk_nscb, + unlnk_nscb->callback, + unlnk_nscb->p); /* call callback */ unlnk_nscb->callback(unlnk_nscb->p); @@ -201,8 +202,9 @@ schedule_run(void) /* make returned time relative to now */ timersub(&nexttime, &tv, &rettime); - SRLOG("returning time to next event as %ldms", - (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000)); + NSLOG(schedule, DEBUG, + "returning time to next event as %ldms", + (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000)); /* return next event time in milliseconds (24days max wait) */ return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000); @@ -216,12 +218,16 @@ void list_schedule(void) gettimeofday(&tv, NULL); - LOG("schedule list at %ld:%ld", tv.tv_sec, tv.tv_usec); + NSLOG(netsurf, INFO, "schedule list at %ld:%ld", tv.tv_sec, tv.tv_usec); cur_nscb = schedule_list; while (cur_nscb != NULL) { - LOG("Schedule %p at %ld:%ld", cur_nscb, cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec); + NSLOG(netsurf, INFO, + "Schedule %p at %ld:%ld", + cur_nscb, + cur_nscb->tv.tv_sec, + cur_nscb->tv.tv_usec); cur_nscb = cur_nscb->next; } } diff --git a/frontends/windows/ssl_cert.c b/frontends/windows/ssl_cert.c index fac211c11..4db061626 100644 --- a/frontends/windows/ssl_cert.c +++ b/frontends/windows/ssl_cert.c @@ -191,7 +191,7 @@ nserror nsw32_cert_verify(struct nsurl *url, return res; } - LOG("creating hInstance %p SSL window", hinst); + NSLOG(netsurf, INFO, "creating hInstance %p SSL window", hinst); ncwin->hWnd = CreateWindowEx(0, windowclassname_sslcert, "SSL Certificate viewer", @@ -208,7 +208,7 @@ nserror nsw32_cert_verify(struct nsurl *url, hinst, NULL); if (ncwin->hWnd == NULL) { - LOG("Window create failed"); + NSLOG(netsurf, INFO, "Window create failed"); return NSERROR_NOMEM; } @@ -375,8 +375,11 @@ nsw32_window_ssl_cert_command(HWND hwnd, int identifier, HWND ctrl_window) { - LOG("notification_code %x identifier %x ctrl_window %p", - notification_code, identifier, ctrl_window); + NSLOG(netsurf, INFO, + "notification_code %x identifier %x ctrl_window %p", + notification_code, + identifier, + ctrl_window); switch(identifier) { case IDC_SSLCERT_BTN_ACCEPT: diff --git a/frontends/windows/windbg.h b/frontends/windows/windbg.h index b2d8640f4..6cd9f97f8 100644 --- a/frontends/windows/windbg.h +++ b/frontends/windows/windbg.h @@ -24,11 +24,13 @@ const char *msg_num_to_name(int msg); void win_perror(const char *lpszFunction); -#define LOG_WIN_MSG(h, m, w, l) \ - if (((m) != WM_SETCURSOR) && \ - ((m) != WM_MOUSEMOVE) && \ - ((m) != WM_NCHITTEST) && \ - ((m) != WM_ENTERIDLE)) \ - LOG("%s, hwnd %p, w 0x%x, l 0x%Ix", msg_num_to_name(m), h, w, l); +#define LOG_WIN_MSG(h, m, w, l) \ + if (((m) != WM_SETCURSOR) && \ + ((m) != WM_MOUSEMOVE) && \ + ((m) != WM_NCHITTEST) && \ + ((m) != WM_ENTERIDLE)) \ + NSLOG(netsurf, INFO, \ + "%s, hwnd %p, w 0x%x, l 0x%Ix", \ + msg_num_to_name(m), h, w, l) #endif diff --git a/frontends/windows/window.c b/frontends/windows/window.c index c72173697..90d076812 100644 --- a/frontends/windows/window.c +++ b/frontends/windows/window.c @@ -88,7 +88,7 @@ static int get_window_dpi(HWND hwnd) ReleaseDC(hwnd, hdc); - LOG("FIX DPI %d", dpi); + NSLOG(netsurf, INFO, "FIX DPI %d", dpi); return dpi; } @@ -163,7 +163,9 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw) gw->mainmenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_MAIN)); gw->rclick = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_CONTEXT)); - LOG("creating hInstance %p GUI window %p", hInstance, gw); + NSLOG(netsurf, INFO, + "creating hInstance %p GUI window %p", + hInstance, gw); hwnd = CreateWindowEx(0, windowclassname_main, "NetSurf Browser", @@ -181,7 +183,7 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw) NULL); if (hwnd == NULL) { - LOG("Window create failed"); + NSLOG(netsurf, INFO, "Window create failed"); return NULL; } @@ -194,9 +196,10 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw) (nsoption_int(window_height) >= 100) && (nsoption_int(window_x) >= 0) && (nsoption_int(window_y) >= 0)) { - LOG("Setting Window position %d,%d %d,%d", - nsoption_int(window_x), nsoption_int(window_y), - nsoption_int(window_width), nsoption_int(window_height)); + NSLOG(netsurf, INFO, + "Setting Window position %d,%d %d,%d", + nsoption_int(window_x), nsoption_int(window_y), + nsoption_int(window_width), nsoption_int(window_height)); SetWindowPos(hwnd, HWND_TOP, nsoption_int(window_x), nsoption_int(window_y), @@ -227,47 +230,50 @@ nsws_window_toolbar_command(struct gui_window *gw, int identifier, HWND ctrl_window) { - LOG("notification_code %d identifier %d ctrl_window %p", - notification_code, identifier, ctrl_window); + NSLOG(netsurf, INFO, + "notification_code %d identifier %d ctrl_window %p", + notification_code, + identifier, + ctrl_window); switch(identifier) { case IDC_MAIN_URLBAR: switch (notification_code) { case EN_CHANGE: - LOG("EN_CHANGE"); + NSLOG(netsurf, INFO, "EN_CHANGE"); break; case EN_ERRSPACE: - LOG("EN_ERRSPACE"); + NSLOG(netsurf, INFO, "EN_ERRSPACE"); break; case EN_HSCROLL: - LOG("EN_HSCROLL"); + NSLOG(netsurf, INFO, "EN_HSCROLL"); break; case EN_KILLFOCUS: - LOG("EN_KILLFOCUS"); + NSLOG(netsurf, INFO, "EN_KILLFOCUS"); break; case EN_MAXTEXT: - LOG("EN_MAXTEXT"); + NSLOG(netsurf, INFO, "EN_MAXTEXT"); break; case EN_SETFOCUS: - LOG("EN_SETFOCUS"); + NSLOG(netsurf, INFO, "EN_SETFOCUS"); break; case EN_UPDATE: - LOG("EN_UPDATE"); + NSLOG(netsurf, INFO, "EN_UPDATE"); break; case EN_VSCROLL: - LOG("EN_VSCROLL"); + NSLOG(netsurf, INFO, "EN_VSCROLL"); break; default: - LOG("Unknown notification_code"); + NSLOG(netsurf, INFO, "Unknown notification_code"); break; } break; @@ -421,7 +427,7 @@ nsws_window_urlbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) case WM_DESTROY: hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); if (hFont != NULL) { - LOG("Destroyed font object"); + NSLOG(netsurf, INFO, "Destroyed font object"); DeleteObject(hFont); } @@ -502,12 +508,13 @@ nsws_window_urlbar_create(HINSTANCE hInstance, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial"); if (hFont != NULL) { - LOG("Setting font object"); + NSLOG(netsurf, INFO, "Setting font object"); SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, 0); } - LOG("Created url bar hwnd:%p, x:%d, y:%d, w:%d, h:%d", - hwnd, urlx, urly, urlwidth, urlheight); + NSLOG(netsurf, INFO, + "Created url bar hwnd:%p, x:%d, y:%d, w:%d, h:%d", hwnd, urlx, + urly, urlwidth, urlheight); return hwnd; } @@ -548,7 +555,7 @@ nsws_window_throbber_create(HINSTANCE hInstance, NULL); nsws_find_resource(avi, "throbber.avi", "windows/res/throbber.avi"); - LOG("setting throbber avi as %s", avi); + NSLOG(netsurf, INFO, "setting throbber avi as %s", avi); Animate_Open(hwnd, avi); if (gw->throbbing) { Animate_Play(hwnd, 0, -1, -1); @@ -576,7 +583,8 @@ get_imagelist(HINSTANCE hInstance, int resid, int bsize, int bcnt) HIMAGELIST hImageList; HBITMAP hScrBM; - LOG("resource id %d, bzize %d, bcnt %d", resid, bsize, bcnt); + NSLOG(netsurf, INFO, "resource id %d, bzize %d, bcnt %d", resid, + bsize, bcnt); hImageList = ImageList_Create(bsize, bsize, ILC_COLOR24 | ILC_MASK, 0, @@ -997,8 +1005,11 @@ nsws_window_command(HWND hwnd, { nserror ret; - LOG("notification_code %x identifier %x ctrl_window %p", - notification_code, identifier, ctrl_window); + NSLOG(netsurf, INFO, + "notification_code %x identifier %x ctrl_window %p", + notification_code, + identifier, + ctrl_window); switch(identifier) { @@ -1073,7 +1084,7 @@ nsws_window_command(HWND hwnd, HANDLE h = GetClipboardData(CF_TEXT); if (h != NULL) { char *content = GlobalLock(h); - LOG("pasting %s\n", content); + NSLOG(netsurf, INFO, "pasting %s\n", content); GlobalUnlock(h); } CloseClipboard(); @@ -1276,7 +1287,7 @@ nsws_window_command(HWND hwnd, int len = SendMessage(gw->urlbar, WM_GETTEXTLENGTH, 0, 0); char addr[len + 1]; SendMessage(gw->urlbar, WM_GETTEXT, (WPARAM)(len + 1), (LPARAM)addr); - LOG("launching %s\n", addr); + NSLOG(netsurf, INFO, "launching %s\n", addr); if (nsurl_create(addr, &url) != NSERROR_OK) { win32_warning("NoMemory", 0); @@ -1313,7 +1324,7 @@ nsws_window_command(HWND hwnd, */ static bool win32_window_get_scroll(struct gui_window *gw, int *sx, int *sy) { - LOG("get scroll"); + NSLOG(netsurf, INFO, "get scroll"); if (gw == NULL) return false; @@ -1410,7 +1421,8 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) gw = nsws_get_gui_window(hwnd); if (gw == NULL) { - LOG("Unable to find gui window structure for hwnd %p", hwnd); + NSLOG(netsurf, INFO, + "Unable to find gui window structure for hwnd %p", hwnd); return DefWindowProc(hwnd, msg, wparam, lparam); } @@ -1463,7 +1475,7 @@ win32_window_create(struct browser_window *bw, { struct gui_window *gw; - LOG("Creating gui window for browser window %p", bw); + NSLOG(netsurf, INFO, "Creating gui window for browser window %p", bw); gw = calloc(1, sizeof(struct gui_window)); if (gw == NULL) { @@ -1484,7 +1496,7 @@ win32_window_create(struct browser_window *bw, gw->mouse = malloc(sizeof(struct browser_mouse)); if (gw->mouse == NULL) { free(gw); - LOG("Unable to allocate mouse state"); + NSLOG(netsurf, INFO, "Unable to allocate mouse state"); return NULL; } gw->mouse->gui = gw; @@ -1504,8 +1516,12 @@ win32_window_create(struct browser_window *bw, gw->statusbar = nsws_window_create_statusbar(hinst, gw->main, gw); gw->drawingarea = nsws_window_create_drawable(hinst, gw->main, gw); - LOG("new window: main:%p toolbar:%p statusbar %p drawingarea %p", - gw->main, gw->toolbar, gw->statusbar, gw->drawingarea); + NSLOG(netsurf, INFO, + "new window: main:%p toolbar:%p statusbar %p drawingarea %p", + gw->main, + gw->toolbar, + gw->statusbar, + gw->drawingarea); font_hwnd = gw->drawingarea; open_windows++; @@ -1556,7 +1572,7 @@ win32_window_get_dimensions(struct gui_window *gw, *width = gw->width; *height = gw->height; - LOG("gw:%p w=%d h=%d", gw, *width, *height); + NSLOG(netsurf, INFO, "gw:%p w=%d h=%d", gw, *width, *height); return NSERROR_OK; } @@ -1588,7 +1604,7 @@ static void win32_window_set_title(struct gui_window *w, const char *title) return; } - LOG("%p, title %s", w, title); + NSLOG(netsurf, INFO, "%p, title %s", w, title); fulltitle = malloc(strlen(title) + SLEN(" - NetSurf") + 1); if (fulltitle == NULL) { win32_warning("NoMemory", 0); @@ -1865,7 +1881,9 @@ nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect) gw->requestscrolly = rect->y0 - gw->scrolly; } - /*LOG("requestscroll x,y:%d,%d", w->requestscrollx, w->requestscrolly);*/ + NSLOG(netsurf, DEEPDEBUG, + "requestscroll x,y:%d,%d", + gw->requestscrollx, gw->requestscrolly); /* set the vertical scroll offset */ si.cbSize = sizeof(si); @@ -1876,7 +1894,9 @@ nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect) si.nPos = max(gw->scrolly + gw->requestscrolly, 0); si.nPos = min(si.nPos, height - gw->height); SetScrollInfo(gw->drawingarea, SB_VERT, &si, TRUE); - /*LOG("SetScrollInfo VERT min:%d max:%d page:%d pos:%d", si.nMin, si.nMax, si.nPage, si.nPos);*/ + NSLOG(netsurf, DEEPDEBUG, + "SetScrollInfo VERT min:%d max:%d page:%d pos:%d", + si.nMin, si.nMax, si.nPage, si.nPos); /* set the horizontal scroll offset */ si.cbSize = sizeof(si); @@ -1887,7 +1907,9 @@ nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect) si.nPos = max(gw->scrollx + gw->requestscrollx, 0); si.nPos = min(si.nPos, width - gw->width); SetScrollInfo(gw->drawingarea, SB_HORZ, &si, TRUE); - /*LOG("SetScrollInfo HORZ min:%d max:%d page:%d pos:%d", si.nMin, si.nMax, si.nPage, si.nPos);*/ + NSLOG(netsurf, DEEPDEBUG, + "SetScrollInfo HORZ min:%d max:%d page:%d pos:%d", + si.nMin, si.nMax, si.nPage, si.nPos); /* Set caret position */ GetCaretPos(&p); @@ -1900,8 +1922,19 @@ nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect) r.bottom = gw->height + 1; r.left = 0; r.right = gw->width + 1; - ScrollWindowEx(gw->drawingarea, - gw->requestscrollx, - gw->requestscrolly, &r, NULL, NULL, &redraw, SW_INVALIDATE); - /*LOG("ScrollWindowEx %d, %d", - w->requestscrollx, - w->requestscrolly);*/ + ScrollWindowEx(gw->drawingarea, + - gw->requestscrollx, + - gw->requestscrolly, + &r, + NULL, + NULL, + &redraw, + SW_INVALIDATE); + NSLOG(netsurf, DEEPDEBUG, + "ScrollWindowEx %d, %d", + - gw->requestscrollx, + - gw->requestscrolly); + gw->scrolly += gw->requestscrolly; gw->scrollx += gw->requestscrollx; gw->requestscrollx = 0; |