Terminal emulation applet
- From: Ole Laursen <ole_laursen hardworking dk>
- To: gnome-devel-list gnome org
- Subject: Terminal emulation applet
- Date: 03 Jun 2000 14:58:11 -0400
I have recently completed making an applet that puts a full-featured
terminal inside the panel, so now I was wondering if it could be
included in the standard gnome-applets package?
The features are:
- uses a Zvt widget with a property box that allows you to customize
all important properties of the widget
- optional scrollbar
- the property dialog has size controls which includes a toggle
button for automatic adjusting to the size of the panel
So it is basically much like swallowing a gnome-terminal, just smaller
because of the lack of things like the menubar (which doesn't make
sense for an applet), and with the necessary controls to make it a
well-behaved applet. And since it is a native applet, it is much
easier to set up and hasn't got some of the problems of the swallowed
programs (e.g. concerning session managing).
Anyway, I have put up a temporary (and somewhat crude ;-) page with
lots of screenshots to give an impression of how it looks like in
action:
http://sunsite.auc.dk/olau/termlet.html
Beware, I think there are about 100 kb of images on that page. The
source can be fetched directly from
http://sunsite.auc.dk/olau/terminal.tar.gz
The current makefile is a very temporary one and may require a bit of
hacking to get working - I didn't want to go through the hassle of
figuring out how to make proper ./configure'd system if the applet is
going to be included in the standard distribution anyway.
If it is accepted, I will figure out how to make the documentation for
the properties dialog and the applet in general (right now help is the
only thing missing), and find out how the other applets are being
built so that I can mimic their behaviour. I can probably have
it ready for submission within a week or so.
Concerning stability: since I completed coding the applet, I have been
using it myself for some time without having any problems. The only
thing left is that the last feature I added, grabbing the keyboard
focus, is behaving a bit strange.
I more or less copied the code from gnome-terminal - in the main
function I register a callback for the menu that pops up when you
press the right mouse button over an applet:
applet_widget_register_callback(APPLET_WIDGET(applet),
"toggle_grab_keyboard",
_("Grab keyboard"),
toggle_grab_keyboard_cb,
NULL);
and then
static void toggle_grab_keyboard_cb(AppletWidget *applet, gpointer data)
{
gboolean *keyboard_grabbed = (gboolean *) gtk_object_get_data(GTK_OBJECT(applet), "keyboard_grabbed");
*keyboard_grabbed = ! *keyboard_grabbed;
if (*keyboard_grabbed)
gdk_keyboard_grab(ZVT_TERM(gtk_object_get_data(GTK_OBJECT(applet),"term"))->term_window,
TRUE, GDK_CURRENT_TIME);
else
gdk_keyboard_ungrab(GDK_CURRENT_TIME);
}
Now when the grab keyboard is chosen in the menu and you focus another
window, the window doesn't get the keyboard presses like 'a' or 'g'
but neither does the terminal widget. Not until you press up-arrow or
tab (or similar) twice, at which point the cursor will start blinking
and respond to the presses. Fun.
It seems to me that the wrong widget is getting the keyboard focus at
first so you have to cycle the focus to the correct one. I'm packaging
the Zvt widget inside a frame which is packaged inside a hbox inside a
handle box. Sometimes the hbox also contains a scrollbar which is
unset(CAN_FOCUS) but this doesn't seem to change the behaviour.
Can anyone help, or do I have to throw the feature away? Maybe I
should add that I'm pretty new to X and GTK+ programming.
--
Ole Laursen
http://sunsite.auc.dk/olau/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]