1 Index: navit/configure.in
2 ===================================================================
3 --- navit.orig/configure.in 2010-01-17 03:57:45.000000000 +0100
4 +++ navit/configure.in 2010-01-17 03:58:01.441732498 +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-01-17 03:57:45.000000000 +0100
22 +++ navit/navit/Makefile.am 2010-01-17 03:58:01.441732498 +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-01-17 03:57:45.000000000 +0100
44 +++ navit/navit/attr_def.h 2010-01-17 03:58:01.441732498 +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-01-17 03:56:03.000000000 +0100
56 +++ navit/navit/gui/internal/gui_internal.c 2010-01-17 03:58:01.441732498 +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-01-17 03:56:03.000000000 +0100
70 +++ navit/navit/navit.h 2010-01-17 03:58:01.445071550 +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-01-17 03:56:03.000000000 +0100
85 +++ navit/navit/xpm/Makefile.am 2010-01-17 03:58:01.445071550 +0100
89 DESKTOPFILEdir=$(datadir)/applications
91 +DESKTOPFILE_DATA = desktop_icons/navit.desktop, desktop_icons/org.navit-project.Navit.service
93 DESKTOPFILE_DATA = desktop_icons/navit.desktop
96 ICON128dir=$(datadir)/icons/hicolor/128x128/apps
97 ICON128_DATA = desktop_icons/128x128/navit.png
98 diff --git a/navit/navit.c b/navit/navit.c
99 index eb92e8b..83a3b88 100644
103 #include "messages.h"
104 #include "vehicleprofile.h"
105 #include "sunriset.h"
108 +#include "libosso.h"
111 * @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
113 @@ -138,8 +140,15 @@ struct navit {
116 int zoom_min, zoom_max;
118 + osso_context_t *osso_context;
119 + gboolean fullscreen; // True=fullscreen
120 + int screen_unblank; // 0=never, 1=GPS event, 2=fullscreen
124 +struct navit *global_navit;
126 struct gui *main_loop_gui;
129 @@ -160,6 +169,102 @@ static void navit_cmd_set_center_cursor(struct navit *this_);
130 static void navit_cmd_announcer_toggle(struct navit *this_);
131 static void navit_set_vehicle(struct navit *this_, struct navit_vehicle *nv);
135 + * Remember state of Fullscreen
137 + * @param navit our context
138 + * @param fullscreen indicates whether we have full screen
142 +navit_osso_fullscreen(struct navit *this_, int fullscreen)
144 + dbg(2,"setting fullscreen to %s\n", fullscreen == 0 ? "no":"yes");
145 + this_->fullscreen = (fullscreen == 1);
149 + * * Tell osso to unblank the screen
151 + * * @param navit our context
152 + * * @returns nothing
155 +navit_osso_display_on(struct navit *this_)
158 + dbg(2,"unblank screen: fs=%d, unblank on: %d\n", this_->fullscreen, this_->screen_unblank);
159 + switch (this_->screen_unblank) {
162 + case 1: // GPS event
163 + //osso_display_state_on(this_->osso_context);
164 + err=osso_display_blanking_pause(this_->osso_context);
165 + dbg(1,"Unblank result: ", err == OSSO_OK ? "Ok" : (err == OSSO_ERROR ? "Error" : "Invalid context"));
167 + case 2: // fullscreen
168 + if (this_->fullscreen) {
169 + //osso_display_state_on(this_->osso_context);
170 + err=osso_display_blanking_pause(this_->osso_context);
171 + dbg(1,"Unblank result: ", err == OSSO_OK ? "Ok" : (err == OSSO_ERROR ? "Error" : "Invalid context"));
179 + * * Act on Osso event
180 + * * @param state The oss hardware state
184 +osso_cb_hw_state_idle(osso_hw_state_t *state)
186 + dbg(0,"(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n",
187 + state->system_inactivity_ind,
188 + state->save_unsaved_data_ind, state->shutdown_ind,
189 + state->memory_low_ind, state->sig_device_mode_ind);
191 + if(state->shutdown_ind)
193 + /* we are going down, down, down */
194 + navit_destroy(global_navit);
197 +/* figure this out later
198 + if(state->save_unsaved_data_ind)
200 + // save all our data, if any
203 + if(state->memory_low_ind)
205 + // do something to reduce memory needs
214 + * * Handle osso events
215 + * * @param state Osso hardware state
216 + * * @param data ptr to private data
217 + * * @returns nothing
220 +osso_cb_hw_state(osso_hw_state_t *state, gpointer data)
222 + osso_hw_state_t *state_copy = g_new(osso_hw_state_t, 1);
223 + memcpy(state_copy, state, sizeof(osso_hw_state_t));
224 + g_idle_add((GSourceFunc)osso_cb_hw_state_idle, state_copy);
230 navit_add_mapset(struct navit *this_, struct mapset *ms)
232 @@ -681,6 +786,10 @@ navit_new(struct attr *parent, struct attr **attrs)
237 + this_->screen_unblank = 1; // 1=GPS
240 transform_setup(this_->trans, ¢er, zoom, (this_->orientation != -1) ? this_->orientation : 0);
241 for (;*attrs; attrs++) {
242 navit_set_attr_do(this_, *attrs, 1);
243 @@ -1031,8 +1140,6 @@ navit_add_bookmark(struct navit *this_, struct pcoord *c, const char *descriptio
244 callback_list_call_attr_0(this_->attr_cbl, attr_bookmark_map);
247 -struct navit *global_navit;
250 navit_add_bookmarks_from_file(struct navit *this_)
252 @@ -1395,6 +1502,19 @@ navit_init(struct navit *this_)
253 navit_window_items_new(this_);
257 + dbg(1,"Installing osso context for org.navit-project.navit\n");
258 + this_->osso_context = osso_initialize("org.navit-project.navit",
259 + VERSION, TRUE, NULL);
260 + if(this_->osso_context == NULL) {
261 + dbg(0, "error initiating osso context\n");
263 + osso_hw_set_event_cb(this_->osso_context, NULL, osso_cb_hw_state, NULL);
265 + /* add callback to unblank screen on gps event */
266 + navit_add_callback(this_, callback_new_attr_1(callback_cast(navit_osso_display_on), attr_position_coord_geo, this_));
269 messagelist_init(this_->messages);
271 navit_set_cursors(this_);
272 @@ -1746,6 +1866,14 @@ navit_set_attr_do(struct navit *this_, struct attr *attr, int init)
273 attr_updated=(this_->center_timeout != attr->u.num);
274 this_->center_timeout = attr->u.num;
276 + // screen unblank for Nokia N8x0
277 + case attr_screen_unblank:
278 + if (!strcmp(attr->u.str,"GPS"))
279 + this_->screen_unblank = 1;
280 + if (!strcmp(attr->u.str, "fullscreen"))
281 + this_->screen_unblank = 2;
282 + dbg(1,"screen_unblank set to %d\n",this_->screen_unblank);
285 attr_updated=(this_->tracking_flag != !!attr->u.num);
286 this_->tracking_flag=!!attr->u.num;
287 @@ -2447,6 +2575,12 @@ navit_block(struct navit *this_, int block)
289 navit_destroy(struct navit *this_)
293 + dbg(1,"Disconnecting from osso\n");
294 + osso_deinitialize(this_->osso_context);
297 /* TODO: destroy objects contained in this_ */
299 vehicle_destroy(this_->vehicle->vehicle);