1 Index: navit/configure.in
2 ===================================================================
3 --- navit.orig/configure.in 2010-02-05 00:57:22.000000000 +0100
4 +++ navit/configure.in 2010-02-05 00:58:19.127738212 +0100
9 + PKG_CHECK_MODULES(LIBOSSO, libosso, [
10 + AC_DEFINE(HAVE_OSSO, 1, [Have the osso library])
11 + AC_SUBST(OSSO_CFLAGS)
16 if test x"${enable_hildon}" = xyes ; then
17 AC_DEFINE(USE_HILDON, 1, [Build with maemo/hildon support])
18 AC_SUBST(HILDON_CFLAGS)
19 Index: navit/navit/Makefile.am
20 ===================================================================
21 --- navit.orig/navit/Makefile.am 2010-02-05 00:57:22.000000000 +0100
22 +++ navit/navit/Makefile.am 2010-02-05 00:58:19.148160706 +0100
27 -AM_CPPFLAGS = -I$(top_srcdir)/navit/fib-1.1 @NAVIT_CFLAGS@ @ZLIB_CFLAGS@ -DPREFIX=\"@prefix@\" -DLIBDIR=\"@libdir@\" -DMODULE=navit
28 +AM_CPPFLAGS = -I$(top_srcdir)/navit/fib-1.1 @NAVIT_CFLAGS@ @LIBOSSO_CFLAGS@ @ZLIB_CFLAGS@ -DPREFIX=\"@prefix@\" -DLIBDIR=\"@libdir@\" -DMODULE=navit
29 BUILT_SOURCES = version.h navit_config.h
35 navit_SOURCES = start.c
36 -navit_LDADD = libnavit.la @NAVIT_LIBS@ @WORDEXP_LIBS@ @ZLIB_LIBS@ @INTLLIBS@ -Lfib-1.1 -lfib
37 +navit_LDADD = libnavit.la @NAVIT_LIBS@ @WORDEXP_LIBS@ @LIBOSSO_LIBS@ @ZLIB_LIBS@ @INTLLIBS@ -Lfib-1.1 -lfib
41 Index: navit/navit/attr_def.h
42 ===================================================================
43 --- navit.orig/navit/attr_def.h 2010-02-05 00:55:56.000000000 +0100
44 +++ navit/navit/attr_def.h 2010-02-05 00:58:19.150834975 +0100
49 +ATTR(screen_unblank) /* for N8x0 */
53 Index: navit/navit/gui/internal/gui_internal.c
54 ===================================================================
55 --- navit.orig/navit/gui/internal/gui_internal.c 2010-02-05 00:46:35.000000000 +0100
56 +++ navit/navit/gui/internal/gui_internal.c 2010-02-05 00:58:19.150834975 +0100
58 graphics_draw_mode(this->gra, draw_mode_end);
59 this->win->fullscreen(this->win, attr->u.num > 0);
60 graphics_draw_mode(this->gra, draw_mode_begin);
62 + navit_osso_fullscreen(this->nav, attr->u.num > 0);
65 this->fullscreen=attr->u.num;
67 Index: navit/navit/navit.h
68 ===================================================================
69 --- navit.orig/navit/navit.h 2010-02-05 00:41:18.000000000 +0100
70 +++ navit/navit/navit.h 2010-02-05 00:58:19.150834975 +0100
72 void navit_ignore_graphics_events(struct navit *this_, int ignore);
73 int navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback);
74 void navit_handle_motion(struct navit *this_, struct point *p);
76 +void navit_osso_display_on(struct navit *this_);
77 +void navit_osso_fullscreen(struct navit *this_, int fullscreen);
79 void navit_zoom_in(struct navit *this_, int factor, struct point *p);
80 void navit_zoom_out(struct navit *this_, int factor, struct point *p);
81 struct navit *navit_new(struct attr *parent, struct attr **attrs);
82 Index: navit/navit/xpm/Makefile.am
83 ===================================================================
84 --- navit.orig/navit/xpm/Makefile.am 2010-02-05 00:55:56.000000000 +0100
85 +++ navit/navit/xpm/Makefile.am 2010-02-05 00:59:52.957318625 +0100
89 DESKTOPFILEdir=$(datadir)/applications
92 + DESKTOPFILE_DATA = desktop_icons/navit.desktop, desktop_icons/org.navit-project.Navit.service
94 DESKTOPFILE_DATA = desktop_icons/navit.desktop
97 ICON128dir=$(datadir)/icons/hicolor/128x128/apps
98 ICON128_DATA = desktop_icons/128x128/navit.png
99 Index: navit/navit/navit.c
100 ===================================================================
101 --- navit.orig/navit/navit.c 2010-02-05 00:46:22.368648992 +0100
102 +++ navit/navit/navit.c 2010-02-05 00:58:19.150834975 +0100
104 #include "messages.h"
105 #include "vehicleprofile.h"
106 #include "sunriset.h"
109 +#include "libosso.h"
112 * @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
117 int zoom_min, zoom_max;
119 + osso_context_t *osso_context;
120 + gboolean fullscreen; // True=fullscreen
121 + int screen_unblank; // 0=never, 1=GPS event, 2=fullscreen
125 +struct navit *global_navit;
127 struct gui *main_loop_gui;
130 @@ -160,6 +169,102 @@
131 static void navit_cmd_announcer_toggle(struct navit *this_);
132 static void navit_set_vehicle(struct navit *this_, struct navit_vehicle *nv);
136 + * Remember state of Fullscreen
138 + * @param navit our context
139 + * @param fullscreen indicates whether we have full screen
143 +navit_osso_fullscreen(struct navit *this_, int fullscreen)
145 + dbg(2,"setting fullscreen to %s\n", fullscreen == 0 ? "no":"yes");
146 + this_->fullscreen = (fullscreen == 1);
150 + * * Tell osso to unblank the screen
152 + * * @param navit our context
153 + * * @returns nothing
156 +navit_osso_display_on(struct navit *this_)
159 + dbg(2,"unblank screen: fs=%d, unblank on: %d\n", this_->fullscreen, this_->screen_unblank);
160 + switch (this_->screen_unblank) {
163 + case 1: // GPS event
164 + //osso_display_state_on(this_->osso_context);
165 + err=osso_display_blanking_pause(this_->osso_context);
166 + dbg(1,"Unblank result: ", err == OSSO_OK ? "Ok" : (err == OSSO_ERROR ? "Error" : "Invalid context"));
168 + case 2: // fullscreen
169 + if (this_->fullscreen) {
170 + //osso_display_state_on(this_->osso_context);
171 + err=osso_display_blanking_pause(this_->osso_context);
172 + dbg(1,"Unblank result: ", err == OSSO_OK ? "Ok" : (err == OSSO_ERROR ? "Error" : "Invalid context"));
180 + * * Act on Osso event
181 + * * @param state The oss hardware state
185 +osso_cb_hw_state_idle(osso_hw_state_t *state)
187 + dbg(0,"(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n",
188 + state->system_inactivity_ind,
189 + state->save_unsaved_data_ind, state->shutdown_ind,
190 + state->memory_low_ind, state->sig_device_mode_ind);
192 + if(state->shutdown_ind)
194 + /* we are going down, down, down */
195 + navit_destroy(global_navit);
198 +/* figure this out later
199 + if(state->save_unsaved_data_ind)
201 + // save all our data, if any
204 + if(state->memory_low_ind)
206 + // do something to reduce memory needs
215 + * * Handle osso events
216 + * * @param state Osso hardware state
217 + * * @param data ptr to private data
218 + * * @returns nothing
221 +osso_cb_hw_state(osso_hw_state_t *state, gpointer data)
223 + osso_hw_state_t *state_copy = g_new(osso_hw_state_t, 1);
224 + memcpy(state_copy, state, sizeof(osso_hw_state_t));
225 + g_idle_add((GSourceFunc)osso_cb_hw_state_idle, state_copy);
231 navit_add_mapset(struct navit *this_, struct mapset *ms)
238 + this_->screen_unblank = 1; // 1=GPS
241 transform_setup(this_->trans, ¢er, zoom, (this_->orientation != -1) ? this_->orientation : 0);
242 for (;*attrs; attrs++) {
243 navit_set_attr_do(this_, *attrs, 1);
244 @@ -1031,8 +1140,6 @@
245 callback_list_call_attr_0(this_->attr_cbl, attr_bookmark_map);
248 -struct navit *global_navit;
251 navit_add_bookmarks_from_file(struct navit *this_)
253 @@ -1395,6 +1502,19 @@
254 navit_window_items_new(this_);
258 + dbg(1,"Installing osso context for org.navit-project.navit\n");
259 + this_->osso_context = osso_initialize("org.navit-project.navit",
260 + VERSION, TRUE, NULL);
261 + if(this_->osso_context == NULL) {
262 + dbg(0, "error initiating osso context\n");
264 + osso_hw_set_event_cb(this_->osso_context, NULL, osso_cb_hw_state, NULL);
266 + /* add callback to unblank screen on gps event */
267 + navit_add_callback(this_, callback_new_attr_1(callback_cast(navit_osso_display_on), attr_position_coord_geo, this_));
270 messagelist_init(this_->messages);
272 navit_set_cursors(this_);
273 @@ -1746,6 +1866,14 @@
274 attr_updated=(this_->center_timeout != attr->u.num);
275 this_->center_timeout = attr->u.num;
277 + // screen unblank for Nokia N8x0
278 + case attr_screen_unblank:
279 + if (!strcmp(attr->u.str,"GPS"))
280 + this_->screen_unblank = 1;
281 + if (!strcmp(attr->u.str, "fullscreen"))
282 + this_->screen_unblank = 2;
283 + dbg(1,"screen_unblank set to %d\n",this_->screen_unblank);
286 attr_updated=(this_->tracking_flag != !!attr->u.num);
287 this_->tracking_flag=!!attr->u.num;
288 @@ -2448,6 +2576,12 @@
290 navit_destroy(struct navit *this_)
294 + dbg(1,"Disconnecting from osso\n");
295 + osso_deinitialize(this_->osso_context);
298 /* TODO: destroy objects contained in this_ */
300 vehicle_destroy(this_->vehicle->vehicle);