aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-04-06 00:41:37 +0200
committerJoakim Verona2013-04-06 00:41:37 +0200
commitc1a5b51f2bb636d87d2315a68a074da113d82177 (patch)
treed61158eab59df986a691a24d37829c5f1602d7f3
parent9639da1e26683b6a54d255bb07a24dd6e0fae354 (diff)
downloademacs-c1a5b51f2bb636d87d2315a68a074da113d82177.tar.gz
emacs-c1a5b51f2bb636d87d2315a68a074da113d82177.zip
some cleanups
-rw-r--r--README.xwidget69
-rw-r--r--lisp/xwidget-test.el7
-rw-r--r--src/xwidget.c58
3 files changed, 72 insertions, 62 deletions
diff --git a/README.xwidget b/README.xwidget
index 6ca6f1a62ca..e13834ba04c 100644
--- a/README.xwidget
+++ b/README.xwidget
@@ -404,7 +404,9 @@ Missing separate debuginfos, use: debuginfo-install hunspell-1.2.15-2.fc15.x86_6
404 CLOSED: [2011-07-19 Tue 14:26] 404 CLOSED: [2011-07-19 Tue 14:26]
405now we just hard code sizes. but webkit widgets for instance can 405now we just hard code sizes. but webkit widgets for instance can
406report sizes that suit the content. support that. 406report sizes that suit the content. support that.
407** TODO BUG xwidget view ghosts 407** DONE BUG xwidget view ghosts
408 CLOSED: [2013-04-05 Fri 23:35]
409(havent seen this in quite a while)
408- xwidget-webkit-browse-url somewhere 410- xwidget-webkit-browse-url somewhere
409- split window. 411- split window.
410now theres 2 webkit views 412now theres 2 webkit views
@@ -929,7 +931,9 @@ http://developer.gnome.org/gdk/stable/gdk-Windows.html#GdkWindow-from-embedder
929turned out to be not so hard, captured events, copied them and 931turned out to be not so hard, captured events, copied them and
930forwarded them offscreen! 932forwarded them offscreen!
931 933
932** TODO investigate gdk_window_redirect_to_drawable 934** CANCELLED investigate gdk_window_redirect_to_drawable
935 CLOSED: [2013-04-05 Fri 23:37]
936(cancelled this, the current approach seems okay)
933http://developer.gnome.org/gdk/stable/gdk-Windows.html#gdk-offscreen-window-set-embedder 937http://developer.gnome.org/gdk/stable/gdk-Windows.html#gdk-offscreen-window-set-embedder
934maybe could be used in place of my own copy hacks? to work it must 938maybe could be used in place of my own copy hacks? to work it must
935support a chain of redirects, which seems unlikely. the benefit would 939support a chain of redirects, which seems unlikely. the benefit would
@@ -1397,7 +1401,9 @@ isn't needed if emacs bg erase disabled
1397might be some annoying local issues with my install because it is not 1401might be some annoying local issues with my install because it is not
1398reliably reproducible. (went away during merges) 1402reliably reproducible. (went away during merges)
1399 1403
1400** TODO low impact xwidget based image viewer 1404** CANCELLED low impact xwidget based image viewer
1405 CLOSED: [2013-04-05 Fri 23:38]
1406(cancelled this because it no longer seems like a good idea)
1401for instance to render SVG using webkit, or some other canvas. 1407for instance to render SVG using webkit, or some other canvas.
1402that way it would be possible to merge to trunk in stages. 1408that way it would be possible to merge to trunk in stages.
1403 1409
@@ -1558,7 +1564,6 @@ when an xwidget is removed from xwidget-alist, and there are no other
1558references(mostly views) the xwidget should be garbage collected. 1564references(mostly views) the xwidget should be garbage collected.
1559 1565
1560special finalization would go into gc_sweep() 1566special finalization would go into gc_sweep()
1561<<<<<<< TREE
1562** TODO embedding evince 1567** TODO embedding evince
1563http://developer.gnome.org/libevview/3.2/libevview-ev-view.html 1568http://developer.gnome.org/libevview/3.2/libevview-ev-view.html
1564would be useful for reading PDF:s and other document types. 1569would be useful for reading PDF:s and other document types.
@@ -1623,3 +1628,59 @@ Current limitation:
1623 xwgir methods, emacs crashes. 1628 xwgir methods, emacs crashes.
1624 1629
1625 1630
1631** TODO investigate gdk_offscreen_window_set_embedder()
1632https://developer.gnome.org/gdk/unstable/gdk-Windows.html
1633
1634,----
1635| Offscreen windows are more general than composited windows, since they
1636| allow not only to modify the rendering of the child window onto its
1637| parent, but also to apply coordinate transformations.
1638|
1639| To integrate an offscreen window into a window hierarchy, one has to
1640| call gdk_offscreen_window_set_embedder() and handle a number of
1641| signals. The "pick-embedded-child" signal on the embedder window is
1642| used to select an offscreen child at given coordinates, and the
1643| "to-embedder" and "from-embedder" signals on the offscreen window are
1644| used to translate coordinates between the embedder and the offscreen
1645| window.
1646|
1647| For rendering an offscreen window onto its embedder, the contents of
1648| the offscreen window are available as a pixmap, via
1649| gdk_offscreen_window_get_pixmap().
1650`----
1651
1652okay, [2013-04-03 Wed] I finally suceeded in this approach!
1653it was pretty hard to make it work and currently works like this:
1654- the on screen dravwing area is the embedder
1655- you must implement "pick child"
1656event forwarding is done automatically!
1657
1658BUT its not really super, because it only works well with a single
1659embedder.
1660
1661perhaps the strategy could be refined:
1662- the window frame would be the embedder for all xwidgets. (but what
1663 about several frames then?)
1664- in the from-embedder signal handler, which maps container coords to
1665 embedded widget coords, find out which xw-view i clicked on, and
1666 compute the coords.
1667
1668[2013-04-04 Thu] I had a strategy working for a xwgir button but not
1669a webkit. set_embedded in the motion event handler for the xv. it
1670even works for 2 frames! but not webkit :(
1671
1672[2013-04-05 Fri] it works for xwgir osr components, but not for
1673webkit. Webkit retains the previous event forwarding system.
1674
1675Now it works like this:
1676- the offscreen widget is created as before
1677- the on-screen views also as before, painting and copying as before.
1678- gdk_offscreen_window_set_embedder() is now used to embedd the
1679 offscreen widget in the onscreen one, upon view creation
1680- only one widget can embedd one other. This means that the embedding
1681 widget must be switched between the onscreen ones. This is now done
1682 in the mouse motion event handler.
1683
1684The above approach has been tested for xwgir created buttons and seems
1685to work. it doesnt work for webkit, so the old scheme is preserved
1686for webkit.
diff --git a/lisp/xwidget-test.el b/lisp/xwidget-test.el
index ba434f3d79a..6d4953c0ae0 100644
--- a/lisp/xwidget-test.el
+++ b/lisp/xwidget-test.el
@@ -98,6 +98,13 @@
98 (xwidget-insert (point-min) 'xwgirCheckButton "xwgir label didnt work..." 700 700) 98 (xwidget-insert (point-min) 'xwgirCheckButton "xwgir label didnt work..." 700 700)
99 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) 99 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
100 100
101(xwidget-demo "a-xwgir-slider"
102 (xwgir-require-namespace "Gtk" "3.0")
103 (put 'xwgirSlider :xwgir-class '("Gtk" "Slider"))
104
105 (xwidget-insert (point-min) 'xwgirSlider "xwgir label didnt work..." 700 700)
106 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
107
101(xwidget-demo "a-xwgir-webkit" 108(xwidget-demo "a-xwgir-webkit"
102 (xwgir-require-namespace "WebKit" "3.0") 109 (xwgir-require-namespace "WebKit" "3.0")
103 (put 'xwgirWebkit :xwgir-class '("WebKit" "WebView")) 110 (put 'xwgirWebkit :xwgir-class '("WebKit" "WebView"))
diff --git a/src/xwidget.c b/src/xwidget.c
index c6714ad40a5..8a88a596163 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -238,11 +238,6 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0,
238 xw->widget_osr = xwgir_create( SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))), 238 xw->widget_osr = xwgir_create( SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))),
239 SDATA(Fcar(Fget(xw->type, Qcxwgir_class)))); 239 SDATA(Fcar(Fget(xw->type, Qcxwgir_class))));
240 240
241 ///debug xwgir
242 /* gdk_offscreen_window_set_embedder ( gtk_widget_get_window (xw->widget_osr), */
243 /* gtk_widget_get_window (GTK_WIDGET (xw->widgetwindow_osr)) */
244 /* ); */
245 ///
246 gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height); 241 gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height);
247 gtk_container_add (xw->widgetwindow_osr, xw->widget_osr); 242 gtk_container_add (xw->widgetwindow_osr, xw->widget_osr);
248 243
@@ -254,9 +249,6 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0,
254 /* signals */ 249 /* signals */
255 g_signal_connect (G_OBJECT ( xw->widgetwindow_osr), "damage-event", G_CALLBACK (xwidget_osr_damage_event_callback), NULL); 250 g_signal_connect (G_OBJECT ( xw->widgetwindow_osr), "damage-event", G_CALLBACK (xwidget_osr_damage_event_callback), NULL);
256 251
257 //TODO these were just a test hack
258 /* g_signal_connect (G_OBJECT ( xw->widget_osr), "key-press-event", G_CALLBACK (webkit_osr_key_event_callback), NULL); */
259 /* g_signal_connect (G_OBJECT ( xw->widget_osr), "key-release-event", G_CALLBACK (webkit_osr_key_event_callback), NULL); */
260 252
261 if (EQ(xw->type, Qwebkit_osr)){ 253 if (EQ(xw->type, Qwebkit_osr)){
262 g_signal_connect (G_OBJECT ( xw->widget_osr), 254 g_signal_connect (G_OBJECT ( xw->widget_osr),
@@ -303,56 +295,6 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0,
303 } 295 }
304#endif 296#endif
305 297
306 /* if (EQ(xw->type, Qsocket_osr)){ */
307 /* printf("init socket osr\n"); */
308 /* block_input(); */
309 /* xw->widgetwindow_osr = GTK_CONTAINER (gtk_offscreen_window_new ()); */
310 /* gtk_window_resize( GTK_WINDOW(xw->widgetwindow_osr), xw->width, xw->height); */
311
312 /* //////////////////// */
313 /* //xw->widget_osr = webkit_web_view_new(); */
314 /* xw->widget_osr = gtk_socket_new(); */
315 /* //g_signal_connect_after(xv->widget, "plug-added", G_CALLBACK(xwidget_plug_added), "plug added"); */
316 /* //g_signal_connect_after(xv->widget, "plug-removed", G_CALLBACK(xwidget_plug_removed), "plug removed"); */
317 /* /////////////////// */
318
319 /* gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height); */
320 /* gtk_container_add (xw->widgetwindow_osr, xw->widget_osr); */
321
322 /* gtk_widget_show_all (GTK_WIDGET (xw->widgetwindow_osr)); */
323
324 /* /\* store some xwidget data in the gtk widgets for convenient retrieval in the event handlers. *\/ */
325 /* g_object_set_data (G_OBJECT (xw->widget_osr), XG_XWIDGET, (gpointer) (xw)); */
326 /* g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, (gpointer) (xw)); */
327 /* g_signal_connect (G_OBJECT ( xw->widgetwindow_osr), "damage-event", G_CALLBACK (xwidget_osr_damage_event_callback), NULL); */
328
329 /* //webkit_web_view_load_uri(WEBKIT_WEB_VIEW(xw->widget_osr), "http://www.fsf.org"); */
330 /* unblock_input(); */
331
332 /* } */
333
334
335 /* ////////////////////////////// */
336 /* gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height); */
337 /* gtk_container_add (xw->widgetwindow_osr, xw->widget_osr); */
338
339 /* gtk_widget_show_all (GTK_WIDGET (xw->widgetwindow_osr)); */
340
341 /* /\* store some xwidget data in the gtk widgets for convenient retrieval in the event handlers. *\/ */
342 /* g_object_set_data (G_OBJECT (xw->widget_osr), XG_XWIDGET, (gpointer) (xw)); */
343 /* g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, (gpointer) (xw)); */
344 /* /\* signals *\/ */
345 /* g_signal_connect (G_OBJECT ( xw->widgetwindow_osr), "damage-event", G_CALLBACK (xwidget_osr_damage_event_callback), NULL); */
346 /* g_signal_connect (G_OBJECT ( xw->widget_osr), "button-press-event", G_CALLBACK (xwgir_event_callback), xw); */
347
348
349 /* unblock_input(); */
350 /* } */
351
352 ////////////////////////////////////////////////////////
353
354
355
356 UNGCPRO; 298 UNGCPRO;
357 return val; 299 return val;
358} 300}