summaryrefslogtreecommitdiff
path: root/apps/x11_main.c
AgeCommit message (Collapse)Author
2012-07-25Exit in child process if fork/exec to open $BROWSER doesn't work.Tor Andersson
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
2011-09-04Coalesce consecutive X11 resize events into a single resize operation.Sebastian Rasmussen
2011-09-04Repaint only viewer search area when editing search string.Sebastian Rasmussen
2011-09-04Remove unused redraw timeout from X11 viewer.Sebastian Rasmussen
2011-08-30Ignore X11 key mappings when searching.Bert
2011-08-30Do not change view when reloading file.Bert
2011-04-08Add special case non-aa scan converter with accompanying blit functions.Tor Andersson
Also turn on font hinting when rendering non-aa text.
2011-04-04Le Roi est mort, vive le Roi!Tor Andersson
The run-together words are dead! Long live the underscores! The postscript inspired naming convention of using all run-together words has served us well, but it is now time for more readable code. In this commit I have also added the sed script, rename.sed, that I used to convert the source. Use it on your patches and application code.
2011-04-01apps: Add XPS support to mupdf viewer.Tor Andersson
2011-03-09Remove duplicated line in usage message.Tor Andersson
2011-03-03Update version numbers.Tor Andersson
2011-03-01Update icons.Tor Andersson
2011-02-03Fix typo in WM_DELETE_WINDOW patch.Tor Andersson
2011-02-02Also set window title with XStoreName.Tor Andersson
2011-02-02Handle WM_DELETE client messages.Tor Andersson
2010-12-30Adhere to nil idiom.Sebastian Rasmussen
2010-07-17Silence warnings.Tor Andersson
2010-07-16Add a flag to disable the accelerated plotting functions in pdfdraw.Tor Andersson
2010-07-08Simplify #ifdef labyrinth and make some source more c89 compatible.Tor Andersson
2010-07-08Remove unmaintained MMX optimized function and runtime detection.Tor Andersson