summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--configure.in2
-rw-r--r--doc/Eterm.1.in2
-rw-r--r--src/buttons.c4
-rw-r--r--src/command.c24
-rw-r--r--src/debug.h4
-rw-r--r--src/e.c30
-rw-r--r--src/events.c36
-rw-r--r--src/menus.c16
-rw-r--r--src/misc.c10
-rw-r--r--src/misc.h1
-rw-r--r--src/options.c8
-rw-r--r--src/pixmap.c5
-rw-r--r--src/pixmap.h2
-rw-r--r--src/profile.h109
-rw-r--r--src/screen.c65
-rw-r--r--src/startup.h2
-rw-r--r--src/term.c19
-rw-r--r--utils/Etwinop8
19 files changed, 172 insertions, 183 deletions
diff --git a/ChangeLog b/ChangeLog
index 629f731..ff873c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3339,3 +3339,11 @@ Wed Mar 8 19:35:36 PST 2000 Michael Jennings <mej@eterm.org>
named pipe rather than to /dev/tty0.
-------------------------------------------------------------------------------
+Tue Mar 14 19:11:26 PST 2000 Michael Jennings <mej@eterm.org>
+
+ Some further fixes for inline functions, 2 new winop actions, brand
+ new and improved profiling macros, some miscellaneous fixes for SGI
+ from Kimball Thurston <kimball@sgrail.com>, and more robust checking
+ in the pasting code.
+
+-------------------------------------------------------------------------------
diff --git a/configure.in b/configure.in
index 5f9e066..a16d6c2 100644
--- a/configure.in
+++ b/configure.in
@@ -6,7 +6,7 @@ AM_INIT_AUTOMAKE(Eterm, 0.9.1)
dnl# Set some basic variables
DATE="`date '+%d %B %Y'`"
AC_SUBST(DATE)
-AUTHORS="Michael Jennings (mej@eterm.org) and Tuomo Venäläinen (vendu@cc.hut.fi) "
+AUTHORS="Michael Jennings (mej@eterm.org) "
AC_SUBST(AUTHORS)
AC_DEFINE_UNQUOTED(AUTHORS, "$AUTHORS")
diff --git a/doc/Eterm.1.in b/doc/Eterm.1.in
index 54bc03b..3da740a 100644
--- a/doc/Eterm.1.in
+++ b/doc/Eterm.1.in
@@ -1542,7 +1542,7 @@ directive to allow for separation of the configuration information into
multiple files.
.SH AUTHORS
-Michael Jennings (mej@eterm.org) and Tuomo Venäläinen (vendu@cc.hut.fi).
+Michael Jennings (mej@eterm.org)
Man page re-written for version 0.8 by Shaleh (shaleh@debian.org).
.SH URL(s)
diff --git a/src/buttons.c b/src/buttons.c
index 2f99922..dd7d7e2 100644
--- a/src/buttons.c
+++ b/src/buttons.c
@@ -46,12 +46,12 @@ static const char cvs_ident[] = "$Id$";
#include "term.h"
#include "windows.h"
-static __inline__ void draw_string(buttonbar_t *, Drawable, GC, int, int, char *, size_t);
+static inline void draw_string(buttonbar_t *, Drawable, GC, int, int, char *, size_t);
buttonbar_t *buttonbar = NULL;
long bbar_total_h = -1;
-static __inline__ void
+static inline void
draw_string(buttonbar_t *bbar, Drawable d, GC gc, int x, int y, char *str, size_t len)
{
diff --git a/src/command.c b/src/command.c
index 2ccba4a..4394003 100644
--- a/src/command.c
+++ b/src/command.c
@@ -45,6 +45,7 @@ static const char cvs_ident[] = "$Id$";
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
+#include <string.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
@@ -106,9 +107,6 @@ static const char cvs_ident[] = "$Id$";
#if defined(linux)
# include <linux/tty.h> /* For N_TTY_BUF_SIZE. */
#endif
-#if defined(linux)
-# include <string.h> /* For strsep(). -vendu */
-#endif
/* Eterm-specific Headers */
#include "command.h"
@@ -1130,9 +1128,9 @@ clean_exit(void)
*/
#ifdef __sgi
-__inline__ int sgi_get_pty(void);
+inline int sgi_get_pty(void);
-__inline__ int
+inline int
sgi_get_pty(void)
{
int fd = -1;
@@ -1146,9 +1144,9 @@ sgi_get_pty(void)
#endif
#ifdef HAVE_DEV_PTC
-__inline__ int aix_get_pty(void);
+inline int aix_get_pty(void);
-__inline__ int
+inline int
aix_get_pty(void)
{
@@ -1163,9 +1161,9 @@ aix_get_pty(void)
#endif
#ifdef HAVE_SCO_PTYS
-__inline__ int sco_get_pty(void);
+inline int sco_get_pty(void);
-__inline__ int
+inline int
sco_get_pty(void)
{
@@ -1197,9 +1195,9 @@ sco_get_pty(void)
#endif
#ifdef HAVE_DEV_PTMX
-__inline__ int svr_get_pty(void);
+inline int svr_get_pty(void);
-__inline__ int
+inline int
svr_get_pty(void)
{
@@ -1230,9 +1228,9 @@ svr_get_pty(void)
#define PTYCHAR1 "pqrstuvwxyz"
#define PTYCHAR2 "0123456789abcdefghijklmnopqrstuvwxyz"
-__inline__ int gen_get_pty(void);
+inline int gen_get_pty(void);
-__inline__ int
+inline int
gen_get_pty(void)
{
diff --git a/src/debug.h b/src/debug.h
index d817151..a0ce11c 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -27,6 +27,10 @@
#include <stdlib.h>
#include <time.h>
+#if defined(__GNUC__) && !defined(inline)
+# define inline __inline__
+#endif
+
extern unsigned int debug_level;
/* Assert macros stolen from my work on Ebar. If these macros break with your cpp, let me know -- mej@eterm.org */
diff --git a/src/e.c b/src/e.c
index 3604290..cef3476 100644
--- a/src/e.c
+++ b/src/e.c
@@ -369,6 +369,36 @@ eterm_handle_winop(char *action)
XMapWindow(Xdisplay, win);
} else if (!BEG_STRCASECMP(action, "unmap")) {
XUnmapWindow(Xdisplay, win);
+ } else if (!BEG_STRCASECMP(action, "move")) {
+ int x, y, n;
+ char *xx, *yy;
+
+ n = NumWords(action);
+ if (n == 3 || n == 4) {
+ if (n == 3) {
+ win = TermWin.parent;
+ }
+ xx = PWord(n - 1, action);
+ yy = PWord(n, action);
+ x = (int) strtol(xx, (char **) NULL, 0);
+ y = (int) strtol(yy, (char **) NULL, 0);
+ XMoveWindow(Xdisplay, win, x, y);
+ }
+ } else if (!BEG_STRCASECMP(action, "resize")) {
+ int w, h, n;
+ char *ww, *hh;
+
+ n = NumWords(action);
+ if (n == 3 || n == 4) {
+ if (n == 3) {
+ win = TermWin.parent;
+ }
+ ww = PWord(n - 1, action);
+ hh = PWord(n, action);
+ w = (int) strtol(ww, (char **) NULL, 0);
+ h = (int) strtol(hh, (char **) NULL, 0);
+ XResizeWindow(Xdisplay, win, w, h);
+ }
} else if (!BEG_STRCASECMP(action, "kill")) {
XKillClient(Xdisplay, win);
} else if (!BEG_STRCASECMP(action, "iconify")) {
diff --git a/src/events.c b/src/events.c
index 194a7a8..25b2ae4 100644
--- a/src/events.c
+++ b/src/events.c
@@ -46,6 +46,7 @@ static const char cvs_ident[] = "$Id$";
#include "menus.h"
#include "options.h"
#include "pixmap.h"
+#include "profile.h"
#include "screen.h"
#include "scrollbar.h"
#include "term.h"
@@ -199,21 +200,18 @@ event_win_is_parent(register event_dispatcher_data_t * data, Window win)
unsigned char
handle_key_press(event_t * ev)
{
-
#ifdef COUNT_X_EVENTS
static long long keypress_cnt = 0;
#endif
-#ifdef PROFILE_X_EVENTS
- struct timeval keypress_start, keypress_stop;
-#endif
- P_SETTIMEVAL(keypress_start);
+ PROF_INIT(handle_key_press);
D_EVENTS(("handle_key_press(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
- COUNT_EVENT(keypress_cnt);
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0);
+
+ COUNT_EVENT(keypress_cnt);
lookup_key(ev);
- P_SETTIMEVAL(keypress_stop);
- P_EVENT_TIME("KeyPress", keypress_start, keypress_stop);
+ PROF_DONE(handle_key_press);
+ PROF_TIME(handle_key_press);
return 1;
}
@@ -550,15 +548,11 @@ handle_selection_request(event_t * ev)
unsigned char
handle_expose(event_t * ev)
{
-
#ifdef COUNT_X_EVENTS
static long long expose_cnt = 0;
#endif
-#ifdef PROFILE_X_EVENTS
- struct timeval expose_start, expose_stop;
-#endif
- P_SETTIMEVAL(expose_start);
+ PROF_INIT(handle_expose);
D_EVENTS(("handle_expose(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0);
@@ -581,8 +575,8 @@ handle_expose(event_t * ev)
XSelectInput(Xdisplay, desktop_window, PropertyChangeMask);
}
#endif
- P_SETTIMEVAL(expose_stop);
- P_EVENT_TIME("Expose", expose_start, expose_stop);
+ PROF_DONE(handle_expose);
+ PROF_TIME(handle_expose);
return 1;
}
@@ -712,18 +706,14 @@ handle_button_release(event_t * ev)
unsigned char
handle_motion_notify(event_t * ev)
{
-
#ifdef COUNT_X_EVENTS
static long long motion_cnt = 0;
#endif
-#ifdef PROFILE_X_EVENTS
- struct timeval motion_start, motion_stop;
-#endif
+ PROF_INIT(handle_motion_notify);
D_EVENTS(("handle_motion_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
COUNT_EVENT(motion_cnt);
- P_SETTIMEVAL(motion_start);
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0);
if ((PrivateModes & PrivMode_mouse_report) && !(button_state.bypass_keystate))
@@ -743,10 +733,12 @@ handle_motion_notify(event_t * ev)
#endif
selection_extend((ev->xbutton.x), (ev->xbutton.y), (ev->xbutton.state & Button3Mask));
}
- P_SETTIMEVAL(motion_stop);
- P_EVENT_TIME("MotionNotify", motion_start, motion_stop);
+ PROF_DONE(handle_motion_notify);
+ PROF_TIME(handle_motion_notify);
return 1;
}
+ PROF_DONE(handle_motion_notify);
+ PROF_TIME(handle_motion_notify);
return 1;
}
diff --git a/src/menus.c b/src/menus.c
index 9ca04a0..42a667a 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -52,12 +52,12 @@ static Time button_press_time;
static int button_press_x = 0, button_press_y = 0;
static menu_t *current_menu;
-static __inline__ void grab_pointer(Window win);
-static __inline__ void ungrab_pointer(void);
-static __inline__ void draw_string(Drawable d, GC gc, int x, int y, char *str, size_t len);
-static __inline__ unsigned short center_coords(register unsigned short c1, register unsigned short c2);
+static inline void grab_pointer(Window win);
+static inline void ungrab_pointer(void);
+static inline void draw_string(Drawable d, GC gc, int x, int y, char *str, size_t len);
+static inline unsigned short center_coords(register unsigned short c1, register unsigned short c2);
-static __inline__ void
+static inline void
grab_pointer(Window win)
{
@@ -88,7 +88,7 @@ grab_pointer(Window win)
}
}
-static __inline__ void
+static inline void
ungrab_pointer(void)
{
@@ -96,7 +96,7 @@ ungrab_pointer(void)
XUngrabPointer(Xdisplay, CurrentTime);
}
-static __inline__ void
+static inline void
draw_string(Drawable d, GC gc, int x, int y, char *str, size_t len)
{
@@ -110,7 +110,7 @@ draw_string(Drawable d, GC gc, int x, int y, char *str, size_t len)
XDrawString(Xdisplay, d, gc, x, y, str, len);
}
-static __inline__ unsigned short
+static inline unsigned short
center_coords(register unsigned short c1, register unsigned short c2)
{
diff --git a/src/misc.c b/src/misc.c
index afc7068..3b859cb 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -297,9 +297,17 @@ safe_print_string(char *str, unsigned long len)
char *p;
unsigned long n = 0, i;
+ if (len == ((unsigned long) -1)) {
+ FREE(ret_buff);
+ rb_size = 0;
+ return ((char *) NULL);
+ }
if (ret_buff == NULL) {
- ret_buff = (char *) MALLOC(len + 1);
rb_size = len;
+ ret_buff = (char *) MALLOC(rb_size + 1);
+ } else if (len > rb_size) {
+ rb_size = len;
+ ret_buff = (char *) REALLOC(ret_buff, rb_size + 1);
}
for (i = 0, p = ret_buff; i < len; i++, str++, n++) {
if (n + 2 >= rb_size) {
diff --git a/src/misc.h b/src/misc.h
index 04f5606..14f91c2 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -42,6 +42,7 @@ extern char *str_trim(char *str);
extern int parse_escaped_string(char *str);
extern const char *search_path(const char *pathlist, const char *file, const char *ext);
extern const char *find_file(const char *file, const char *ext);
+extern char *safe_print_string(char *buff, unsigned long len);
extern unsigned long add_carriage_returns(unsigned char *buff, unsigned long cnt);
_XFUNCPROTOEND
diff --git a/src/options.c b/src/options.c
index f61f79a..52b6ca6 100644
--- a/src/options.c
+++ b/src/options.c
@@ -2504,7 +2504,7 @@ parse_image(char *buff, void *state)
tmp = (int *) MALLOC(sizeof(int));
return ((void *) tmp);
}
- ASSERT_RVAL(state != NULL, (file_skip_to_end(), NULL));
+ ASSERT_RVAL(state != NULL, (void *)(file_skip_to_end(), NULL));
if (*buff == CONF_END_CHAR) {
int *tmp;
@@ -2973,7 +2973,7 @@ parse_menu(char *buff, void *state)
menu = menu_create(title);
return ((void *) menu);
}
- ASSERT_RVAL(state != NULL, (file_skip_to_end(), NULL));
+ ASSERT_RVAL(state != NULL, (void *)(file_skip_to_end(), NULL));
menu = (menu_t *) state;
if (*buff == CONF_END_CHAR) {
if (!(*(menu->title))) {
@@ -3021,7 +3021,7 @@ parse_menuitem(char *buff, void *state)
static menu_t *menu;
menuitem_t *curitem;
- ASSERT_RVAL(state != NULL, (file_skip_to_end(), NULL));
+ ASSERT_RVAL(state != NULL, (void *)(file_skip_to_end(), NULL));
if (*buff == CONF_BEGIN_CHAR) {
menu = (menu_t *) state;
curitem = menuitem_create(NULL);
@@ -3096,7 +3096,7 @@ parse_bbar(char *buff, void *state)
bbar = bbar_create();
return ((void *) bbar);
}
- ASSERT_RVAL(state != NULL, (file_skip_to_end(), NULL));
+ ASSERT_RVAL(state != NULL, (void *)(file_skip_to_end(), NULL));
bbar = (buttonbar_t *) state;
if (*buff == CONF_END_CHAR) {
bbar_add(bbar);
diff --git a/src/pixmap.c b/src/pixmap.c
index 47a30b6..f061039 100644
--- a/src/pixmap.c
+++ b/src/pixmap.c
@@ -45,6 +45,7 @@ static const char cvs_ident[] = "$Id$";
#include "screen.h"
#include "scrollbar.h"
#include "term.h"
+#include "windows.h"
#ifdef PIXMAP_SUPPORT
static ImlibBorder bord_none = { 0, 0, 0, 0 };
@@ -1556,7 +1557,7 @@ get_desktop_pixmap(void)
if (desktop_window == None) {
D_PIXMAP(("No desktop window. Aborting.\n"));
free_desktop_pixmap();
- return (desktop_pixmap = None);
+ return (None);
}
prop = XInternAtom(Xdisplay, "_XROOTPMAP_ID", True);
@@ -1564,7 +1565,7 @@ get_desktop_pixmap(void)
if (prop == None && prop2 == None) {
free_desktop_pixmap();
- return (desktop_pixmap = None);
+ return (None);
}
if (color_pixmap != None) {
D_PIXMAP(("Removing old solid color pixmap 0x%08x.\n", color_pixmap));
diff --git a/src/pixmap.h b/src/pixmap.h
index 1a1fcc7..d504372 100644
--- a/src/pixmap.h
+++ b/src/pixmap.h
@@ -51,7 +51,7 @@
# define delete_simage(simg) NOP
#endif
#define PIXMAP_EXT NULL
-/* '[', 2*4 + 2*3 digits + 3 delimiters, ']'. -vendu */
+
#define GEOM_LEN 19
enum {
diff --git a/src/profile.h b/src/profile.h
index ec44bbc..743fe67 100644
--- a/src/profile.h
+++ b/src/profile.h
@@ -1,78 +1,49 @@
-/* profile.h for Eterm.
- * 25 Mar 1998, vendu.
+/*
+ * Copyright (C) 1997-2000, Michael Jennings
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies of the Software, its documentation and marketing & publicity
+ * materials, and acknowledgment shall be given in the documentation, materials
+ * and software packages that this Software was used.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _PROFILE_H
# define _PROFILE_H
-/* included for a possible #define PROFILE */
-# include <stdio.h>
+#ifdef ENABLE_PROFILE
+
# include <sys/time.h>
# include <unistd.h>
-/* NOTE: if PROFILE is not defined, all macros in this file will
- * be set to (void)0 so they won't get compiled into binaries.
- */
-# ifdef ENABLE_PROFILE
-
-/* Data structures */
-
typedef struct {
- long long total;
- struct timeval start;
- struct timeval stop;
-} P_counter_t;
-
-/* Profiling macros */
-
-/* Sets tv to current time.
- * struct timeval tv;
- * Usage: P_SETTIMEVAL(struct timeval tv);
- */
-# define P_SETTIMEVAL(tv) gettimeofday(&(tv), NULL)
-
-/* NOT FINISHED YET */
-# define P_UPDATETOTAL(cnt) { \
- cnt.total += P_CMPTIMEVALS_USEC(cnt.start, cnt.stop); \
-}
-
-/* Declare cnt and initialize by setting to zero.
- * P_counter_t cnt;
- * Usage: P_INITCOUNTER(counter);
- * NOTES: cnt will be declared. This means that you'll
- * probably need to localize a block where to use this; see
- * the definition of P_CALL() elsewhere in this file.
- */
-# define P_INITCOUNTER(cnt) \
- P_counter_t cnt = { 0, { 0, 0 }, { 0, 0 } }
-/* Time from start to stop in microseconds
- * struct timeval start, stop;
- */
-# define P_CMPTIMEVALS_USEC(start, stop) \
- ((stop.tv_sec - start.tv_sec)*1000000 \
- + (stop.tv_usec - start.tv_usec))
-
-/* Counts the time spent in the call f and outputs
- * str: <time spent in f in microseconds> to stderr.
- * NOTE: f can be any function call, for example sqrt(5).
- */
-# define P_CALL(f, str) { \
- P_INITCOUNTER(cnt); \
- P_SETTIMEVAL(cnt.start); \
- f; \
- P_SETTIMEVAL(cnt.stop); \
- fprintf(stderr, "%s: %ld\n", str, \
- P_CMPTIMEVALS_USEC(cnt.start, cnt.stop)); \
-}
-
-# else /* ENABLE_PROFILE */
-
-# define P_SETTIMEVAL(tv) ((void)0)
-# define P_UPDATETOTAL(cnt) ((void)0)
-# define P_INITCOUNTER(cnt) ((void)0)
-# define P_CMPTIMEVALS_USEC(start, stop) ((void)0)
-# define P_CALL(f, str) f
-
-# endif /* ENABLE_PROFILE */
-
-#endif /* _PROFILE_H */
+ const char *func_name;
+ struct timeval start_time, end_time;
+} prof_time_t;
+
+# define PROF_INIT(f) prof_time_t f##_prof_time = { #f, { 0, 0 }, { 0, 0 } }; gettimeofday(& f##_prof_time.start_time, NULL)
+# define PROF_DONE(f) gettimeofday(& f##_prof_time.end_time, NULL)
+# define PROF_TIME(f) do {prof_time_t t = f##_prof_time; unsigned long s, u; s = t.end_time.tv_sec - t.start_time.tv_sec; u = t.end_time.tv_usec - t.start_time.tv_usec; \
+ if (u > 1000000UL) {s--; u += 1000000UL;} D_PROFILE(("Elapsed time for function %s: %d.%06d seconds.\n", #f, s, u));} while (0)
+# define PROF_FUNC(f, c) do {PROF_INIT(f); c; PROF_DONE(f); PROF_TIME(f);} while (0)
+#else
+# define PROF_INIT(f) NOP
+# define PROF_DONE(f) NOP
+# define PROF_TIME(f) NOP
+# define PROF_FUNC(f, c) NOP
+#endif /* ENABLE_PROFILE */
+
+#endif /* _PROFILE_H */
diff --git a/src/screen.c b/src/screen.c
index 9829bff..b14185c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -41,9 +41,7 @@ static const char cvs_ident[] = "$Id$";
#ifdef PIXMAP_SUPPORT
# include "pixmap.h"
#endif
-#ifdef PROFILE_SCREEN
-# include "profile.h"
-#endif
+#include "profile.h"
#include "term.h"
/* These arrays store the text and rendering info that were last drawn to the screen. */
@@ -107,8 +105,8 @@ static short lost_multi = 0;
#endif
/* Fill part/all of a drawn line with blanks. */
-__inline__ void blank_line(text_t *, rend_t *, int, rend_t);
-__inline__ void
+inline void blank_line(text_t *, rend_t *, int, rend_t);
+inline void
blank_line(text_t * et, rend_t * er, int width, rend_t efs)
{
/* int i = width; */
@@ -121,8 +119,8 @@ blank_line(text_t * et, rend_t * er, int width, rend_t efs)
}
/* Create a new row in the screen buffer and initialize it. */
-__inline__ void blank_screen_mem(text_t **, rend_t **, int, rend_t);
-__inline__ void
+inline void blank_screen_mem(text_t **, rend_t **, int, rend_t);
+inline void
blank_screen_mem(text_t **tp, rend_t **rp, int row, rend_t efs)
{
register unsigned int i = TermWin.ncol;
@@ -582,14 +580,7 @@ scroll_text(int row1, int row2, int count, int spec)
{
register int i, j;
-#ifdef PROFILE_SCREEN
- static long call_cnt = 0;
- static long long total_time = 0;
-
- P_INITCOUNTER(cnt);
- P_SETTIMEVAL(cnt.start);
-#endif
-
+ PROF_INIT(scroll_text);
D_SCREEN(("scroll_text(%d,%d,%d,%d): %s\n", row1, row2, count, spec, (current_screen == PRIMARY) ? "Primary" : "Secondary"));
if (count == 0 || (row1 > row2))
@@ -679,12 +670,8 @@ scroll_text(int row1, int row2, int count, int spec)
}
count = -count;
}
-#ifdef PROFILE_SCREEN
- P_SETTIMEVAL(cnt.stop);
- total_time += P_CMPTIMEVALS_USEC(cnt.start, cnt.stop);
- fprintf(stderr, "scroll_text(%ld): %ld microseconds (%d)\n",
- ++call_cnt, P_CMPTIMEVALS_USEC(cnt.start, cnt.stop), total_time);
-#endif
+ PROF_DONE(scroll_text);
+ PROF_TIME(scroll_text);
return count;
}
@@ -1612,12 +1599,8 @@ scr_refresh(int type)
register int nrows = TermWin.nrow;
register int ncols = TermWin.ncol;
#endif
-#ifdef PROFILE_SCREEN
- static long call_cnt = 0;
- static long long total_time = 0;
- P_INITCOUNTER(cnt);
-#endif
+ PROF_INIT(scr_refresh);
switch (type) {
case NO_REFRESH:
@@ -1633,10 +1616,6 @@ scr_refresh(int type)
if (type == NO_REFRESH)
return;
-#ifdef PROFILE_SCREEN
- P_SETTIMEVAL(cnt.start);
-#endif
-
if (buffer_pixmap) {
draw_buffer = buffer_pixmap;
} else {
@@ -1999,12 +1978,8 @@ scr_refresh(int type)
refresh_all = 0;
D_SCREEN(("Exiting.\n"));
-#ifdef PROFILE_SCREEN
- P_SETTIMEVAL(cnt.stop);
- total_time += P_CMPTIMEVALS_USEC(cnt.start, cnt.stop);
- fprintf(stderr, "scr_refresh(%ld): %ld microseconds (%d)\n",
- ++call_cnt, P_CMPTIMEVALS_USEC(cnt.start, cnt.stop), total_time);
-#endif
+ PROF_DONE(scr_refresh);
+ PROF_TIME(scr_refresh);
}
int
@@ -2259,7 +2234,9 @@ selection_paste(Window win, unsigned prop, int Delete)
return;
for (nread = 0, bytes_after = 1; bytes_after > 0;) {
if ((XGetWindowProperty(Xdisplay, win, prop, (nread / 4), PROP_SIZE, Delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems, &bytes_after, &data) != Success)) {
- XFree(data);
+ if (data != NULL) {
+ XFree(data);
+ }
return;
}
nread += nitems;
@@ -2277,12 +2254,18 @@ selection_paste(Window win, unsigned prop, int Delete)
xtextp.nitems = nitems;
XmbTextPropertyToTextList(Xdisplay, &xtextp, &cl, &size);
- for (i = 0 ; i < size ; i ++) {
- PasteIt(cl[i], strlen(cl[i]));
+ if (cl) {
+ for (i = 0 ; i < size ; i ++) {
+ if (cl[i]) {
+ PasteIt(cl[i], strlen(cl[i]));
+ }
+ }
+ XFreeStringList(cl);
}
- XFreeStringList(cl);
}
- XFree(data);
+ if (data) {
+ XFree(data);
+ }
}
}
diff --git a/src/startup.h b/src/startup.h
index 73bfcc4..b9b028b 100644
--- a/src/startup.h
+++ b/src/startup.h
@@ -41,7 +41,7 @@
#define THEME_CFG "theme.cfg"
#define USER_CFG "user.cfg"
-#define MAX_COLS 200
+#define MAX_COLS 250
#define MAX_ROWS 128
#ifdef MIN
diff --git a/src/term.c b/src/term.c
index bf9f88a..91f7d97 100644
--- a/src/term.c
+++ b/src/term.c
@@ -41,6 +41,7 @@ static const char cvs_ident[] = "$Id$";
#include "e.h"
#include "events.h"
#include "font.h"
+#include "misc.h"
#include "startup.h"
#include "options.h"
#include "pixmap.h"
@@ -220,21 +221,27 @@ lookup_key(XEvent * ev)
kbuf[0] = '\0';
/* Lookup the string equivalent in terms of the XIM input context. */
len = XmbLookupString(xim_input_context, &ev->xkey, (char *) kbuf, sizeof(short_buf), &keysym, &status_return);
+ D_TTY(("XmbLookupString() gave us len %d, keysym 0x%04x, and buffer \"%s\" based on the XIM input context %010p\n",
+ len, keysym, safe_print_string(kbuf, len), xim_input_context));
/* Whoops, it's too long. Allocate a new buffer and repeat the call. */
if (status_return == XBufferOverflow) {
kbuf = (unsigned char *) MALLOC(len + 1);
kbuf_alloced = 1;
len = XmbLookupString(xim_input_context, &ev->xkey, (char *) kbuf, len, &keysym, &status_return);
+ D_TTY(("XmbLookupString() gave us len %d, keysym 0x%04x, and buffer \"%s\" based on the XIM input context %010p\n",
+ len, keysym, safe_print_string(kbuf, len), xim_input_context));
}
valid_keysym = (status_return == XLookupKeySym) || (status_return == XLookupBoth);
} else {
/* No XIM input context. Do it the normal way. */
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(short_buf), &keysym, NULL);
+ D_TTY(("XLookupString() gave us len %d, keysym 0x%04x, and buffer \"%s\"\n", len, keysym, safe_print_string(kbuf, len)));
valid_keysym = 1;
}
#else /* USE_XIM */
/* Translate the key event into its corresponding string according to X. This also gets us a keysym. */
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, NULL);
+ D_TTY(("XLookupString() gave us len %d, keysym 0x%04x, and buffer \"%s\"\n", len, keysym, safe_print_string(kbuf, len)));
/* If there is no string and it's a Latin2-4 character, replace it with the Latin1 character instead. */
if (!len && (keysym >= 0x0100) && (keysym < 0x0400)) {
@@ -741,17 +748,7 @@ sprintf((char *) kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))); \
tt_write(&ch, 1);
}
-#if DEBUG >= DEBUG_CMD
- if (debug_level >= DEBUG_CMD) {
- char *p;
- int i;
-
- fprintf(stderr, "key 0x%04x[%d]: `", (unsigned int) keysym, len);
- for (i = 0, p = (char *) kbuf; i < len; i++, p++)
- fprintf(stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p);
- fprintf(stderr, "'\n");
- }
-#endif /* DEBUG_CMD */
+ D_TTY(("After handling: len %d, keysym 0x%04x, and buffer \"%s\"\n", len, keysym, safe_print_string(kbuf, len)));
tt_write(kbuf, len); /* Send the resulting string to the child process */
LK_RET();
diff --git a/utils/Etwinop b/utils/Etwinop
index d9d5331..e6be8dc 100644
--- a/utils/Etwinop
+++ b/utils/Etwinop
@@ -5,7 +5,7 @@
# $Id$
if [ $# -eq 0 ]; then
- echo "Syntax: Etwinop { raise | lower | map | unmap | iconify | kill } [windowid]"
+ echo "Syntax: Etwinop { raise | lower | map | unmap | move | resize | iconify | kill } [windowid]"
echo
exit 0
fi
@@ -23,10 +23,6 @@ else
ac_n= ac_c='\c'
fi
-if [ "X$2" = "X" ]; then
- winop="$1"
-else
- winop="$1 $2"
-fi
+winop="$*"
echo $ac_n "]7;winop:$winop$ac_c"