diff options
| author | Joakim Verona | 2012-02-27 00:31:01 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-02-27 00:31:01 +0100 |
| commit | e8e42079e76ca6255bbd53312994ba8e1b3b0ee8 (patch) | |
| tree | 5a442dcda68978873a824fdb292e71bf48d736e8 | |
| parent | 4c6365623410b93cd6d0c0ff58581503974e0ea8 (diff) | |
| download | emacs-e8e42079e76ca6255bbd53312994ba8e1b3b0ee8.tar.gz emacs-e8e42079e76ca6255bbd53312994ba8e1b3b0ee8.zip | |
bug when passing xwidget in event
| -rw-r--r-- | .gitignore | 4 | ||||
| -rw-r--r-- | lisp/xwidget.el | 6 | ||||
| -rw-r--r-- | src/xwidget.c | 14 |
3 files changed, 18 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore index 21702f7cd07..50470179e38 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -15,3 +15,7 @@ makefile | |||
| 15 | 15 | ||
| 16 | /bin/ | 16 | /bin/ |
| 17 | /site-lisp/ | 17 | /site-lisp/ |
| 18 | *.o | ||
| 19 | *.elc | ||
| 20 | .bzr | ||
| 21 | *# \ No newline at end of file | ||
diff --git a/lisp/xwidget.el b/lisp/xwidget.el index 50e74add6a0..4329382081c 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el | |||
| @@ -160,6 +160,7 @@ defaults to the string looking like a url around the cursor position." | |||
| 160 | ;(xwidget-callback (xwidget-get xwidget 'callback));;TODO stopped working for some reason | 160 | ;(xwidget-callback (xwidget-get xwidget 'callback));;TODO stopped working for some reason |
| 161 | ) | 161 | ) |
| 162 | ;(funcall xwidget-callback xwidget xwidget-event-type) | 162 | ;(funcall xwidget-callback xwidget xwidget-event-type) |
| 163 | (message "xw callback %s" xwidget) | ||
| 163 | (funcall 'xwidget-webkit-callback xwidget xwidget-event-type) | 164 | (funcall 'xwidget-webkit-callback xwidget xwidget-event-type) |
| 164 | )) | 165 | )) |
| 165 | 166 | ||
| @@ -299,9 +300,9 @@ Argument STR string." | |||
| 299 | "make id-element show. for instance an anchor." | 300 | "make id-element show. for instance an anchor." |
| 300 | (interactive (list (xwidget-webkit-current-session) (read-string "element id:"))) | 301 | (interactive (list (xwidget-webkit-current-session) (read-string "element id:"))) |
| 301 | (let* ((y1 | 302 | (let* ((y1 |
| 302 | (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementsByName('%s')[0].getBoundingClientRect().top" element-id) 0))) | 303 | (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementsByName('%s')[0].getBoundingClientRect().top" element-id) "0"))) |
| 303 | (y2 | 304 | (y2 |
| 304 | (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementById('%s').getBoundingClientRect().top" element-id) 0))) | 305 | (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementById('%s').getBoundingClientRect().top" element-id) "0"))) |
| 305 | (y3 (max y1 y2))) | 306 | (y3 (max y1 y2))) |
| 306 | ;;now we need to tell emacs to scroll the element into view. | 307 | ;;now we need to tell emacs to scroll the element into view. |
| 307 | (xwidget-log "scroll: %d" y3) | 308 | (xwidget-log "scroll: %d" y3) |
| @@ -378,6 +379,7 @@ Argument H height." | |||
| 378 | (xwidget-webkit-execute-script xw (format "document.title=%s;" script)) | 379 | (xwidget-webkit-execute-script xw (format "document.title=%s;" script)) |
| 379 | (setq title (xwidget-webkit-get-title xw)) | 380 | (setq title (xwidget-webkit-get-title xw)) |
| 380 | (if (equal emptytag title) (setq title "")) | 381 | (if (equal emptytag title) (setq title "")) |
| 382 | (unless title (setq title default)) | ||
| 381 | title)) | 383 | title)) |
| 382 | 384 | ||
| 383 | 385 | ||
diff --git a/src/xwidget.c b/src/xwidget.c index 93d7c46a41f..b43cc14a791 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -98,6 +98,7 @@ | |||
| 98 | #include <webkit/webkitwebplugin.h> | 98 | #include <webkit/webkitwebplugin.h> |
| 99 | #include <webkit/webkitglobals.h> | 99 | #include <webkit/webkitglobals.h> |
| 100 | #include <webkit/webkitwebnavigationaction.h> | 100 | #include <webkit/webkitwebnavigationaction.h> |
| 101 | #include <webkit/webkitdownload.h> | ||
| 101 | #endif | 102 | #endif |
| 102 | 103 | ||
| 103 | #include "xwidget.h" | 104 | #include "xwidget.h" |
| @@ -123,7 +124,8 @@ allocate_xwidget_view (void) | |||
| 123 | { | 124 | { |
| 124 | return ALLOCATE_PSEUDOVECTOR (struct xwidget_view, redisplayed, PVEC_XWIDGET_VIEW); | 125 | return ALLOCATE_PSEUDOVECTOR (struct xwidget_view, redisplayed, PVEC_XWIDGET_VIEW); |
| 125 | } | 126 | } |
| 126 | 127 | #define XSETXWIDGET(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET)) | |
| 128 | #define XSETXWIDGET_VIEW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET_VIEW)) | ||
| 127 | 129 | ||
| 128 | Lisp_Object Qxwidget; | 130 | Lisp_Object Qxwidget; |
| 129 | Lisp_Object Qcxwidget; | 131 | Lisp_Object Qcxwidget; |
| @@ -457,13 +459,15 @@ gboolean webkit_osr_key_event_callback (GtkWidget *widget, GdkEventKey *event, g | |||
| 457 | void store_xwidget_event_string(struct xwidget* xw, char* eventname,char* eventstr){ | 459 | void store_xwidget_event_string(struct xwidget* xw, char* eventname,char* eventstr){ |
| 458 | //refactor attempt | 460 | //refactor attempt |
| 459 | struct input_event event; | 461 | struct input_event event; |
| 462 | Lisp_Object xwl; | ||
| 463 | XSETXWIDGET(xwl,xw); | ||
| 460 | EVENT_INIT (event); | 464 | EVENT_INIT (event); |
| 461 | event.kind = XWIDGET_EVENT; | 465 | event.kind = XWIDGET_EVENT; |
| 462 | event.frame_or_window = Qnil; //frame; //how to get the frame here? //TODO i store it in the xwidget now | 466 | event.frame_or_window = Qnil; //frame; //how to get the frame here? //TODO i store it in the xwidget now |
| 463 | 467 | ||
| 464 | event.arg = Qnil; | 468 | event.arg = Qnil; |
| 465 | event.arg = Fcons (build_string(eventstr), event.arg); //string so dont intern | 469 | event.arg = Fcons (build_string(eventstr), event.arg); //string so dont intern |
| 466 | event.arg = Fcons ((Lisp_Object)xw, event.arg); //TODO | 470 | event.arg = Fcons (xwl, event.arg); //TODO |
| 467 | event.arg = Fcons (intern (eventname), event.arg);//interning should be ok | 471 | event.arg = Fcons (intern (eventname), event.arg);//interning should be ok |
| 468 | kbd_buffer_store_event (&event); | 472 | kbd_buffer_store_event (&event); |
| 469 | 473 | ||
| @@ -487,11 +491,13 @@ gboolean webkit_osr_download_callback (WebKitWebView *webkitwebview, | |||
| 487 | WebKitDownload *arg1, | 491 | WebKitDownload *arg1, |
| 488 | gpointer data) | 492 | gpointer data) |
| 489 | { | 493 | { |
| 490 | printf("download requested %s\n", webkit_download_get_uri (arg1)); | ||
| 491 | //TODO this event sending code should be refactored | 494 | //TODO this event sending code should be refactored |
| 492 | struct input_event event; | 495 | struct input_event event; |
| 493 | // struct xwidget *xw = (struct xwidget *) data; | 496 | // struct xwidget *xw = (struct xwidget *) data; |
| 494 | struct xwidget* xw = (struct xwidget*) g_object_get_data (G_OBJECT (webkitwebview), XG_XWIDGET); | 497 | struct xwidget* xw = (struct xwidget*) g_object_get_data (G_OBJECT (webkitwebview), XG_XWIDGET); |
| 498 | printf("download requested %s\n", webkit_download_get_uri (arg1)); | ||
| 499 | |||
| 500 | |||
| 495 | printf("webkit finished loading\n"); | 501 | printf("webkit finished loading\n"); |
| 496 | 502 | ||
| 497 | store_xwidget_event_string(xw, "download-requested", webkit_download_get_uri (arg1)); | 503 | store_xwidget_event_string(xw, "download-requested", webkit_download_get_uri (arg1)); |
| @@ -829,7 +835,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 829 | 835 | ||
| 830 | //FUGLY macro that checks WEBKIT_IS_WEB_VIEW(xw->widget_osr) first | 836 | //FUGLY macro that checks WEBKIT_IS_WEB_VIEW(xw->widget_osr) first |
| 831 | #define WEBKIT_FN_INIT() \ | 837 | #define WEBKIT_FN_INIT() \ |
| 832 | struct xwidget* xw;\ | 838 | struct xwidget* xw; \ |
| 833 | if(!XXWIDGETP(xwidget)) {printf("ERROR not an xwidget\n"); return Qnil;}; \ | 839 | if(!XXWIDGETP(xwidget)) {printf("ERROR not an xwidget\n"); return Qnil;}; \ |
| 834 | if(Qnil == xwidget) {printf("ERROR xwidget nil\n"); return Qnil;}; \ | 840 | if(Qnil == xwidget) {printf("ERROR xwidget nil\n"); return Qnil;}; \ |
| 835 | xw = XXWIDGET(xwidget); \ | 841 | xw = XXWIDGET(xwidget); \ |