Ticket #915: 0001-Add-graphics_null-add-an-attribute-event_loop-so-we-.patch

File 0001-Add-graphics_null-add-an-attribute-event_loop-so-we-.patch, 2.3 KB (added by woglinde, 9 years ago)
  • navit/navit/attr_def.h

    From b850d276c356d899006e07d9af6b568351ecae93 Mon Sep 17 00:00:00 2001
    From: woglinde <heinold@inf.fu-berlin.de>
    Date: Fri, 12 Aug 2011 11:42:50 +0200
    Subject: [PATCH] Add:graphics_null: add an attribute event_loop, so we can
     choose if the null graphics can have events, usefull if you
     want run navit as a routing-enginge with dbus and no
     graphics
    
    ---
     navit/navit/attr_def.h                    |    1 +
     navit/navit/graphics/null/graphics_null.c |   15 +++++++++++++--
     navit/navit/navit.dtd                     |    1 +
     3 files changed, 15 insertions(+), 2 deletions(-)
    
    diff --git a/navit/navit/attr_def.h b/navit/navit/attr_def.h
    index 600bdd9..19cae39 100644
    a b ATTR(readwrite) 
    232232ATTR(cache)
    233233ATTR(create)
    234234ATTR(persistent)
     235ATTR(event_loop)
    235236ATTR2(0x0002ffff,type_int_end)
    236237ATTR2(0x00030000,type_string_begin)
    237238ATTR(type)
  • navit/navit/graphics/null/graphics_null.c

    diff --git a/navit/navit/graphics/null/graphics_null.c b/navit/navit/graphics/null/graphics_null.c
    index f69530b..5c1a2cd 100644
    a b  
    2222#ifdef HAVE_UNISTD_H
    2323#include <unistd.h>
    2424#endif
     25#include "item.h"
    2526#include "point.h"
    2627#include "graphics.h"
    2728#include "color.h"
    static struct graphics_priv * 
    230231graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
    231232{
    232233        *meth=graphics_methods;
    233         if (!event_request_system("null","graphics_null"))
    234                 return NULL;
     234        struct attr *event_loop = NULL;
     235
     236        event_loop = attr_search(attrs, NULL, attr_event_loop);
     237
     238        if ((event_loop != NULL) && (event_loop->u.num == 1)) {
     239                if (!event_request_system("glib", "graphics_null"))
     240                        return NULL;
     241        } else {
     242                if (!event_request_system("null", "graphics_null"))
     243                        return NULL;
     244        }
     245
    235246        return &graphics_priv;
    236247}
    237248
  • navit/navit/navit.dtd

    diff --git a/navit/navit/navit.dtd b/navit/navit/navit.dtd
    index 33b6e3c..5d9c144 100644
    a b  
    3333<!ATTLIST gui enabled CDATA #IMPLIED>
    3434<!ELEMENT graphics EMPTY>
    3535<!ATTLIST graphics type CDATA #REQUIRED>
     36<!ATTLIST graphics event_loop CDATA #IMPLIED>
    3637<!ELEMENT vehicle (log*)>
    3738<!ATTLIST vehicle name CDATA #REQUIRED>
    3839<!ATTLIST vehicle source CDATA #REQUIRED>