From c30546d5324cdb57b02de119492f402b546c22fa Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 20 Mar 2014 22:42:02 +0100 Subject: Fix compiler warnings. These appear to fix some genuine bugs too (comparing unsigned numbers with integers, note that the result of (gint - guint) is unsigned! (bzr r13171) --- src/libgdl/gdl-dock-item-button-image.c | 4 ++-- src/libgdl/gdl-dock-item-grip.c | 5 ++--- src/libgdl/gdl-dock-object.c | 2 +- src/libgdl/gdl-dock-paned.c | 8 ++++---- src/libgdl/gdl-dock.c | 11 ++++------- src/libgdl/gdl-switcher.c | 5 ++--- 6 files changed, 15 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/libgdl/gdl-dock-item-button-image.c b/src/libgdl/gdl-dock-item-button-image.c index 31613a898..77cfe5d6c 100644 --- a/src/libgdl/gdl-dock-item-button-image.c +++ b/src/libgdl/gdl-dock-item-button-image.c @@ -135,8 +135,8 @@ static void gdl_dock_item_button_image_class_init ( GdlDockItemButtonImageClass *klass) { - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); + //GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + //GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); widget_class->expose_event = diff --git a/src/libgdl/gdl-dock-item-grip.c b/src/libgdl/gdl-dock-item-grip.c index 2c3ec061e..d23eb7f98 100644 --- a/src/libgdl/gdl-dock-item-grip.c +++ b/src/libgdl/gdl-dock-item-grip.c @@ -536,10 +536,9 @@ gdl_dock_item_grip_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GdlDockItemGrip *grip; - GtkRequisition close_requisition = { 0, }; - GtkRequisition iconify_requisition = { 0, }; + GtkRequisition close_requisition = { 0, 0 }; + GtkRequisition iconify_requisition = { 0, 0 }; GtkAllocation child_allocation; - GdkRectangle label_area; guint border_width; g_return_if_fail (GDL_IS_DOCK_ITEM_GRIP (widget)); diff --git a/src/libgdl/gdl-dock-object.c b/src/libgdl/gdl-dock-object.c index a362d277a..4092ecc9f 100644 --- a/src/libgdl/gdl-dock-object.c +++ b/src/libgdl/gdl-dock-object.c @@ -869,7 +869,7 @@ gdl_dock_param_get_type (void) static GType our_type = 0; if (our_type == 0) { - GTypeInfo tinfo = { 0, }; + GTypeInfo tinfo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; our_type = g_type_register_static (G_TYPE_STRING, "GdlDockParam", &tinfo, 0); /* register known transform functions */ diff --git a/src/libgdl/gdl-dock-paned.c b/src/libgdl/gdl-dock-paned.c index 42212d489..5b4561ef3 100644 --- a/src/libgdl/gdl-dock-paned.c +++ b/src/libgdl/gdl-dock-paned.c @@ -436,20 +436,20 @@ gdl_dock_paned_dock_request (GdlDockObject *object, my_request.target = object; /* See if it's in the border_width band. */ - if (rel_x < bw) { + if (rel_x < (gint)bw) { my_request.position = GDL_DOCK_LEFT; my_request.rect.width *= SPLIT_RATIO; divider = other.width; - } else if (rel_x > alloc.width - bw) { + } else if (rel_x > alloc.width - (gint)bw) { my_request.position = GDL_DOCK_RIGHT; my_request.rect.x += my_request.rect.width * (1 - SPLIT_RATIO); my_request.rect.width *= SPLIT_RATIO; divider = MAX (0, my.width - other.width); - } else if (rel_y < bw) { + } else if (rel_y < (gint)bw) { my_request.position = GDL_DOCK_TOP; my_request.rect.height *= SPLIT_RATIO; divider = other.height; - } else if (rel_y > alloc.height - bw) { + } else if (rel_y > alloc.height - (gint)bw) { my_request.position = GDL_DOCK_BOTTOM; my_request.rect.y += my_request.rect.height * (1 - SPLIT_RATIO); my_request.rect.height *= SPLIT_RATIO; diff --git a/src/libgdl/gdl-dock.c b/src/libgdl/gdl-dock.c index 6225864f0..c87468e5c 100644 --- a/src/libgdl/gdl-dock.c +++ b/src/libgdl/gdl-dock.c @@ -311,8 +311,6 @@ gdl_dock_constructor (GType type, } if (dock->_priv->floating) { - GdlDockObject *controller; - /* create floating window for this dock */ dock->_priv->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_object_set_data (G_OBJECT (dock->_priv->window), "dock", dock); @@ -832,17 +830,17 @@ gdl_dock_dock_request (GdlDockObject *object, my_request.target = dock->root; /* See if it's in the border_width band. */ - if (rel_x < bw) { + if (rel_x < (gint)bw) { my_request.position = GDL_DOCK_LEFT; my_request.rect.width *= SPLIT_RATIO; - } else if (rel_x > alloc.width - bw) { + } else if (rel_x > alloc.width - (gint)bw) { my_request.position = GDL_DOCK_RIGHT; my_request.rect.x += my_request.rect.width * (1 - SPLIT_RATIO); my_request.rect.width *= SPLIT_RATIO; - } else if (rel_y < bw) { + } else if (rel_y < (gint)bw) { my_request.position = GDL_DOCK_TOP; my_request.rect.height *= SPLIT_RATIO; - } else if (rel_y > alloc.height - bw) { + } else if (rel_y > alloc.height - (gint)bw) { my_request.position = GDL_DOCK_BOTTOM; my_request.rect.y += my_request.rect.height * (1 - SPLIT_RATIO); my_request.rect.height *= SPLIT_RATIO; @@ -1215,7 +1213,6 @@ gdl_dock_add_item (GdlDock *dock, /* Non-floating item. */ if (dock->root) { GdlDockPlacement local_placement; - GtkRequisition preferred_size; best_dock_item = gdl_dock_find_best_placement_item (GDL_DOCK_ITEM (dock->root), diff --git a/src/libgdl/gdl-switcher.c b/src/libgdl/gdl-switcher.c index 780438886..53a4b1989 100644 --- a/src/libgdl/gdl-switcher.c +++ b/src/libgdl/gdl-switcher.c @@ -255,12 +255,12 @@ button_toggled_callback (GtkToggleButton *toggle_button, static int layout_buttons (GdlSwitcher *switcher) { - GtkRequisition client_requisition = {0,}; + GtkRequisition client_requisition = {0,0}; GtkAllocation allocation; GdlSwitcherStyle switcher_style; gboolean icons_only; int num_btns = g_slist_length (switcher->priv->buttons); - int btns_per_row; + unsigned int btns_per_row; GSList **rows, *p; Button *button; int row_number; @@ -790,7 +790,6 @@ gdl_switcher_add_button (GdlSwitcher *switcher, const gchar *label, GdkPixbuf *pixbuf_icon, gint switcher_id, GtkWidget* page) { - GtkWidget *event_box; GtkWidget *button_widget; GtkWidget *hbox; GtkWidget *icon_widget; -- cgit v1.2.3 From 97032aebb40c2a22d4333892dbb8a62ef72a0ceb Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 20 Mar 2014 23:10:07 +0100 Subject: supress warnings (bzr r13173) --- src/libcroco/cr-om-parser.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/libcroco/cr-om-parser.c b/src/libcroco/cr-om-parser.c index ea622e35c..c1acb855c 100644 --- a/src/libcroco/cr-om-parser.c +++ b/src/libcroco/cr-om-parser.c @@ -39,6 +39,9 @@ struct _CROMParserPriv { #define PRIVATE(a_this) ((a_this)->priv) +// Unfortunately, C does not allow unnamed function arguments, so use this macro instead... +#define UNUSED(x) (void)(x) + /* *Forward declaration of a type defined later *in this file. @@ -207,6 +210,8 @@ static void start_font_face (CRDocHandler * a_this, CRParsingLocation *a_location) { + UNUSED(a_location); + enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; @@ -302,6 +307,8 @@ static void charset (CRDocHandler * a_this, CRString * a_charset, CRParsingLocation *a_location) { + UNUSED(a_location); + enum CRStatus status = CR_OK; CRStatement *stmt = NULL, *stmt2 = NULL; @@ -340,6 +347,8 @@ start_page (CRDocHandler * a_this, CRString * a_pseudo, CRParsingLocation *a_location) { + UNUSED(a_location); + enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; @@ -381,6 +390,9 @@ end_page (CRDocHandler * a_this, CRString * a_page, CRString * a_pseudo_page) { + UNUSED(a_page); + UNUSED(a_pseudo_page); + enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; @@ -407,8 +419,6 @@ end_page (CRDocHandler * a_this, cr_statement_destroy (ctxt->cur_stmt); ctxt->cur_stmt = NULL; } - a_page = NULL; /*keep compiler happy */ - a_pseudo_page = NULL; /*keep compiler happy */ } static void @@ -416,6 +426,8 @@ start_media (CRDocHandler * a_this, GList * a_media_list, CRParsingLocation *a_location) { + UNUSED(a_location); + enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; @@ -444,6 +456,8 @@ start_media (CRDocHandler * a_this, static void end_media (CRDocHandler * a_this, GList * a_media_list) { + UNUSED(a_media_list); + enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; @@ -470,7 +484,6 @@ end_media (CRDocHandler * a_this, GList * a_media_list) ctxt->cur_stmt = NULL ; ctxt->cur_media_stmt = NULL ; - a_media_list = NULL; } static void @@ -480,6 +493,9 @@ import_style (CRDocHandler * a_this, CRString * a_uri_default_ns, CRParsingLocation *a_location) { + UNUSED(a_uri_default_ns); + UNUSED(a_location); + enum CRStatus status = CR_OK; CRString *uri = NULL; CRStatement *stmt = NULL, @@ -530,7 +546,6 @@ import_style (CRDocHandler * a_this, cr_statement_destroy (stmt); stmt = NULL; } - a_uri_default_ns = NULL; /*keep compiler happy */ } static void @@ -557,6 +572,8 @@ start_selector (CRDocHandler * a_this, CRSelector * a_selector_list) static void end_selector (CRDocHandler * a_this, CRSelector * a_selector_list) { + UNUSED(a_selector_list); + enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; @@ -604,7 +621,6 @@ end_selector (CRDocHandler * a_this, CRSelector * a_selector_list) } } - a_selector_list = NULL; /*keep compiler happy */ } static void -- cgit v1.2.3 From 3d0d9f52c3cfaf870c2985507af4d05648f184be Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 20 Mar 2014 23:13:18 +0100 Subject: remove #pragma for 11 year old compiler that I cannot imagine anyone using at this point (bzr r13174) --- src/extension/internal/pdfinput/pdf-parser.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src') diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp index 30e120d26..b398486e6 100644 --- a/src/extension/internal/pdfinput/pdf-parser.cpp +++ b/src/extension/internal/pdfinput/pdf-parser.cpp @@ -76,10 +76,6 @@ extern "C" { // Operator table //------------------------------------------------------------------------ -#ifdef WIN32 // this works around a bug in the VC7 compiler -# pragma optimize("",off) -#endif - PdfOperator PdfParser::opTab[] = { {"\"", 3, {tchkNum, tchkNum, tchkString}, &PdfParser::opMoveSetShowText}, @@ -249,10 +245,6 @@ PdfOperator PdfParser::opTab[] = { &PdfParser::opCurveTo2} }; -#ifdef WIN32 // this works around a bug in the VC7 compiler -# pragma optimize("",on) -#endif - #define numOps (sizeof(opTab) / sizeof(PdfOperator)) //------------------------------------------------------------------------ -- cgit v1.2.3 From dcd9fafa57174f7e2b8102adcf1c5701c43cffa9 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 20 Mar 2014 23:59:13 +0100 Subject: apply 2geom rev. 2169 (bug fix) (bzr r13175) --- src/2geom/generic-interval.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/2geom/generic-interval.h b/src/2geom/generic-interval.h index 41eaf59b0..f6d4718de 100644 --- a/src/2geom/generic-interval.h +++ b/src/2geom/generic-interval.h @@ -274,10 +274,12 @@ public: /** @brief Union with another interval, gracefully handling empty ones. */ void unionWith(GenericOptInterval const &a) { - if (*this) { // check that we are not empty - (*this)->unionWith(*a); - } else if (a) { - *this = *a; + if (a) { + if (*this) { // check that we are not empty + (*this)->unionWith(*a); + } else { + *this = *a; + } } } void intersectWith(GenericOptInterval const &o) { -- cgit v1.2.3 From 1d584c4ddd28280f5c9224175ce39aea9e690600 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 21 Mar 2014 00:16:02 +0100 Subject: control-point-selection : fix a (very unlikely) crash upon dereferencing unitialized bound variable (bzr r13176) --- src/ui/tool/control-point-selection.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index b5ee0a597..d10ed0f0d 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -194,6 +194,8 @@ void ControlPointSelection::align(Geom::Dim2 axis) bound.unionWith(Geom::OptInterval((*i)->position()[d])); } + if (!bound) { return; } + double new_coord = bound->middle(); for (iterator i = _points.begin(); i != _points.end(); ++i) { Geom::Point pos = (*i)->position(); @@ -220,6 +222,8 @@ void ControlPointSelection::distribute(Geom::Dim2 d) bound.unionWith(Geom::OptInterval(pos[d])); } + if (!bound) { return; } + // now we iterate over the multimap and set aligned positions. double step = size() == 1 ? 0 : bound->extent() / (size() - 1); double start = bound->min(); -- cgit v1.2.3 From 5c8f302c230b5952da6bbbda14fe49399c9ee894 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 21 Mar 2014 18:46:09 +0100 Subject: libcroco: fix pointer signedness errors (bzr r13178) --- src/libcroco/cr-parser.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/libcroco/cr-parser.c b/src/libcroco/cr-parser.c index 41d3eab5a..f14f8a015 100644 --- a/src/libcroco/cr-parser.c +++ b/src/libcroco/cr-parser.c @@ -78,7 +78,7 @@ typedef struct _CRParserError CRParserError; *parsing routines. */ struct _CRParserError { - guchar *msg; + gchar *msg; enum CRStatus status; glong line; glong column; @@ -374,11 +374,11 @@ static enum CRStatus cr_parser_parse_simple_selector (CRParser * a_this, static enum CRStatus cr_parser_parse_simple_sels (CRParser * a_this, CRSimpleSel ** a_sel); -static CRParserError *cr_parser_error_new (const guchar * a_msg, +static CRParserError *cr_parser_error_new (const gchar * a_msg, enum CRStatus); static void cr_parser_error_set_msg (CRParserError * a_this, - const guchar * a_msg); + const gchar * a_msg); static void cr_parser_error_dump (CRParserError * a_this); @@ -392,7 +392,7 @@ static void cr_parser_error_destroy (CRParserError * a_this); static enum CRStatus cr_parser_push_error (CRParser * a_this, - const guchar * a_msg, + const gchar * a_msg, enum CRStatus a_status); static enum CRStatus cr_parser_dump_err_stack (CRParser * a_this, @@ -411,7 +411,7 @@ static enum CRStatus *@return the newly built instance of #CRParserError. */ static CRParserError * -cr_parser_error_new (const guchar * a_msg, enum CRStatus a_status) +cr_parser_error_new (const gchar * a_msg, enum CRStatus a_status) { CRParserError *result = NULL; @@ -436,7 +436,7 @@ cr_parser_error_new (const guchar * a_msg, enum CRStatus a_status) *@param a_msg the new message. */ static void -cr_parser_error_set_msg (CRParserError * a_this, const guchar * a_msg) +cr_parser_error_set_msg (CRParserError * a_this, const gchar * a_msg) { g_return_if_fail (a_this); @@ -515,7 +515,7 @@ cr_parser_error_destroy (CRParserError * a_this) */ static enum CRStatus cr_parser_push_error (CRParser * a_this, - const guchar * a_msg, enum CRStatus a_status) + const gchar * a_msg, enum CRStatus a_status) { enum CRStatus status = CR_OK; -- cgit v1.2.3 From de29fdf792fc739be65787538a3bf6da6cd01f8b Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 21 Mar 2014 18:53:05 +0100 Subject: fix macro redefinition errors (bzr r13179) --- src/libnrtype/FontFactory.cpp | 6 ++++-- src/libnrtype/FontInstance.cpp | 6 ++++-- src/libnrtype/Layout-TNG-Input.cpp | 10 +++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index f05b75aaa..7c0b4ffba 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -8,12 +8,14 @@ * */ -#define PANGO_ENABLE_ENGINE - #ifdef HAVE_CONFIG_H # include "config.h" #endif +#ifndef PANGO_ENABLE_ENGINE +#define PANGO_ENABLE_ENGINE +#endif + #include #include #include "libnrtype/FontFactory.h" diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index a5b782344..20eca6740 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -8,12 +8,14 @@ * */ -#define PANGO_ENABLE_ENGINE - #ifdef HAVE_CONFIG_H # include "config.h" #endif +#ifndef PANGO_ENABLE_ENGINE +#define PANGO_ENABLE_ENGINE +#endif + #include #include FT_OUTLINE_H #include FT_BBOX_H diff --git a/src/libnrtype/Layout-TNG-Input.cpp b/src/libnrtype/Layout-TNG-Input.cpp index c7b0948e8..cb3e6f620 100644 --- a/src/libnrtype/Layout-TNG-Input.cpp +++ b/src/libnrtype/Layout-TNG-Input.cpp @@ -9,7 +9,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifndef PANGO_ENABLE_ENGINE #define PANGO_ENABLE_ENGINE +#endif #include #include "Layout-TNG.h" @@ -25,8 +31,10 @@ namespace Text { void Layout::_clearInputObjects() { - for(std::vector::iterator it = _input_stream.begin() ; it != _input_stream.end() ; ++it) + for(std::vector::iterator it = _input_stream.begin() ; it != _input_stream.end() ; ++it) { delete *it; + } + _input_stream.clear(); _input_wrap_shapes.clear(); } -- cgit v1.2.3 From 2152c53fe2292956b122e1fab16775e4727ee516 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 21 Mar 2014 18:59:26 +0100 Subject: cairo-render-context: swap order of header inclusion to redefinition clash of #define STRICT in pangowin32.h with windef.h (pango should check if STRICT is already defined or not) (bzr r13180) --- src/extension/internal/cairo-render-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 4ec6ae1c8..c09b8e9c8 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -72,8 +72,8 @@ #include #endif #ifdef CAIRO_HAS_WIN32_FONT -#include #include +#include #endif #include -- cgit v1.2.3 From 093c7f7d26dd6d8028a01d9eefe313efd82c075a Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 21 Mar 2014 19:08:00 +0100 Subject: libuemf: make uemf_utf.c compile cleanly with specific version of iconv. (current devlibs version) (bzr r13181) --- src/libuemf/uemf_utf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libuemf/uemf_utf.c b/src/libuemf/uemf_utf.c index bce60af4d..0c07148a4 100644 --- a/src/libuemf/uemf_utf.c +++ b/src/libuemf/uemf_utf.c @@ -49,11 +49,14 @@ void U_swap2(void *ul, unsigned int count); on another funky system this code may need to be modified, or define ICONV_CAST on the compile line(but it may be tricky). */ +#if _LIBICONV_VERSION == 0x0109 +# define ICONV_CAST (const char **) +#endif // _LIBICONV_VERSION 0x0109 #ifdef SOL8 -#define ICONV_CAST (const char **) +# define ICONV_CAST (const char **) #endif //SOL8 #if !defined(ICONV_CAST) -#define ICONV_CAST (char **) +# define ICONV_CAST (char **) #endif //ICONV_CAST /** \endcond */ -- cgit v1.2.3 From 3e250052040d27cfab48f06e72a0a420928823d3 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 22 Mar 2014 13:11:05 +0100 Subject: fix self-assignment. use of UNUSED macro to better show the intent of the code (bzr r13182) --- src/libuemf/uemf_endian.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libuemf/uemf_endian.c b/src/libuemf/uemf_endian.c index f025416c3..f5dcf829a 100644 --- a/src/libuemf/uemf_endian.c +++ b/src/libuemf/uemf_endian.c @@ -36,6 +36,10 @@ extern "C" { #include "uemf.h" #include "uemf_endian.h" +// Unfortunately, C does not allow unnamed function arguments, so use this macro instead... +#define UNUSED(x) (void)(x) + + // hide almost everuything in here from Doxygen //! \cond @@ -425,7 +429,8 @@ by end user code and to further that end prototypes are NOT provided and they ar // all core*_swap call this, U_EMRSETMARGN_swap and some others all it directly // numbered as core5 to be consistent with uemf.c, but must appear before the others as there is no prototype void core5_swap(char *record, int torev){ - torev = torev; // shuts up compiler warnings about unused parameters + UNUSED(torev); + PU_ENHMETARECORD pEMR = (PU_ENHMETARECORD)(record); U_swap4(pEMR,2); // iType nSize } -- cgit v1.2.3 From 9df0bd626eed33451e8eeebffcb393fb7ae0f0d8 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 22 Mar 2014 13:21:38 +0100 Subject: tool/node.cpp : don't rely on g_error terminating the program, allow more graceful error handling. (bzr r13183) --- src/ui/tool/node.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index e246bf997..fbbc4be64 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -1217,6 +1217,7 @@ Handle *Node::handleToward(Node *to) return back(); } g_error("Node::handleToward(): second node is not adjacent!"); + return NULL; } Node *Node::nodeToward(Handle *dir) @@ -1228,6 +1229,7 @@ Node *Node::nodeToward(Handle *dir) return _prev(); } g_error("Node::nodeToward(): handle is not a child of this node!"); + return NULL; } Handle *Node::handleAwayFrom(Node *to) @@ -1239,6 +1241,7 @@ Handle *Node::handleAwayFrom(Node *to) return front(); } g_error("Node::handleAwayFrom(): second node is not adjacent!"); + return NULL; } Node *Node::nodeAwayFrom(Handle *h) @@ -1250,6 +1253,7 @@ Node *Node::nodeAwayFrom(Handle *h) return _next(); } g_error("Node::nodeAwayFrom(): handle is not a child of this node!"); + return NULL; } Glib::ustring Node::_getTip(unsigned state) const -- cgit v1.2.3 From 9ab9abf19bfa43ade88b449cd7631fbc5854caa3 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 22 Mar 2014 13:25:02 +0100 Subject: libcroco: don't write double parenthesis unnecessarily (interferes with the very useful clang parenthesis/assignment warning mechanism) (bzr r13184) --- src/libcroco/cr-parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libcroco/cr-parser.c b/src/libcroco/cr-parser.c index f14f8a015..69b521496 100644 --- a/src/libcroco/cr-parser.c +++ b/src/libcroco/cr-parser.c @@ -2430,14 +2430,14 @@ cr_parser_parse_stylesheet (CRParser * a_this) import_string, NULL, &location) ; - if ((PRIVATE (a_this)->sac_handler->resolve_import == TRUE)) { + if (PRIVATE (a_this)->sac_handler->resolve_import == TRUE) { /* *TODO: resolve the *import rule. */ } - if ((PRIVATE (a_this)->sac_handler->import_style_result)) { + if (PRIVATE (a_this)->sac_handler->import_style_result) { PRIVATE (a_this)->sac_handler->import_style_result (PRIVATE (a_this)->sac_handler, media_list, import_string, -- cgit v1.2.3 From 4bc006ff078c6c1d91fa86d472a97e78c8261a0c Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 22 Mar 2014 14:51:44 +0100 Subject: libuemf: more self-assignment -> unused changes (bzr r13185) --- src/libuemf/uwmf_endian.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libuemf/uwmf_endian.c b/src/libuemf/uwmf_endian.c index 6caa24d8f..5fbb450dc 100644 --- a/src/libuemf/uwmf_endian.c +++ b/src/libuemf/uwmf_endian.c @@ -24,6 +24,8 @@ extern "C" { #include "uwmf.h" #include "uwmf_endian.h" +#define UNUSED(x) (void)(x) + // hide almost everything in this file from Doxygen //! \cond /* Prototypes for functions used here and defined in uemf_endian.c, but which are not supposed @@ -282,7 +284,7 @@ by end user code and to further that end prototypes are NOT provided and they ar /* Size16 EVERY record type should call this, directly or indirectly*/ void U_WMRCORE_SIZE16_swap(char *record, int torev){ - torev = torev; // shuts up compiler warnings about unused parameters + UNUSED(torev); U_swap4(record, 1); /* Size16_4 is at offset 0 in U_METARECORD */ } @@ -307,7 +309,7 @@ void U_WMRCORE_U16_N16_swap(char *record, int torev){ /* all records that specify palette objects */ void U_WMRCORE_PALETTE_swap(char *record, int torev){ - torev = torev; // shuts up compiler warnings about unused parameters + UNUSED(torev); U_WMRCORE_SIZE16_swap(record, torev); palette_swap(record + offsetof(U_WMRANIMATEPALETTE,Palette)); } @@ -700,7 +702,7 @@ void U_WMRDIBCREATEPATTERNBRUSH_swap(char *record, int torev){ } void U_WMRSTRETCHDIB_swap(char *record, int torev){ - torev = torev; + UNUSED(torev); U_WMRCORE_U32_N16_swap(record,9,torev); dibheader_swap(record + offsetof(U_WMRSTRETCHDIB,dib), torev); } -- cgit v1.2.3 From 049186720d57e2b2dce66a8bfd1efe29a797de44 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 23 Mar 2014 14:41:29 +0100 Subject: gradient midpoint dragging: fix terrible bug in the code (don't know it's phenotype) (bzr r13186) --- src/gradient-drag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 6773069de..8a0d7ee26 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -2387,7 +2387,7 @@ void GrDrag::selected_move(double x, double y, bool write_repr, bool scale_radia gr_midpoint_limits(dragger, server, &begin, &end, &low_lim, &high_lim, &moving); Geom::LineSegment ls(low_lim, high_lim); - Geom::Point p = ls.pointAt(ls.nearestPoint(dragger->point + p)); + Geom::Point p = ls.pointAt(ls.nearestPoint(dragger->point + Geom::Point(x,y))); Geom::Point displacement = p - dragger->point; for (GSList const* i = moving; i != NULL; i = i->next) { -- cgit v1.2.3 From 7aeac5c7dfc317ad37bcc8a9d90556a852f316ed Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 23 Mar 2014 15:04:45 +0100 Subject: powerstroke: fix bad coding bug! (bzr r13188) --- src/live_effects/lpe-powerstroke.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index acf8ab6a5..90b01aaa4 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -305,7 +305,6 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise const & y, // width path LineJoinType jointype, double miter_limit, - bool /*forward_direction*/, double tol=Geom::EPSILON) { /* per definition, each discontinuity should be fixed with a join-ending, as defined by linejoin_type @@ -608,7 +607,7 @@ LPEPowerStroke::doEffect_path (std::vector const & path_in) Piecewise > pwd2_out = compose(pwd2_in,x) + y*compose(n,x); Piecewise > mirrorpath = reverse(compose(pwd2_in,x) - y*compose(n,x)); - Geom::Path fixed_path = path_from_piecewise_fix_cusps( pwd2_out, y, jointype, miter_limit, LPE_CONVERSION_TOLERANCE); + Geom::Path fixed_path = path_from_piecewise_fix_cusps( pwd2_out, y, jointype, miter_limit, LPE_CONVERSION_TOLERANCE); Geom::Path fixed_mirrorpath = path_from_piecewise_fix_cusps( mirrorpath, reverse(y), jointype, miter_limit, LPE_CONVERSION_TOLERANCE); if (path_in[0].closed()) { -- cgit v1.2.3 From de8450cc3161988edb0ffb713d94fe10bb5412e6 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 23 Mar 2014 17:02:42 +0100 Subject: emf-print.cpp : fix coding... :'( (bzr r13189) --- src/extension/internal/emf-print.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 4bb892821..ed25bf767 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -915,17 +915,13 @@ int PrintEmf::vector_rect_alignment(double angle, Geom::Point vtest){ are slightly displaced. */ Geom::Point PrintEmf::get_pathrect_corner(Geom::Path pathRect, double angle, int corner){ - Geom::Point v1 = Geom::Point(1,0) * Geom::Rotate(-angle); // unit horizontal side (sign change because Y increases DOWN) - Geom::Point v2 = Geom::Point(0,1) * Geom::Rotate(-angle); // unit vertical side (sign change because Y increases DOWN) - Geom::Point center, P1; - int LR; // 1 if Left, 0 if Right - int UL; // 1 if Lower, 0 if Upper (as viewed on screen, y coordinates increase downwards) - center = Geom::Point(0,0); - Geom::Path::const_iterator cit = pathRect.begin(); - for(; cit != pathRect.end_open();++cit) { + Geom::Point center(0,0); + for(Geom::Path::const_iterator cit = pathRect.begin(); cit != pathRect.end_open(); ++cit) { center += cit->initialPoint()/4.0; } + int LR; // 1 if Left, 0 if Right + int UL; // 1 if Lower, 0 if Upper (as viewed on screen, y coordinates increase downwards) switch(corner){ case 1: //UR LR = 0; @@ -944,11 +940,15 @@ Geom::Point PrintEmf::get_pathrect_corner(Geom::Path pathRect, double angle, int UL = 0; break; } - cit = pathRect.begin(); - for(int i; cit != pathRect.end_open();++cit,i++) { + + Geom::Point v1 = Geom::Point(1,0) * Geom::Rotate(-angle); // unit horizontal side (sign change because Y increases DOWN) + Geom::Point v2 = Geom::Point(0,1) * Geom::Rotate(-angle); // unit vertical side (sign change because Y increases DOWN) + Geom::Point P1; + for(Geom::Path::const_iterator cit = pathRect.begin(); cit != pathRect.end_open(); ++cit) { P1 = cit->initialPoint(); - if((LR == (dot(P1 - center,v1)> 0 ? 0 : 1)) && - (UL == (dot(P1 - center,v2)> 0 ? 1 : 0)))break; + + if ( ( LR == (dot(P1 - center,v1) > 0 ? 0 : 1) ) + && ( UL == (dot(P1 - center,v2) > 0 ? 1 : 0) ) ) break; } return(P1); } -- cgit v1.2.3 From d8bca572c833841866ac4fd1cf1aef139a9b9fc0 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 23 Mar 2014 18:35:36 +0100 Subject: fix Windows build for newer gcc/libs (bzr r13190) --- src/inkscape.cpp | 5 ++++- src/winmain.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 8c4ba5695..54451aba4 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -32,7 +32,10 @@ # define HAS_PROC_SELF_EXE //to get path of executable #else -#define _WIN32_IE 0x0400 +#if !defined(_WIN32_IE) || (_WIN32_IE < 0x0400) +# undef _WIN32_IE +# define _WIN32_IE 0x0400 +#endif //#define HAS_SHGetSpecialFolderPath #define HAS_SHGetSpecialFolderLocation #define HAS_GetModuleFileName diff --git a/src/winmain.cpp b/src/winmain.cpp index 607660740..5120e44e0 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -11,7 +11,12 @@ #include #include #include -#define _WIN32_WINNT 0x0501 + +#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501) +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +#endif + #include extern int main (int argc, char **argv); -- cgit v1.2.3 From 3a4bbd50a7b0f06b8bb126db2af10782d91eda28 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 23 Mar 2014 18:59:12 +0100 Subject: remove files that interface through C with libvpsc, we are using C++ so... (bzr r13191) --- src/libvpsc/CMakeLists.txt | 2 - src/libvpsc/Makefile_insert | 2 - src/libvpsc/csolve_VPSC.cpp | 128 -------------------------------------------- src/libvpsc/csolve_VPSC.h | 72 ------------------------- 4 files changed, 204 deletions(-) delete mode 100644 src/libvpsc/csolve_VPSC.cpp delete mode 100644 src/libvpsc/csolve_VPSC.h (limited to 'src') diff --git a/src/libvpsc/CMakeLists.txt b/src/libvpsc/CMakeLists.txt index 4099900b5..aa693670c 100644 --- a/src/libvpsc/CMakeLists.txt +++ b/src/libvpsc/CMakeLists.txt @@ -3,7 +3,6 @@ set(libvpsc_SRC block.cpp blocks.cpp constraint.cpp - csolve_VPSC.cpp generate-constraints.cpp remove_rectangle_overlap.cpp solve_VPSC.cpp @@ -16,7 +15,6 @@ set(libvpsc_SRC block.h blocks.h constraint.h - csolve_VPSC.h generate-constraints.h pairingheap/PairingHeap.h pairingheap/dsexceptions.h diff --git a/src/libvpsc/Makefile_insert b/src/libvpsc/Makefile_insert index 4af86324e..cb05be6c0 100644 --- a/src/libvpsc/Makefile_insert +++ b/src/libvpsc/Makefile_insert @@ -11,7 +11,6 @@ libvpsc_libvpsc_a_SOURCES = libvpsc/block.cpp\ libvpsc/pairingheap/PairingHeap.cpp\ libvpsc/remove_rectangle_overlap.cpp\ libvpsc/solve_VPSC.cpp\ - libvpsc/csolve_VPSC.cpp\ libvpsc/variable.cpp\ libvpsc/block.h\ libvpsc/blocks.h\ @@ -21,5 +20,4 @@ libvpsc_libvpsc_a_SOURCES = libvpsc/block.cpp\ libvpsc/pairingheap/dsexceptions.h\ libvpsc/remove_rectangle_overlap.h\ libvpsc/solve_VPSC.h\ - libvpsc/csolve_VPSC.h\ libvpsc/variable.h diff --git a/src/libvpsc/csolve_VPSC.cpp b/src/libvpsc/csolve_VPSC.cpp deleted file mode 100644 index 60e88a50b..000000000 --- a/src/libvpsc/csolve_VPSC.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Bridge for C programs to access solve_VPSC (which is in C++). - * - * Authors: - * Tim Dwyer - * - * Copyright (C) 2005 Authors - * - * Released under GNU LGPL. Read the file 'COPYING' for more information. - */ -#include -#include -#include -#include -#include "variable.h" -#include "constraint.h" -#include "generate-constraints.h" -#include "solve_VPSC.h" -#include "csolve_VPSC.h" -using namespace vpsc; -extern "C" { -Variable* newVariable(int id, double desiredPos, double weight) { - return new Variable(id,desiredPos,weight); -} -Constraint* newConstraint(Variable* left, Variable* right, double gap) { - return new Constraint(left,right,gap); -} -Solver* newSolver(int n, Variable* vs[], int m, Constraint* cs[]) { - return new Solver(n,vs,m,cs); -} -Solver* newIncSolver(int n, Variable* vs[], int m, Constraint* cs[]) { - return (Solver*)new vpsc::IncSolver(n,vs,m,cs); -} - -int genXConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs,int transitiveClosure) { - Rectangle* rs[n]; - for(int i=0;i 0); - Rectangle* rs[n]; - for(int i=0;isatisfy(); - } catch(const char *e) { - std::cerr << e << std::endl; - exit(1); - } -} -int getSplitCnt(IncSolver *vpsc) { - return vpsc->splitCnt; -} -void deleteVPSC(Solver *vpsc) { - assert(vpsc!=NULL); - delete vpsc; -} -void solveVPSC(Solver* vpsc) { - vpsc->solve(); -} -void splitIncVPSC(IncSolver* vpsc) { - vpsc->splitBlocks(); -} -void setVariableDesiredPos(Variable *v, double desiredPos) { - v->desiredPosition = desiredPos; -} -double getVariablePos(Variable *v) { - return v->position(); -} -void remapInConstraints(Variable *u, Variable *v, double dgap) { - for(Constraints::iterator i=u->in.begin();i!=u->in.end();i++) { - Constraint* c=*i; - c->right=v; - c->gap+=dgap; - v->in.push_back(c); - } - u->in.clear(); -} -void remapOutConstraints(Variable *u, Variable *v, double dgap) { - for(Constraints::iterator i=u->out.begin();i!=u->out.end();i++) { - Constraint* c=*i; - c->left=v; - c->gap+=dgap; - v->out.push_back(c); - } - u->out.clear(); -} -int getLeftVarID(Constraint *c) { - return c->left->id; -} -int getRightVarID(Constraint *c){ - return c->right->id; -} -double getSeparation(Constraint *c){ - return c->gap; -} -} diff --git a/src/libvpsc/csolve_VPSC.h b/src/libvpsc/csolve_VPSC.h deleted file mode 100644 index edfd16657..000000000 --- a/src/libvpsc/csolve_VPSC.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file - * Bridge for C programs to access solve_VPSC (which is in C++). - */ -/* - * Authors: - * Tim Dwyer - * - * Copyright (C) 2005 Authors - * - * Released under GNU LGPL. Read the file 'COPYING' for more information. - */ -#ifndef CSOLVE_VPSC_H_ -#define CSOLVE_VPSC_H_ -#ifdef __cplusplus -namespace vpsc -{ - class Variable; - class Constraint; - class Solver; - class IncSolver; -} -/* TODO 'using' should never be in a .h file. We need a different approach here. */ -using vpsc::Variable; -using vpsc::Constraint; -using vpsc::Solver; -using vpsc::IncSolver; -extern "C" { -#else -typedef struct Variable Variable; -typedef struct Constraint Constraint; -typedef struct Solver Solver; -typedef struct IncSolver IncSolver; -#endif - -Variable* newVariable(int id, double desiredPos, double weight); -void setVariableDesiredPos(Variable *, double desiredPos); -double getVariablePos(Variable*); - -Constraint* newConstraint(Variable* left, Variable* right, double gap); - -Solver* newSolver(int n, Variable* vs[], int m, Constraint* cs[]); -void deleteSolver(Solver*); -void deleteConstraint(Constraint*); -void deleteVariable(Variable*); -Constraint** newConstraints(int m); -void deleteConstraints(int m,Constraint**); -void remapInConstraints(Variable *u, Variable *v, double dgap); -void remapOutConstraints(Variable *u, Variable *v, double dgap); -int getLeftVarID(Constraint *c); -int getRightVarID(Constraint *c); -double getSeparation(Constraint *c); - -#ifndef HAVE_POINTF_S -typedef struct pointf_s { double x, y; } pointf; -typedef struct { pointf LL, UR; } boxf; -#endif -int genXConstraints(int n, boxf[], Variable** vs, Constraint*** cs, - int transitiveClosure); -int genYConstraints(int n, boxf[], Variable** vs, Constraint*** cs); - -void satisfyVPSC(Solver*); -void deleteVPSC(Solver*); -void solveVPSC(Solver*); -void splitIncVPSC(IncSolver*); -Solver* newIncSolver(int n, Variable* vs[], int m, Constraint* cs[]); -void splitIncSolver(IncSolver*); -int getSplitCnt(IncSolver *vpsc); -#ifdef __cplusplus -} -#endif -#endif /* CSOLVE_VPSC_H_ */ -- cgit v1.2.3 From 149a53e28c2ba291e9bca8a0b7512db3231c92f5 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 23 Mar 2014 21:46:53 +0100 Subject: "fix" GTK3 build. (bzr r13192) --- src/ui/dialog/input.cpp | 82 ++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 82e65435d..2d4755fd2 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -53,10 +53,10 @@ /* XPM */ static char const * core_xpm[] = { "16 16 4 1", -" c None", -". c #808080", -"+ c #000000", -"@ c #FFFFFF", +" c None", +". c #808080", +"+ c #000000", +"@ c #FFFFFF", " ", " ", " ", @@ -291,9 +291,9 @@ static char const *button_on[] = { /* XPM */ static char const * axis_none_xpm[] = { "24 8 3 1", -" c None", -". c #000000", -"+ c #808080", +" c None", +". c #000000", +"+ c #808080", " ", " .++++++++++++++++++. ", " .+ . .+. ", @@ -305,10 +305,10 @@ static char const * axis_none_xpm[] = { /* XPM */ static char const * axis_off_xpm[] = { "24 8 4 1", -" c None", -". c #808080", -"+ c #000000", -"@ c #FFFFFF", +" c None", +". c #808080", +"+ c #000000", +"@ c #FFFFFF", " ", " .++++++++++++++++++. ", " .+@@@@@@@@@@@@@@@@@@+. ", @@ -320,9 +320,9 @@ static char const * axis_off_xpm[] = { /* XPM */ static char const * axis_on_xpm[] = { "24 8 3 1", -" c None", -". c #000000", -"+ c #00FF00", +" c None", +". c #000000", +"+ c #00FF00", " ", " .................... ", " ..++++++++++++++++++.. ", @@ -1707,9 +1707,9 @@ void InputDialogImpl::updateTestAxes( Glib::ustring const& key, GdkDevice* dev ) axesValues[i].set_sensitive(true); if ( dev && (i < static_cast(G_N_ELEMENTS(axesValues)) ) ) { // FIXME: Device axis ranges are inaccessible in GTK+ 3 and - // are deprecated in GTK+ 2. Progress-bar ranges are disabled - // until we find an alternative solution - + // are deprecated in GTK+ 2. Progress-bar ranges are disabled + // until we find an alternative solution + // if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) { axesValues[i].set_sensitive(true); // axesValues[i].set_fraction( (axesMap[key][i].second- dev->axes[i].min) / (dev->axes[i].max - dev->axes[i].min) ); @@ -1726,10 +1726,10 @@ void InputDialogImpl::updateTestAxes( Glib::ustring const& key, GdkDevice* dev ) if ( dev && (i < static_cast(G_N_ELEMENTS(axesValues)) ) ) { // FIXME: Device axis ranges are inaccessible in GTK+ 3 and - // are deprecated in GTK+ 2. Progress-bar ranges are disabled - // until we find an alternative solution + // are deprecated in GTK+ 2. Progress-bar ranges are disabled + // until we find an alternative solution - // if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) { + // if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) { axesValues[i].set_sensitive(true); // axesValues[i].set_fraction( (axesMap[key][i].second- dev->axes[i].min) / (dev->axes[i].max - dev->axes[i].min) ); // } @@ -1860,8 +1860,8 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event) GdkEventButton* btnEvt = reinterpret_cast(event); if ( btnEvt->device ) { key = getKeyFor(btnEvt->device); - source = gdk_device_get_source(btnEvt->device); - devName = gdk_device_get_name(btnEvt->device); + source = gdk_device_get_source(btnEvt->device); + devName = gdk_device_get_name(btnEvt->device); mapAxesValues(key, btnEvt->axes, btnEvt->device); if ( buttonMap[key].find(btnEvt->button) == buttonMap[key].end() ) { @@ -1889,8 +1889,8 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event) GdkEventMotion* btnMtn = reinterpret_cast(event); if ( btnMtn->device ) { key = getKeyFor(btnMtn->device); - source = gdk_device_get_source(btnMtn->device); - devName = gdk_device_get_name(btnMtn->device); + source = gdk_device_get_source(btnMtn->device); + devName = gdk_device_get_name(btnMtn->device); mapAxesValues(key, btnMtn->axes, btnMtn->device); } gchar* name = gtk_accelerator_name(0, static_cast(btnMtn->state)); @@ -1915,19 +1915,16 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event) if ( (lastSourceSeen != source) || (lastDevnameSeen != devName) ) { switch (source) { - case GDK_SOURCE_MOUSE: - { + case GDK_SOURCE_MOUSE: { testThumb.set(getPix(PIX_CORE)); + break; } - break; - case GDK_SOURCE_CURSOR: - { -// g_message("flip to cursor"); + case GDK_SOURCE_CURSOR: { +// g_message("flip to cursor"); testThumb.set(getPix(PIX_MOUSE)); + break; } - break; - case GDK_SOURCE_PEN: - { + case GDK_SOURCE_PEN: { if (devName == _("pad")) { // g_message("flip to pad"); testThumb.set(getPix(PIX_SIDEBUTTONS)); @@ -1935,17 +1932,24 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event) // g_message("flip to pen"); testThumb.set(getPix(PIX_TIP)); } + break; } - break; - case GDK_SOURCE_ERASER: - { + case GDK_SOURCE_ERASER: { // g_message("flip to eraser"); testThumb.set(getPix(PIX_ERASER)); + break; } - break; -// default: -// g_message("gurgle"); +#if WITH_GTKMM_3_0 + /// \fixme GTK3 added new GDK_SOURCEs that should be handled here! + case GDK_SOURCE_KEYBOARD: + case GDK_SOURCE_TOUCHSCREEN: + case GDK_SOURCE_TOUCHPAD: { + g_warning("InputDialogImpl::eventSnoop : unhandled GDK_SOURCE type!"); + break; + } +#endif } + updateTestButtons(key, hotButton); lastSourceSeen = source; lastDevnameSeen = devName; -- cgit v1.2.3