*** empty log message ***
authorroot <root>
Sun, 20 Feb 2005 00:09:25 +0000 (00:09 +0000)
committerroot <root>
Sun, 20 Feb 2005 00:09:25 +0000 (00:09 +0000)
Changes
MANIFEST
doc/embed-tk [new file with mode: 0755]
doc/rxvt-tabbed
src/init.C
src/main.C
src/rxvt.h

diff --git a/Changes b/Changes
index a2e95e738ee5163eda9d37d25ec3d3cf81def231..1168ac5775e1fdd5278232b6b626fcaed60c2561 100644 (file)
--- a/Changes
+++ b/Changes
@@ -17,6 +17,9 @@ WISH: just for fun, do shade and tint with XRender.
           that uses an existing pty for I/O instead of starting
           a command.
         - implement enough of XEMBED to allow for correct focus.
+        - added doc/embed-tk, an embedding example in Perl/Tk,
+          and doc/rxvt-tabbed, a primitive tabbed shell implemented
+          in Perl/Gtk2.
         - fix assertioan failure ("crash") on mousewheel-scrolling
           when the terminal height is small, by removing the assert.
           (reported by Mikael Magnusson).
index 17cd0d136fb24f4a4f11b2d54d55f5e35d24f4c9..cee6a531bd5ea662a5535f84e3f86be4b6ab5cae 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -11,6 +11,8 @@ reconf
 genac
 
 doc/embed
+doc/embed-tk
+doc/rxvt-tabbed
 doc/pty-fd
 doc/etc/rxvt-unicode.terminfo
 doc/etc/rxvt-unicode.termcap
diff --git a/doc/embed-tk b/doc/embed-tk
new file mode 100755 (executable)
index 0000000..e502314
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+
+# sample script to illustrate the -embed option
+# using Tk
+# resizes do not work yet.
+
+use Tk;
+
+my $mw = new MainWindow;
+
+my $frame = $mw->Frame (width => 700, height => 400, container => 1)
+               ->pack (fill => "both", expand => 1);
+
+system "rxvt -embed " . ($frame->id) . " &";
+
+MainLoop;
index 64247ba4cb1f59e505405d59560c69be8241d7a6..dabd965b1a5da5fa9280ee4fd983d5eee2028fd4 100755 (executable)
@@ -11,6 +11,8 @@ my $RXVT_BASENAME = "rxvt";
 use Gtk2;
 use Encode;
 
+$SIG{CHLD} = 'IGNORE';
+
 my $event_cb; # $wid => $cb
 
 init Gtk2;
index 74a17d8ba59a05038227ce1ce5c6bb15d93703ab..bf9aa873651b1484f184b0f41c2ae0d2505072dd 100644 (file)
@@ -205,6 +205,7 @@ const char *const xa_names[] =
 #endif
 #if ENABLE_XEMBED
     "_XEMBED",
+    "_XEMBED_INFO",
 #endif
   };
 
@@ -931,7 +932,7 @@ rxvt_term::create_windows (int argc, const char *const *argv)
   long vt_emask;
   XSetWindowAttributes attributes;
   XWindowAttributes gattr;
-  Window top;
+  Window top, parent;
   dDisp;
 
 #ifdef USING_W11LIB
@@ -979,59 +980,44 @@ rxvt_term::create_windows (int argc, const char *const *argv)
   if (!set_fonts ())
     rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
 
+  parent = DefaultRootWindow (disp);
+
 #if ENABLE_XEMBED
   if (rs[Rs_embed])
     {
       XWindowAttributes wattr;
 
-      top = strtol (rs[Rs_embed], 0, 0);
+      parent = strtol (rs[Rs_embed], 0, 0);
 
-      if (!XGetWindowAttributes (disp, top, &wattr))
+      if (!XGetWindowAttributes (disp, parent, &wattr))
         rxvt_fatal ("invalid window-id specified with -embed, aborting.\n");
 
       window_calc (wattr.width, wattr.height);
-
-#if 0
-      if (wattr.map_state == IsViewable)
-        {
-          TermWin.mapped = 1;
-          refresh_type = FAST_REFRESH;
-          XClearWindow (disp, top);
-          // TODO: make XMapNotify-event-code a function and call it
-          // TODO: how can I detect visibility without unmap/map?
-          // TODO: focusin etc.
-        }
-#else
-      // it's easiest just to unmap/map to get all state correctly set-up
-      XUnmapWindow (disp, top);
-#endif
     }
