wm2 port. ok and tweaks sturm@
This commit is contained in:
parent
e8e0b32ab7
commit
ecd030689a
5
x11/wm2/distinfo
Normal file
5
x11/wm2/distinfo
Normal file
@ -0,0 +1,5 @@
|
||||
MD5 (wm2-4.tar.gz) = Ox1tpHoAwGQ2iRZpJhvWUQ==
|
||||
RMD160 (wm2-4.tar.gz) = Mrj3wK49KAaEUFs/abKoK6+rrPE=
|
||||
SHA1 (wm2-4.tar.gz) = 3ZWecu7coROzct32e5UmDiUiapE=
|
||||
SHA256 (wm2-4.tar.gz) = psM1I5D5WMUDNAjOc+Gr2WdzcqfIxZSeOaYv2kM7BU0=
|
||||
SIZE (wm2-4.tar.gz) = 32807
|
12
x11/wm2/files/Makefile
Normal file
12
x11/wm2/files/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 2007/04/27 18:31:12 matthieu Exp $
|
||||
|
||||
BINDIR= ${PREFIX}/bin
|
||||
MANDIR= ${PREFIX}/man/cat
|
||||
|
||||
PROG= wm2
|
||||
SRCS= Border.C Buttons.C Client.C Events.C Main.C Manager.C Rotated.C
|
||||
|
||||
CPPFLAGS+= -I${X11BASE}/include
|
||||
LDADD+= -L${X11BASE}/lib -lXext -lX11 -lXau -lXdmcp
|
||||
|
||||
.include <bsd.prog.mk>
|
136
x11/wm2/files/wm2.1
Normal file
136
x11/wm2/files/wm2.1
Normal file
@ -0,0 +1,136 @@
|
||||
.\" $OpenBSD: wm2.1,v 1.1.1.1 2007/04/27 18:31:12 matthieu Exp $
|
||||
.Dd March 28, 1998
|
||||
.Dt WM2 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm wm2
|
||||
.Nd a window manager
|
||||
.Sh SYNOPSIS
|
||||
.Nm wm2
|
||||
.Sh DESCRIPTION
|
||||
.Nm wm2
|
||||
is a window manager for X. It provides an unusual style of window
|
||||
decoration and as little functionality as I feel comfortable with in a
|
||||
window manager. wm2 is not configurable, except by editing the source
|
||||
and recompiling the code, and is really intended for people who don't
|
||||
particularly want their window manager to be too friendly.
|
||||
.Pp
|
||||
.Nm wm2
|
||||
provides:
|
||||
.Bl -dash
|
||||
.It
|
||||
Decorative frames for your windows.
|
||||
.It
|
||||
The ability to move, resize, hide and restore windows.
|
||||
.It
|
||||
No icons.
|
||||
.It
|
||||
No configurable root menus, buttons or mouse or keyboard bindings.
|
||||
.It
|
||||
No virtual desktop, toolbars or integrated applications.
|
||||
.El
|
||||
.Sh USAGE
|
||||
To run wm2, make sure you're not already running a window manager,
|
||||
make sure the DISPLAY variable is correctly set, and then execute the
|
||||
file
|
||||
.Nm wm2 .
|
||||
There are no command-line options or X resources, and
|
||||
there is no start-up file. If your X server doesn't support the Shape
|
||||
extension, wm2 will exit (and will never work on your server); if it
|
||||
can't find the required fonts or allocate the required colours, it
|
||||
will also exit (but you should be able to fix this by changing the
|
||||
definitions in
|
||||
.Pa Config.h
|
||||
and recompiling).
|
||||
.Pp
|
||||
Available window manipulations are:
|
||||
.Bl -dash
|
||||
.It
|
||||
To focus a window: depends on the focus policy you selected
|
||||
in
|
||||
.Pa Config.h
|
||||
before compiling. See "Focus policy", below.
|
||||
.It
|
||||
To raise a window: click on its tab or frame, unless you have
|
||||
auto-raise on focus set in
|
||||
.Pa Config.h .
|
||||
.It
|
||||
To move a window: make sure it's in focus, then click and drag
|
||||
on its tab.
|
||||
.It
|
||||
To hide a window: make sure it's in focus, then click on the
|
||||
button at the top of its tab.
|
||||
.It
|
||||
To recover a hidden window: click left button on the root
|
||||
window for the root menu, and choose the window you want.
|
||||
.It
|
||||
To start a new xterm: use the first item on root menu ("New").
|
||||
.It
|
||||
To delete a window: make sure it's in focus, click on the
|
||||
button on the tab, hold the mouse button for at least a
|
||||
second and a half until the cursor changes to a cross, then
|
||||
release. (I know, it's not very easy. On the other hand,
|
||||
things like Windows-95 tend to obscure the fact that most
|
||||
windows already have a perfectly good Close option. If the
|
||||
default delay doesn't suit you, change it in
|
||||
.Pa Config.h
|
||||
and recompile.)
|
||||
.It
|
||||
To resize a window: make sure it's in focus, then click and
|
||||
drag on its bottom-right corner. For a constrained resize,
|
||||
click and drag on the bottom-left or top-right corner of
|
||||
the enclosing window frame.
|
||||
.It
|
||||
To flip around amongst the windows on-screen: click with the right
|
||||
mouse button on the root window or on any window's frame or tab.
|
||||
.It
|
||||
To exit from wm2: move the mouse pointer to the very edge of the
|
||||
screen at the extreme lower-right corner, and click left button on
|
||||
the root window for the root menu. The menu should have an extra
|
||||
option labelled "Exit wm2"; select this.
|
||||
.El
|
||||
All move and resize operations are opaque.
|
||||
.Sh FOCUS POLICY
|
||||
.Pa Config.h
|
||||
contains settings for focus policy. There are three things
|
||||
you can define to either True or False: CONFIG_CLICK_TO_FOCUS,
|
||||
CONFIG_RAISE_ON_FOCUS and CONFIG_AUTO_RAISE. The first two are
|
||||
connected: together they define a focus policy. The third is a
|
||||
separate focus policy on its own and will only work if the first two
|
||||
are both False. CONFIG_AUTO_RAISE differs from
|
||||
(!CONFIG_CLICK_TO_FOCUS && CONFIG_RAISE_ON_FOCUS) only in that it
|
||||
provides a short delay before raising each window. The delay is also
|
||||
definable in
|
||||
.Pa Config.h .
|
||||
.Sh XTERM
|
||||
Some versions of xterm and rxvt run badly with wm2. If you use xterm
|
||||
and find that it refreshes the window excessively slowly, you might
|
||||
like to try experimenting with a different terminal emulation program.
|
||||
I think it might help to ensure that the scrollbar is on the
|
||||
right-hand side of the rxvt window and is thick enough that wmx's
|
||||
resize handle doesn't obscure any of the text area.
|
||||
.Sh SEE ALSO
|
||||
.Xr twm 1 ,
|
||||
.Xr fvwm 1
|
||||
.Sh AUTHORS
|
||||
wm2 was written by Chris Cannam, recycling a lot of code and structure
|
||||
from "9wm" by David Hogan (see http://www.cs.su.oz.au/~dhog/ ). 9wm
|
||||
is written in C, so very little of the code is used verbatim, but the
|
||||
intention was to reuse and a lot of the resulting code is
|
||||
recognisable. (Also 9wm's minimalism was rather inspiring.) I've
|
||||
made enough changes to make it very probable that any bugs you find
|
||||
will be my fault rather than David's.
|
||||
.Pp
|
||||
wm2 also uses version 2.0 of Alan Richardson's "xvertext"
|
||||
font-rotation routines.
|
||||
.Pp
|
||||
The sideways tabs on the window frames were Andy Green's idea.
|
||||
.Pp
|
||||
If you want to hack the code into something else for your own
|
||||
amusement, please go ahead. Feel free to modify and redistribute, as
|
||||
long as you retain the original copyrights as appropriate.
|
||||
.Pp
|
||||
This manual page was written by Matthieu Herrb, from the README file.
|
||||
.Sh BUGS
|
||||
The principal bug is that wm2 now has too many features. That aside,
|
||||
if you find a bug, please report it to me (preferably with a fix).
|
18
x11/wm2/patches/patch-Border_C
Normal file
18
x11/wm2/patches/patch-Border_C
Normal file
@ -0,0 +1,18 @@
|
||||
$OpenBSD: patch-Border_C,v 1.1.1.1 2007/04/27 18:31:12 matthieu Exp $
|
||||
--- Border.C.orig Fri Mar 21 12:12:30 1997
|
||||
+++ Border.C Wed Apr 11 22:29:23 2007
|
||||
@@ -189,11 +189,11 @@ void Border::fixTabHeight(int maxHeight)
|
||||
m_tabHeight = XRotTextWidth(m_tabFont, m_label, len) + 6 + m_tabWidth;
|
||||
if (m_tabHeight <= maxHeight) return;
|
||||
|
||||
- char *newLabel = (char *)malloc(len + 3);
|
||||
+ char *newLabel = (char *)malloc(len + 4);
|
||||
|
||||
do {
|
||||
- strncpy(newLabel, m_label, len - 1);
|
||||
- strcpy(newLabel + len - 1, "...");
|
||||
+ strlcpy(newLabel, m_label, len + 4);
|
||||
+ strlcat(newLabel, "...", len + 4);
|
||||
m_tabHeight = XRotTextWidth(m_tabFont, newLabel,
|
||||
strlen(newLabel)) + 6 + m_tabWidth;
|
||||
--len;
|
12
x11/wm2/patches/patch-Buttons_C
Normal file
12
x11/wm2/patches/patch-Buttons_C
Normal file
@ -0,0 +1,12 @@
|
||||
$OpenBSD: patch-Buttons_C,v 1.1.1.1 2007/04/27 18:31:12 matthieu Exp $
|
||||
--- Buttons.C.orig Fri Mar 21 12:12:30 1997
|
||||
+++ Buttons.C Wed Apr 11 22:29:23 2007
|
||||
@@ -327,7 +327,7 @@ void WindowManager::menu(XButtonEvent *e)
|
||||
void WindowManager::showGeometry(int x, int y)
|
||||
{
|
||||
char string[20];
|
||||
- sprintf(string, "%d %d\n", x, y);
|
||||
+ snprintf(string, sizeof(string), "%d %d\n", x, y);
|
||||
int width = XTextWidth(m_menuFont, string, strlen(string)) + 8;
|
||||
int height = m_menuFont->ascent + m_menuFont->descent + 8;
|
||||
int mx = DisplayWidth (display(), m_screenNumber) - 1;
|
30
x11/wm2/patches/patch-General_h
Normal file
30
x11/wm2/patches/patch-General_h
Normal file
@ -0,0 +1,30 @@
|
||||
$OpenBSD: patch-General_h,v 1.1.1.1 2007/04/27 18:31:12 matthieu Exp $
|
||||
--- General.h.orig Fri Mar 21 12:12:30 1997
|
||||
+++ General.h Wed Apr 11 22:29:23 2007
|
||||
@@ -10,12 +10,11 @@
|
||||
#undef _POSIX_SOURCE
|
||||
#endif
|
||||
|
||||
-#define _POSIX_SOURCE 1
|
||||
-
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
@@ -29,10 +28,10 @@
|
||||
// True and False are defined in Xlib.h
|
||||
typedef char Boolean;
|
||||
|
||||
-#define NewString(x) (strcpy((char *)malloc(strlen(x)+1),(x)))
|
||||
+#define NewString(x) (strdup(x))
|
||||
|
||||
#ifndef SIGNAL_CALLBACK_TYPE
|
||||
-#define SIGNAL_CALLBACK_TYPE (void (*)(...))
|
||||
+#define SIGNAL_CALLBACK_TYPE (void (*)(int))
|
||||
#endif
|
||||
|
||||
#define signal(x,y) \
|
59
x11/wm2/patches/patch-Manager_C
Normal file
59
x11/wm2/patches/patch-Manager_C
Normal file
@ -0,0 +1,59 @@
|
||||
$OpenBSD: patch-Manager_C,v 1.1.1.1 2007/04/27 18:31:12 matthieu Exp $
|
||||
--- Manager.C.orig Fri Mar 21 12:12:30 1997
|
||||
+++ Manager.C Wed Apr 11 22:29:23 2007
|
||||
@@ -191,11 +191,11 @@ int WindowManager::errorHandler(Display *d, XErrorEven
|
||||
|
||||
char msg[100], number[30], request[100];
|
||||
XGetErrorText(d, e->error_code, msg, 100);
|
||||
- sprintf(number, "%d", e->request_code);
|
||||
+ snprintf(number, sizeof(number), "%d", e->request_code);
|
||||
XGetErrorDatabaseText(d, "XRequest", number, "", request, 100);
|
||||
|
||||
- if (request[0] == '\0') sprintf(request, "<request-code-%d>",
|
||||
- e->request_code);
|
||||
+ if (request[0] == '\0') snprintf(request, sizeof(request),
|
||||
+ "<request-code-%d>", e->request_code);
|
||||
|
||||
fprintf(stderr, "wm2: %s (0x%lx): %s\n", request, e->resourceid, msg);
|
||||
|
||||
@@ -321,7 +321,7 @@ unsigned long WindowManager::allocateColour(char *name
|
||||
&nearest, &ideal)) {
|
||||
|
||||
char error[100];
|
||||
- sprintf(error, "couldn't load %s colour", desc);
|
||||
+ snprintf(error, sizeof(error), "couldn't load %s colour", desc);
|
||||
fatal(error);
|
||||
|
||||
} else return nearest.pixel;
|
||||
@@ -368,7 +368,7 @@ Time WindowManager::timestamp(Boolean reset)
|
||||
return m_currentTime;
|
||||
}
|
||||
|
||||
-void WindowManager::sigHandler()
|
||||
+void WindowManager::sigHandler(int)
|
||||
{
|
||||
m_signalled = True;
|
||||
}
|
||||
@@ -521,11 +521,6 @@ Boolean WindowManager::raiseTransients(Client *c)
|
||||
}
|
||||
}
|
||||
|
||||
-#ifdef sgi
|
||||
-extern "C" {
|
||||
-extern int putenv(char *); /* not POSIX */
|
||||
-}
|
||||
-#endif
|
||||
|
||||
void WindowManager::spawn()
|
||||
{
|
||||
@@ -543,8 +538,8 @@ void WindowManager::spawn()
|
||||
|
||||
if (displayName && (displayName[0] != '\0')) {
|
||||
|
||||
- char *pstring = (char *)malloc(strlen(displayName) + 10);
|
||||
- sprintf(pstring, "DISPLAY=%s", displayName);
|
||||
+ char *pstring;
|
||||
+ asprintf(&pstring, "DISPLAY=%s", displayName);
|
||||
putenv(pstring);
|
||||
}
|
||||
|
12
x11/wm2/patches/patch-Manager_h
Normal file
12
x11/wm2/patches/patch-Manager_h
Normal file
@ -0,0 +1,12 @@
|
||||
$OpenBSD: patch-Manager_h,v 1.1.1.1 2007/04/27 18:31:12 matthieu Exp $
|
||||
--- Manager.h.orig Fri Mar 21 12:12:30 1997
|
||||
+++ Manager.h Wed Apr 11 22:29:23 2007
|
||||
@@ -85,7 +85,7 @@ class WindowManager { (private)
|
||||
|
||||
static Boolean m_initialising;
|
||||
static int errorHandler(Display *, XErrorEvent *);
|
||||
- static void sigHandler();
|
||||
+ static void sigHandler(int);
|
||||
static int m_signalled;
|
||||
|
||||
void initialiseScreen();
|
34
x11/wm2/patches/patch-Rotated_C
Normal file
34
x11/wm2/patches/patch-Rotated_C
Normal file
@ -0,0 +1,34 @@
|
||||
$OpenBSD: patch-Rotated_C,v 1.1.1.1 2007/04/27 18:31:12 matthieu Exp $
|
||||
--- Rotated.C.orig Fri Mar 21 12:12:30 1997
|
||||
+++ Rotated.C Wed Apr 11 22:29:23 2007
|
||||
@@ -40,17 +40,19 @@ static char *my_strtok(char *, char *);
|
||||
static char *my_strdup(char *str)
|
||||
{
|
||||
char *s;
|
||||
+ size_t len;
|
||||
|
||||
if (str == NULL) return NULL;
|
||||
|
||||
- s = (char *)malloc((unsigned)(strlen(str)+1));
|
||||
+ len = strlen(str) + 1;
|
||||
+ s = (char *)malloc(len);
|
||||
/* this error is highly unlikely ... */
|
||||
if (s == NULL) {
|
||||
fprintf(stderr, "Fatal error: my_strdup(): Couldn't do malloc (gulp!)\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- strcpy(s, str);
|
||||
+ strlcpy(s, str, len);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -228,7 +230,7 @@ XRotFontStruct *XRotLoadFont(Display *dpy, char *fontn
|
||||
XFillRectangle(dpy, canvas, font_gc, 0, 0, boxlen, boxlen);
|
||||
|
||||
/* draw the character centre top right on canvas ... */
|
||||
- sprintf(text, "%c", ichar);
|
||||
+ snprintf(text, sizeof(text), "%c", ichar);
|
||||
XSetForeground(dpy, font_gc, on);
|
||||
XDrawImageString(dpy, canvas, font_gc, boxlen/2 - lbearing,
|
||||
boxlen/2 - descent, text, 1);
|
Loading…
Reference in New Issue
Block a user