Ticket #282: p282-r3313.patch
File p282-r3313.patch, 5.1 KB (added by www.google.com/accounts/o8/id?id=aitoawkf0frlp4x3vjbz-vqlc-bpyhbdworle10, 11 years ago) |
---|
-
navit/Makefile.am
26 26 AM_CPPFLAGS = -I$(top_srcdir)/navit/fib-1.1 @NAVIT_CFLAGS@ @ZLIB_CFLAGS@ -DPREFIX=\"@prefix@\" -DLIBDIR=\"@libdir@\" -DMODULE=navit 27 27 BUILT_SOURCES = version.h navit_config.h 28 28 29 if USE_OSSO 30 AM_CPPFLAGS += @LIBOSSO_CFLAGS@ 31 endif 32 29 33 if BIN_NAVIT 30 34 bin_PROGRAMS = navit 31 35 endif … … 42 46 lib@LIBNAVIT@_la_LIBADD += -Lsupport/libc -lsupport_libc 43 47 endif 44 48 49 if USE_OSSO 50 lib@LIBNAVIT@_la_LIBADD += @LIBOSSO_LIBS@ 51 endif 52 45 53 pkgdata_DATA = navit.xml 46 54 47 55 EXTRA_DIST = navit_shipped.xml navit.dtd … … 121 129 navit_LDADD += -lgdi32 -lcomctl32 -lwinmm 122 130 endif 123 131 132 if USE_OSSO 133 navit_LDADD += @LIBOSSO_CFLAGS@ 134 endif 124 135 125 136 resource.rsc: $(top_srcdir)/navit/gui/win32/resources/resource.rc 126 137 $(WINDRES) -I $(top_srcdir)/navit/gui/win32/resources $(top_srcdir)/navit/gui/win32/resources/resource.rc resource.rsc -
navit/navit.c
63 63 #include "sunriset.h" 64 64 #include "bookmarks.h" 65 65 66 #ifdef HAVE_OSSO 67 #include "libosso.h" 68 #endif 69 66 70 /** 67 71 * @defgroup navit the navit core instance. navit is the object containing nearly everything: A set of maps, one or more vehicle, a graphics object for rendering the map, a gui object for displaying the user interface, a route object, a navigation object and so on. Be warned that it is theoretically possible to have more than one navit object 68 72 * @{ … … 142 146 int flags; 143 147 /* 1=No graphics ok */ 144 148 /* 2=No gui ok */ 149 #ifdef HAVE_OSSO 150 osso_context_t *osso_context; 151 #endif 145 152 }; 146 153 147 154 struct gui *main_loop_gui; … … 702 709 {"fmt_coordinates",command_cast(navit_cmd_fmt_coordinates)}, 703 710 }; 704 711 712 #ifdef HAVE_OSSO 713 static void 714 navit_osso_display_on(struct navit *this_) 715 { 716 osso_return_t err; 717 err=osso_display_blanking_pause(this_->osso_context); 718 dbg(1,"Unblank result: ", err == OSSO_OK ? "Ok" : (err == OSSO_ERROR ? "Error" : "Invalid context")); 719 } 705 720 721 static gboolean 722 osso_cb_hw_state_idle(osso_hw_state_t *state) 723 { 724 dbg(0,"(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n", 725 state->system_inactivity_ind, 726 state->save_unsaved_data_ind, state->shutdown_ind, 727 state->memory_low_ind, state->sig_device_mode_ind); 728 729 if(state->shutdown_ind) 730 { 731 /* we are going down, down, down */ 732 navit_destroy(global_navit); 733 exit(1); 734 } 735 736 g_free(state); 737 738 return FALSE; 739 } 740 741 /** 742 * * Handle osso events 743 * * @param state Osso hardware state 744 * * @param data ptr to private data 745 * * @returns nothing 746 **/ 747 static void 748 osso_cb_hw_state(osso_hw_state_t *state, gpointer data) 749 { 750 osso_hw_state_t *state_copy = g_new(osso_hw_state_t, 1); 751 memcpy(state_copy, state, sizeof(osso_hw_state_t)); 752 g_idle_add((GSourceFunc)osso_cb_hw_state_idle, state_copy); 753 } 754 #endif /* HAVE_OSSO */ 755 706 756 struct navit * 707 757 navit_new(struct attr *parent, struct attr **attrs) 708 758 { … … 753 803 command_add_table(this_->attr_cbl, commands, sizeof(commands)/sizeof(struct command_table), this_); 754 804 755 805 this_->messages = messagelist_new(attrs); 756 806 807 #ifdef HAVE_OSSO 808 dbg(1,"Installing osso context for org.navit_project.navit\n"); 809 this_->osso_context = osso_initialize("org.navit_project.navit",VERSION, TRUE, NULL); 810 if(this_->osso_context == NULL) { 811 dbg(0, "error initiating osso context\n"); 812 } 813 osso_hw_set_event_cb(this_->osso_context, NULL, osso_cb_hw_state, NULL); 814 815 /* add callback to unblank screen on gps event */ 816 navit_add_callback(this_, callback_new_attr_1(callback_cast(navit_osso_display_on), attr_position_coord_geo, this_)); 817 #endif /* HAVE_OSSO */ 818 757 819 return this_; 758 820 } 759 821 … … 2324 2386 void 2325 2387 navit_destroy(struct navit *this_) 2326 2388 { 2389 2390 #ifdef HAVE_OSSO 2391 osso_deinitialize(this_->osso_context); 2392 #endif /* HAVE_OSSO */ 2393 2327 2394 /* TODO: destroy objects contained in this_ */ 2328 2395 if (this_->vehicle) 2329 2396 vehicle_destroy(this_->vehicle->vehicle); -
configure.in
218 218 ], [ 219 219 AC_MSG_RESULT(no) 220 220 ]) 221 PKG_CHECK_MODULES(LIBOSSO, libosso, [ 222 AC_DEFINE(HAVE_OSSO, 1, [Have the osso library]) 223 AC_SUBST(OSSO_CFLAGS) 224 AC_SUBST(OSSO_LIBS) 225 enable_osso=yes 226 ], [ 227 enable_osso=no 228 AC_MSG_RESULT(no) 229 ]) 221 230 if test x"${enable_hildon}" = xyes ; then 222 231 AC_DEFINE(USE_HILDON, 1, [Build with maemo/hildon support]) 223 232 AC_SUBST(HILDON_CFLAGS) … … 225 234 fi 226 235 fi 227 236 AM_CONDITIONAL(USE_HILDON, test "${enable_hildon}" = "xyes") 237 AM_CONDITIONAL(USE_OSSO, [ test "$enable_osso" = "yes" ]) 228 238 229 239 AC_ARG_ENABLE(garmin, [ --disable-garmin disable garmin support], USE_GARMIN=$enableval, USE_GARMIN=yes) 230 240