summaryrefslogtreecommitdiff
path: root/platform/x11/win_main.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-07-17 17:32:12 +0100
committerRobin Watts <robin.watts@artifex.com>2013-07-19 19:56:27 +0100
commit42eb247ea0c69ba8cc249b1bb44fafcdcbdd2621 (patch)
tree6fde9d99a9551faa8abc6e0d4d3aa24db5824e4f /platform/x11/win_main.c
parent90d1d2cf603ba9d61e8160c0ba12325cd8249034 (diff)
downloadmupdf-42eb247ea0c69ba8cc249b1bb44fafcdcbdd2621.tar.xz
Add mupdf-curl app
Windows and X11. Allows files to be fetched and displayed as they are downloaded both with and without linearization, using hints if available.
Diffstat (limited to 'platform/x11/win_main.c')
-rw-r--r--platform/x11/win_main.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/platform/x11/win_main.c b/platform/x11/win_main.c
index 51dada02..6ddd171a 100644
--- a/platform/x11/win_main.c
+++ b/platform/x11/win_main.c
@@ -25,7 +25,7 @@ static HWND hwndview = NULL;
static HDC hdc;
static HBRUSH bgbrush;
static HBRUSH shbrush;
-static BITMAPINFO *dibinf;
+static BITMAPINFO *dibinf = NULL;
static HCURSOR arrowcurs, handcurs, waitcurs, caretcurs;
static LRESULT CALLBACK frameproc(HWND, UINT, WPARAM, LPARAM);
static LRESULT CALLBACK viewproc(HWND, UINT, WPARAM, LPARAM);
@@ -644,11 +644,18 @@ void winopen()
SetCursor(arrowcurs);
}
+static void
+do_close(pdfapp_t *app)
+{
+ pdfapp_close(app);
+ free(dibinf);
+}
+
void winclose(pdfapp_t *app)
{
if (pdfapp_preclose(app))
{
- pdfapp_close(app);
+ do_close(app);
exit(0);
}
}
@@ -877,6 +884,11 @@ void winreloadfile(pdfapp_t *app)
pdfapp_open(app, filename, 1);
}
+void winreloadpage(pdfapp_t *app)
+{
+ SendMessage(hwndview, WM_APP, 0, 0);
+}
+
void winopenuri(pdfapp_t *app, char *buf)
{
ShellExecuteA(hwndframe, "open", buf, 0, 0, SW_SHOWNORMAL);
@@ -1126,6 +1138,12 @@ viewproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
handlemouse(oldx, oldy, 0, 0); /* update cursor */
}
return 0;
+
+ /* We use WM_APP to trigger a reload and repaint of a page */
+ case WM_APP:
+ pdfapp_reloadpage(&gapp);
+ break;
+
}
fflush(stdout);
@@ -1199,7 +1217,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShow
DispatchMessage(&msg);
}
- pdfapp_close(&gapp);
+ do_close(&gapp);
fz_free_context(ctx);
return 0;