-  else
+
 #endif
-    {
-      window_calc (0, 0);
+  window_calc (0, 0);
 
-      /* sub-window placement & size in rxvt_resize_subwindows () */
+  /* sub-window placement & size in rxvt_resize_subwindows () */
 #ifdef PREFER_24BIT
-      attributes.background_pixel = pix_colors_focused[Color_border];
-      attributes.border_pixel = pix_colors_focused[Color_border];
-      attributes.colormap = display->cmap;
-      top = XCreateWindow (disp, DefaultRootWindow (disp),
-                           szHint.x, szHint.y,
-                           szHint.width, szHint.height,
-                           TermWin.ext_bwidth,
-                           display->depth, InputOutput,
-                           display->visual,
-                           CWColormap | CWBackPixel | CWBorderPixel, &attributes);
+  attributes.background_pixel = pix_colors_focused[Color_border];
+  attributes.border_pixel = pix_colors_focused[Color_border];
+  attributes.colormap = display->cmap;
+  top = XCreateWindow (disp, parent,
+                       szHint.x, szHint.y,
+                       szHint.width, szHint.height,
+                       TermWin.ext_bwidth,
+                       display->depth, InputOutput,
+                       display->visual,
+                       CWColormap | CWBackPixel | CWBorderPixel, &attributes);
 #else
-      top = XCreateSimpleWindow (disp, DefaultRootWindow (disp),
-                                 szHint.x, szHint.y,
-                                 szHint.width, szHint.height,
-                                 TermWin.ext_bwidth,
-                                 pix_colors_focused[Color_border],
-                                 pix_colors_focused[Color_border]);
+  top = XCreateSimpleWindow (disp, parent,
+                             szHint.x, szHint.y,
+                             szHint.width, szHint.height,
+                             TermWin.ext_bwidth,
+                             pix_colors_focused[Color_border],
+                             pix_colors_focused[Color_border]);
 #endif
-    }
 
   TermWin.parent[0] = top;
 
@@ -1187,8 +1173,13 @@ rxvt_term::create_windows (int argc, const char *const *argv)
   scr_recolour ();
 
 #if ENABLE_XEMBED
-  // why this is necessary, I don't know, race condition??
-  XMoveWindow (disp, TermWin.vt, window_vt_x, window_vt_y);
+  if (rs[Rs_embed])
+    {
+      long info[2] = { 0, XEMBED_MAPPED };
+
+      XChangeProperty (disp, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO],
+                       32, PropModeReplace, (unsigned char *)&info, 2);
+    }
 #endif
 }
 
index 775cc8a5682e74516fd3df31fa0f3d2e5849bc70..70dfcec6414df51a6ed9b039351807b3af9d2585 100644 (file)
@@ -254,11 +254,7 @@ rxvt_term::~rxvt_term ()
 #endif
       delete TermWin.drawable;
       // destroy all windows
-      if (TermWin.parent[0]
-#if ENABLE_XEMBED
-          && !rs[Rs_embed]
-#endif
-          )
+      if (TermWin.parent[0])
         XDestroyWindow (disp, TermWin.parent[0]);
     }
 
index 4c23ea6f3c7bbc07b89bed5c3182f4170a9f51b7..2d67fa856d7125a0a4d6bc00f8a2736659e5e672 100644 (file)
@@ -204,6 +204,8 @@ typedef struct _mwmhints {
 # define XEMBED_FOCUS_CURRENT            0 
 # define XEMBED_FOCUS_FIRST              1 
 # define XEMBED_FOCUS_LAST               2
+
+# define XEMBED_MAPPED                 (1 << 0)
 #endif
 
 /*
@@ -698,6 +700,7 @@ enum {
 #endif
 #if ENABLE_XEMBED
   XA_XEMBED,
+  XA_XEMBED_INFO,
 #endif
   NUM_XA
 };