diff options
author | tegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-09-28 18:04:57 +0000 |
---|---|---|
committer | tegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-09-28 18:04:57 +0000 |
commit | 34c3ebc42ffa91dc9cb9e4f86fcf523e267d93bf (patch) | |
tree | 42055d22c5973ee4ccd3e321672b06be45d1d81a | |
parent | 1fd77fff1e02fe7d11ee9039f46697b02bfa9851 (diff) | |
download | navit-34c3ebc42ffa91dc9cb9e4f86fcf523e267d93bf.tar.gz |
fix:graphics/null: -fixed initialization of null graphics driver to enable callback emission from navit instance
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4793 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | navit/graphics/null/graphics_null.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c index 41b49097b..7fde6fcc8 100644 --- a/navit/graphics/null/graphics_null.c +++ b/navit/graphics/null/graphics_null.c @@ -29,11 +29,15 @@ #include "plugin.h" #include "event.h" #include "debug.h" +#include "window.h" +#include "callback.h" #if defined(WINDOWS) || defined(WIN32) || defined (HAVE_API_WIN32_CE) #include <windows.h> # define sleep(i) Sleep(i * 1000) #endif +static struct callback_list* callbacks; + static int dummy; static struct graphics_priv { int dummy; @@ -173,10 +177,37 @@ draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound); +static void +resize_callback(int w, int h) +{ + callback_list_call_attr_2(callbacks, attr_resize, + GINT_TO_POINTER(1), GINT_TO_POINTER(1)); +} + +static int +graphics_null_fullscreen(struct window *w, int on) +{ + return 1; +} + +static void +graphics_null_disable_suspend(struct window *w) +{ +} + static void * get_data(struct graphics_priv *this, char const *type) { - return &dummy; + if (strcmp(type, "window") == 0) { + struct window *win; + win = g_new0(struct window, 1); + win->priv = this; + win->fullscreen = graphics_null_fullscreen; + win->disable_suspend = graphics_null_disable_suspend; + resize_callback(1,1); + return win; + } + return NULL; } static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) @@ -243,7 +274,8 @@ graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr if (!event_request_system("null", "graphics_null")) return NULL; } - + callbacks = cbl; + resize_callback(1,1); return &graphics_priv; } |