- new option -pty-fd that makes the terminal a slave
that uses an existing pty for I/O instead of starting
a command.
+ - implement enough of XEMBED to allow for correct focus.
- SYNCCVS. backported bugfixes done to rxvt
(sourceforge bugs #1028739, #1028732), except for
pts/%s fix as it seems to collide with freebsd,
needs to be US-ASCII all the time).
- toggle default application keypad/cursor mode to help
some apps who fail to set the correct mode.
+ - check for WM_PROTOCOLS type in ClientMessage as to
+ not destroy the window for other types of messages.
- remove shared library (or any library) support - it is
of no use currently (and -embed is a better way to embed
rxvt-unicode).
$window->add ($frame);
-my $rxvt = new Gtk2::DrawingArea;
+my $rxvt = new Gtk2::Socket;
$frame->add ($rxvt);
$frame->set_size_request (700, 400);
$window->show_all;
</dd>
<dd>
<pre>
- my $rxvt = new Gtk2::DrawingArea;
- $...->add ($rxvt); # important to add it somewhere first
- $rxvt->realize; # now it can be realized
- my $xid = $rxvt->window->get_xid;</pre>
-</dd>
-<dd>
-<pre>
- system "rxvt -embed $xid &";</pre>
+ my $rxvt = new Gtk2::Socket;
+ $rxvt->signal_connect_after (realize => sub {
+ my $xid = $_[0]->window->get_xid;
+ system "rxvt -embed $xid &";
+ });</pre>
</dd>
<p></p>
<dt><strong><a name="item__2dpty_2dfd_fileno"><strong>-pty-fd</strong> <em>fileno</em></a></strong><br />
.\" ========================================================================
.\"
.IX Title "rxvt 1"
-.TH rxvt 1 "2005-02-18" "5.2" "RXVT-UNICODE"
+.TH rxvt 1 "2005-02-19" "5.2" "RXVT-UNICODE"
.SH "NAME"
rxvt\-unicode (ouR XVT, unicode) \- (a VT102 emulator for the X window system)
.SH "SYNOPSIS"
Here is a short Gtk2\-perl snippet that illustrates how this option can be
used (a longer example is in \fIdoc/embed\fR):
.Sp
-.Vb 4
-\& my $rxvt = new Gtk2::DrawingArea;
-\& $...->add ($rxvt); # important to add it somewhere first
-\& $rxvt->realize; # now it can be realized
-\& my $xid = $rxvt->window->get_xid;
-.Ve
-.Sp
-.Vb 1
-\& system "@@RXVT_NAME@@ -embed $xid &";
+.Vb 5
+\& my $rxvt = new Gtk2::Socket;
+\& $rxvt->signal_connect_after (realize => sub {
+\& my $xid = $_[0]->window->get_xid;
+\& system "@@RXVT_NAME@@ -embed $xid &";
+\& });
.Ve
.IP "\fB\-pty\-fd\fR \fIfileno\fR" 4
.IX Item "-pty-fd fileno"
Here is a short Gtk2-perl snippet that illustrates how this option can be
used (a longer example is in F<doc/embed>):
- my $rxvt = new Gtk2::DrawingArea;
- $...->add ($rxvt); # important to add it somewhere first
- $rxvt->realize; # now it can be realized
- my $xid = $rxvt->window->get_xid;
-
- system "@@RXVT_NAME@@ -embed $xid &";
+ my $rxvt = new Gtk2::Socket;
+ $rxvt->signal_connect_after (realize => sub {
+ my $xid = $_[0]->window->get_xid;
+ system "@@RXVT_NAME@@ -embed $xid &";
+ });
=item B<-pty-fd> I<fileno>
Here is a short Gtk2-perl snippet that illustrates how this option
can be used (a longer example is in doc/embed):
- my $rxvt = new Gtk2::DrawingArea;
- $...->add ($rxvt); # important to add it somewhere first
- $rxvt->realize; # now it can be realized
- my $xid = $rxvt->window->get_xid;
-
- system "rxvt -embed $xid &";
+ my $rxvt = new Gtk2::Socket;
+ $rxvt->signal_connect_after (realize => sub {
+ my $xid = $_[0]->window->get_xid;
+ system "rxvt -embed $xid &";
+ });
-pty-fd *fileno*
Tells rxvt NOT to execute any commands or create a new pty/tty pair
case ClientMessage:
if (ev.xclient.format == 32
- && (Atom)ev.xclient.data.l[0] == xa[XA_WMDELETEWINDOW])
- destroy ();
+ && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]
+ && ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW])
+ destroy ();
+#if ENABLE_XEMBED
+ else if (ev.xclient.format == 32
+ && ev.xclient.message_type == xa[XA_XEMBED])
+ {
+ if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
+ focus_in ();
+ else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
+ focus_out ();
+ }
+#endif
#ifdef OFFIX_DND
/* OffiX Dnd (drag 'n' drop) protocol */
- else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL]
- && (ev.xclient.data.l[0] == DndFile
- || ev.xclient.data.l[0] == DndDir
- || ev.xclient.data.l[0] == DndLink))
+ else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL]
+ && (ev.xclient.data.l[0] == DndFile
+ || ev.xclient.data.l[0] == DndDir
+ || ev.xclient.data.l[0] == DndLink))
{
/* Get Dnd data */
Atom ActualType;
break;
case FocusIn:
- if (!TermWin.focus)
- {
- TermWin.focus = 1;
- want_refresh = 1;
-#ifdef USE_XIM
- if (Input_Context != NULL)
- {
- IMSetStatusPosition ();
- XSetICFocus (Input_Context);
- }
-#endif
-#ifdef CURSOR_BLINK
- if (options & Opt_cursorBlink)
- cursor_blink_ev.start (NOW + BLINK_INTERVAL);
-#endif
-#ifdef OFF_FOCUS_FADING
- if (rs[Rs_fade])
- {
- pix_colors = pix_colors_focused;
- scr_recolour ();
- }
-#endif
-
- }
+ focus_in ();
break;
case FocusOut:
- if (TermWin.focus)
- {
- TermWin.focus = 0;
- want_refresh = 1;
-
-#if ENABLE_FRILLS || ISO_14755
- iso14755buf = 0;
-#endif
-#if ENABLE_OVERLAY
- scr_overlay_off ();
-#endif
-#ifdef USE_XIM
- if (Input_Context != NULL)
- XUnsetICFocus (Input_Context);
-#endif
-#ifdef CURSOR_BLINK
- if (options & Opt_cursorBlink)
- cursor_blink_ev.stop ();
- hidden_cursor = 0;
-#endif
-#ifdef OFF_FOCUS_FADING
- if (rs[Rs_fade])
- {
- pix_colors = pix_colors_unfocused;
- scr_recolour ();
- }
-#endif
- }
+ focus_out ();
break;
case ConfigureNotify:
}
}
+void
+rxvt_term::focus_in ()
+{
+ if (!TermWin.focus)
+ {
+ TermWin.focus = 1;
+ want_refresh = 1;
+#ifdef USE_XIM
+ if (Input_Context != NULL)
+ {
+ IMSetStatusPosition ();
+ XSetICFocus (Input_Context);
+ }
+#endif
+#ifdef CURSOR_BLINK
+ if (options & Opt_cursorBlink)
+ cursor_blink_ev.start (NOW + BLINK_INTERVAL);
+#endif
+#ifdef OFF_FOCUS_FADING
+ if (rs[Rs_fade])
+ {
+ pix_colors = pix_colors_focused;
+ scr_recolour ();
+ }
+#endif
+ }
+}
+
+void
+rxvt_term::focus_out ()
+{
+ if (TermWin.focus)
+ {
+ TermWin.focus = 0;
+ want_refresh = 1;
+
+#if ENABLE_FRILLS || ISO_14755
+ iso14755buf = 0;
+#endif
+#if ENABLE_OVERLAY
+ scr_overlay_off ();
+#endif
+#ifdef USE_XIM
+ if (Input_Context != NULL)
+ XUnsetICFocus (Input_Context);
+#endif
+#ifdef CURSOR_BLINK
+ if (options & Opt_cursorBlink)
+ cursor_blink_ev.stop ();
+ hidden_cursor = 0;
+#endif
+#ifdef OFF_FOCUS_FADING
+ if (rs[Rs_fade])
+ {
+ pix_colors = pix_colors_unfocused;
+ scr_recolour ();
+ }
+#endif
+ }
+}
+
#if TRANSPARENT
void
rxvt_term::rootwin_cb (XEvent &ev)
"TIMESTAMP",
"VT_SELECTION",
"INCR",
+ "WM_PROTOCOLS",
"WM_DELETE_WINDOW",
"CLIPBOARD",
#if ENABLE_FRILLS
#ifdef OFFIX_DND
"DndProtocol",
"DndSelection",
+#endif
+#if ENABLE_XEMBED
+ "_XEMBED",
#endif
};
if (!set_fonts ())
rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
-#if ENABLE_FRILLS
+#if ENABLE_XEMBED
if (rs[Rs_embed])
{
XWindowAttributes wattr;
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);
+ 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]);
+ szHint.x, szHint.y,
+ szHint.width, szHint.height,
+ TermWin.ext_bwidth,
+ pix_colors_focused[Color_border],
+ pix_colors_focused[Color_border]);
#endif
}
(char **)argv, argc, &szHint, &wmHint, &classHint);
/* Enable delete window protocol */
- XSetWMProtocols (disp, top, &xa[XA_WMDELETEWINDOW], 1);
+ XSetWMProtocols (disp, top, &xa[XA_WM_DELETE_WINDOW], 1);
#if ENABLE_FRILLS
long pid = getpid ();
| KeyReleaseMask
#endif
| FocusChangeMask | VisibilityChangeMask
- | ExposureMask
- | StructureNotifyMask);
+ | ExposureMask | StructureNotifyMask);
+
termwin_ev.start (display, top);
#if ENABLE_FRILLS
delete TermWin.drawable;
// destroy all windows
if (TermWin.parent[0]
-#if ENABLE_FRILLS
+#if ENABLE_XEMBED
&& !rs[Rs_embed]
#endif
)
#include "iom.h"
#include "salloc.h"
+#if ENABLE_FRILLS
+# define ENABLE_XEMBED 1
+#endif
+
/*
*****************************************************************************
* SYSTEM HACKS
} MWMHints;
#endif
+#if ENABLE_XEMBED
+// XEMBED messages
+# define XEMBED_EMBEDDED_NOTIFY 0
+# define XEMBED_WINDOW_ACTIVATE 1
+# define XEMBED_WINDOW_DEACTIVATE 2
+# define XEMBED_REQUEST_FOCUS 3
+# define XEMBED_FOCUS_IN 4
+# define XEMBED_FOCUS_OUT 5
+# define XEMBED_FOCUS_NEXT 6
+# define XEMBED_FOCUS_PREV 7
+
+# define XEMBED_MODALITY_ON 10
+# define XEMBED_MODALITY_OFF 11
+# define XEMBED_REGISTER_ACCELERATOR 12
+# define XEMBED_UNREGISTER_ACCELERATOR 13
+# define XEMBED_ACTIVATE_ACCELERATOR 14
+
+// XEMBED detail code
+# define XEMBED_FOCUS_CURRENT 0
+# define XEMBED_FOCUS_FIRST 1
+# define XEMBED_FOCUS_LAST 2
+#endif
+
/*
*****************************************************************************
* NORMAL DEFINES
Rs_int_bwidth,
Rs_borderLess,
Rs_lineSpace,
- Rs_embed,
Rs_pty_fd,
+#endif
+#if ENABLE_XEMBED
+ Rs_embed,
#endif
Rs_cutchars,
Rs_modifier,
XA_TIMESTAMP,
XA_VT_SELECTION,
XA_INCR,
- XA_WMDELETEWINDOW,
+ XA_WM_PROTOCOLS,
+ XA_WM_DELETE_WINDOW,
XA_CLIPBOARD,
#if ENABLE_FRILLS
XA_NET_WM_PID,
#if OFFIX_DND /* OffiX Dnd (drag 'n' drop) support */
XA_DNDPROTOCOL,
XA_DNDSELECTION,
+#endif
+#if ENABLE_XEMBED
+ XA_XEMBED,
#endif
NUM_XA
};
void mouse_report (XButtonEvent &ev);
void button_press (XButtonEvent &ev);
void button_release (XButtonEvent &ev);
+ void focus_in ();
+ void focus_out ();
int check_our_parents ();
#ifdef PRINTPIPE
FILE *popen_printer ();
STRG (Rs_title, NULL, "T", NULL, NULL), /* short form */
STRG (Rs_iconName, "iconName", "n", "string", "icon name for window"),
STRG (Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"),
-#if ENABLE_FRILLS
+#if ENABLE_XEMBED
STRG (Rs_embed, NULL, "embed", "windowid", "window id to embed terminal in"),
+#endif
+#if ENABLE_FRILLS
STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"),
STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"),
STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL),