changeset 1109:39febe63d2c9

add support for --xid command line option The --xid option is used by a plugin for the claws mail client (http://www.claws-mail.org/) to embed the dillo window into the mailer application to display HTML mails.
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Mon, 18 May 2009 17:52:45 +0200
parents aedb85a48b23
children b76606e867fe
files ChangeLog src/Makefile.am src/dillo.cc src/menu.cc src/nav.c src/ui.cc src/uicmd.cc src/uicmd.hh
diffstat 8 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon May 18 03:25:37 2009 +0000
+++ b/ChangeLog	Mon May 18 17:52:45 2009 +0200
@@ -83,6 +83,7 @@
  - Support CSS @import directive.
  - Disable form widgets while stylesheets are loading.
  - Fix image scaling on reload with border, margin, or padding > 0.
+ - Implement --xid command line option (used by claws mail client).
    Patches: Johannes Hofmann
 +- Updated the GPL copyright note in the source files.
    Patch: Detlef Riekenberg
--- a/src/Makefile.am	Mon May 18 03:25:37 2009 +0000
+++ b/src/Makefile.am	Mon May 18 17:52:45 2009 +0200
@@ -108,6 +108,8 @@
 	dpiapi.h \
 	pixmaps.h \
 	findbar.cc \
-	findbar.hh
+	findbar.hh \
+	xembed.cc \
+	xembed.hh
 
 EXTRA_DIST = chg srch
--- a/src/dillo.cc	Mon May 18 03:25:37 2009 +0000
+++ b/src/dillo.cc	Mon May 18 17:52:45 2009 +0200
@@ -314,7 +314,7 @@
    }
 
    // Create a new UI/bw pair
-   BrowserWindow *bw = a_UIcmd_browser_window_new(0, 0, NULL);
+   BrowserWindow *bw = a_UIcmd_browser_window_new(0, 0, xid, NULL);
 
    /* Proxy authentication */
    if (prefs.http_proxyuser && !a_Http_proxy_auth()) {
--- a/src/menu.cc	Mon May 18 03:25:37 2009 +0000
+++ b/src/menu.cc	Mon May 18 17:52:45 2009 +0200
@@ -86,7 +86,7 @@
 {
    if (strcmp((char*)data, "nw") == 0) {
       UI *ui = (UI*)popup_bw->ui;
-      a_UIcmd_browser_window_new(ui->w(), ui->h(), popup_bw);
+      a_UIcmd_browser_window_new(ui->w(), ui->h(), 0, popup_bw);
    } else if (strcmp((char*)data, "nt") == 0) {
       a_UIcmd_open_url_nt(popup_bw, NULL, 1);
    } else if (strcmp((char*)data, "of") == 0) {
--- a/src/nav.c	Mon May 18 03:25:37 2009 +0000
+++ b/src/nav.c	Mon May 18 17:52:45 2009 +0200
@@ -431,7 +431,7 @@
    BrowserWindow *newbw;
 
    a_UIcmd_get_wh(bw, &w, &h);
-   newbw = a_UIcmd_browser_window_new(w, h, bw);
+   newbw = a_UIcmd_browser_window_new(w, h, 0, bw);
    a_Nav_push(newbw, url);
 }
 
--- a/src/ui.cc	Mon May 18 03:25:37 2009 +0000
+++ b/src/ui.cc	Mon May 18 17:52:45 2009 +0200
@@ -780,7 +780,7 @@
          set_panelmode(UI_HIDDEN);
          ret = 1;
       } else if (cmd == KEYS_NEW_WINDOW) {
-         a_UIcmd_browser_window_new(w(),h(),a_UIcmd_get_bw_by_widget(this));
+         a_UIcmd_browser_window_new(w(),h(),0,a_UIcmd_get_bw_by_widget(this));
          ret = 1;
       } else if (cmd == KEYS_OPEN) {
          a_UIcmd_open_file(a_UIcmd_get_bw_by_widget(this));
--- a/src/uicmd.cc	Mon May 18 03:25:37 2009 +0000
+++ b/src/uicmd.cc	Mon May 18 17:52:45 2009 +0200
@@ -28,6 +28,7 @@
 #include "timeout.hh"
 #include "menu.hh"
 #include "dialog.hh"
+#include "xembed.hh"
 #include "bookmark.h"
 #include "history.h"
 #include "msg.h"
@@ -387,10 +388,11 @@
  * Create a new UI and its associated BrowserWindow data structure.
  * Use style from v_ui. If non-NULL it must be of type UI*.
  */
-BrowserWindow *a_UIcmd_browser_window_new(int ww, int wh, const void *vbw)
+BrowserWindow *a_UIcmd_browser_window_new(int ww, int wh, uint32_t xid, const void *vbw)
 {
    BrowserWindow *old_bw = (BrowserWindow*)vbw;
    BrowserWindow *new_bw = NULL;
+   Xembed *win;
 
    if (ww <= 0 || wh <= 0) {
       // Set default geometry from dillorc.
@@ -398,7 +400,8 @@
       wh = prefs.height;
    }
 
-   Window *win = new Window(ww, wh);
+   win = new Xembed(ww, wh);
+
    win->shortcut(0); // Ignore Escape
    if (prefs.buffered_drawing != 2)
       win->clear_double_buffer();
@@ -417,6 +420,8 @@
    DilloTabs->add(new_ui);
    DilloTabs->resizable(new_ui);
    DilloTabs->window()->resizable(new_ui);
+   if (xid)
+      win->embed(xid);
    DilloTabs->window()->show();
 
    if (old_bw == NULL && prefs.xpos >= 0 && prefs.ypos >= 0) {
@@ -472,7 +477,7 @@
    // WORKAROUND: limit the number of tabs because of a fltk bug
    if (ui->tabs()->children() >= 127)
       return a_UIcmd_browser_window_new(ui->window()->w(), ui->window()->h(),
-                                        vbw);
+                                        0, vbw);
 
    // Create and set the UI
    UI *new_ui = new UI(0, 0, ui->w(), ui->h(), DEFAULT_TAB_LABEL, ui);
--- a/src/uicmd.hh	Mon May 18 03:25:37 2009 +0000
+++ b/src/uicmd.hh	Mon May 18 17:52:45 2009 +0200
@@ -8,7 +8,7 @@
 #endif /* __cplusplus */
 
 
-BrowserWindow *a_UIcmd_browser_window_new(int ww, int wh, const void *v_bw);
+BrowserWindow *a_UIcmd_browser_window_new(int ww, int wh, uint32_t xid, const void *v_bw);
 BrowserWindow *a_UIcmd_get_bw_by_widget(void *v_wid);
 void a_UIcmd_send_event_to_tabs_by_wid(int e, void *v_wid);
 void a_UIcmd_open_urlstr(void *vbw, const char *urlstr);