diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2010-12-20 05:20:21 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2010-12-20 05:20:21 +0100 |
commit | 9dc18220400d9a6f4fe3e65ba73d77f4844d249a (patch) | |
tree | 1b30d6221c167df02c345dde1acf4da18ee621ff | |
parent | b44b3e6a544c239e7581c72e73b4c5b089ffcff0 (diff) | |
download | logdiag-9dc18220400d9a6f4fe3e65ba73d77f4844d249a.tar.gz logdiag-9dc18220400d9a6f4fe3e65ba73d77f4844d249a.tar.xz logdiag-9dc18220400d9a6f4fe3e65ba73d77f4844d249a.zip |
Fix problems discovered while testing on Windows.
* Set the working directory for glib-genmarshal correctly.
* Use one more path suffix when searching for glibconfig.h.
* Don't assume that gdk_screen_get_resolution() returns
a useful value.
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | cmake/FindJsonGlib.cmake | 2 | ||||
-rw-r--r-- | src/ld-canvas.c | 12 |
3 files changed, 21 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index aba8443..fc9bfc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,16 @@ function (glib_genmarshal base prefix) set (command_base ${GLIB_GENMARSHAL_EXECUTABLE} --prefix ${prefix} "${base_name}.list") - # NOTE: VERBATIM may cause problems, so it is not used here + # On Windows, the final makefile may contain: + # cd e:\abc && ... + # That won't actually change the directory. We have to do: + # cd e:\abc && e: && ... + if (WIN32 AND "${base_path}" MATCHES "^.:[/\\\\]") + string (SUBSTRING "${base_path}" 0 2 base_drive) + set (command_base "${base_drive}" && "${command_base}") + endif (WIN32 AND "${base_path}" MATCHES "^.:[/\\\\]") + + # NOTE: VERBATIM would cause problems, so it is not used here add_custom_command (OUTPUT ${base}.c COMMAND ${command_base} --body > "${base_name}.c" DEPENDS "${base}.list" diff --git a/cmake/FindJsonGlib.cmake b/cmake/FindJsonGlib.cmake index e07ac75..ab19c10 100644 --- a/cmake/FindJsonGlib.cmake +++ b/cmake/FindJsonGlib.cmake @@ -38,7 +38,7 @@ find_path (JSON_GLIB_INCLUDE_DIR_GOBJECT glib-object.h find_path (JSON_GLIB_INCLUDE_DIR_GLIBCONFIG glibconfig.h PATHS /usr/lib - PATH_SUFFIXES glib-2.0/include) + PATH_SUFFIXES glib-2.0 glib-2.0/include) find_library (JSON_GLIB_LIBRARIES json-glib-1.0) diff --git a/src/ld-canvas.c b/src/ld-canvas.c index 0667adb..259d7d1 100644 --- a/src/ld-canvas.c +++ b/src/ld-canvas.c @@ -36,6 +36,9 @@ /* Tolerance on all sides of symbols for strokes. */ #define SYMBOL_AREA_TOLERANCE 0.5 +/* The default screen resolution in DPI units. */ +#define DEFAULT_SCREEN_RESOLUTION 96 + /* * LdCanvasPrivate: * @diagram: A diagram object assigned to this canvas as a model. @@ -455,11 +458,16 @@ ld_canvas_get_library (LdCanvas *self) static gdouble ld_canvas_get_base_unit_in_px (GtkWidget *self) { + gdouble resolution; + g_return_val_if_fail (GTK_IS_WIDGET (self), 1); + resolution = gdk_screen_get_resolution (gtk_widget_get_screen (self)); + if (resolution == -1) + resolution = DEFAULT_SCREEN_RESOLUTION; + /* XXX: It might look better if the unit was rounded to a whole number. */ - return gdk_screen_get_resolution (gtk_widget_get_screen (self)) - / MM_PER_INCH * LD_CANVAS_BASE_UNIT_LENGTH; + return resolution / MM_PER_INCH * LD_CANVAS_BASE_UNIT_LENGTH; } /* |