diff options
| author | Joakim Verona | 2013-06-12 23:37:36 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-06-12 23:37:36 +0200 |
| commit | bfa52886b98804a3e1440a03c4c07490568e6407 (patch) | |
| tree | 0d26aa6a7a78a38173f06d48200d9e62d986d468 /src | |
| parent | dd7febaa6c58b6c0163ab0f7344ea70b51614460 (diff) | |
| parent | 32a590b04a10f6bbe92bc1519b9e5ba2d32cfabc (diff) | |
| download | emacs-bfa52886b98804a3e1440a03c4c07490568e6407.tar.gz emacs-bfa52886b98804a3e1440a03c4c07490568e6407.zip | |
Merge branch 'xwidget' of https://github.com/daimrod/xwidget-emacs into xwidget
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.in | 3 | ||||
| -rw-r--r-- | src/emacsgtkfixed.c | 2 | ||||
| -rw-r--r-- | src/xwidget.c | 272 | ||||
| -rw-r--r-- | src/xwidget.h | 2 |
4 files changed, 118 insertions, 161 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 8d8133c9e6c..3b5c736517f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -237,9 +237,6 @@ CFLAGS_SOUND= @CFLAGS_SOUND@ | |||
| 237 | RSVG_LIBS= @RSVG_LIBS@ | 237 | RSVG_LIBS= @RSVG_LIBS@ |
| 238 | RSVG_CFLAGS= @RSVG_CFLAGS@ | 238 | RSVG_CFLAGS= @RSVG_CFLAGS@ |
| 239 | 239 | ||
| 240 | CLUTTER_LIBS= @CLUTTER_LIBS@ | ||
| 241 | CLUTTER_CFLAGS= @CLUTTER_CFLAGS@ | ||
| 242 | |||
| 243 | WEBKIT_LIBS= @WEBKIT_LIBS@ | 240 | WEBKIT_LIBS= @WEBKIT_LIBS@ |
| 244 | WEBKIT_CFLAGS= @WEBKIT_CFLAGS@ | 241 | WEBKIT_CFLAGS= @WEBKIT_CFLAGS@ |
| 245 | 242 | ||
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c index 6df0b2422b1..f675bd76d97 100644 --- a/src/emacsgtkfixed.c +++ b/src/emacsgtkfixed.c | |||
| @@ -184,7 +184,7 @@ static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget, | |||
| 184 | 184 | ||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | #endif | 187 | #endif /* HAVE_XWIDGETS */ |
| 188 | 188 | ||
| 189 | static void | 189 | static void |
| 190 | emacs_fixed_class_init (EmacsFixedClass *klass) | 190 | emacs_fixed_class_init (EmacsFixedClass *klass) |
diff --git a/src/xwidget.c b/src/xwidget.c index d169069c99d..eada274949c 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -68,7 +68,7 @@ | |||
| 68 | 68 | ||
| 69 | #include "gtkutil.h" | 69 | #include "gtkutil.h" |
| 70 | #include "font.h" | 70 | #include "font.h" |
| 71 | #endif | 71 | #endif /* HAVE_X_WINDOWS */ |
| 72 | 72 | ||
| 73 | #include <gtk/gtk.h> | 73 | #include <gtk/gtk.h> |
| 74 | #include <gdk/gdk.h> | 74 | #include <gdk/gdk.h> |
| @@ -79,18 +79,6 @@ | |||
| 79 | #include "emacsgtkfixed.h" | 79 | #include "emacsgtkfixed.h" |
| 80 | #endif | 80 | #endif |
| 81 | 81 | ||
| 82 | |||
| 83 | |||
| 84 | #ifdef HAVE_GOOCANVAS | ||
| 85 | #include <goocanvas.h> | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #ifdef HAVE_CLUTTER | ||
| 89 | #include <librsvg/rsvg.h> | ||
| 90 | #include <clutter/clutter.h> | ||
| 91 | #include <clutter-gtk/clutter-gtk.h> | ||
| 92 | #endif | ||
| 93 | |||
| 94 | #include <wchar.h> | 82 | #include <wchar.h> |
| 95 | 83 | ||
| 96 | #ifdef HAVE_WEBKIT_OSR | 84 | #ifdef HAVE_WEBKIT_OSR |
| @@ -132,14 +120,14 @@ allocate_xwidget_view (void) | |||
| 132 | #define XSETXWIDGET_VIEW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET_VIEW)) | 120 | #define XSETXWIDGET_VIEW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET_VIEW)) |
| 133 | 121 | ||
| 134 | Lisp_Object Qxwidget; | 122 | Lisp_Object Qxwidget; |
| 135 | Lisp_Object Qcxwidget; | 123 | Lisp_Object QCxwidget; |
| 136 | Lisp_Object Qtitle; | 124 | Lisp_Object QCtitle; |
| 137 | Lisp_Object Qxwidget_set_keyboard_grab; | 125 | Lisp_Object Qxwidget_set_keyboard_grab; |
| 138 | Lisp_Object Qxwidget_embed_steal_window; | 126 | Lisp_Object Qxwidget_embed_steal_window; |
| 139 | Lisp_Object Qxwidget_info; | 127 | Lisp_Object Qxwidget_info; |
| 140 | Lisp_Object Qxwidget_resize; | 128 | Lisp_Object Qxwidget_resize; |
| 141 | Lisp_Object Qxwidget_send_keyboard_event; | 129 | Lisp_Object Qxwidget_send_keyboard_event; |
| 142 | Lisp_Object Qcxwgir_class; | 130 | Lisp_Object QCxwgir_class; |
| 143 | Lisp_Object Qbutton, Qtoggle, Qslider, Qsocket, Qsocket_osr, Qcairo, Qxwgir, | 131 | Lisp_Object Qbutton, Qtoggle, Qslider, Qsocket, Qsocket_osr, Qcairo, Qxwgir, |
| 144 | Qwebkit_osr, QCplist; | 132 | Qwebkit_osr, QCplist; |
| 145 | 133 | ||
| @@ -188,14 +176,27 @@ xwgir_event_callback (GtkWidget *widget, | |||
| 188 | GtkWidget* xwgir_create(char* class, char* namespace); | 176 | GtkWidget* xwgir_create(char* class, char* namespace); |
| 189 | static void | 177 | static void |
| 190 | send_xembed_ready_event (struct xwidget* xw, int xembedid); | 178 | send_xembed_ready_event (struct xwidget* xw, int xembedid); |
| 191 | DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0, | 179 | DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 8, 0, |
| 192 | doc: /* xw */ | 180 | doc: /* Make an xwidget from BEG to END of TYPE. |
| 181 | |||
| 182 | If BUFFER is nil it uses the current buffer. If BUFFER is a string and | ||
| 183 | no such buffer exists, it is created. | ||
| 184 | |||
| 185 | TYPE is a symbol which can take one of the following values: | ||
| 186 | - Button | ||
| 187 | - ToggleButton | ||
| 188 | - slider | ||
| 189 | - socket | ||
| 190 | - socket-osr | ||
| 191 | - cairo | ||
| 192 | */ | ||
| 193 | ) | 193 | ) |
| 194 | (Lisp_Object beg, Lisp_Object end, | 194 | (Lisp_Object beg, Lisp_Object end, |
| 195 | Lisp_Object type, | 195 | Lisp_Object type, |
| 196 | Lisp_Object title, | 196 | Lisp_Object title, |
| 197 | Lisp_Object width, Lisp_Object height, | 197 | Lisp_Object width, Lisp_Object height, |
| 198 | Lisp_Object data) | 198 | Lisp_Object data, |
| 199 | Lisp_Object buffer) | ||
| 199 | { | 200 | { |
| 200 | //should work a bit like "make-button"(make-button BEG END &rest PROPERTIES) | 201 | //should work a bit like "make-button"(make-button BEG END &rest PROPERTIES) |
| 201 | // arg "type" and fwd should be keyword args eventually | 202 | // arg "type" and fwd should be keyword args eventually |
| @@ -203,16 +204,18 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0, | |||
| 203 | //(xwidget-info (car xwidget-alist)) | 204 | //(xwidget-info (car xwidget-alist)) |
| 204 | struct xwidget* xw = allocate_xwidget(); | 205 | struct xwidget* xw = allocate_xwidget(); |
| 205 | Lisp_Object val; | 206 | Lisp_Object val; |
| 206 | struct gcpro gcpro1; | ||
| 207 | GCPRO1(xw); | ||
| 208 | XSETSYMBOL(xw->type, type); | 207 | XSETSYMBOL(xw->type, type); |
| 209 | XSETSTRING(xw->title, title); | 208 | XSETSTRING(xw->title, title); |
| 210 | //TODO buffer should be an optional argument not just assumed to be the current buffer | 209 | if (NILP (buffer)) |
| 211 | XSETBUFFER(xw->buffer, Fcurrent_buffer()); // conservatively gcpro xw since we call lisp | 210 | buffer = Fcurrent_buffer(); // no need to gcpro because Fcurrent_buffer doesn't call Feval/eval_sub. |
| 211 | else | ||
| 212 | buffer = Fget_buffer_create (buffer); | ||
| 213 | XSETBUFFER(xw->buffer, buffer); | ||
| 214 | |||
| 212 | xw->height = XFASTINT(height); | 215 | xw->height = XFASTINT(height); |
| 213 | xw->width = XFASTINT(width); | 216 | xw->width = XFASTINT(width); |
| 214 | XSETPSEUDOVECTOR (val, xw, PVEC_XWIDGET); //?? dunno why i need this | 217 | XSETPSEUDOVECTOR (val, xw, PVEC_XWIDGET); // set the vectorlike_header of VAL with the correct value |
| 215 | Vxwidget_alist = Fcons ( val, Vxwidget_alist); | 218 | Vxwidget_alist = Fcons (val, Vxwidget_alist); |
| 216 | xw->widgetwindow_osr = NULL; | 219 | xw->widgetwindow_osr = NULL; |
| 217 | xw->widget_osr = NULL; | 220 | xw->widget_osr = NULL; |
| 218 | xw->plist = Qnil; | 221 | xw->plist = Qnil; |
| @@ -224,78 +227,77 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0, | |||
| 224 | */ | 227 | */ |
| 225 | if (EQ(xw->type, Qwebkit_osr)|| | 228 | if (EQ(xw->type, Qwebkit_osr)|| |
| 226 | EQ(xw->type, Qsocket_osr)|| | 229 | EQ(xw->type, Qsocket_osr)|| |
| 227 | (Fget(xw->type, Qcxwgir_class) != Qnil)){ | 230 | (Fget(xw->type, QCxwgir_class) != Qnil)) { |
| 228 | printf("init osr widget\n"); | 231 | printf("init osr widget\n"); |
| 229 | block_input(); | 232 | block_input(); |
| 230 | xw->widgetwindow_osr = GTK_CONTAINER (gtk_offscreen_window_new ()); | 233 | xw->widgetwindow_osr = GTK_CONTAINER (gtk_offscreen_window_new ()); |
| 231 | gtk_window_resize( GTK_WINDOW(xw->widgetwindow_osr), xw->width, xw->height); | 234 | gtk_window_resize(GTK_WINDOW(xw->widgetwindow_osr), xw->width, xw->height); |
| 232 | 235 | ||
| 233 | if (EQ(xw->type, Qwebkit_osr)) | 236 | if (EQ(xw->type, Qwebkit_osr)) |
| 234 | xw->widget_osr = webkit_web_view_new(); | 237 | xw->widget_osr = webkit_web_view_new(); |
| 235 | if(EQ(xw->type, Qsocket_osr)) | 238 | if(EQ(xw->type, Qsocket_osr)) |
| 236 | xw->widget_osr = gtk_socket_new(); | 239 | xw->widget_osr = gtk_socket_new(); |
| 237 | if(Fget(xw->type, Qcxwgir_class) != Qnil) | 240 | if(Fget(xw->type, QCxwgir_class) != Qnil) |
| 238 | xw->widget_osr = xwgir_create( SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))), | 241 | xw->widget_osr = xwgir_create(SDATA(Fcar(Fcdr(Fget(xw->type, QCxwgir_class)))), |
| 239 | SDATA(Fcar(Fget(xw->type, Qcxwgir_class)))); | 242 | SDATA(Fcar(Fget(xw->type, QCxwgir_class)))); |
| 240 | 243 | ||
| 241 | gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height); | 244 | gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height); |
| 242 | gtk_container_add (xw->widgetwindow_osr, xw->widget_osr); | 245 | gtk_container_add (xw->widgetwindow_osr, xw->widget_osr); |
| 243 | 246 | ||
| 244 | gtk_widget_show_all (GTK_WIDGET (xw->widgetwindow_osr)); | 247 | gtk_widget_show_all (GTK_WIDGET (xw->widgetwindow_osr)); |
| 245 | 248 | ||
| 246 | /* store some xwidget data in the gtk widgets for convenient retrieval in the event handlers. */ | 249 | /* store some xwidget data in the gtk widgets for convenient retrieval in the event handlers. */ |
| 247 | g_object_set_data (G_OBJECT (xw->widget_osr), XG_XWIDGET, (gpointer) (xw)); | 250 | g_object_set_data (G_OBJECT (xw->widget_osr), XG_XWIDGET, (gpointer) (xw)); |
| 248 | g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, (gpointer) (xw)); | 251 | g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, (gpointer) (xw)); |
| 249 | /* signals */ | 252 | |
| 250 | g_signal_connect (G_OBJECT ( xw->widgetwindow_osr), "damage-event", G_CALLBACK (xwidget_osr_damage_event_callback), NULL); | 253 | /* signals */ |
| 251 | 254 | g_signal_connect (G_OBJECT (xw->widgetwindow_osr), "damage-event", | |
| 252 | 255 | G_CALLBACK (xwidget_osr_damage_event_callback), NULL); | |
| 253 | if (EQ(xw->type, Qwebkit_osr)){ | 256 | |
| 254 | g_signal_connect (G_OBJECT ( xw->widget_osr), | 257 | if (EQ(xw->type, Qwebkit_osr)) { |
| 255 | "document-load-finished", | 258 | g_signal_connect (G_OBJECT (xw->widget_osr), |
| 256 | G_CALLBACK (webkit_osr_document_load_finished_callback), | 259 | "document-load-finished", |
| 257 | xw); | 260 | G_CALLBACK (webkit_osr_document_load_finished_callback), |
| 261 | xw); | ||
| 258 | 262 | ||
| 259 | g_signal_connect (G_OBJECT ( xw->widget_osr), | 263 | g_signal_connect (G_OBJECT (xw->widget_osr), |
| 260 | "download-requested", | 264 | "download-requested", |
| 261 | G_CALLBACK (webkit_osr_download_callback), | 265 | G_CALLBACK (webkit_osr_download_callback), |
| 262 | xw); | 266 | xw); |
| 263 | 267 | ||
| 264 | g_signal_connect (G_OBJECT ( xw->widget_osr), | 268 | g_signal_connect (G_OBJECT (xw->widget_osr), |
| 265 | "mime-type-policy-decision-requested", | 269 | "mime-type-policy-decision-requested", |
| 266 | G_CALLBACK (webkit_osr_mime_type_policy_typedecision_requested_callback), | 270 | G_CALLBACK (webkit_osr_mime_type_policy_typedecision_requested_callback), |
| 267 | xw); | 271 | xw); |
| 268 | 272 | ||
| 269 | g_signal_connect (G_OBJECT ( xw->widget_osr), | 273 | g_signal_connect (G_OBJECT (xw->widget_osr), |
| 270 | "new-window-policy-decision-requested", | 274 | "new-window-policy-decision-requested", |
| 271 | G_CALLBACK (webkit_osr_new_window_policy_decision_requested_callback), | 275 | G_CALLBACK (webkit_osr_new_window_policy_decision_requested_callback), |
| 272 | xw); | 276 | xw); |
| 273 | 277 | ||
| 274 | g_signal_connect (G_OBJECT ( xw->widget_osr), | 278 | g_signal_connect (G_OBJECT (xw->widget_osr), |
| 275 | "navigation-policy-decision-requested", | 279 | "navigation-policy-decision-requested", |
| 276 | G_CALLBACK (webkit_osr_navigation_policy_decision_requested_callback), | 280 | G_CALLBACK (webkit_osr_navigation_policy_decision_requested_callback), |
| 277 | xw); | 281 | xw); |
| 278 | //webkit_web_view_load_uri(WEBKIT_WEB_VIEW(xw->widget_osr), "http://www.fsf.org"); | 282 | //webkit_web_view_load_uri(WEBKIT_WEB_VIEW(xw->widget_osr), "http://www.fsf.org"); |
| 279 | 283 | ||
| 280 | } | 284 | } |
| 281 | 285 | ||
| 282 | if (EQ(xw->type, Qsocket_osr)) { | 286 | if (EQ(xw->type, Qsocket_osr)) { |
| 283 | printf ("xwid:%d socket id:%x %d\n", | 287 | printf ("xwid:%d socket id:%x %d\n", |
| 284 | xw, | 288 | xw, |
| 285 | gtk_socket_get_id (GTK_SOCKET (xw->widget_osr)), | 289 | gtk_socket_get_id (GTK_SOCKET (xw->widget_osr)), |
| 286 | gtk_socket_get_id (GTK_SOCKET (xw->widget_osr))); | 290 | gtk_socket_get_id (GTK_SOCKET (xw->widget_osr))); |
| 287 | send_xembed_ready_event (xw, | 291 | send_xembed_ready_event (xw, gtk_socket_get_id (GTK_SOCKET (xw->widget_osr))); |
| 288 | gtk_socket_get_id (GTK_SOCKET (xw->widget_osr))); | 292 | //gtk_widget_realize(xw->widget); |
| 289 | //gtk_widget_realize(xw->widget); | 293 | } |
| 290 | } | ||
| 291 | 294 | ||
| 292 | 295 | ||
| 293 | unblock_input(); | 296 | unblock_input(); |
| 294 | 297 | ||
| 295 | } | 298 | } |
| 296 | #endif | 299 | #endif /* HAVE_WEBKIT_OSR */ |
| 297 | 300 | ||
| 298 | UNGCPRO; | ||
| 299 | return val; | 301 | return val; |
| 300 | } | 302 | } |
| 301 | 303 | ||
| @@ -762,7 +764,7 @@ xwgir_convert_lisp_to_gir_arg(GIArgument* giarg, | |||
| 762 | void | 764 | void |
| 763 | refactor_attempt(){ | 765 | refactor_attempt(){ |
| 764 | //this methhod should be called from xwgir-xwidget-call-method and from xwgir xwidget construction | 766 | //this methhod should be called from xwgir-xwidget-call-method and from xwgir xwidget construction |
| 765 | char* class = SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))); | 767 | char* class = SDATA(Fcar(Fcdr(Fget(xw->type, QCxwgir_class)))); |
| 766 | 768 | ||
| 767 | GIObjectInfo* obj_info = g_irepository_find_by_name(girepository, namespace, class); | 769 | GIObjectInfo* obj_info = g_irepository_find_by_name(girepository, namespace, class); |
| 768 | GIFunctionInfo* f_info = g_object_info_find_method (obj_info, SDATA(method)); | 770 | GIFunctionInfo* f_info = g_object_info_find_method (obj_info, SDATA(method)); |
| @@ -792,7 +794,7 @@ refactor_attempt(){ | |||
| 792 | } | 794 | } |
| 793 | return Qt; | 795 | return Qt; |
| 794 | } | 796 | } |
| 795 | #endif | 797 | #endif /* 0 */ |
| 796 | 798 | ||
| 797 | DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_call_method, 3, 3, 0, | 799 | DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_call_method, 3, 3, 0, |
| 798 | doc: /* call xwidget object method.*/) | 800 | doc: /* call xwidget object method.*/) |
| @@ -808,7 +810,7 @@ DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_ | |||
| 808 | if(Qnil == xwidget) {printf("ERROR xwidget nil\n"); return Qnil;}; | 810 | if(Qnil == xwidget) {printf("ERROR xwidget nil\n"); return Qnil;}; |
| 809 | xw = XXWIDGET(xwidget); | 811 | xw = XXWIDGET(xwidget); |
| 810 | if(NULL == xw) printf("ERROR xw is 0\n"); | 812 | if(NULL == xw) printf("ERROR xw is 0\n"); |
| 811 | char* namespace = SDATA(Fcar(Fget(xw->type, Qcxwgir_class))); | 813 | char* namespace = SDATA(Fcar(Fget(xw->type, QCxwgir_class))); |
| 812 | //we need the concrete widget, which happens in 2 ways depending on OSR or not TODO | 814 | //we need the concrete widget, which happens in 2 ways depending on OSR or not TODO |
| 813 | GtkWidget* widget = NULL; | 815 | GtkWidget* widget = NULL; |
| 814 | if(NULL == xw->widget_osr) { | 816 | if(NULL == xw->widget_osr) { |
| @@ -823,7 +825,7 @@ DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_ | |||
| 823 | /* char* class = G_OBJECT_TYPE_NAME(widget); //gives "GtkButton"(I want "Button") */ | 825 | /* char* class = G_OBJECT_TYPE_NAME(widget); //gives "GtkButton"(I want "Button") */ |
| 824 | /* class += strlen(namespace); //TODO check for corresponding api method. but this seems to work. */ | 826 | /* class += strlen(namespace); //TODO check for corresponding api method. but this seems to work. */ |
| 825 | 827 | ||
| 826 | char* class = SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))); | 828 | char* class = SDATA(Fcar(Fcdr(Fget(xw->type, QCxwgir_class)))); |
| 827 | 829 | ||
| 828 | GIObjectInfo* obj_info = g_irepository_find_by_name(girepository, namespace, class); | 830 | GIObjectInfo* obj_info = g_irepository_find_by_name(girepository, namespace, class); |
| 829 | GIFunctionInfo* f_info = g_object_info_find_method (obj_info, SDATA(method)); | 831 | GIFunctionInfo* f_info = g_object_info_find_method (obj_info, SDATA(method)); |
| @@ -981,54 +983,9 @@ xwidget_init_view (struct xwidget *xww, | |||
| 981 | //Cairo view | 983 | //Cairo view |
| 982 | //uhm cairo is differentish in gtk 3. | 984 | //uhm cairo is differentish in gtk 3. |
| 983 | //gdk_cairo_create (gtk_widget_get_window (FRAME_GTK_WIDGET (s->f))); | 985 | //gdk_cairo_create (gtk_widget_get_window (FRAME_GTK_WIDGET (s->f))); |
| 984 | #ifdef HAVE_GOOCANVAS | ||
| 985 | xv->widget = goo_canvas_new(); | ||
| 986 | GooCanvasItem *root, *rect_item, *text_item; | ||
| 987 | goo_canvas_set_bounds (GOO_CANVAS (xv->widget), 0, 0, 1000, 1000); | ||
| 988 | root = goo_canvas_get_root_item (GOO_CANVAS (xv->widget)); | ||
| 989 | rect_item = goo_canvas_rect_new (root, 100, 100, 400, 400, | ||
| 990 | "line-width", 10.0, | ||
| 991 | "radius-x", 20.0, | ||
| 992 | "radius-y", 10.0, | ||
| 993 | "stroke-color", "yellow", | ||
| 994 | "fill-color", "red", | ||
| 995 | NULL); | ||
| 996 | |||
| 997 | text_item = goo_canvas_text_new (root, "Hello World", 300, 300, -1, | ||
| 998 | GTK_ANCHOR_CENTER, | ||
| 999 | "font", "Sans 24", | ||
| 1000 | NULL); | ||
| 1001 | goo_canvas_item_rotate (text_item, 45, 300, 300); | ||
| 1002 | |||
| 1003 | #endif | ||
| 1004 | #ifdef HAVE_CLUTTER | ||
| 1005 | xv->widget = gtk_clutter_embed_new ();; | ||
| 1006 | ClutterActor *stage = NULL; | ||
| 1007 | stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED ( xv->widget)); | ||
| 1008 | ClutterColor stage_color = { 0xaa, 0xaa, 0xaa, 0xff }; /* Black */ | ||
| 1009 | clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); | ||
| 1010 | |||
| 1011 | ClutterActor * texture = clutter_cairo_texture_new (1000, 1000); | ||
| 1012 | clutter_container_add_actor(stage, texture); | ||
| 1013 | clutter_actor_set_position(texture, 0,0); | ||
| 1014 | clutter_actor_show(texture); | ||
| 1015 | |||
| 1016 | cairo_t *cr; | ||
| 1017 | cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (texture)); | ||
| 1018 | |||
| 1019 | /* draw on the context */ | ||
| 1020 | RsvgHandle *h = rsvg_handle_new_from_file ("/tmp/tst.svg", | ||
| 1021 | NULL); | ||
| 1022 | |||
| 1023 | rsvg_handle_render_cairo(h, cr); | ||
| 1024 | cairo_destroy (cr); | ||
| 1025 | |||
| 1026 | /* Show the stage: */ | ||
| 1027 | clutter_actor_show (stage); | ||
| 1028 | #endif | ||
| 1029 | } else if (EQ(xww->type, Qwebkit_osr)|| | 986 | } else if (EQ(xww->type, Qwebkit_osr)|| |
| 1030 | EQ(xww->type, Qsocket_osr)|| | 987 | EQ(xww->type, Qsocket_osr)|| |
| 1031 | (Fget(xww->type, Qcxwgir_class) != Qnil))//xwgir widgets are OSR | 988 | (Fget(xww->type, QCxwgir_class) != Qnil))//xwgir widgets are OSR |
| 1032 | { | 989 | { |
| 1033 | #ifdef HAVE_WEBKIT_OSR //TODO the ifdef isnt really relevant anymore, we always have osr | 990 | #ifdef HAVE_WEBKIT_OSR //TODO the ifdef isnt really relevant anymore, we always have osr |
| 1034 | printf("osr init:%s\n",SDATA(SYMBOL_NAME(xww->type))); | 991 | printf("osr init:%s\n",SDATA(SYMBOL_NAME(xww->type))); |
| @@ -1067,7 +1024,7 @@ xwidget_init_view (struct xwidget *xww, | |||
| 1067 | /* g_signal_connect (G_OBJECT ( xv->widget), "key-release-event", */ | 1024 | /* g_signal_connect (G_OBJECT ( xv->widget), "key-release-event", */ |
| 1068 | /* G_CALLBACK (xwidget_osr_event_forward), NULL); */ | 1025 | /* G_CALLBACK (xwidget_osr_event_forward), NULL); */ |
| 1069 | 1026 | ||
| 1070 | #endif | 1027 | #endif /* HAVE_WEBKIT_OSR */ |
| 1071 | 1028 | ||
| 1072 | 1029 | ||
| 1073 | } | 1030 | } |
| @@ -1114,7 +1071,7 @@ xwidget_init_view (struct xwidget *xww, | |||
| 1114 | //xwgir debug | 1071 | //xwgir debug |
| 1115 | if (//EQ(xww->type, Qwebkit_osr)|| //TODO should be able to choose compile time which method to use with webkit | 1072 | if (//EQ(xww->type, Qwebkit_osr)|| //TODO should be able to choose compile time which method to use with webkit |
| 1116 | EQ(xww->type, Qsocket_osr)|| | 1073 | EQ(xww->type, Qsocket_osr)|| |
| 1117 | (Fget(xww->type, Qcxwgir_class) != Qnil))//xwgir widgets are OSR | 1074 | (Fget(xww->type, QCxwgir_class) != Qnil))//xwgir widgets are OSR |
| 1118 | { | 1075 | { |
| 1119 | //xwidget_set_embedder_view(xww,xv); | 1076 | //xwidget_set_embedder_view(xww,xv); |
| 1120 | printf("gdk_offscreen_window_set_embedder %d %d\n", | 1077 | printf("gdk_offscreen_window_set_embedder %d %d\n", |
| @@ -1350,7 +1307,7 @@ DEFUN ("xwidget-webkit-dom-dump", Fxwidget_webkit_dom_dump, Sxwidget_webkit_dom | |||
| 1350 | 1307 | ||
| 1351 | 1308 | ||
| 1352 | 1309 | ||
| 1353 | #endif | 1310 | #endif /* HAVE_WEBKIT_OSR */ |
| 1354 | 1311 | ||
| 1355 | 1312 | ||
| 1356 | 1313 | ||
| @@ -1611,12 +1568,14 @@ syms_of_xwidget (void) | |||
| 1611 | defsubr (&Sxwidget_buffer); | 1568 | defsubr (&Sxwidget_buffer); |
| 1612 | defsubr (&Sset_xwidget_plist); | 1569 | defsubr (&Sset_xwidget_plist); |
| 1613 | 1570 | ||
| 1614 | DEFSYM (Qxwidget ,"xwidget"); | 1571 | DEFSYM (Qxwidget, "xwidget"); |
| 1615 | 1572 | ||
| 1616 | DEFSYM (Qcxwidget ,":xwidget"); | 1573 | DEFSYM (QCxwidget, ":xwidget"); |
| 1617 | DEFSYM (Qcxwgir_class ,":xwgir-class"); | 1574 | DEFSYM (QCxwgir_class, ":xwgir-class"); |
| 1618 | DEFSYM (Qtitle ,":title"); | 1575 | DEFSYM (QCtitle, ":title"); |
| 1619 | 1576 | ||
| 1577 | /* Do not forget to update the docstring of make-xwidget if you add | ||
| 1578 | new types. */ | ||
| 1620 | DEFSYM (Qbutton, "Button"); //changed to match the gtk class because xwgir(experimental and not really needed) | 1579 | DEFSYM (Qbutton, "Button"); //changed to match the gtk class because xwgir(experimental and not really needed) |
| 1621 | DEFSYM (Qtoggle, "ToggleButton"); | 1580 | DEFSYM (Qtoggle, "ToggleButton"); |
| 1622 | DEFSYM (Qslider, "slider"); | 1581 | DEFSYM (Qslider, "slider"); |
| @@ -1626,10 +1585,11 @@ syms_of_xwidget (void) | |||
| 1626 | 1585 | ||
| 1627 | DEFSYM (QCplist, ":plist"); | 1586 | DEFSYM (QCplist, ":plist"); |
| 1628 | 1587 | ||
| 1629 | DEFVAR_LISP ("xwidget-alist", Vxwidget_alist, doc: /*xwidgets list*/); | 1588 | DEFVAR_LISP ("xwidget-alist", Vxwidget_alist, doc: /*xwidgets list*/); |
| 1630 | Vxwidget_alist = Qnil; | 1589 | Vxwidget_alist = Qnil; |
| 1631 | DEFVAR_LISP ("xwidget-view-alist", Vxwidget_view_alist, doc: /*xwidget views list*/); | 1590 | |
| 1632 | Vxwidget_alist = Qnil; | 1591 | DEFVAR_LISP ("xwidget-view-alist", Vxwidget_view_alist, doc: /*xwidget views list*/); |
| 1592 | Vxwidget_view_alist = Qnil; | ||
| 1633 | 1593 | ||
| 1634 | Fprovide (intern ("xwidget-internal"), Qnil); | 1594 | Fprovide (intern ("xwidget-internal"), Qnil); |
| 1635 | 1595 | ||
| @@ -1744,12 +1704,12 @@ lookup_xwidget (Lisp_Object spec) | |||
| 1744 | Lisp_Object value; | 1704 | Lisp_Object value; |
| 1745 | struct xwidget *xw; | 1705 | struct xwidget *xw; |
| 1746 | 1706 | ||
| 1747 | value = xwidget_spec_value (spec, Qcxwidget, &found1); | 1707 | value = xwidget_spec_value (spec, QCxwidget, &found1); |
| 1748 | xw = XXWIDGET(value); | 1708 | xw = XXWIDGET(value); |
| 1749 | 1709 | ||
| 1750 | /* value = xwidget_spec_value (spec, QCtype, &found); */ | 1710 | /* value = xwidget_spec_value (spec, QCtype, &found); */ |
| 1751 | /* xw->type = SYMBOLP (value) ? value : Qbutton; //default to button */ | 1711 | /* xw->type = SYMBOLP (value) ? value : Qbutton; //default to button */ |
| 1752 | /* value = xwidget_spec_value (spec, Qtitle, &found2); */ | 1712 | /* value = xwidget_spec_value (spec, QCtitle, &found2); */ |
| 1753 | /* xw->title = STRINGP (value) ? (char *) SDATA (value) : "?"; //funky cast FIXME TODO */ | 1713 | /* xw->title = STRINGP (value) ? (char *) SDATA (value) : "?"; //funky cast FIXME TODO */ |
| 1754 | 1714 | ||
| 1755 | /* value = xwidget_spec_value (spec, QCheight, NULL); */ | 1715 | /* value = xwidget_spec_value (spec, QCheight, NULL); */ |
| @@ -1852,4 +1812,4 @@ xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix) | |||
| 1852 | } | 1812 | } |
| 1853 | 1813 | ||
| 1854 | 1814 | ||
| 1855 | #endif | 1815 | #endif /* HAVE_XWIDGETS */ |
diff --git a/src/xwidget.h b/src/xwidget.h index e5cfe6de902..92c6e6e3513 100644 --- a/src/xwidget.h +++ b/src/xwidget.h | |||
| @@ -107,4 +107,4 @@ struct xwidget* lookup_xwidget (Lisp_Object spec); | |||
| 107 | #define XG_XWIDGET "emacs_xwidget" | 107 | #define XG_XWIDGET "emacs_xwidget" |
| 108 | #define XG_XWIDGET_VIEW "emacs_xwidget_view" | 108 | #define XG_XWIDGET_VIEW "emacs_xwidget_view" |
| 109 | void xwidget_view_delete_all_in_window( struct window *w ); | 109 | void xwidget_view_delete_all_in_window( struct window *w ); |
| 110 | #endif | 110 | #endif /* XWIDGET_H_INCLUDED */ |