Ticket #283: diff-1

File diff-1, 3.5 KB (added by Gerritv, 13 years ago)
Line 
1Index: Makefile.am
2===================================================================
3--- Makefile.am (revision 1968)
4+++ Makefile.am (working copy)
5@@ -2,4 +2,4 @@
6 AM_CPPFLAGS = @GTK2_CFLAGS@ -I$(top_srcdir) -I$(top_srcdir)/navit -DMODULE=graphics_gtk_drawing_area
7 modulegraphics_LTLIBRARIES = libgraphics_gtk_drawing_area.la
8 libgraphics_gtk_drawing_area_la_SOURCES = graphics_gtk_drawing_area.c
9-libgraphics_gtk_drawing_area_la_LDFLAGS = @GTK2_LIBS@ @IMLIB2_LIBS@ -module
10+libgraphics_gtk_drawing_area_la_LDFLAGS = @GTK2_LIBS@ @IMLIB2_LIBS@
11Index: graphics_gtk_drawing_area.c
12===================================================================
13--- graphics_gtk_drawing_area.c (revision 1968)
14+++ graphics_gtk_drawing_area.c (working copy)
15@@ -42,6 +42,7 @@
16 #include "keys.h"
17 #include "plugin.h"
18 #include "navit/font/freetype/font_freetype.h"
19+#include "navit.h"
20 
21 #ifndef GDK_Book
22 #define GDK_Book XF86XK_Book
23@@ -79,6 +80,7 @@
24        enum draw_mode_num mode;
25        struct callback_list *cbl;
26        struct font_freetype_methods freetype_methods;
27+       struct navit *nav;
28 };
29 
30 
31@@ -324,7 +326,10 @@
32        struct font_freetype_text *t;
33 
34        if (! font)
35+       {
36+               dbg(0,"no font, returning\n");
37                return;
38+       }
39 #if 0 /* Temporarily disabled because it destroys text rendering of overlays and in gui internal in some places */
40        /*
41         This needs an improvement, no one checks if the strings are visible
42@@ -698,7 +703,21 @@
43        return FALSE;
44 }
45 
46+/* *
47+ * * Exit navit (X pressed)
48+ * * @param widget active widget
49+ * * @param event the event (delete_event)
50+ * * @param nav our Navit context
51+ * * @returns TRUE
52+ * */
53 static gint
54+delete(GtkWidget *widget, GdkEventKey *event, struct navit *nav)
55+{
56+       navit_destroy(nav);
57+       return TRUE;
58+}
59+
60+static gint
61 keypress(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
62 {
63        struct graphics_priv *this=user_data;
64@@ -735,10 +754,16 @@
65                key[1]='\0';
66                break;
67        case GDK_Book:
68+#ifdef USE_HILDON
69+       case GDK_F7:
70+#endif
71                key[0]=NAVIT_KEY_ZOOM_IN;
72                key[1]='\0';
73                break;
74        case GDK_Calendar:
75+#ifdef USE_HILDON
76+       case GDK_F8:
77+#endif
78                key[0]=NAVIT_KEY_ZOOM_OUT;
79                key[1]='\0';
80                break;
81@@ -801,6 +826,7 @@
82        if (!strcmp(type,"window")) {
83                this->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
84                gtk_window_set_default_size(GTK_WINDOW(this->win), this->win_w, this->win_h);
85+               dbg(1,"h= %i, w= %i\n",this->win_h, this->win_w);
86                gtk_window_set_title(GTK_WINDOW(this->win), "Navit");
87                gtk_window_set_wmclass (GTK_WINDOW (this->win), "navit", "Navit");
88                gtk_widget_realize(this->win);
89@@ -810,6 +836,7 @@
90                gtk_widget_set_sensitive(this->widget, TRUE);
91                gtk_widget_grab_focus(this->widget);
92                g_signal_connect(G_OBJECT(this->widget), "key-press-event", G_CALLBACK(keypress), this);
93+       g_signal_connect(G_OBJECT(this->win), "delete_event", G_CALLBACK(delete), this->nav);
94                this->window.fullscreen=graphics_gtk_drawing_area_fullscreen;
95                this->window.priv=this;
96                return &this->window;
97@@ -868,6 +895,7 @@
98 
99        draw=gtk_drawing_area_new();
100        struct graphics_priv *this=graphics_gtk_drawing_area_new_helper(meth);
101+       this->nav = nav;
102        this->widget=draw;
103        this->win_w=792;
104        if ((attr=attr_search(attrs, NULL, attr_w)))
105@@ -887,6 +915,7 @@
106        g_signal_connect(G_OBJECT(draw), "button_release_event", G_CALLBACK(button_release), this);
107        g_signal_connect(G_OBJECT(draw), "scroll_event", G_CALLBACK(scroll), this);
108        g_signal_connect(G_OBJECT(draw), "motion_notify_event", G_CALLBACK(motion_notify), this);
109+       g_signal_connect(G_OBJECT(draw), "delete_event", G_CALLBACK(delete), nav);
110        return this;
111 }
112