aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xwidget.c80
1 files changed, 51 insertions, 29 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index caf6aa9aae5..5663617eb4a 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -179,7 +179,7 @@ gboolean webkit_osr_navigation_policy_decision_requested_callback(WebKitWebView
179 WebKitWebNavigationAction *navigation_action, 179 WebKitWebNavigationAction *navigation_action,
180 WebKitWebPolicyDecision *policy_decision, 180 WebKitWebPolicyDecision *policy_decision,
181 gpointer user_data); 181 gpointer user_data);
182 182GtkWidget* xwgir_create(char* class, char* namespace);
183 183
184DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0, 184DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0,
185 doc: /* xw */ 185 doc: /* xw */
@@ -297,6 +297,49 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0,
297 297
298 } 298 }
299 299
300
301 ////////////////////////////////////////////////////////
302 if(Fget(xw->type, Qcxwgir_class) != Qnil){
303 //here we have run out of hard coded symbols, we will now attempt to create
304 //a widget dynamically
305 //TODO
306 // - support OSR
307 // - support constructor args
308 // - support signals
309 // - check that the argument widget type actually exists
310 printf("init xwgir osr\n");
311 block_input();
312 xw->widgetwindow_osr = GTK_CONTAINER (gtk_offscreen_window_new ());
313 gtk_window_resize( GTK_WINDOW(xw->widgetwindow_osr), xw->width, xw->height);
314
315 printf("xwgir symbol %s %s %s:\n",
316 SDATA(SYMBOL_NAME(xw->type)),
317 SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))),
318 SDATA(Fcar(Fget(xw->type, Qcxwgir_class))));
319 //xv->widget = xwgir_create ("Button");
320 Fcar(Fget(xw->type, Qcxwgir_class));
321 xw->widget_osr = xwgir_create( SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))),
322 SDATA(Fcar(Fget(xw->type, Qcxwgir_class))));
323
324 gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height);
325 gtk_container_add (xw->widgetwindow_osr, xw->widget_osr);
326
327 gtk_widget_show_all (GTK_WIDGET (xw->widgetwindow_osr));
328
329 /* store some xwidget data in the gtk widgets for convenient retrieval in the event handlers. */
330 g_object_set_data (G_OBJECT (xw->widget_osr), XG_XWIDGET, (gpointer) (xw));
331 g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, (gpointer) (xw));
332 /* signals */
333 g_signal_connect (G_OBJECT ( xw->widgetwindow_osr), "damage-event", G_CALLBACK (webkit_osr_damage_event_callback), NULL);
334
335
336 unblock_input();
337 }
338
339 ////////////////////////////////////////////////////////
340
341
342
300 UNGCPRO; 343 UNGCPRO;
301 return val; 344 return val;
302} 345}
@@ -877,8 +920,12 @@ xwidget_init_view (struct xwidget *xww,
877 /* Show the stage: */ 920 /* Show the stage: */
878 clutter_actor_show (stage); 921 clutter_actor_show (stage);
879#endif 922#endif
880 } else if (EQ(xww->type, Qwebkit_osr)||EQ(xww->type, Qsocket_osr)) { 923 } else if (EQ(xww->type, Qwebkit_osr)||
881#ifdef HAVE_WEBKIT_OSR 924 EQ(xww->type, Qsocket_osr)||
925 (Fget(xww->type, Qcxwgir_class) != Qnil))//xwgir widgets are OSR
926 {
927#ifdef HAVE_WEBKIT_OSR //TODO the ifdef isnt really relevant anymore, we always have osr
928 printf("osr init:%s\n",SDATA(SYMBOL_NAME(xww->type)));
882 xv->widget = gtk_drawing_area_new(); 929 xv->widget = gtk_drawing_area_new();
883 gtk_widget_set_app_paintable ( xv->widget, TRUE); //because expose event handling 930 gtk_widget_set_app_paintable ( xv->widget, TRUE); //because expose event handling
884 gtk_widget_add_events(xv->widget, 931 gtk_widget_add_events(xv->widget,
@@ -901,32 +948,7 @@ xwidget_init_view (struct xwidget *xww,
901#endif 948#endif
902 949
903 950
904 } else //xwgir sanity checks: 951 }
905 if(Fget(xww->type, Qcxwgir_class) == Qnil){
906 printf("error, Fget(xww->type, Qcxwgir_class) was nil\n");
907 //we cant just return null here, because drawing will crash later.
908 //currently just display an error component, and stop furher xwgir handling
909 xv->widget = gtk_button_new_with_label ("xwgir failed");
910 } else {
911 //here we have run out of hard coded symbols, we will now attempt to create
912 //a widget dynamically
913 //TODO
914 // - support OSR
915 // - support constructor args
916 // - support signals
917 // - check that the argument widget type actually exists
918
919 printf("xwgir symbol %s %s %s:\n",
920 SDATA(SYMBOL_NAME(xww->type)),
921 SDATA(Fcar(Fcdr(Fget(xww->type, Qcxwgir_class)))),
922 SDATA(Fcar(Fget(xww->type, Qcxwgir_class))));
923 //xv->widget = xwgir_create ("Button");
924 Fcar(Fget(xww->type, Qcxwgir_class));
925 xv->widget = xwgir_create( SDATA(Fcar(Fcdr(Fget(xww->type, Qcxwgir_class)))),
926 SDATA(Fcar(Fget(xww->type, Qcxwgir_class))));
927
928 }
929
930 //else return NULL; 952 //else return NULL;
931 953
932 //widget realization 954 //widget realization