summaryrefslogtreecommitdiff
path: root/apps/x11_main.c
AgeCommit message (Collapse)Author
2013-06-20Rearrange source files.Tor Andersson
2013-06-19Fix exception handling changes in X11 app.Tor Andersson
2013-06-09Remove fz_interactive API in favour of direct use of pdf APIPaul Gardiner
2013-04-29x11: Copy to clipboard on Ctl+C.Tor Andersson
For better interoperability with non-unix-y apps that don't know about selection and middle-click paste, add the ability to use Ctl+C to copy the selected text to the clipboard. Thanks to Sebras for original patch.
2013-04-26Fix dirty flag handling bug in X11 event loop.Robin Watts
When I added transition handling to mupdf, I broke the X11 behaviour of coalescing all events and only blitting when idle. This commit restores that behaviour, except when transitions are actually in progress (when it still blits instantly).
2013-02-06Change to pass structures by reference rather than value.Robin Watts
This is faster on ARM in particular. The primary changes involve fz_matrix, fz_rect and fz_bbox. Rather than passing 'fz_rect r' into a function, we now consistently pass 'const fz_rect *r'. Where a rect is passed in and modified, we miss the 'const' off. Where possible, we return the pointer to the modified structure to allow 'chaining' of expressions. The basic upshot of this work is that we do far fewer copies of rectangle/matrix structures, and all the copies we do are explicit. This has opened the way to other optimisations, also performed in this commit. Rather than using expressions like: fz_concat(fz_scale(sx, sy), fz_translate(tx, ty)) we now have fz_pre_{scale,translate,rotate} functions. These can be implemented much more efficiently than doing the fully fledged matrix multiplication that fz_concat requires. We add fz_rect_{min,max} functions to return pointers to the min/max points of a rect. These can be used to in transformations to directly manipulate values. With a little casting in the path transformation code we can avoid more needless copying. We rename fz_widget_bbox to the more consistent fz_bound_widget.
2012-12-13Bug 693462: Tweak X11 app startup.Robin Watts
A user (stu-mupdf) points out that if winopen fails, we throw an error, which crashes due to the exception stack not having been set up yet. The solution is simply to move pdfapp_init a little earlier.
2012-11-27Forms: avoid directly saving to the original filePaul Gardiner
MuPDF needs access to the original file when saving, and in any case directly overwritting the original file has much more potential for data loss than use of a temporary file.
2012-11-16Build on Solaris (10, at least)Chris Liddell
Requires GNU make and gcc.
2012-10-19Fix bug where X11 motion events were parsed as button eventsSebastian Rasmussen
2012-10-17First steps towards supporting transitions.Robin Watts
Only Fade, Wipe and Blinds supported so far. Hit 'p' in the viewer to go into 'presentation' mode. Page swaps then transition from page to page. Pages auto advance until key or mouse is used.
2012-09-19Forms: handle print request, both from javascript and from named actionPaul Gardiner
Currently the app windows app responds with a message box explaining that the MuPDF library passes print requests to the app, but the app does not implement printing.
2012-09-18Forms: add event handling api and specifically support for javascript alertPaul Gardiner
2012-08-16Forms: respond to failed validation in windows appPaul Gardiner
2012-08-03Forms: add basic support for choice widgets to the Windows appPaul Gardiner
2012-08-02Forms: add support for save on exit to the windows appPaul Gardiner
2012-08-01Merge branch 'master' into formsPaul Gardiner
Conflicts: pdf/mupdf-internal.h pdf/pdf_font.c
2012-07-25Exit in child process if fork/exec to open $BROWSER doesn't work.Tor Andersson
2012-06-20Stub wintextinput on x11.Tor Andersson
2012-06-20Add better mechanism for enumerating annotation rectangles.Robin Watts
Rather than having a dedicated call to enumerate the rectangles for the annotations on a page, add an interface for enumerating annotations with accessor functions. Currently the only accessor function is the one to get the annotation rectangle. Use this new scheme in place of fz_bound_annots within mudraw. Also use this scheme to set the caret cursor in the viewer when over a data field.
2012-04-28Free document/app when document cannot be shown in X11 viewer.Sebastian Rasmussen
2012-04-20Pass UTF8 filename to fz_open_document / fz_open_file to remove kludges.Tor Andersson
Use _wopen on a UTF8 -> wchar_t decoded filename to support UTF8 filenames for win32.
2012-03-15Bug 692871: Improve X11 cut/paste handlingRobin Watts
Take on Johann Giwers patch for X11 cut/paste handling. Many thanks. Also remove a stray printf.
2012-03-13Add ctx argument and rename fz_bound_pixmap to fz_pixmap_bbox.Tor Andersson
2012-03-13Rename some functions and accessors to be more consistent.Tor Andersson
Debug printing functions: debug -> print. Accessors: get noun attribute -> noun attribute. Find -> lookup when the returned value is not reference counted. pixmap_with_rect -> pixmap_with_bbox. We are reserving the word "find" to mean lookups that give ownership of objects to the caller. Lookup is used in other places where the ownership is not transferred, or simple values are returned. The rename is done by the sed script in scripts/rename3.sed
2012-03-13Split XPS header. Update Makefile dependencies. Add pixmap w/h accessors.Tor Andersson
2012-03-12Create style sheet and group extracted text into blocks, lines and spans.Tor Andersson
2012-03-07Splitting tweaks.Tor Andersson
2012-02-11Purge unused and bit rotted fz_accelerate stuff.Tor Andersson
2012-02-08Lock reworking.Robin Watts
This is a significant change to the use of locks in MuPDF. Previously, the user had the option of passing us lock/unlock functions for a single mutex as part of the allocation struct. Now we remove these entries from the allocation struct, and make a separate 'locks' struct. This enables people to use fz_alloc_default with locking. If multithreaded operation is required, then the user is required to create FZ_LOCK_MAX mutexes, which will be locked or unlocked by MuPDF calling the lock/unlock functions within the new fz_locks_context structure passed in at context creation. These mutexes are not required to be recursive (they may be, but MuPDF should never call them in this way). MuPDF avoids deadlocks by imposing a locking ordering on itself; a thread will never take lock n, if it already holds any lock i for which 0 <= i <= n. Currently, there are 4 locks used within MuPDF. Lock 0: The alloc lock; taken around all calls to user supplied (or default) allocation functions. Also taken around all accesses to the refs field of storable items. Lock 1: The store lock; taken whenever the store data structures (specifically the linked list pointers) are accessed. Lock 2: The file lock; taken whenever a thread is accessing the raw file. We use the debugging macros to insist that this is held whenever we do a file based seek or read. We also insist that this is never held when we resolve an indirect reference, as this can have the effect of moving the file pointer. Lock 3: The glyphcache lock; taken whenever a thread calls freetype, or accesses the glyphcache data structures. This introduces some complexities w.r.t type3 fonts. Locking can be hugely problematic, so to ease our minds as to the correctness of this code, we introduce some debugging macros. These compile away to nothing unless FITZ_DEBUG_LOCKING is defined. fz_assert_lock_held(ctx, lock) checks that we hold lock. fz_assert_lock_not_held(ctx, lock) checks that we do not hold lock. In addition fz_lock_debug_lock and fz_lock_debug_unlock are used on every fz_lock/fz_unlock to check the validity of the operation we are performing - in particular it checks that we do/do not already hold the lock we are trying to take/drop, and that by taking this lock we are not violating our defined locking order. The RESOLVE macro (used throughout the code to check whether we need to resolve an indirect reference) calls fz_assert_lock_not_held to ensure that we aren't about to resolve an indirect reference (and hence move the stream pointer) when the file is locked. In order to implement the file locking properly, pdf_open_stream (and friends) now lock the file as a side effect (because they fz_seek to the start of the stream). The lock is automatically dropped on an fz_close of such streams. Previously, the glyph cache was created in a context when it was first required; this presents problems as it can be shared between several contexts or not, depending on whether it is created before the contexts are cloned. We now always create it at startup, so it is always shared. This means that we need reference counting for the glyph caches. Added here. In fz_render_glyph, we take the glyph cache lock, and check to see whether the glyph is in the cache. If it is, we bump the refcount, drop the lock and returned the cached character. If it is not, we need to render the character. For freetype based fonts we keep the lock throughout the rendering process, thus ensuring that freetype is only called in a single threaded manner. For type3 fonts, however, we need to invoke the interpreter again to render the glyph streams. This can require reentrance to this routine. We therefore drop the glyph cache lock, call the interpreter to render us our pixmap, and take the lock again. This dropping and retaking of the lock introduces a possible race condition; 2 threads may try to render the same character at the same time. We therefore modify our hash table insert routines to behave differently if it comes to insert an entry only to find that an entry with the same key is already there. We spot this case; if we have just rendered a type3 glyph and when we try to insert it into the cache discover that someone has beaten us to it, we just discard our entry and use the cached one. Hopefully this will seldom be a problem in practise; to solve it properly would require greater complexity (probably involving spotting that another thread is already working on the desired rendering, and sleeping on a semaphore until it completes).
2012-02-06Fix 692841: Look at ConfigureNotify events while waiting for MapNotify.Tor Andersson
We used to discard all events until we got a MapNotify, but some window managers send the ConfigureNotify before the window is mapped.
2012-01-30Add CBZ (comic book zip-file) parser.Tor Andersson
2012-01-18Add fullscreen mode to mupdf viewer.Tor Andersson
Toggle with 'f'. Fullscreen turns off shrinkwrap, and shrinkwrap turns off fullscreen.
2012-01-11Use enum for FZ_STORE_DEFAULT default size.Tor Andersson
2012-01-11Set default values for alloc context and max store size if none are given.Sebastian Rasmussen
2012-01-11Do not unnecessarily use O_BINARY in X11 viewer.Sebastian Rasmussen
2011-12-15Fix warnings/errors on unix builds.Robin Watts
Fix warnings/errors thrown up by the last few commits (which were only tested on windows).
2011-12-08Stylistic changes when testing pointer values for NULL.Tor Andersson
Also: use 'cannot' instead of 'failed to' in error messages.
2011-12-08Remove deprecated error handling code.Tor Andersson
2011-12-08Use context in x11_main.Tor Andersson
2011-11-15Merge branch 'master' into contextRobin Watts
Mostly redoing the xps_context to xps_document change and adding contexts to newly written code. Conflicts: apps/pdfapp.c apps/pdfapp.h apps/x11_main.c apps/xpsdraw.c draw/draw_device.c draw/draw_scale.c fitz/base_object.c fitz/fitz.h pdf/mupdf.h pdf/pdf_interpret.c pdf/pdf_outline.c pdf/pdf_page.c xps/muxps.h xps/xps_doc.c xps/xps_xml.c
2011-10-12Make entering search terms not interfere with page number drawing.Sebastian Rasmussen
2011-10-12Default to opening URIs with xdg-open instead of open in X11 viewer.Sebastian Rasmussen
Based on a patch by Zhihao Yuan <lichray@gmail.com>.
2011-10-12Ask for screen resolution in X11 viewer.Sebastian Rasmussen
Based on a patch by Zhihao Yuan <lichray@gmail.com>.
2011-09-21Rename malloc functions for arrays (fz_calloc and fz_realloc).Tor Andersson
2011-09-20Reshuffle exception context code to fit Tor's aesthetic sense.Tor Andersson
2011-09-17Show page number in X11 viewer upon 'P' keypress.Sebastian Rasmussen
2011-09-15Add context to mupdf.Robin Watts
Huge pervasive change to lots of files, adding a context for exception handling and allocation. In time we'll move more statics into there. Also fix some for(i = 0; i < function(...); i++) calls.
2011-09-14Initial import of exception handling codeRobin Watts
Import exception handling code from WSS, modified to fit into the fitz world. With this code we have 'real' fz_try/fz_catch/fz_rethrow functions, handling a fz_except type. We therefore rename the existing fz_throw/ fz_catch/fz_rethrow to be fz_error_make/fz_error_handle/fz_error_note. We don't actually use fz_try/fz_catch/fz_rethrow yet...
2011-09-04Reload file in X11 viewer upon SIGHUP.Sebastian Rasmussen