Ticket #282: screen_unblank.patch
| File screen_unblank.patch, 9.8 KB (added by akashihi, 2 years ago) |
|---|
-
navit/xpm/Makefile.am
205 205 endif 206 206 207 207 DESKTOPFILEdir=$(datadir)/applications 208 if USE_HILDON 209 DESKTOPFILE_DATA = desktop_icons/navit.desktop, desktop_icons/org.navit-project.Navit.service 210 else 208 211 DESKTOPFILE_DATA = desktop_icons/navit.desktop 212 endif 209 213 210 214 ICON128dir=$(datadir)/icons/hicolor/128x128/apps 211 215 ICON128_DATA = desktop_icons/128x128/navit.png -
navit/font/freetype/font_freetype.c
5 5 #include <ft2build.h> 6 6 #include <glib.h> 7 7 #include FT_FREETYPE_H 8 #if ndef USE_CACHING9 # define USE_CACHING 18 #ifdef USE_CACHING 9 #undef USE_CACHING 10 10 #endif 11 11 #if USE_CACHING 12 12 #include FT_CACHE_H -
navit/Makefile.am
21 21 endif 22 22 23 23 24 AM_CPPFLAGS = -I$(top_srcdir)/navit/fib-1.1 @NAVIT_CFLAGS@ @ ZLIB_CFLAGS@ -DPREFIX=\"@prefix@\" -DLIBDIR=\"@libdir@\" -DMODULE=navit24 AM_CPPFLAGS = -I$(top_srcdir)/navit/fib-1.1 @NAVIT_CFLAGS@ @LIBOSSO_CFLAGS@ @ZLIB_CFLAGS@ -DPREFIX=\"@prefix@\" -DLIBDIR=\"@libdir@\" -DMODULE=navit 25 25 BUILT_SOURCES = version.h navit_config.h 26 26 27 27 if BIN_NAVIT … … 91 91 92 92 else 93 93 navit_SOURCES = start.c 94 navit_LDADD = libnavit.la @NAVIT_LIBS@ @WORDEXP_LIBS@ @ ZLIB_LIBS@ @INTLLIBS@ -Lfib-1.1 -lfib94 navit_LDADD = libnavit.la @NAVIT_LIBS@ @WORDEXP_LIBS@ @LIBOSSO_LIBS@ @ZLIB_LIBS@ @INTLLIBS@ -Lfib-1.1 -lfib 95 95 96 96 endif 97 97 -
navit/attr_def.h
274 274 ATTR(filter) 275 275 ATTR(daylayout) 276 276 ATTR(nightlayout) 277 ATTR(screen_unblank) /* for N8x0 */ 277 278 ATTR(xml_text) 278 279 ATTR(layout_name) 279 280 ATTR(user_name) -
navit/gui/internal/gui_internal.c
4365 4365 graphics_draw_mode(this->gra, draw_mode_end); 4366 4366 this->win->fullscreen(this->win, attr->u.num > 0); 4367 4367 graphics_draw_mode(this->gra, draw_mode_begin); 4368 #ifdef HAVE_OSSO 4369 navit_osso_fullscreen(this->nav, attr->u.num > 0); 4370 #endif 4368 4371 } 4369 4372 this->fullscreen=attr->u.num; 4370 4373 return 1; -
navit/navit.c
61 61 #include "messages.h" 62 62 #include "vehicleprofile.h" 63 63 #include "sunriset.h" 64 64 #ifdef HAVE_OSSO 65 #include "libosso.h" 66 #endif 65 67 /** 66 68 * @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 67 69 * @{ … … 138 140 int prevTs; 139 141 int graphics_flags; 140 142 int zoom_min, zoom_max; 143 #ifdef HAVE_OSSO 144 osso_context_t *osso_context; 145 gboolean fullscreen; // True=fullscreen 146 int screen_unblank; // 0=never, 1=GPS event, 2=fullscreen 147 #endif 141 148 }; 142 149 150 struct navit *global_navit; 151 143 152 struct gui *main_loop_gui; 144 153 145 154 struct attr_iter { … … 160 169 static void navit_cmd_announcer_toggle(struct navit *this_); 161 170 static void navit_set_vehicle(struct navit *this_, struct navit_vehicle *nv); 162 171 172 #ifdef HAVE_OSSO 173 /** 174 * Remember state of Fullscreen 175 * 176 * @param navit our context 177 * @param fullscreen indicates whether we have full screen 178 * @returns nothing 179 */ 163 180 void 181 navit_osso_fullscreen(struct navit *this_, int fullscreen) 182 { 183 dbg(2,"setting fullscreen to %s\n", fullscreen == 0 ? "no":"yes"); 184 this_->fullscreen = (fullscreen == 1); 185 } 186 187 /** 188 * * Tell osso to unblank the screen 189 * * 190 * * @param navit our context 191 * * @returns nothing 192 **/ 193 void 194 navit_osso_display_on(struct navit *this_) 195 { 196 osso_return_t err; 197 dbg(2,"unblank screen: fs=%d, unblank on: %d\n", this_->fullscreen, this_->screen_unblank); 198 switch (this_->screen_unblank) { 199 case 0: // never 200 break; 201 case 1: // GPS event 202 //osso_display_state_on(this_->osso_context); 203 err=osso_display_blanking_pause(this_->osso_context); 204 dbg(1,"Unblank result: ", err == OSSO_OK ? "Ok" : (err == OSSO_ERROR ? "Error" : "Invalid context")); 205 break; 206 case 2: // fullscreen 207 if (this_->fullscreen) { 208 //osso_display_state_on(this_->osso_context); 209 err=osso_display_blanking_pause(this_->osso_context); 210 dbg(1,"Unblank result: ", err == OSSO_OK ? "Ok" : (err == OSSO_ERROR ? "Error" : "Invalid context")); 211 } 212 break; 213 default: 214 break; 215 } 216 } 217 /** 218 * * Act on Osso event 219 * * @param state The oss hardware state 220 * * @returns FALSE 221 * */ 222 static gboolean 223 osso_cb_hw_state_idle(osso_hw_state_t *state) 224 { 225 dbg(0,"(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n", 226 state->system_inactivity_ind, 227 state->save_unsaved_data_ind, state->shutdown_ind, 228 state->memory_low_ind, state->sig_device_mode_ind); 229 230 if(state->shutdown_ind) 231 { 232 /* we are going down, down, down */ 233 navit_destroy(global_navit); 234 exit(1); 235 } 236 /* figure this out later 237 if(state->save_unsaved_data_ind) 238 { 239 // save all our data, if any 240 } 241 242 if(state->memory_low_ind) 243 { 244 // do something to reduce memory needs 245 } 246 */ 247 g_free(state); 248 249 return FALSE; 250 } 251 252 /** 253 * * Handle osso events 254 * * @param state Osso hardware state 255 * * @param data ptr to private data 256 * * @returns nothing 257 **/ 258 static void 259 osso_cb_hw_state(osso_hw_state_t *state, gpointer data) 260 { 261 osso_hw_state_t *state_copy = g_new(osso_hw_state_t, 1); 262 memcpy(state_copy, state, sizeof(osso_hw_state_t)); 263 g_idle_add((GSourceFunc)osso_cb_hw_state_idle, state_copy); 264 } 265 #endif 266 267 268 void 164 269 navit_add_mapset(struct navit *this_, struct mapset *ms) 165 270 { 166 271 this_->mapsets = g_list_append(this_->mapsets, ms); … … 681 786 682 787 this_->prevTs=0; 683 788 789 #ifdef HAVE_OSSO 790 this_->screen_unblank = 1; // 1=GPS 791 #endif 792 684 793 transform_setup(this_->trans, ¢er, zoom, (this_->orientation != -1) ? this_->orientation : 0); 685 794 for (;*attrs; attrs++) { 686 795 navit_set_attr_do(this_, *attrs, 1); … … 1031 1140 callback_list_call_attr_0(this_->attr_cbl, attr_bookmark_map); 1032 1141 } 1033 1142 1034 struct navit *global_navit;1035 1036 1143 static void 1037 1144 navit_add_bookmarks_from_file(struct navit *this_) 1038 1145 { … … 1395 1502 navit_window_items_new(this_); 1396 1503 #endif 1397 1504 1505 #ifdef HAVE_OSSO 1506 dbg(1,"Installing osso context for org.navit-project.navit\n"); 1507 this_->osso_context = osso_initialize("org.navit-project.navit", 1508 VERSION, TRUE, NULL); 1509 if(this_->osso_context == NULL) { 1510 dbg(0, "error initiating osso context\n"); 1511 } 1512 osso_hw_set_event_cb(this_->osso_context, NULL, osso_cb_hw_state, NULL); 1513 1514 /* add callback to unblank screen on gps event */ 1515 navit_add_callback(this_, callback_new_attr_1(callback_cast(navit_osso_display_on), attr_position_coord_geo, this_)); 1516 #endif 1517 1398 1518 messagelist_init(this_->messages); 1399 1519 1400 1520 navit_set_cursors(this_); … … 1746 1866 attr_updated=(this_->center_timeout != attr->u.num); 1747 1867 this_->center_timeout = attr->u.num; 1748 1868 break; 1869 // screen unblank for Nokia N8x0 1870 case attr_screen_unblank: 1871 if (!strcmp(attr->u.str,"GPS")) 1872 this_->screen_unblank = 1; 1873 if (!strcmp(attr->u.str, "fullscreen")) 1874 this_->screen_unblank = 2; 1875 dbg(1,"screen_unblank set to %d\n",this_->screen_unblank); 1876 break; 1749 1877 case attr_tracking: 1750 1878 attr_updated=(this_->tracking_flag != !!attr->u.num); 1751 1879 this_->tracking_flag=!!attr->u.num; … … 2447 2575 void 2448 2576 navit_destroy(struct navit *this_) 2449 2577 { 2578 2579 #ifdef HAVE_OSSO 2580 dbg(1,"Disconnecting from osso\n"); 2581 osso_deinitialize(this_->osso_context); 2582 #endif 2583 2450 2584 /* TODO: destroy objects contained in this_ */ 2451 2585 if (this_->vehicle) 2452 2586 vehicle_destroy(this_->vehicle->vehicle); -
navit/navit.h
61 61 void navit_ignore_graphics_events(struct navit *this_, int ignore); 62 62 int navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback); 63 63 void navit_handle_motion(struct navit *this_, struct point *p); 64 #ifdef HAVE_OSSO 65 void navit_osso_display_on(struct navit *this_); 66 void navit_osso_fullscreen(struct navit *this_, int fullscreen); 67 #endif 64 68 void navit_zoom_in(struct navit *this_, int factor, struct point *p); 65 69 void navit_zoom_out(struct navit *this_, int factor, struct point *p); 66 70 struct navit *navit_new(struct attr *parent, struct attr **attrs); -
configure.in
203 203 ], [ 204 204 AC_MSG_RESULT(no) 205 205 ]) 206 PKG_CHECK_MODULES(LIBOSSO, libosso, [ 207 AC_DEFINE(HAVE_OSSO, 1, [Have the osso library]) 208 AC_SUBST(OSSO_CFLAGS) 209 AC_SUBST(OSSO_LIBS) 210 ], [ 211 AC_MSG_RESULT(no) 212 ]) 206 213 if test x"${enable_hildon}" = xyes ; then 207 214 AC_DEFINE(USE_HILDON, 1, [Build with maemo/hildon support]) 208 215 AC_SUBST(HILDON_CFLAGS)
