diff options
author | Pierre Grandin <grandinp@altern.org> | 2016-12-01 19:23:13 +0000 |
---|---|---|
committer | Pierre Grandin <grandinp@altern.org> | 2016-12-01 19:23:13 +0000 |
commit | 5030d911084584f9b37aeaa916ab43130044edbf (patch) | |
tree | 0f0e400aa2c575c3fcdfcceaa6012d2f760e525e /navit/graphics | |
parent | 449e5530c4ee68f77691c811f0670cf90e9e58a4 (diff) | |
parent | 59bbe485ba74a6df5ec944275ae28fc1bd98981e (diff) | |
download | navit-5030d911084584f9b37aeaa916ab43130044edbf.tar.gz |
Merge branch 'trunk' into trac/1341trac/1341
Conflicts:
navit/Makefile.am
navit/xpm/Makefile.am
po/Makefile.am
Diffstat (limited to 'navit/graphics')
-rw-r--r-- | navit/graphics/android/graphics_android.c | 238 | ||||
-rw-r--r-- | navit/graphics/gd/graphics_gd.c | 8 | ||||
-rw-r--r-- | navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c | 10 | ||||
-rw-r--r-- | navit/graphics/null/graphics_null.c | 6 | ||||
-rw-r--r-- | navit/graphics/opengl/graphics_opengl.c | 10 | ||||
-rw-r--r-- | navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp | 9 | ||||
-rw-r--r-- | navit/graphics/sdl/event.c | 2 | ||||
-rw-r--r-- | navit/graphics/sdl/event_sdl.c | 2 | ||||
-rw-r--r-- | navit/graphics/sdl/graphics_sdl.c | 14 | ||||
-rw-r--r-- | navit/graphics/win32/graphics_win32.c | 10 |
10 files changed, 268 insertions, 41 deletions
diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c index a543252ce..0d6aa30d2 100644 --- a/navit/graphics/android/graphics_android.c +++ b/navit/graphics/android/graphics_android.c @@ -25,6 +25,8 @@ #include "point.h" #include "graphics.h" #include "color.h" +#include "item.h" +#include "xmlconfig.h" #include "plugin.h" #include "event.h" #include "debug.h" @@ -32,14 +34,13 @@ #include "android.h" #include "command.h" -int dummy; - struct graphics_priv { jclass NavitGraphicsClass; jmethodID NavitGraphics_draw_polyline, NavitGraphics_draw_polygon, NavitGraphics_draw_rectangle, NavitGraphics_draw_circle, NavitGraphics_draw_text, NavitGraphics_draw_image, NavitGraphics_draw_image_warp, NavitGraphics_draw_mode, NavitGraphics_draw_drag, - NavitGraphics_overlay_disable, NavitGraphics_overlay_resize, NavitGraphics_SetCamera; + NavitGraphics_overlay_disable, NavitGraphics_overlay_resize, NavitGraphics_SetCamera, + NavitGraphics_setBackgroundColor; jclass PaintClass; jmethodID Paint_init,Paint_setStrokeWidth,Paint_setARGB; @@ -64,6 +65,8 @@ struct graphics_priv { struct callback_list *cbl; struct window win; + struct padding *padding; + jint bgcolor; }; struct graphics_font_priv { @@ -246,9 +249,9 @@ image_new(struct graphics_priv *gra, struct graphics_image_methods *meth, char * if (localBitmap) { ret->width=(*jnienv)->CallIntMethod(jnienv, localBitmap, gra->Bitmap_getWidth); ret->height=(*jnienv)->CallIntMethod(jnienv, localBitmap, gra->Bitmap_getHeight); - if((*w!=-1 && *w!=ret->width) || (*h!=-1 && *w!=ret->height)) { + if((*w!=IMAGE_W_H_UNSET && *w!=ret->width) || (*h!=IMAGE_W_H_UNSET && *w!=ret->height)) { jclass scaledBitmap=(*jnienv)->CallStaticObjectMethod(jnienv, gra->BitmapClass, - gra->Bitmap_createScaledBitmap, localBitmap, (*w==-1)?ret->width:*w, (*h==-1)?ret->height:*h, JNI_TRUE); + gra->Bitmap_createScaledBitmap, localBitmap, (*w==IMAGE_W_H_UNSET)?ret->width:*w, (*h==IMAGE_W_H_UNSET)?ret->height:*h, JNI_TRUE); if(!scaledBitmap) { dbg(lvl_error,"Bitmap scaling to %dx%d failed for %s",*w,*h,path); } else { @@ -419,9 +422,11 @@ static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graph static void * get_data(struct graphics_priv *this, const char *type) { - if (strcmp(type,"window")) - return NULL; - return &this->win; + if (!strcmp(type,"padding")) + return this->padding; + if (!strcmp(type,"window")) + return &this->win; + return NULL; } static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) @@ -463,11 +468,29 @@ set_attr(struct graphics_priv *gra, struct attr *attr) case attr_use_camera: (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_SetCamera, attr->u.num); return 1; + case attr_background_color: + gra->bgcolor = (attr->u.color->a / 0x101) << 24 + | (attr->u.color->r / 0x101) << 16 + | (attr->u.color->g / 0x101) << 8 + | (attr->u.color->b / 0x101); + dbg(lvl_debug, "set attr_background_color %04x %04x %04x %04x (%08x)\n", + attr->u.color->r, attr->u.color->g, attr->u.color->b, attr->u.color->a, gra->bgcolor); + if (gra->NavitGraphics_setBackgroundColor != NULL) + (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_setBackgroundColor, gra->bgcolor); + else + dbg(lvl_error, "NavitGraphics.setBackgroundColor not found, cannot set background color\n"); + return 1; default: return 0; } } + +int show_native_keyboard (struct graphics_keyboard *kbd); + +void hide_native_keyboard (struct graphics_keyboard *kbd); + + static struct graphics_methods graphics_methods = { graphics_destroy, draw_mode, @@ -490,16 +513,29 @@ static struct graphics_methods graphics_methods = { overlay_disable, overlay_resize, set_attr, + show_native_keyboard, + hide_native_keyboard, }; static void resize_callback(struct graphics_priv *gra, int w, int h) { dbg(lvl_debug,"w=%d h=%d ok\n",w,h); + dbg(lvl_debug,"gra=%p, %d callbacks in list\n", gra, g_list_length(gra->cbl)); callback_list_call_attr_2(gra->cbl, attr_resize, (void *)w, (void *)h); } static void +padding_callback(struct graphics_priv *gra, int left, int top, int right, int bottom) +{ + dbg(lvl_debug, "win.padding left=%d top=%d right=%d bottom=%d ok\n", left, top, right, bottom); + gra->padding->left = left; + gra->padding->top = top; + gra->padding->right = right; + gra->padding->bottom = bottom; +} + +static void motion_callback(struct graphics_priv *gra, int x, int y) { struct point p; @@ -549,6 +585,19 @@ set_activity(jobject graphics) return 1; } +/** + * @brief Initializes a new Android graphics instance. + * + * This initializes a new Android graphics instance, which can either be the main view or an overlay. + * + * @param ret The new graphics instance + * @param parent The graphics instance that contains the new instance ({@code NULL} for the main view) + * @param p The position of the overlay in its parent ({@code NULL} for the main view) + * @param w The width of the overlay (0 for the main view) + * @param h The height of the overlay (0 for the main view) + * @param wraparound (0 for the main view) + * @param use_camera Whether to use the camera (0 for overlays) + */ static int graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, struct point *pnt, int w, int h, int wraparound, int use_camera) { @@ -556,6 +605,8 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s jmethodID cid, Context_getPackageName; dbg(lvl_debug,"at 2 jnienv=%p\n",jnienv); + if (parent) + ret->padding = parent->padding; if (!find_class_global("android/graphics/Paint", &ret->PaintClass)) return 0; if (!find_method(ret->PaintClass, "<init>", "(I)V", &ret->Paint_init)) @@ -631,6 +682,14 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s cb=callback_new_1(callback_cast(resize_callback), ret); (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (int)cb); + cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setPaddingChangedCallback", "(I)V"); + if (cid == NULL) { + dbg(lvl_error,"no SetPaddingCallback method found\n"); + return 0; /* exception thrown */ + } + cb=callback_new_1(callback_cast(padding_callback), ret); + (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (int)cb); + cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setButtonCallback", "(I)V"); if (cid == NULL) { dbg(lvl_error,"no SetButtonCallback method found\n"); @@ -686,7 +745,7 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s } static jclass NavitClass; -static jmethodID Navit_disableSuspend, Navit_exit, Navit_fullscreen, Navit_runOptionsItem; +static jmethodID Navit_disableSuspend, Navit_exit, Navit_fullscreen, Navit_runOptionsItem, Navit_showMenu, Navit_showNativeKeyboard, Navit_hideNativeKeyboard; static int graphics_android_fullscreen(struct window *win, int on) @@ -702,6 +761,17 @@ graphics_android_disable_suspend(struct window *win) (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_disableSuspend); } +/** + * @brief Runs an item from the Android menu. + * + * This is a callback function which implements multiple API functions. + * + * @param this The {@code graohics_prov} structure + * @param function The API function which was called + * @param in Parameters to pass to the API function + * @param out Points to a buffer which will receive a pointer to the output of the command + * @param valid + */ static void graphics_android_cmd_runMenuItem(struct graphics_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) { @@ -717,18 +787,58 @@ graphics_android_cmd_runMenuItem(struct graphics_priv *this, char *function, str (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_runOptionsItem, ncmd); } +/** + * @brief Shows the Android menu. + * + * This is the callback function associated with the {@code menu()} API function. + * + * @param this The {@code graohics_prov} structure + * @param function The API function which was called + * @param in Parameters to pass to the API function + * @param out Points to a buffer which will receive a pointer to the output of the command + * @param valid + */ +static void +graphics_android_cmd_menu(struct graphics_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) +{ + dbg(lvl_debug, "enter\n"); + (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_showMenu); +} + +/** + * The command table. Each entry consists of an API function name and the callback function which implements + * this command. + */ static struct command_table commands[] = { {"map_download_dialog",command_cast(graphics_android_cmd_runMenuItem)}, {"set_map_location",command_cast(graphics_android_cmd_runMenuItem)}, {"backup_restore_dialog",command_cast(graphics_android_cmd_runMenuItem)}, + {"menu", command_cast(graphics_android_cmd_menu)}, }; +/** + * @brief Creates a new Android graphics instance. + * + * This method is called when the graphics plugin is initialized. It creates the main view, i.e. the map view. + * Unless overlay mode is enabled, it also holds any OSD items. + * + * @param nav The navit instance. + * @param meth The methods for the new graphics instance + * @param attrs The attributes for the new graphics instance + * @param cbl The callback list for the new graphics instance + * + * @return The new graphics instance + */ static struct graphics_priv * graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct graphics_priv *ret; struct attr *attr; int use_camera=0; + jmethodID cid; + jint android_bgcolor; + + dbg(lvl_debug, "enter\n"); if (!event_request_system("android","graphics_android")) return NULL; ret=g_new0(struct graphics_priv, 1); @@ -738,6 +848,23 @@ graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct at ret->win.priv=ret; ret->win.fullscreen=graphics_android_fullscreen; ret->win.disable_suspend=graphics_android_disable_suspend; + ret->padding = g_new0(struct padding, 1); + ret->padding->left = 0; + ret->padding->top = 0; + ret->padding->right = 0; + ret->padding->bottom = 0; + /* attr_background_color is the background color for system bars (API 17+ only) */ + if ((attr=attr_search(attrs, NULL, attr_background_color))) { + ret->bgcolor = (attr->u.color->a / 0x101) << 24 + | (attr->u.color->r / 0x101) << 16 + | (attr->u.color->g / 0x101) << 8 + | (attr->u.color->b / 0x101); + dbg(lvl_debug, "attr_background_color %04x %04x %04x %04x (%08x)\n", + attr->u.color->r, attr->u.color->g, attr->u.color->b, attr->u.color->a, ret->bgcolor); + } else { + /* default is the same as for OSD */ + ret->bgcolor = 0x60000000; + } if ((attr=attr_search(attrs, NULL, attr_use_camera))) { use_camera=attr->u.num; } @@ -746,6 +873,26 @@ graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct at } image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal); if (graphics_android_init(ret, NULL, NULL, 0, 0, 0, use_camera)) { + cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "hasMenuButton", "()Z"); + if (cid != NULL) { + attr = g_new0(struct attr, 1); + attr->type = attr_has_menu_button; + attr->u.num = (*jnienv)->CallBooleanMethod(jnienv, ret->NavitGraphics, cid); + + /* + * Although the attribute refers to information obtained by the graphics plugin, we are storing it + * with the navit object: the object is easier to access from anywhere in the program, and ultimately + * it refers to a configuration value affecting all of Navit, thus users are likely to look for it in + * the navit object (as the fact that graphics also handles input devices is not immedately obvious). + */ + navit_object_set_attr((struct navit_object *) nav, attr); + dbg(lvl_debug, "attr_has_menu_button=%d\n", attr->u.num); + g_free(attr); + } + ret->NavitGraphics_setBackgroundColor = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setBackgroundColor", "(I)V"); + if (ret->NavitGraphics_setBackgroundColor != NULL) { + (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, ret->NavitGraphics_setBackgroundColor, ret->bgcolor); + } dbg(lvl_debug,"returning %p\n",ret); return ret; } else { @@ -754,6 +901,21 @@ graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct at } } +/** + * @brief Creates a new overlay + * + * This method creates a graphics instance for a new overlay. If overlay mode is enabled, a separate overlay is + * created for each OSD item. + * + * @param gr The parent graphics instance, i.e. the one which will contain the overlay. + * @param meth The methods for the new graphics instance + * @param p The position of the overlay in its parent + * @param w The width of the overlay + * @param h The height of the overlay + * @param wraparound + * + * @return The graphics instance for the new overlay + */ static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { @@ -971,6 +1133,11 @@ event_android_new(struct event_methods *meth) Navit_runOptionsItem = (*jnienv)->GetMethodID(jnienv, NavitClass, "runOptionsItem", "(I)V"); if (Navit_runOptionsItem == NULL) return NULL; + Navit_showMenu = (*jnienv)->GetMethodID(jnienv, NavitClass, "showMenu", "()V"); + if (Navit_showMenu == NULL) + return NULL; + Navit_showNativeKeyboard = (*jnienv)->GetMethodID(jnienv, NavitClass, "showNativeKeyboard", "()I"); + Navit_hideNativeKeyboard = (*jnienv)->GetMethodID(jnienv, NavitClass, "hideNativeKeyboard", "()V"); dbg(lvl_debug,"ok\n"); *meth=event_android_methods; @@ -978,10 +1145,59 @@ event_android_new(struct event_methods *meth) } +/** + * @brief Displays the native input method. + * + * This method decides whether a native on-screen input method, such as a virtual keyboard, needs to be + * displayed. A typical case in which there is no need for an on-screen input method is if a hardware + * keyboard is present. + * + * Note that the Android platform lacks reliable means of determining whether an on-screen input method + * is going to be displayed or how much screen space it is going to occupy. Therefore this method tries + * to guess these values. They have been tested and found to work correctly with the AOSP keyboard, and + * are thus expected to be compatible with most on-screen keyboards found on the market, but results may + * be unexpected with other input methods. + * + * @param kbd A {@code struct graphics_keyboard} which describes the requirements for the input method + * and will be populated with the data of the input method before the function returns. + * + * @return True if the input method is going to be displayed, false if not. + */ +int show_native_keyboard (struct graphics_keyboard *kbd) { + kbd->w = -1; + if (Navit_showNativeKeyboard == NULL) { + dbg(lvl_error, "method Navit.showNativeKeyboard() not found, cannot display keyboard\n"); + return 0; + } + kbd->h = (*jnienv)->CallIntMethod(jnienv, android_activity, Navit_showNativeKeyboard); + dbg(lvl_error, "keyboard size is %d x %d px\n", kbd->w, kbd->h); + dbg(lvl_error, "return\n"); + /* zero height means we're not showing a keyboard, therefore normalize height to boolean */ + return !!(kbd->h); +} + + +/** + * @brief Hides the native input method and frees associated private data. + * + * @param kbd The {@code struct graphics_keyboard} which was passed to the earlier call to + * {@link show_native_keyboard(struct graphics_keyboard *)}. The {@code gra_priv} member of the struct + * will be freed by this function. + */ +void hide_native_keyboard (struct graphics_keyboard *kbd) { + if (Navit_hideNativeKeyboard == NULL) { + dbg(lvl_error, "method Navit.hideNativeKeyboard() not found, cannot dismiss keyboard\n"); + return; + } + (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_hideNativeKeyboard); + g_free(kbd->gra_priv); +} + + void plugin_init(void) { dbg(lvl_debug,"enter\n"); - plugin_register_graphics_type("android", graphics_android_new); - plugin_register_event_type("android", event_android_new); + plugin_register_category_graphics("android", graphics_android_new); + plugin_register_category_event("android", event_android_new); } diff --git a/navit/graphics/gd/graphics_gd.c b/navit/graphics/gd/graphics_gd.c index 47868d622..3ef6c520b 100644 --- a/navit/graphics/gd/graphics_gd.c +++ b/navit/graphics/gd/graphics_gd.c @@ -813,6 +813,8 @@ static struct graphics_methods graphics_methods = { overlay_disable, overlay_resize, set_attr, + NULL, /* show_native_keyboard */ + NULL, /* hide_native_keyboard */ }; static struct graphics_priv * @@ -824,7 +826,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin dbg(lvl_debug,"enter\n"); ret=g_new0(struct graphics_priv, 1); *meth=graphics_methods; - font_freetype_new=plugin_get_font_type("freetype"); + font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) return NULL; font_freetype_new(&ret->freetype_methods); @@ -853,7 +855,7 @@ graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr ** struct font_priv * (*font_freetype_new)(void *meth); struct graphics_priv *ret; event_request_system("glib","graphics_gd_new"); - font_freetype_new=plugin_get_font_type("freetype"); + font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) return NULL; *meth=graphics_methods; @@ -879,5 +881,5 @@ graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr ** void plugin_init(void) { - plugin_register_graphics_type("gd", graphics_gd_new); + plugin_register_category_graphics("gd", graphics_gd_new); } diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c index 6ec67d1c0..387003c40 100644 --- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c +++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c @@ -205,7 +205,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n GdkPixbufLoader *loader=gdk_pixbuf_loader_new(); if (!loader) return NULL; - if (*w != -1 || *h != -1) + if (*w != IMAGE_W_H_UNSET || *h != IMAGE_W_H_UNSET) gdk_pixbuf_loader_set_size(loader, *w, *h); gdk_pixbuf_loader_write(loader, buffer->start, buffer->len, NULL); gdk_pixbuf_loader_close(loader, NULL); @@ -213,7 +213,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n g_object_ref(pixbuf); g_object_unref(loader); } else { - if (*w == -1 && *h == -1) + if (*w == IMAGE_W_H_UNSET && *h == IMAGE_W_H_UNSET) pixbuf=gdk_pixbuf_new_from_file(name, NULL); else pixbuf=gdk_pixbuf_new_from_file_at_size(name, *w, *h, NULL); @@ -1073,13 +1073,15 @@ static struct graphics_methods graphics_methods = { overlay_disable, overlay_resize, set_attr, + NULL, /* show_native_keyboard */ + NULL, /* hide_native_keyboard */ }; static struct graphics_priv * graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth) { struct font_priv * (*font_freetype_new)(void *meth); - font_freetype_new=plugin_get_font_type("freetype"); + font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) return NULL; struct graphics_priv *this=g_new0(struct graphics_priv,1); @@ -1148,5 +1150,5 @@ plugin_init(void) #ifdef HAVE_API_WIN32 setlocale(LC_NUMERIC, "C"); /* WIN32 gtk resets LC_NUMERIC */ #endif - plugin_register_graphics_type("gtk_drawing_area", graphics_gtk_drawing_area_new); + plugin_register_category_graphics("gtk_drawing_area", graphics_gtk_drawing_area_new); } diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c index e3d617af2..ecac7d528 100644 --- a/navit/graphics/null/graphics_null.c +++ b/navit/graphics/null/graphics_null.c @@ -236,6 +236,8 @@ static struct graphics_methods graphics_methods = { get_text_bbox, overlay_disable, overlay_resize, + NULL, /* show_native_keyboard */ + NULL, /* hide_native_keyboard */ }; static struct graphics_priv * @@ -352,6 +354,6 @@ event_null_new(struct event_methods *meth) void plugin_init(void) { - plugin_register_graphics_type("null", graphics_null_new); - plugin_register_event_type("null", event_null_new); + plugin_register_category_graphics("null", graphics_null_new); + plugin_register_category_event("null", event_null_new); } diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c index b6e0fb41a..98230f0dc 100644 --- a/navit/graphics/opengl/graphics_opengl.c +++ b/navit/graphics/opengl/graphics_opengl.c @@ -451,7 +451,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, width = FreeImage_GetWidth(image); height = FreeImage_GetHeight(image); - if ((*w != width || *h != height) && 0 < *w && 0 < *h) { + if ((*w != width || *h != height) && *w != IMAGE_W_H_UNSET && *h != IMAGE_W_H_UNSET) { FIBITMAP *image2; image2 = FreeImage_Rescale(image, *w, *h, FILTER_BOX); FreeImage_Unload(image); @@ -1432,13 +1432,15 @@ static struct graphics_methods graphics_methods = { NULL, overlay_disable, overlay_resize, + NULL, /* show_native_keyboard */ + NULL, /* hide_native_keyboard */ }; static struct graphics_priv * graphics_opengl_new_helper(struct graphics_methods *meth) { struct font_priv *(*font_freetype_new) (void *meth); - font_freetype_new = plugin_get_font_type("freetype"); + font_freetype_new = plugin_get_category_font("freetype"); if (!font_freetype_new) { return NULL; @@ -1815,6 +1817,6 @@ event_opengl_new(struct event_methods *meth) void plugin_init(void) { - plugin_register_graphics_type("opengl", graphics_opengl_new); - plugin_register_event_type("opengl", event_opengl_new); + plugin_register_category_graphics("opengl", graphics_opengl_new); + plugin_register_category_event("opengl", event_opengl_new); } diff --git a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp index 714f0753e..65163ea9d 100644 --- a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp +++ b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp @@ -696,7 +696,8 @@ static struct graphics_methods graphics_methods = { overlay_disable, NULL, set_attr, - + NULL, /* show_native_keyboard */ + NULL, /* hide_native_keyboard */ }; //############################################################################################################## @@ -853,7 +854,7 @@ static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct return NULL; #endif #ifdef QT_QPAINTER_USE_FREETYPE - font_freetype_new=(struct font_priv *(*)(void *))plugin_get_font_type("freetype"); + font_freetype_new=(struct font_priv *(*)(void *))plugin_get_category_font("freetype"); if (!font_freetype_new) { dbg(lvl_error,"no freetype\n"); return NULL; @@ -920,9 +921,9 @@ static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct //############################################################################################################## void plugin_init(void) { - plugin_register_graphics_type("qt_qpainter", graphics_qt_qpainter_new); + plugin_register_category_graphics("qt_qpainter", graphics_qt_qpainter_new); #ifdef QT_QPAINTER_USE_EVENT_QT - plugin_register_event_type("qt", event_qt_new); + plugin_register_category_event("qt", event_qt_new); #endif } diff --git a/navit/graphics/sdl/event.c b/navit/graphics/sdl/event.c index cd4b81802..f96b079b3 100644 --- a/navit/graphics/sdl/event.c +++ b/navit/graphics/sdl/event.c @@ -377,5 +377,5 @@ event_sdl_new(struct event_methods* methods) { /* ---------- SDL Eventhandling ---------- */ void sdl_event_init(void) { - plugin_register_event_type("sdl", event_sdl_new); + plugin_register_category_event("sdl", event_sdl_new); } diff --git a/navit/graphics/sdl/event_sdl.c b/navit/graphics/sdl/event_sdl.c index d640d5edb..28fe4fafb 100644 --- a/navit/graphics/sdl/event_sdl.c +++ b/navit/graphics/sdl/event_sdl.c @@ -339,5 +339,5 @@ event_sdl_new(struct event_methods* methods) void event_sdl_register(void) { - plugin_register_event_type("sdl", event_sdl_new); + plugin_register_category_event("sdl", event_sdl_new); } diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c index e5d9f7872..b1a9c17b9 100644 --- a/navit/graphics/sdl/graphics_sdl.c +++ b/navit/graphics/sdl/graphics_sdl.c @@ -96,8 +96,6 @@ struct graphics_priv { /* </main> */ }; -static int dummy; - #ifdef USE_WEBOS # define WEBOS_KEY_SHIFT 0x130 # define WEBOS_KEY_SYM 0x131 @@ -875,7 +873,7 @@ get_data(struct graphics_priv *this, char const *type) win->disable_suspend=NULL; return win; } else { - return &dummy; + return NULL; } } @@ -909,6 +907,8 @@ static struct graphics_methods graphics_methods = { overlay_disable, NULL, /* overlay_resize */ NULL, /* set_attr */ + NULL, /* show_native_keyboard */ + NULL, /* hide_native_keyboard */ }; static struct graphics_priv * @@ -986,7 +986,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin struct font_priv *(*font_freetype_new) (void *meth); - font_freetype_new = plugin_get_font_type ("freetype"); + font_freetype_new = plugin_get_category_font ("freetype"); if (!font_freetype_new) { @@ -1407,7 +1407,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr * this->cbl = cbl; /* initialize fonts */ - font_freetype_new = plugin_get_font_type("freetype"); + font_freetype_new = plugin_get_category_font("freetype"); if (!font_freetype_new) { g_free(this); @@ -1852,9 +1852,9 @@ void plugin_init(void) { #ifdef USE_WEBOS - plugin_register_event_type("sdl", event_sdl_new); + plugin_register_category_event("sdl", event_sdl_new); #endif - plugin_register_graphics_type("sdl", graphics_sdl_new); + plugin_register_category_graphics("sdl", graphics_sdl_new); } // vim: sw=4 ts=8 diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c index 124832a38..3d8fa351d 100644 --- a/navit/graphics/win32/graphics_win32.c +++ b/navit/graphics/win32/graphics_win32.c @@ -1445,9 +1445,9 @@ static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct gr /* Hash_key will be freed ater the hash table, so set it to NULL here to disable freing it on this function return */ hash_key=NULL; if(ret) { - if (*w==-1) + if (*w==IMAGE_W_H_UNSET) *w=ret->width; - if (*h==-1) + if (*h==IMAGE_W_H_UNSET) *h=ret->height; if (*w!=ret->width || *h!=ret->height) { if(ret->png_pixels && ret->hBitmap) @@ -1582,6 +1582,8 @@ static struct graphics_methods graphics_methods = get_text_bbox, overlay_disable, overlay_resize, + NULL, /* show_native_keyboard */ + NULL, /* hide_native_keyboard */ }; @@ -1843,6 +1845,6 @@ static struct event_priv * void plugin_init(void) { - plugin_register_graphics_type("win32", graphics_win32_new); - plugin_register_event_type("win32", event_win32_new); + plugin_register_category_graphics("win32", graphics_win32_new); + plugin_register_category_event("win32", event_win32_new); } |