aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGrégoire Jadi2013-06-24 09:45:38 +0200
committerGrégoire Jadi2013-06-24 09:45:38 +0200
commitff248cdccef204c512fda28a43380f60f8a9166d (patch)
tree7c55e19d9cc328954e0ff1f962d9e6b2fa02170a /src
parent1a0f9e5e80586e4f2157fdfecae250c5619edf15 (diff)
downloademacs-ff248cdccef204c512fda28a43380f60f8a9166d.tar.gz
emacs-ff248cdccef204c512fda28a43380f60f8a9166d.zip
* src/xwidget.c: Fix a lot of errors when compiling with --enable-checking
and --enable-check-lisp-object-type.
Diffstat (limited to 'src')
-rw-r--r--src/xwidget.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index 955a6d0e524..a73710479d7 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -205,13 +205,13 @@ TYPE is a symbol which can take one of the following values:
205 //(xwidget-info (car xwidget-alist)) 205 //(xwidget-info (car xwidget-alist))
206 struct xwidget* xw = allocate_xwidget(); 206 struct xwidget* xw = allocate_xwidget();
207 Lisp_Object val; 207 Lisp_Object val;
208 XSETSYMBOL(xw->type, type); 208 xw->type = type;
209 XSETSTRING(xw->title, title); 209 xw->title = title;
210 if (NILP (buffer)) 210 if (NILP (buffer))
211 buffer = Fcurrent_buffer(); // no need to gcpro because Fcurrent_buffer doesn't call Feval/eval_sub. 211 buffer = Fcurrent_buffer(); // no need to gcpro because Fcurrent_buffer doesn't call Feval/eval_sub.
212 else 212 else
213 buffer = Fget_buffer_create (buffer); 213 buffer = Fget_buffer_create (buffer);
214 XSETBUFFER(xw->buffer, buffer); 214 xw->buffer = buffer;
215 215
216 xw->height = XFASTINT(height); 216 xw->height = XFASTINT(height);
217 xw->width = XFASTINT(width); 217 xw->width = XFASTINT(width);
@@ -228,7 +228,7 @@ TYPE is a symbol which can take one of the following values:
228 */ 228 */
229 if (EQ(xw->type, Qwebkit_osr)|| 229 if (EQ(xw->type, Qwebkit_osr)||
230 EQ(xw->type, Qsocket_osr)|| 230 EQ(xw->type, Qsocket_osr)||
231 (Fget(xw->type, QCxwgir_class) != Qnil)) { 231 (!NILP (Fget(xw->type, QCxwgir_class)))) {
232 printf("init osr widget\n"); 232 printf("init osr widget\n");
233 block_input(); 233 block_input();
234 xw->widgetwindow_osr = GTK_CONTAINER (gtk_offscreen_window_new ()); 234 xw->widgetwindow_osr = GTK_CONTAINER (gtk_offscreen_window_new ());
@@ -238,7 +238,7 @@ TYPE is a symbol which can take one of the following values:
238 xw->widget_osr = webkit_web_view_new(); 238 xw->widget_osr = webkit_web_view_new();
239 if(EQ(xw->type, Qsocket_osr)) 239 if(EQ(xw->type, Qsocket_osr))
240 xw->widget_osr = gtk_socket_new(); 240 xw->widget_osr = gtk_socket_new();
241 if(Fget(xw->type, QCxwgir_class) != Qnil) 241 if(!NILP (Fget(xw->type, QCxwgir_class)))
242 xw->widget_osr = xwgir_create(SDATA(Fcar(Fcdr(Fget(xw->type, QCxwgir_class)))), 242 xw->widget_osr = xwgir_create(SDATA(Fcar(Fcdr(Fget(xw->type, QCxwgir_class)))),
243 SDATA(Fcar(Fget(xw->type, QCxwgir_class)))); 243 SDATA(Fcar(Fget(xw->type, QCxwgir_class))));
244 244
@@ -312,11 +312,13 @@ xwidget_hidden(struct xwidget_view *xv)
312static void 312static void
313buttonclick_handler (GtkWidget * widget, gpointer data) 313buttonclick_handler (GtkWidget * widget, gpointer data)
314{ 314{
315 struct xwidget *xw = (struct xwidget *) data; 315 Lisp_Object xw;
316 XSETXWIDGET(xw, (struct xwidget *) data);
317
316 struct input_event event; 318 struct input_event event;
317 Lisp_Object frame; 319 Lisp_Object frame;
318 FRAME_PTR f = NULL;//(FRAME_PTR) g_object_get_data (G_OBJECT (xw->widget), XG_FRAME_DATA); //TODO 320 FRAME_PTR f = NULL; //(FRAME_PTR) g_object_get_data (G_OBJECT (XXWIDGET (xw)->widget), XG_FRAME_DATA); //TODO
319 printf ("button clicked xw:%d '%s'\n", xw, xw->title); 321 printf ("button clicked xw:%d '%s'\n", xw, XXWIDGET (xw)->title);
320 322
321 EVENT_INIT (event); 323 EVENT_INIT (event);
322 event.kind = XWIDGET_EVENT; 324 event.kind = XWIDGET_EVENT;
@@ -327,7 +329,7 @@ buttonclick_handler (GtkWidget * widget, gpointer data)
327 329
328 330
329 event.arg = Qnil; 331 event.arg = Qnil;
330 event.arg = Fcons ((Lisp_Object)xw, event.arg); //TODO send the actual xwidget object now instead 332 event.arg = Fcons (xw, event.arg);
331 event.arg = Fcons (intern ("buttonclick"), event.arg); 333 event.arg = Fcons (intern ("buttonclick"), event.arg);
332 334
333 kbd_buffer_store_event (&event); 335 kbd_buffer_store_event (&event);
@@ -339,6 +341,8 @@ buttonclick_handler (GtkWidget * widget, gpointer data)
339static void 341static void
340send_xembed_ready_event (struct xwidget* xw, int xembedid) 342send_xembed_ready_event (struct xwidget* xw, int xembedid)
341{ 343{
344 Lisp_Object xw_lo;
345 XSETXWIDGET(xw_lo, xw);
342 struct input_event event; 346 struct input_event event;
343 EVENT_INIT (event); 347 EVENT_INIT (event);
344 event.kind = XWIDGET_EVENT; 348 event.kind = XWIDGET_EVENT;
@@ -346,7 +350,7 @@ send_xembed_ready_event (struct xwidget* xw, int xembedid)
346 350
347 event.arg = Qnil; 351 event.arg = Qnil;
348 event.arg = Fcons (make_number (xembedid), event.arg); 352 event.arg = Fcons (make_number (xembedid), event.arg);
349 event.arg = Fcons ((Lisp_Object)xw, event.arg); //TODO 353 event.arg = Fcons (xw_lo, event.arg);
350 event.arg = Fcons (intern ("xembed-ready"), event.arg); 354 event.arg = Fcons (intern ("xembed-ready"), event.arg);
351 355
352 356
@@ -808,7 +812,7 @@ DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_
808 812
809 struct xwidget* xw; 813 struct xwidget* xw;
810 if(!XXWIDGETP(xwidget)) {printf("ERROR not an xwidget\n"); return Qnil;}; 814 if(!XXWIDGETP(xwidget)) {printf("ERROR not an xwidget\n"); return Qnil;};
811 if(Qnil == xwidget) {printf("ERROR xwidget nil\n"); return Qnil;}; 815 if (NILP (xwidget)) { printf("ERROR xwidget nil\n"); return Qnil; };
812 xw = XXWIDGET(xwidget); 816 xw = XXWIDGET(xwidget);
813 if(NULL == xw) printf("ERROR xw is 0\n"); 817 if(NULL == xw) printf("ERROR xw is 0\n");
814 char* namespace = SDATA(Fcar(Fget(xw->type, QCxwgir_class))); 818 char* namespace = SDATA(Fcar(Fget(xw->type, QCxwgir_class)));
@@ -839,9 +843,11 @@ DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_
839 return Qnil; 843 return Qnil;
840 } 844 }
841 int i; 845 int i;
846 Lisp_Object n;
842 for (i = 1; i < argscount + 1; ++i) 847 for (i = 1; i < argscount + 1; ++i)
843 { 848 {
844 xwgir_convert_lisp_to_gir_arg(&in_args[i], g_callable_info_get_arg(f_info, i - 1), Fnth(i - 1, arguments)); 849 XSETFASTINT (n, i - 1);
850 xwgir_convert_lisp_to_gir_arg(&in_args[i], g_callable_info_get_arg(f_info, i - 1), Fnth(n, arguments));
845 } 851 }
846 852
847 in_args[0].v_pointer = widget; 853 in_args[0].v_pointer = widget;
@@ -986,7 +992,7 @@ xwidget_init_view (struct xwidget *xww,
986 //gdk_cairo_create (gtk_widget_get_window (FRAME_GTK_WIDGET (s->f))); 992 //gdk_cairo_create (gtk_widget_get_window (FRAME_GTK_WIDGET (s->f)));
987 } else if (EQ(xww->type, Qwebkit_osr)|| 993 } else if (EQ(xww->type, Qwebkit_osr)||
988 EQ(xww->type, Qsocket_osr)|| 994 EQ(xww->type, Qsocket_osr)||
989 (Fget(xww->type, QCxwgir_class) != Qnil))//xwgir widgets are OSR 995 (!NILP (Fget(xww->type, QCxwgir_class))))//xwgir widgets are OSR
990 { 996 {
991#ifdef HAVE_WEBKIT_OSR //TODO the ifdef isnt really relevant anymore, we always have osr 997#ifdef HAVE_WEBKIT_OSR //TODO the ifdef isnt really relevant anymore, we always have osr
992 printf("osr init:%s\n",SDATA(SYMBOL_NAME(xww->type))); 998 printf("osr init:%s\n",SDATA(SYMBOL_NAME(xww->type)));
@@ -1072,7 +1078,7 @@ xwidget_init_view (struct xwidget *xww,
1072 //xwgir debug 1078 //xwgir debug
1073 if (//EQ(xww->type, Qwebkit_osr)|| //TODO should be able to choose compile time which method to use with webkit 1079 if (//EQ(xww->type, Qwebkit_osr)|| //TODO should be able to choose compile time which method to use with webkit
1074 EQ(xww->type, Qsocket_osr)|| 1080 EQ(xww->type, Qsocket_osr)||
1075 (Fget(xww->type, QCxwgir_class) != Qnil))//xwgir widgets are OSR 1081 (!NILP (Fget(xww->type, QCxwgir_class))))//xwgir widgets are OSR
1076 { 1082 {
1077 //xwidget_set_embedder_view(xww,xv); 1083 //xwidget_set_embedder_view(xww,xv);
1078 printf("gdk_offscreen_window_set_embedder %d %d\n", 1084 printf("gdk_offscreen_window_set_embedder %d %d\n",
@@ -1182,7 +1188,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
1182#define WEBKIT_FN_INIT() \ 1188#define WEBKIT_FN_INIT() \
1183 struct xwidget* xw; \ 1189 struct xwidget* xw; \
1184if(!XXWIDGETP(xwidget)) {printf("ERROR not an xwidget\n"); return Qnil;}; \ 1190if(!XXWIDGETP(xwidget)) {printf("ERROR not an xwidget\n"); return Qnil;}; \
1185if(Qnil == xwidget) {printf("ERROR xwidget nil\n"); return Qnil;}; \ 1191 if(NILP (xwidget)) {printf("ERROR xwidget nil\n"); return Qnil;}; \
1186 xw = XXWIDGET(xwidget); \ 1192 xw = XXWIDGET(xwidget); \
1187 if(NULL == xw) printf("ERROR xw is 0\n"); \ 1193 if(NULL == xw) printf("ERROR xw is 0\n"); \
1188 if((NULL == xw->widget_osr) || !WEBKIT_IS_WEB_VIEW(xw->widget_osr)){ \ 1194 if((NULL == xw->widget_osr) || !WEBKIT_IS_WEB_VIEW(xw->widget_osr)){ \
@@ -1383,15 +1389,16 @@ DEFUN ("xwidgetp", Fxwidgetp, Sxwidgetp, 1, 1, 0,
1383DEFUN("xwidget-info", Fxwidget_info , Sxwidget_info, 1,1,0, doc: /* get xwidget props */) 1389DEFUN("xwidget-info", Fxwidget_info , Sxwidget_info, 1,1,0, doc: /* get xwidget props */)
1384 (Lisp_Object xwidget) 1390 (Lisp_Object xwidget)
1385{ 1391{
1386 Lisp_Object info; 1392 Lisp_Object info, n;
1387 struct xwidget* xw = XXWIDGET(xwidget); 1393 struct xwidget* xw = XXWIDGET(xwidget);
1388 1394
1389 info = Fmake_vector (make_number (4), Qnil); 1395 info = Fmake_vector (make_number (4), Qnil);
1390 XSETSYMBOL (XVECTOR (info)->contents[0], xw->type); 1396 ASET (info, 0, xw->type);
1391 XSETSTRING (XVECTOR (info)->contents[1], xw->title); 1397 ASET (info, 1, xw->title);
1392 XSETINT (XVECTOR (info)->contents[2], xw->width); 1398 XSETFASTINT(n, xw->width);
1393 XSETINT (XVECTOR (info)->contents[3], xw->height); 1399 ASET (info, 2, n);
1394 1400 XSETFASTINT(n, xw->height);
1401 ASET (info, 2, n);
1395 1402
1396 return info; 1403 return info;
1397} 1404}
@@ -1497,7 +1504,8 @@ DEFUN("xwidget-delete-zombies", Fxwidget_delete_zombies , Sxwidget_delete_zombie
1497 Lisp_Object w; 1504 Lisp_Object w;
1498 for (int i = 0; i < MAX_XWIDGETS; i++){ 1505 for (int i = 0; i < MAX_XWIDGETS; i++){
1499 xv = &xwidget_views[i]; 1506 xv = &xwidget_views[i];
1500 XSETWINDOW(w, xv->w); 1507 if (xv->w != NULL)
1508 XSETWINDOW(w, xv->w);
1501 if(xv->initialized && (! (WINDOW_LIVE_P(w)))){ 1509 if(xv->initialized && (! (WINDOW_LIVE_P(w)))){
1502 1510
1503 gtk_widget_destroy(GTK_WIDGET(xv->widgetwindow)); 1511 gtk_widget_destroy(GTK_WIDGET(xv->widgetwindow));