summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2011-06-05 11:26:31 +0200
committerMatthieu Herrb <matthieu.herrb@laas.fr>2011-06-05 11:26:31 +0200
commitb2365de9199c4779cceba2505bc8463e1740bb62 (patch)
tree5dcb8de470a1efdc71ce659723cf3e9b24d72d50
parentc066d43835faafd79531ee40a2fa575e596bed2f (diff)
parent70a7f34dfc4d7ea4f7425b9a7359a08a35752bb0 (diff)
Merge remote-tracking branch 'origin/master' into obsd
-rw-r--r--configure.ac3
-rw-r--r--src/Makefile.am2
-rw-r--r--src/add_window.c2
-rw-r--r--src/menus.c15
-rw-r--r--src/session.c2
-rw-r--r--src/twm.h6
-rw-r--r--src/util.c66
7 files changed, 21 insertions, 75 deletions
diff --git a/configure.ac b/configure.ac
index 6f1cef7..9f2d7c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@ AC_INIT([twm], [1.0.6],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [twm])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
+AC_USE_SYSTEM_EXTENSIONS
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -49,7 +50,7 @@ AC_PROG_LEX
AC_CHECK_FUNCS([mkstemp])
# Checks for pkg-config packages
-PKG_CHECK_MODULES(TWM, x11 xext xt xmu ice sm)
+PKG_CHECK_MODULES(TWM, x11 xext xt xmu ice sm xproto >= 7.0.17)
AC_OUTPUT([Makefile
src/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index cb6f615..cfd0b44 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,7 +27,7 @@ bin_PROGRAMS = twm
rcdir = ${datadir}/X11/twm
dist_rc_DATA = system.twmrc
-AM_CFLAGS = $(TWM_CFLAGS) -DXVENDORNAME=\"The\ X.Org\ Foundation\" -DXORG_RELEASE=\"Release\ $(VERSION)\" -D_BSD_SOURCE
+AM_CFLAGS = $(TWM_CFLAGS) -DXVENDORNAME=\"The\ X.Org\ Foundation\" -DXORG_RELEASE=\"Release\ $(VERSION)\"
AM_CFLAGS += -DSYSTEM_INIT_FILE=\"${datadir}/X11/twm/system.twmrc\"
twm_LDADD = $(TWM_LIBS)
diff --git a/src/add_window.c b/src/add_window.c
index af7e384..690354a 100644
--- a/src/add_window.c
+++ b/src/add_window.c
@@ -166,7 +166,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
char *name;
#ifdef DEBUG
- fprintf(stderr, "AddWindow: w = 0x%x\n", w);
+ fprintf(stderr, "AddWindow: w = 0x%lx\n", (unsigned long)w);
#endif
/* allocate space for the twm window */
diff --git a/src/menus.c b/src/menus.c
index 9de036e..b58e036 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -58,6 +58,10 @@ in this Software without prior written authorization from The Open Group.
*
***********************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <stdio.h>
#include <X11/Xos.h>
#include "twm.h"
@@ -507,13 +511,16 @@ UpdateMenu()
if (Event.type != MotionNotify)
continue;
+
+ if (!ActiveMenu)
+ continue;
done = FALSE;
XQueryPointer( dpy, ActiveMenu->w, &JunkRoot, &JunkChild,
&x_root, &y_root, &x, &y, &JunkMask);
/* if we haven't recieved the enter notify yet, wait */
- if (ActiveMenu && !ActiveMenu->entered)
+ if (!ActiveMenu->entered)
continue;
if (XFindContext(dpy, ActiveMenu->w, ScreenContext, &context_data) == 0)
@@ -562,7 +569,7 @@ UpdateMenu()
if (!done)
{
ActiveItem = mi;
- if (ActiveItem->func != F_TITLE && !ActiveItem->state)
+ if (ActiveItem && ActiveItem->func != F_TITLE && !ActiveItem->state)
{
ActiveItem->state = 1;
PaintEntry(ActiveMenu, ActiveItem, False);
@@ -570,7 +577,7 @@ UpdateMenu()
}
/* now check to see if we were over the arrow of a pull right entry */
- if (ActiveItem->func == F_MENU &&
+ if (ActiveItem && ActiveItem->func == F_MENU &&
((ActiveMenu->width - x) < (ActiveMenu->width >> 1)))
{
MenuRoot *save = ActiveMenu;
@@ -913,7 +920,7 @@ MakeMenu(MenuRoot *mr)
b3.flags = DoRed | DoGreen | DoBlue;
num -= 1;
- for (i = 0, cur = start->next; i < num; i++, cur = cur->next)
+ for (i = 0, cur = start->next; i < num && cur; i++, cur = cur->next)
{
f3.red += fred;
f3.green += fgreen;
diff --git a/src/session.c b/src/session.c
index c878ea6..bea1090 100644
--- a/src/session.c
+++ b/src/session.c
@@ -551,7 +551,7 @@ char *filename;
FILE *configFile;
TWMWinConfigEntry *entry;
int done = 0;
- unsigned short version;
+ unsigned short version = 0;
configFile = fopen (filename, "rb");
if (!configFile)
diff --git a/src/twm.h b/src/twm.h
index 420d6c8..1a546a3 100644
--- a/src/twm.h
+++ b/src/twm.h
@@ -62,6 +62,10 @@ from The Open Group.
#ifndef _TWM_
#define _TWM_
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
@@ -349,7 +353,7 @@ extern void InitVariables ( void );
extern void CreateFonts ( void );
extern void RestoreWithdrawnLocation ( TwmWindow *tmp );
extern void Reborder( Time time);
-extern void Done( XtPointer, XtSignalId * );
+extern void Done( XtPointer, XtSignalId * ) _X_NORETURN;
extern void ComputeCommonTitleOffsets ( void );
extern void ComputeTitleLocation ( TwmWindow *tmp );
extern void ComputeWindowTitleOffsets ( TwmWindow *tmp_win, int width, Bool squeeze );
diff --git a/src/util.c b/src/util.c
index ee30d06..b9ccfc4 100644
--- a/src/util.c
+++ b/src/util.c
@@ -767,72 +767,6 @@ SetFocus (TwmWindow *tmp_win, Time time)
XSetInputFocus (dpy, w, RevertToPointerRoot, time);
}
-
-#ifdef NOPUTENV
-/**
- * define our own putenv() if the system doesn't have one.
- * putenv(s): place s (a string of the form "NAME=value") in
- * the environment; replacing any existing NAME. s is placed in
- * environment, so if you change s, the environment changes (like
- * putenv on a sun). Binding removed if you putenv something else
- * called NAME.
- */
-int
-putenv(char *s)
-{
- char *v;
- int varlen, idx;
- extern char **environ;
- char **newenv;
- static int virgin = 1; /* true while "environ" is a virgin */
-
- v = index(s, '=');
- if(v == 0)
- return 0; /* punt if it's not of the right form */
- varlen = (v + 1) - s;
-
- for (idx = 0; environ[idx] != 0; idx++) {
- if (strncmp(environ[idx], s, varlen) == 0) {
- if(v[1] != 0) { /* true if there's a value */
- environ[idx] = s;
- return 0;
- } else {
- do {
- environ[idx] = environ[idx+1];
- } while(environ[++idx] != 0);
- return 0;
- }
- }
- }
-
- /* add to environment (unless no value; then just return) */
- if(v[1] == 0)
- return 0;
- if(virgin) {
- register i;
-
- newenv = (char **) malloc((unsigned) ((idx + 2) * sizeof(char*)));
- if(newenv == 0)
- return -1;
- for(i = idx-1; i >= 0; --i)
- newenv[i] = environ[i];
- virgin = 0; /* you're not a virgin anymore, sweety */
- } else {
- newenv = (char **) realloc((char *) environ,
- (unsigned) ((idx + 2) * sizeof(char*)));
- if (newenv == 0)
- return -1;
- }
-
- environ = newenv;
- environ[idx] = s;
- environ[idx+1] = 0;
-
- return 0;
-}
-#endif /* NOPUTENV */
-
-
static Pixmap
CreateXLogoPixmap (unsigned *widthp, unsigned *heightp)
{