The problem is that Emacs cant actually draw the widgets, as it can with
images. Emacs must notify GTK about where the widgets should be, and how they
should be clipped and so on, and this information must be given to GTK
-synchonous with Emacs display changes. Ok, so why is that difficult then?
+synchronous with Emacs display changes. Ok, so why is that difficult then?
- How do we know when a widget is NOT to be drawn? The only way I found so far
is having a flag for each xwdiget, that is reset before a redisplay. When an
an Emacs window, the story gets more complex.
The problem is that xembed is designed to plug an application window
-inside a a secket and thats it. You can't move a plug between
+inside a socket and thats it. You can't move a plug between
sockets. I tried numerous hacks to get around this but there is
-nothing that works realy well.
+nothing that works really well.
Therefore the Emacs part of the code will only expose well-defined
interfaces. cooperating applications will be able to use the interface
contained.
This app will work by providing a socket that an app plugs into. The
-socket window is copied efficientlp by means of composition to a
-number of other windows, that then are plugged into the different
+socket window is copied efficiently by means of composition to a
+number of other windows, that are then plugged into the different
Emacs sockets.
** old notes from x_draw_xwidget_glyph_string
BUG it seems this method for some reason is called with bad s->x and s->y sometimes.
When this happens the xwidget doesnt move on screen as it should.
- This mightbe because of x_scroll_run. Emacs decides to scroll the screen by blitting sometimes.
+ This might be because of x_scroll_run. Emacs decides to scroll the screen by blitting sometimes.
then emacs doesnt try to actualy call the paint routines, which means this here code will never
run so the xwidget wont know it has been moved.
always available in an off-screen buffer. My current attempt at composition doesnt work properly however.
//allocation debugging. the correct values cant be expected to show upp immediately, but eventually they should get to be ok
- // this is because we dont know when the container gets around to doing layout
+ // this is because we dont know when the container gets around to do layout
//GtkAllocation galloc;
//gtk_widget_get_allocation(GTK_WIDGET (xv->widgetwindow), &galloc);
//printf("allocation %d %d , %d %d\n", galloc.x,galloc.y,galloc.width,galloc.height);
*** old notes about the old live/phantom scheme
//TODO:
- // 1) always draw live xwidget in slected window
+ // 1) always draw live xwidget in selected window
// (2) if there were no live instances of the xwidget in selected window, also draw it live)
// 3) if there was a live xwidget previously, now phantom it.
http://kegel.com/gtk/button.c
-*** TODO examine some library to synthesise events
+*** TODO examine some library to synthesize events
xdotool
xte xautomation
crikey
xwidget.
- retrieve the xwidget objet from the spec with an xwidget-at-point function. It
can be uninitalized which client code must handle. Unlike
- assynchronous process creation we dont get back a handle, because
+ asynchronous process creation we dont get back a handle, because
there is none yet.
- emitted event on initialization, when needed. Many widgets don't
need this. for instance, a button sends an event when pressed. but
CLOSED: [2011-07-04 Mon 16:55]
http://www.lanedo.com/~carlos/gtk3-doc/GtkWidget.html#gtk-widget-set-has-window
mentions that it has_window can only be called inside a widget
-impementation.
+implementation.
this wasnt really the issue. allocation was the problem
*** DONE try scrolled window
I returned to using a simple gtkfixed for the widgetwindow. with
allocation hack and set_has_window it works. Idea prefer not to have
the allocatien hack and it wasnt needed it gtk3 only gtk2. needs
-furthi investigation,
+further investigation.
** various code cleanups
There are many cleanups necessary before any hope of inclusion in
http://gtkplus-p3.0.sourcearchive.com/documentation/2.91.5-0ubuntu1/testoffscreenwindow_8c-source.html
-after many atempts, the basic issue remains. for some reason the
+after many attempts, the basic issue remains. for some reason the
offscreen widget isnt ok when I want to snapshot it, so i simply get
-emptiness. the surface is only ok someimes.
+emptiness. the surface is only ok sometimes.
here is a useful debugging snippets:
#+begin_src C
heres a newer aproach
http://hg.mozilla.org/incubator/embedding/file/29ac0fe51754/gtk/tests/test.cpp
-while webkit clearly has the best traction as an embeddee, the
+while webkit clearly has the best traction as an embedded, the
offscreen rendering issues makes it interesting to see what ff brings
to the table.
https://launchpad.net/gnome-seed
or this funny hack:
-<jave> im trying to understanh how to interact via javascript to an embedded
+<jave> im trying to understand how to interact via javascript to an embedded
webkit gtk instance [23:38]
<jave> i use webkit_web_view_execute_script() which is nice but doesnt return
a value, by design aparently [23:39]
** webkit related
*** TODO webkit support webkit signals
-**** DONE particularily document-load-finished
+**** DONE particularly document-load-finished
CLOSED: [2011-08-01 Mon 22:34]
http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-document-load-finished
because one might need tell set a title and sizes and things when it loads.
xwidget. Then image mode could be reused for webkit mode.
I tried some adaptor code in xwidget.el so webkit mode now delegates
-to image mode buh its a kludge.
+to image mode but its a kludge.
** socket related
*** TODO some flickering during redisplay of sockets
afflicted.
the size allocation workaround works by 1st running the ordinary
-allocation then modifying the results. its done this way to minimise
+allocation then modifying the results. its done this way to minimize
the copy paste index from the base class. it might be that the
original allocation has a brief time window to show itself.
tried to modify the allocation hack so it doesn't call allocate
twice. this doesn't seem to help flicker at all aparently so the
-hypothesis falls. Maybe then a socket simply doesn't lke being clipped
+hypothesis falls. Maybe then a socket simply doesn't like being clipped
by gtkfixed.
*** TODO xwidget view reaping too agressive
- XCopyArea
- x_shift_glyphs_for_insert
- x_scroll_run. this is run by the try_window* functions, and
- inhibiting them dösnt help. but also callid in scrolling_window.
+ inhibiting them doesnt help. but also callid in scrolling_window.
- try_window_reusing_current_matrix
(run-with-timer 1 1 'redraw-display)
seems to work:
-inhibiting scrolling_window(). and this seem to be enaugh to restore
+inhibiting scrolling_window(). and this seem to be enough to restore the
old behaviour, GLYPH_DEBUG doesn't seem needed.
;;; Commentary:
-;;
+;;
;;TODO this breaks compilation when we dont have xwidgets
;;(require 'xwidget-internal)
see xwidget.c for types suitable for TYPE."
(goto-char pos)
- (let ((id (make-xwidget (point) (point) type title width height nil)))
- (put-text-property (point)
- (+ 1 (point)) 'display (list 'xwidget ':xwidget id))
-
+ (let ((id (make-xwidget (point) (point)
+ type title width height nil)))
+ (put-text-property (point) (+ 1 (point))
+ 'display (list 'xwidget ':xwidget id))
id))
-
(defun xwidget-at (pos)
"Return xwidget at POS."
;;TODO this function is a bit tedious because the C layer isnt well protected yet and
(let* ((disp (get-text-property pos 'display))
(xw (car (cdr (cdr disp)))))
;;(if ( xwidgetp xw) xw nil)
- (if (equal 'xwidget (car disp)) xw)
- ))
-
-
+ (if (equal 'xwidget (car disp)) xw)))
;; (defun xwidget-socket-handler ()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; webkit support
(require 'browse-url)
-(require 'image-mode);;for some image-mode alike functinoality
+(require 'image-mode);;for some image-mode alike functionality
(require 'cl-macs);;for flet
;;;###autoload
NEW-SESSION specifies whether to create a new xwidget-webkit session. URL
defaults to the string looking like a url around the cursor position."
(interactive (progn
- (require 'browse-url)
- (browse-url-interactive-arg "xwidget-webkit URL: "
+ (require 'browse-url)
+ (browse-url-interactive-arg "xwidget-webkit URL: "
;;( xwidget-webkit-current-url)
)))
(when (stringp url)
(setq url (url-tidy url))
(if new-session
- (xwidget-webkit-new-session url)
+ (xwidget-webkit-new-session url)
(xwidget-webkit-goto-url url))))
(funcall ,fn ))))
(defmacro xwidget-image-mode-navigation-adaptor-p (fn)
- "Image code adaptor. `image-mode' FN is called with interactive arg."
+ "Image code adaptor. `image-mode' FN is called with interactive arg."
`(lambda (n) (interactive "p")
(cl-flet ((image-display-size (spec) (xwidget-image-display-size spec)))
(funcall ,fn n))))
(define-key map "w" 'xwidget-webkit-current-url)
;;similar to image mode bindings
- (define-key map (kbd "SPC") (xwidget-image-mode-navigation-adaptor 'image-scroll-up))
- (define-key map (kbd "DEL") (xwidget-image-mode-navigation-adaptor 'image-scroll-down))
-
- (define-key map [remap scroll-up] (xwidget-image-mode-navigation-adaptor 'image-scroll-up))
- (define-key map [remap scroll-up-command] (xwidget-image-mode-navigation-adaptor 'image-scroll-up))
-
- (define-key map [remap scroll-down] (xwidget-image-mode-navigation-adaptor 'image-scroll-down))
- (define-key map [remap scroll-down-command] (xwidget-image-mode-navigation-adaptor 'image-scroll-down))
-
- (define-key map [remap forward-char] (xwidget-image-mode-navigation-adaptor-p 'image-forward-hscroll))
- (define-key map [remap backward-char] (xwidget-image-mode-navigation-adaptor-p 'image-backward-hscroll))
- (define-key map [remap right-char] (xwidget-image-mode-navigation-adaptor-p 'image-forward-hscroll))
- (define-key map [remap left-char] (xwidget-image-mode-navigation-adaptor-p 'image-backward-hscroll))
- (define-key map [remap previous-line] (xwidget-image-mode-navigation-adaptor-p 'image-previous-line))
- (define-key map [remap next-line] (xwidget-image-mode-navigation-adaptor-p 'image-next-line))
-
- (define-key map [remap move-beginning-of-line] (xwidget-image-mode-navigation-adaptor-p 'image-bol))
- (define-key map [remap move-end-of-line] (xwidget-image-mode-navigation-adaptor-p 'image-eol))
- (define-key map [remap beginning-of-buffer] (xwidget-image-mode-navigation-adaptor 'image-bob))
- (define-key map [remap end-of-buffer] (xwidget-image-mode-navigation-adaptor 'image-eob))
+ (define-key map (kbd "SPC") (xwidget-image-mode-navigation-adaptor 'image-scroll-up))
+ (define-key map (kbd "DEL") (xwidget-image-mode-navigation-adaptor 'image-scroll-down))
+
+ (define-key map [remap scroll-up] (xwidget-image-mode-navigation-adaptor 'image-scroll-up))
+ (define-key map [remap scroll-up-command] (xwidget-image-mode-navigation-adaptor 'image-scroll-up))
+
+ (define-key map [remap scroll-down] (xwidget-image-mode-navigation-adaptor 'image-scroll-down))
+ (define-key map [remap scroll-down-command] (xwidget-image-mode-navigation-adaptor 'image-scroll-down))
+
+ (define-key map [remap forward-char] (xwidget-image-mode-navigation-adaptor-p 'image-forward-hscroll))
+ (define-key map [remap backward-char] (xwidget-image-mode-navigation-adaptor-p 'image-backward-hscroll))
+ (define-key map [remap right-char] (xwidget-image-mode-navigation-adaptor-p 'image-forward-hscroll))
+ (define-key map [remap left-char] (xwidget-image-mode-navigation-adaptor-p 'image-backward-hscroll))
+ (define-key map [remap previous-line] (xwidget-image-mode-navigation-adaptor-p 'image-previous-line))
+ (define-key map [remap next-line] (xwidget-image-mode-navigation-adaptor-p 'image-next-line))
+
+ (define-key map [remap move-beginning-of-line] (xwidget-image-mode-navigation-adaptor-p 'image-bol))
+ (define-key map [remap move-end-of-line] (xwidget-image-mode-navigation-adaptor-p 'image-eol))
+ (define-key map [remap beginning-of-buffer] (xwidget-image-mode-navigation-adaptor 'image-bob))
+ (define-key map [remap end-of-buffer] (xwidget-image-mode-navigation-adaptor 'image-eob))
map)
"Keymap for `xwidget-webkit-mode'.")
)
;(funcall xwidget-callback xwidget xwidget-event-type)
(message "xw callback %s" xwidget)
- (funcall 'xwidget-webkit-callback xwidget xwidget-event-type)
- ))
+ (funcall 'xwidget-webkit-callback xwidget xwidget-event-type)))
(defun xwidget-webkit-callback (xwidget xwidget-event-type)
(save-excursion
- (cond ( (buffer-live-p (xwidget-buffer xwidget))
- (set-buffer (xwidget-buffer xwidget))
- (let* ( (strarg (nth 3 last-input-event)))
- (cond ((eq xwidget-event-type 'document-load-finished)
- (xwidget-log "webkit finished loading: '%s'" (xwidget-webkit-get-title xwidget))
- (xwidget-adjust-size-to-content xwidget)
- (rename-buffer (format "*xwidget webkit: %s *" (xwidget-webkit-get-title xwidget)))
- (pop-to-buffer (current-buffer))
- )
-
- ((eq xwidget-event-type 'navigation-policy-decision-requested)
- (if (string-match ".*#\\(.*\\)" strarg)
- (xwidget-webkit-show-id-or-named-element xwidget (match-string 1 strarg))))
- (t (xwidget-log "unhandled event:%s" xwidget-event-type)))))
+ (cond ((buffer-live-p (xwidget-buffer xwidget))
+ (set-buffer (xwidget-buffer xwidget))
+ (let* ((strarg (nth 3 last-input-event)))
+ (cond ((eq xwidget-event-type 'document-load-finished)
+ (xwidget-log "webkit finished loading: '%s'" (xwidget-webkit-get-title xwidget))
+ (xwidget-adjust-size-to-content xwidget)
+ (rename-buffer (format "*xwidget webkit: %s *" (xwidget-webkit-get-title xwidget)))
+ (pop-to-buffer (current-buffer)))
+ ((eq xwidget-event-type 'navigation-policy-decision-requested)
+ (if (string-match ".*#\\(.*\\)" strarg)
+ (xwidget-webkit-show-id-or-named-element xwidget (match-string 1 strarg))))
+ (t (xwidget-log "unhandled event:%s" xwidget-event-type)))))
(t (xwidget-log "error: callback called for xwidget with dead buffer")))))
(define-derived-mode xwidget-webkit-mode
special-mode "xwidget-webkit" "xwidget webkit view mode"
(setq buffer-read-only t)
;; Keep track of [vh]scroll when switching buffers
- (image-mode-setup-winprops)
-
- )
+ (image-mode-setup-winprops))
(defvar xwidget-webkit-last-session-buffer nil)
"
-"javascript that finds the active element."
-;;yes its ugly. because:
-;; - there is aparently no way to find the active frame other than recursion
-;; - the js "for each" construct missbehaved on the "frames" collection
-;; - a window with no frameset still has frames.length == 1, but frames[0].document.activeElement != document.activeElement
-;;TODO the activeelement type needs to be examined, for iframe, etc. sucks.
-)
+ "javascript that finds the active element."
+ ;;yes its ugly. because:
+ ;; - there is aparently no way to find the active frame other than recursion
+ ;; - the js "for each" construct missbehaved on the "frames" collection
+ ;; - a window with no frameset still has frames.length == 1, but frames[0].document.activeElement != document.activeElement
+ ;;TODO the activeelement type needs to be examined, for iframe, etc. sucks.
+ )
(defun xwidget-webkit-insert-string (xw str)
"Insert string in the active field in the webkit.
(progn
(xwidget-webkit-execute-script xww xwidget-webkit-activeelement-js)
(xwidget-webkit-execute-script-rv xww "findactiveelement(document).value;" )))
- (field-type (xwidget-webkit-execute-script-rv xww "findactiveelement(document).type;" )))
+ (field-type (xwidget-webkit-execute-script-rv xww "findactiveelement(document).type;" )))
(list xww
- (cond ( (equal "text" field-type) (read-string "text:" field-value))
- ( (equal "password" field-type) (read-passwd "password:" nil field-value))
- ( (equal "textarea" field-type) (xwidget-webkit-begin-edit-textarea xww field-value))
- ))))
+ (cond ((equal "text" field-type)
+ (read-string "text:" field-value))
+ ((equal "password" field-type)
+ (read-passwd "password:" nil field-value))
+ ((equal "textarea" field-type)
+ (xwidget-webkit-begin-edit-textarea xww field-value))))))
(xwidget-webkit-execute-script xw (format "findactiveelement(document).value='%s'" str)))
(defun xwidget-webkit-begin-edit-textarea (xw text)
- (switch-to-buffer
+ (switch-to-buffer
(generate-new-buffer "textarea"))
-
+
(set (make-local-variable 'xwbl) xw)
- (insert text)
- )
+ (insert text))
(defun xwidget-webkit-end-edit-textarea ()
(interactive)
;; - the selected window is scrolled but this is not always correct
;; - this needs to be interfaced into browse-url somehow. the tricky part is that we need to do this in two steps:
;; A: load the base url, wait for load signal to arrive B: navigate to the anchor when the base url is finished rendering
-
+
;;this part figures out the Y coordinate of the element
- (let ((y
- (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementsByName('%s')[0].getBoundingClientRect().top" element-name) 0))))
- ;;now we need to tell emacs to scroll the element into view.
+ (let ((y (string-to-number
+ (xwidget-webkit-execute-script-rv xw
+ (format "document.getElementsByName('%s')[0].getBoundingClientRect().top" element-name)
+ 0))))
+ ;;now we need to tell emacs to scroll the element into view.
(xwidget-log "scroll: %d" y)
- (set-window-vscroll (selected-window) y t))
- )
+ (set-window-vscroll (selected-window) y t)))
(defun xwidget-webkit-show-id-element (xw element-id)
"make id-element show. for instance an anchor."
- (interactive (list (xwidget-webkit-current-session) (read-string "element id:")))
- (let ((y
- (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementById('%s').getBoundingClientRect().top" element-id) 0))))
- ;;now we need to tell emacs to scroll the element into view.
+ (interactive (list (xwidget-webkit-current-session)
+ (read-string "element id:")))
+ (let ((y (string-to-number
+ (xwidget-webkit-execute-script-rv xw
+ (format "document.getElementById('%s').getBoundingClientRect().top" element-id)
+ 0))))
+ ;;now we need to tell emacs to scroll the element into view.
(xwidget-log "scroll: %d" y)
- (set-window-vscroll (selected-window) y t))
- )
+ (set-window-vscroll (selected-window) y t)))
(defun xwidget-webkit-show-id-or-named-element (xw element-id)
"make id-element show. for instance an anchor."
- (interactive (list (xwidget-webkit-current-session) (read-string "element id:")))
- (let* ((y1
- (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementsByName('%s')[0].getBoundingClientRect().top" element-id) "0")))
- (y2
- (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementById('%s').getBoundingClientRect().top" element-id) "0")))
- (y3 (max y1 y2)))
- ;;now we need to tell emacs to scroll the element into view.
+ (interactive (list (xwidget-webkit-current-session)
+ (read-string "element id:")))
+ (let* ((y1 (string-to-number
+ (xwidget-webkit-execute-script-rv xw
+ (format "document.getElementsByName('%s')[0].getBoundingClientRect().top" element-id)
+ "0")))
+ (y2 (string-to-number
+ (xwidget-webkit-execute-script-rv xw
+ (format "document.getElementById('%s').getBoundingClientRect().top" element-id)
+ "0")))
+ (y3 (max y1 y2)))
+ ;;now we need to tell emacs to scroll the element into view.
(xwidget-log "scroll: %d" y3)
- (set-window-vscroll (selected-window) y3 t))
- )
+ (set-window-vscroll (selected-window) y3 t)))
(defun xwidget-webkit-adjust-size-to-content ()
"Adjust webkit to content size."
(interactive)
- ( xwidget-adjust-size-to-content ( xwidget-webkit-current-session)))
+ (xwidget-adjust-size-to-content (xwidget-webkit-current-session)))
(defun xwidget-webkit-adjust-size (w h)
"Manualy set webkit size.
Argument H height."
;;TODO shouldnt be tied to the webkit xwidget
(interactive "nWidth:\nnHeight:\n")
- ( xwidget-resize ( xwidget-webkit-current-session) w h))
+ (xwidget-resize ( xwidget-webkit-current-session) w h))
(defun xwidget-webkit-fit-width ()
(interactive)
- (xwidget-webkit-adjust-size
- (- (caddr (window-inside-pixel-edges)) (car (window-inside-pixel-edges)))
- 1000))
+ (xwidget-webkit-adjust-size (- (caddr (window-inside-pixel-edges))
+ (car (window-inside-pixel-edges)))
+ 1000))
(defun xwidget-webkit-new-session (url)
-"Create a new webkit session buffer with URL."
+ "Create a new webkit session buffer with URL."
(let*
((bufname (generate-new-buffer-name "*xwidget-webkit*"))
xw)
(setq xw (xwidget-insert 1 'webkit-osr bufname 1000 1000))
(xwidget-put xw 'callback 'xwidget-webkit-callback)
(xwidget-webkit-mode)
- (xwidget-webkit-goto-uri ( xwidget-webkit-last-session) url )))
+ (xwidget-webkit-goto-uri (xwidget-webkit-last-session) url )))
(defun xwidget-webkit-goto-url (url)
"Goto URL."
- (if ( xwidget-webkit-current-session)
+ (if (xwidget-webkit-current-session)
(progn
- (xwidget-webkit-goto-uri ( xwidget-webkit-current-session) url))
- ( xwidget-webkit-new-session url)))
+ (xwidget-webkit-goto-uri (xwidget-webkit-current-session) url))
+ (xwidget-webkit-new-session url)))
(defun xwidget-webkit-back ()
"Back in history."
(interactive)
- (xwidget-webkit-execute-script ( xwidget-webkit-current-session) "history.go(-1);"))
+ (xwidget-webkit-execute-script (xwidget-webkit-current-session) "history.go(-1);"))
(defun xwidget-webkit-reload ()
"Reload current url."
(interactive)
- (xwidget-webkit-execute-script ( xwidget-webkit-current-session) "history.go(0);"))
+ (xwidget-webkit-execute-script (xwidget-webkit-current-session) "history.go(0);"))
(defun xwidget-webkit-current-url ()
"Get the webkit url. place it on kill ring."
(interactive)
- (let* ((rv (xwidget-webkit-execute-script-rv (xwidget-webkit-current-session) "document.URL"))
- (url (kill-new (if rv rv ""))))
+ (let* ((rv (xwidget-webkit-execute-script-rv (xwidget-webkit-current-session)
+ "document.URL"))
+ (url (kill-new (or rv ""))))
(message "url: %s" url )
url))
;;or we find some other way to access the DOM
;;reset webkit title. fugly.
- (let* ( (emptytag "titlecantbewhitespaceohthehorror")
- title)
- (xwidget-webkit-execute-script xw (format "document.title=\"%s\";" (if default default emptytag)))
+ (let* ((emptytag "titlecantbewhitespaceohthehorror")
+ title)
+ (xwidget-webkit-execute-script xw (format "document.title=\"%s\";" (or default emptytag)))
(xwidget-webkit-execute-script xw (format "document.title=%s;" script))
(setq title (xwidget-webkit-get-title xw))
- (if (equal emptytag title) (setq title ""))
- (unless title (setq title default))
+ (if (equal emptytag title)
+ (setq title ""))
+ (unless title
+ (setq title default))
title))
"Change XWIDGET' PROPNAME property to VALUE.
It can be retrieved with `(xwidget-get XWIDGET PROPNAME)'."
(set-xwidget-plist xwidget
- (plist-put (xwidget-plist xwidget) propname value)))
+ (plist-put (xwidget-plist xwidget) propname value)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'xwidget)
-(provide 'xwidget)
-
;;; xwidget.el ends here
XSETSYMBOL(xw->type, type);
XSETSTRING(xw->title, title);
//TODO buffer should be an optional argument not just assumed to be the current buffer
- XSETBUFFER(xw->buffer, Fcurrent_buffer()); // conservatively gcpro xw since we call lisp
+ XSETBUFFER(xw->buffer, Fcurrent_buffer()); // conservatively gcpro xw since we call lisp
xw->height = XFASTINT(height);
xw->width = XFASTINT(width);
- XSETPSEUDOVECTOR (val, xw, PVEC_XWIDGET); //?? dunno why i need this
- Vxwidget_alist = Fcons ( val, Vxwidget_alist);
+ XSETPSEUDOVECTOR (val, xw, PVEC_XWIDGET); // set the vectorlike_header of VAL with the correct value
+ Vxwidget_alist = Fcons (val, Vxwidget_alist);
xw->widgetwindow_osr = NULL;
xw->widget_osr = NULL;
xw->plist = Qnil;
*/
if (EQ(xw->type, Qwebkit_osr)||
EQ(xw->type, Qsocket_osr)||
- (Fget(xw->type, Qcxwgir_class) != Qnil)){
- printf("init osr widget\n");
- block_input();
- xw->widgetwindow_osr = GTK_CONTAINER (gtk_offscreen_window_new ());
- gtk_window_resize( GTK_WINDOW(xw->widgetwindow_osr), xw->width, xw->height);
-
- if (EQ(xw->type, Qwebkit_osr))
- xw->widget_osr = webkit_web_view_new();
- if(EQ(xw->type, Qsocket_osr))
- xw->widget_osr = gtk_socket_new();
- if(Fget(xw->type, Qcxwgir_class) != Qnil)
- xw->widget_osr = xwgir_create( SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))),
+ (Fget(xw->type, Qcxwgir_class) != Qnil)) {
+ printf("init osr widget\n");
+ block_input();
+ xw->widgetwindow_osr = GTK_CONTAINER (gtk_offscreen_window_new ());
+ gtk_window_resize(GTK_WINDOW(xw->widgetwindow_osr), xw->width, xw->height);
+
+ if (EQ(xw->type, Qwebkit_osr))
+ xw->widget_osr = webkit_web_view_new();
+ if(EQ(xw->type, Qsocket_osr))
+ xw->widget_osr = gtk_socket_new();
+ if(Fget(xw->type, Qcxwgir_class) != Qnil)
+ xw->widget_osr = xwgir_create(SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))),
SDATA(Fcar(Fget(xw->type, Qcxwgir_class))));
- gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height);
- gtk_container_add (xw->widgetwindow_osr, xw->widget_osr);
+ gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height);
+ gtk_container_add (xw->widgetwindow_osr, xw->widget_osr);
- gtk_widget_show_all (GTK_WIDGET (xw->widgetwindow_osr));
+ gtk_widget_show_all (GTK_WIDGET (xw->widgetwindow_osr));
- /* store some xwidget data in the gtk widgets for convenient retrieval in the event handlers. */
- g_object_set_data (G_OBJECT (xw->widget_osr), XG_XWIDGET, (gpointer) (xw));
- g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, (gpointer) (xw));
- /* signals */
- g_signal_connect (G_OBJECT ( xw->widgetwindow_osr), "damage-event", G_CALLBACK (xwidget_osr_damage_event_callback), NULL);
+ /* store some xwidget data in the gtk widgets for convenient retrieval in the event handlers. */
+ g_object_set_data (G_OBJECT (xw->widget_osr), XG_XWIDGET, (gpointer) (xw));
+ g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, (gpointer) (xw));
+ /* signals */
+ g_signal_connect (G_OBJECT (xw->widgetwindow_osr), "damage-event",
+ G_CALLBACK (xwidget_osr_damage_event_callback), NULL);
- if (EQ(xw->type, Qwebkit_osr)){
- g_signal_connect (G_OBJECT ( xw->widget_osr),
- "document-load-finished",
- G_CALLBACK (webkit_osr_document_load_finished_callback),
- xw);
+ if (EQ(xw->type, Qwebkit_osr)) {
+ g_signal_connect (G_OBJECT (xw->widget_osr),
+ "document-load-finished",
+ G_CALLBACK (webkit_osr_document_load_finished_callback),
+ xw);
- g_signal_connect (G_OBJECT ( xw->widget_osr),
- "download-requested",
- G_CALLBACK (webkit_osr_download_callback),
- xw);
-
- g_signal_connect (G_OBJECT ( xw->widget_osr),
- "mime-type-policy-decision-requested",
- G_CALLBACK (webkit_osr_mime_type_policy_typedecision_requested_callback),
- xw);
-
- g_signal_connect (G_OBJECT ( xw->widget_osr),
- "new-window-policy-decision-requested",
- G_CALLBACK (webkit_osr_new_window_policy_decision_requested_callback),
- xw);
-
- g_signal_connect (G_OBJECT ( xw->widget_osr),
- "navigation-policy-decision-requested",
- G_CALLBACK (webkit_osr_navigation_policy_decision_requested_callback),
- xw);
- //webkit_web_view_load_uri(WEBKIT_WEB_VIEW(xw->widget_osr), "http://www.fsf.org");
+ g_signal_connect (G_OBJECT (xw->widget_osr),
+ "download-requested",
+ G_CALLBACK (webkit_osr_download_callback),
+ xw);
+
+ g_signal_connect (G_OBJECT (xw->widget_osr),
+ "mime-type-policy-decision-requested",
+ G_CALLBACK (webkit_osr_mime_type_policy_typedecision_requested_callback),
+ xw);
+
+ g_signal_connect (G_OBJECT (xw->widget_osr),
+ "new-window-policy-decision-requested",
+ G_CALLBACK (webkit_osr_new_window_policy_decision_requested_callback),
+ xw);
+
+ g_signal_connect (G_OBJECT (xw->widget_osr),
+ "navigation-policy-decision-requested",
+ G_CALLBACK (webkit_osr_navigation_policy_decision_requested_callback),
+ xw);
+ //webkit_web_view_load_uri(WEBKIT_WEB_VIEW(xw->widget_osr), "http://www.fsf.org");
- }
+ }
- if (EQ(xw->type, Qsocket_osr)) {
- printf ("xwid:%d socket id:%x %d\n",
- xw,
- gtk_socket_get_id (GTK_SOCKET (xw->widget_osr)),
- gtk_socket_get_id (GTK_SOCKET (xw->widget_osr)));
- send_xembed_ready_event (xw,
- gtk_socket_get_id (GTK_SOCKET (xw->widget_osr)));
- //gtk_widget_realize(xw->widget);
- }
+ if (EQ(xw->type, Qsocket_osr)) {
+ printf ("xwid:%d socket id:%x %d\n",
+ xw,
+ gtk_socket_get_id (GTK_SOCKET (xw->widget_osr)),
+ gtk_socket_get_id (GTK_SOCKET (xw->widget_osr)));
+ send_xembed_ready_event (xw, gtk_socket_get_id (GTK_SOCKET (xw->widget_osr)));
+ //gtk_widget_realize(xw->widget);
+ }
- unblock_input();
+ unblock_input();
}
#endif /* HAVE_WEBKIT_OSR */