changeset: 2725:274c5bf77c98
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Mon Jun 14 10:30:23 2010 -0400
files: .hgignore alternative_wmiircs/Makefile alternative_wmiircs/plan9port/Makefile alternative_wmiircs/python/Makefile alternative_wmiircs/python/pygmi/Makefile alternative_wmiircs/python/pyxp/Makefile alternative_wmiircs/ruby/Makefile cmd/Makefile cmd/click/Makefile cmd/click/_util.c cmd/click/dat.h cmd/click/fns.h cmd/click/main.c cmd/keyname/Makefile cmd/keyname/main.c cmd/menu/history.c cmd/menu/keys.c cmd/wmii/fns.h cmd/wmii/key.c cmd/wmii/main.c cmd/wmii9menu.c cmd/x11/Makefile cmd/x11/setfocus.c cmd/x11/wikeyname.c cmd/x11/wiwarp.c cmd/x11/wmii9menu.c debian/copyright doc/wmii.tex img/wmii.eps include/stuff/x.h include/stuff/x11.h lib/libbio/bcat.c lib/libbio/brdstr.c lib/libbio/bvprint.c lib/libfmt/fltfmt.c lib/libfmt/nan64.c lib/libfmt/runevsmprint.c lib/libfmt/vsmprint.c lib/libregexp/regcomp.c lib/libregexp/regsub.c lib/libregexp/rregsub.c lib/libstuff/event/clientmessage.c lib/libstuff/event/destroynotify.c lib/libstuff/event/enternotify.c lib/libstuff/event/expose.c lib/libstuff/event/fo
cusin.c lib/libstuff/event/focusout.c lib/libstuff/event/leavenotify.c lib/libstuff/event/propertynotify.c lib/libstuff/event/selection.c lib/libstuff/event/selectionclear.c lib/libstuff/event/selectionrequest.c lib/libstuff/fmt/fmtbufinit.c lib/libstuff/map.c lib/libstuff/printevent.c lib/libstuff/util/estrndup.c lib/libstuff/util/getbase.c lib/libstuff/util/strcasestr.c lib/libstuff/util/utflcpy.c lib/libstuff/x11/convpts.c lib/libstuff/x11/drawing/drawpoly.c lib/libstuff/x11/errors.c lib/libstuff/x11/initdisplay.c lib/libstuff/x11/keys/parsekey.c lib/libstuff/x11/mouse/grabpointer.c lib/libstuff/x11/mouse/pointerscreen.c lib/libstuff/x11/mouse/querypointer.c lib/libstuff/x11/windows/findwin.c lib/libstuff/x11/xatom.c lib/libutf/runestrdup.c lib/libwmii_hack/x11.c man/wmii.1 man/wmii.man1 mk/lib.mk mk/so.mk mk/wmii.mk rc/Makefile rc/sh.wmii test/Makefile test/event.b util/genconfig util/link
description:
Rearrange some things.
diff -r 0b563245988e -r 274c5bf77c98 .hgignore
--- a/.hgignore Fri Jun 11 23:48:29 2010 -0400
+++ b/.hgignore Mon Jun 14 10:30:23 2010 -0400
@@ -4,7 +4,8 @@
\.([oa]|out|o_pic|so|pyc|pyo|diff)$
\.(diff|orig|rej|bak)$
\.(aux|idx|ilg|ind|log|toc)$
-^cmd/(stfo|osd|wiwarp|setfocus)(/|$)
+^cmd/osd(/|$)
+^cmd/x11/(stfo|wiclick)\.
^(pkg|src)/
^doxy
/bak/
diff -r 0b563245988e -r 274c5bf77c98 alternative_wmiircs/Makefile
--- a/alternative_wmiircs/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ b/alternative_wmiircs/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -2,7 +2,7 @@
include $(ROOT)/mk/hdr.mk
include $(ROOT)/mk/wmii.mk
-BIN = $(ETC)/wmii$(CONFVERSION)
+BIN = $(GLOBALCONF)
DIRS = python \
plan9port \
ruby
diff -r 0b563245988e -r 274c5bf77c98 alternative_wmiircs/plan9port/Makefile
--- a/alternative_wmiircs/plan9port/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ b/alternative_wmiircs/plan9port/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -5,5 +5,5 @@
DOCS = README
EXECS = wmiirc
-DIR = $(ETC)/wmii$(CONFVERSION)/plan9port
+DIR = $(GLOBALCONF)/plan9port
DOCDIR = $(DOC)/alternative_wmiircs/plan9port
diff -r 0b563245988e -r 274c5bf77c98 alternative_wmiircs/python/Makefile
--- a/alternative_wmiircs/python/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ b/alternative_wmiircs/python/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -8,7 +8,7 @@
DIRS = pygmi \
pyxp
-DIR = $(ETC)/wmii$(CONFVERSION)/python
+DIR = $(GLOBALCONF)/python
DOCDIR = $(DOC)/alternative_wmiircs/python
include $(ROOT)/mk/dir.mk
diff -r 0b563245988e -r 274c5bf77c98 alternative_wmiircs/python/pygmi/Makefile
--- a/alternative_wmiircs/python/pygmi/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ b/alternative_wmiircs/python/pygmi/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -9,4 +9,4 @@
monitor.py \
util.py
-DIR = $(ETC)/wmii$(CONFVERSION)/python/pygmi
+DIR = $(GLOBALCONF)/python/pygmi
diff -r 0b563245988e -r 274c5bf77c98 alternative_wmiircs/python/pyxp/Makefile
--- a/alternative_wmiircs/python/pyxp/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ b/alternative_wmiircs/python/pyxp/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -12,4 +12,4 @@
mux.py \
types.py
-DIR = $(ETC)/wmii$(CONFVERSION)/python/pyxp
+DIR = $(GLOBALCONF)/python/pyxp
diff -r 0b563245988e -r 274c5bf77c98 alternative_wmiircs/ruby/Makefile
--- a/alternative_wmiircs/ruby/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ b/alternative_wmiircs/ruby/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -9,5 +9,5 @@
TEXT = config.rb \
config.yaml
-DIR = $(ETC)/wmii$(CONFVERSION)/ruby
+DIR = $(GLOBALCONF)/ruby
DOCDIR = $(DOC)/alternative_wmiircs/ruby
diff -r 0b563245988e -r 274c5bf77c98 cmd/Makefile
--- a/cmd/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ b/cmd/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -4,24 +4,18 @@
wmiir.c: $(ROOT)/mk/wmii.mk
-DIRS = wmii \
- keyname \
- menu \
+DIRS = menu \
strut \
- tray
+ tray \
+ wmii \
+ x11
TARG = wihack \
wmii.rc \
wmii.sh \
- wmii9menu \
wmiir
LIBS += $(LIBS9) $(LIBIXP)
-CFLAGS += $(INCX11)
include $(ROOT)/mk/many.mk
include $(ROOT)/mk/dir.mk
-O9MENU=wmii9menu.o $(ROOT)/lib/libstuff.a $(LIBIXP)
-wmii9menu.out: $(O9MENU)
- $(LINK) $@ $(O9MENU) $$(pkg-config --libs $(X11PACKAGES)) -lXext
-
diff -r 0b563245988e -r 274c5bf77c98 cmd/click/Makefile
--- a/cmd/click/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-ROOT= ../..
-include $(ROOT)/mk/hdr.mk
-include $(ROOT)/mk/wmii.mk
-
-main.c: $(ROOT)/mk/wmii.mk
-
-TARG = click
-HFILES= dat.h fns.h
-
-PACKAGES += $(X11PACKAGES) xext xrandr xrender xinerama
-
-LIB = $(LIBIXP) $(LIBS9)
-LIBS += -lm -lXtst
-CFLAGS += -DIXP_NEEDAPI=86
-OBJ = main
-
-include $(ROOT)/mk/one.mk
-
diff -r 0b563245988e -r 274c5bf77c98 cmd/click/_util.c
--- a/cmd/click/_util.c Fri Jun 11 23:48:29 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
- * See LICENSE file for license details.
- */
-#include "dat.h"
-#include <ctype.h>
-#include <string.h>
-#include "fns.h"
-
-#define strbcmp(str, const) (strncmp((str), (const), sizeof(const)-1))
-static int
-getbase(const char **s, long *sign) {
- const char *p;
- int ret;
-
- ret = 10;
- *sign = 1;
- if(**s == '-') {
- *sign = -1;
- *s += 1;
- }else if(**s == '+')
- *s += 1;
-
- p = *s;
- if(!strbcmp(p, "0x")) {
- *s += 2;
- ret = 16;
- }
- else if(isdigit(p[0])) {
- if(p[1] == 'r') {
- *s += 2;
- ret = p[0] - '0';
- }
- else if(isdigit(p[1]) && p[2] == 'r') {
- *s += 3;
- ret = 10*(p[0]-'0') + (p[1]-'0');
- }
- }
- else if(p[0] == '0') {
- ret = 8;
- }
- if(ret != 10 && (**s == '-' || **s == '+'))
- *sign = 0;
- return ret;
-}
-
-bool
-getlong(const char *s, long *ret) {
- const char *end;
- char *rend;
- int base;
- long sign;
-
- end = s+strlen(s);
- base = getbase(&s, &sign);
- if(sign == 0)
- return false;
-
- *ret = sign * strtol(s, &rend, base);
- return (end == rend);
-}
-
-bool
-getulong(const char *s, ulong *ret) {
- const char *end;
- char *rend;
- int base;
- long sign;
-
- end = s+strlen(s);
- base = getbase(&s, &sign);
- if(sign < 1)
- return false;
-
- *ret = strtoul(s, &rend, base);
- return (end == rend);
-}
-
diff -r 0b563245988e -r 274c5bf77c98 cmd/click/dat.h
--- a/cmd/click/dat.h Fri Jun 11 23:48:29 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#include <fmt.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stuff/x.h>
-#include <stuff/util.h>
-#include <ixp.h>
-
-#define BLOCK(x) do { x; }while(0)
-
-#ifndef EXTERN
-# define EXTERN extern
-#endif
-
-EXTERN Window win;
-
diff -r 0b563245988e -r 274c5bf77c98 cmd/click/fns.h
--- a/cmd/click/fns.h Fri Jun 11 23:48:29 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-
diff -r 0b563245988e -r 274c5bf77c98 cmd/click/main.c
--- a/cmd/click/main.c Fri Jun 11 23:48:29 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/* Copyright ©2006-2010 Kris Maglione <maglione.k at Gmail>
- * See LICENSE file for license details.
- */
-#define EXTERN
-#include "dat.h"
-#include <X11/Xproto.h>
-#include <X11/extensions/XTest.h>
-#include <locale.h>
-#include <string.h>
-#include "fns.h"
-
-static const char version[] = "click-"VERSION", "COPYRIGHT"\n";
-
-static void
-usage(void) {
- fatal("usage: %s [window]\n", argv0);
-}
-
-static void
-click(Window *w, Point p) {
- Rectangle r;
- Point rp;
-
- r = getwinrect(w);
- rp = subpt(r.max, p);
-
- XTestFakeMotionEvent(display, 0, rp.x, rp.y, 0);
-
- XTestFakeButtonEvent(display, 1, true, 0);
- XTestFakeButtonEvent(display, 1, false, 0);
-
- XTestFakeMotionEvent(display, 0, r.max.x, r.max.y, 0);
-}
-
-int
-main(int argc, char *argv[]) {
- char *s;
-
- ARGBEGIN{
- default:
- usage();
- }ARGEND;
-
- initdisplay();
-
- s = ARGF();
- if(s && !getulong(s, &win.xid))
- usage();
- if (!s)
- win.xid = getfocus();
-
- if(argc)
- usage();
-
- click(&win, Pt(1, 1));
-
- XCloseDisplay(display);
- return 0;
-}
-
diff -r 0b563245988e -r 274c5bf77c98 cmd/keyname/Makefile
--- a/cmd/keyname/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-ROOT= ../..
-include $(ROOT)/mk/hdr.mk
-include $(ROOT)/mk/wmii.mk
-
-main.c: $(ROOT)/mk/wmii.mk
-
-TARG = wikeyname
-
-PACKAGES += $(X11PACKAGES)
-
-LIB = $(LIBS9)
-OBJ = main
-
-include $(ROOT)/mk/one.mk
-
diff -r 0b563245988e -r 274c5bf77c98 cmd/keyname/main.c
--- a/cmd/keyname/main.c Fri Jun 11 23:48:29 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/* Copyright ©2010 Kris Maglione <maglione.k at Gmail>
- * See LICENSE file for license details.
- */
-#include <stuff/util.h>
-#include <stuff/x.h>
-#include <fmt.h>
-#include <locale.h>
-
-static const char version[] = "wikeyname-"VERSION", "COPYRIGHT"\n";
-
-static Handlers handlers;
-static char* keyname;
-static int nkeys;
-
-static void
-usage(void) {
- fprint(2, "usage: wikeyname\n");
- exit(1);
-}
-
-int
-main(int argc, char *argv[]) {
-
- setlocale(LC_CTYPE, "");
-
- ARGBEGIN{
- default: usage();
- }ARGEND;
-
- if(argc)
- usage();
-
- initdisplay();
-
- selectinput(&scr.root, KeyPressMask|KeyReleaseMask);
- sethandler(&scr.root, &handlers);
- if(!grabkeyboard(&scr.root))
- fatal("can't grab keyboard\n");
-
- event_loop();
- print("%s\n", keyname);
-
- XCloseDisplay(display);
- return 0;
-}
-
-static bool
-kdown_event(Window *w, void *aux, XKeyEvent *ev) {
- Fmt f;
- char buf[32];
- char *key;
- KeySym ksym;
- int num;
-
- USED(aux);
- nkeys++;
- num = XLookupString(ev, buf, sizeof buf, &ksym, 0);
- key = XKeysymToString(ksym);
-
- fmtstrinit(&f);
- unmask(&f, ev->state, modkey_names, '-');
- if(f.nfmt)
- fmtrune(&f, '-');
- fmtstrcpy(&f, key);
-
- free(keyname);
- keyname = fmtstrflush(&f);
- return false;
-}
-
-static bool
-kup_event(Window *w, void *aux, XKeyEvent *ev) {
-
- USED(w, aux, ev);
- if(keyname != nil && --nkeys <= 0)
- event_looprunning = false;
- return false;
-}
-
-
-static Handlers handlers = {
- .kup = kup_event,
- .kdown = kdown_event,
-};
-
diff -r 0b563245988e -r 274c5bf77c98 cmd/menu/history.c
--- a/cmd/menu/history.c Fri Jun 11 23:48:29 2010 -0400
+++ b/cmd/menu/history.c Mon Jun 14 10:30:23 2010 -0400
@@ -8,7 +8,7 @@
static void
splice(Item *i) {
- if(i->next != nil)
+ if(i->next != nil)
i->next->prev = i->prev;
if(i->prev != nil)
i->prev->next = i->next;
diff -r 0b563245988e -r 274c5bf77c98 cmd/menu/keys.c
--- a/cmd/menu/keys.c Fri Jun 11 23:48:29 2010 -0400
+++ b/cmd/menu/keys.c Mon Jun 14 10:30:23 2010 -0400
@@ -15,28 +15,6 @@
static Key* bindings;
-static void
-init_numlock(void) {
- static int masks[] = {
- ShiftMask, LockMask, ControlMask, Mod1Mask,
- Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
- };
- XModifierKeymap *modmap;
- KeyCode kcode;
- int i, max;
-
- modmap = XGetModifierMapping(display);
- kcode = keycode("Num_Lock");
- if(kcode)
- if(modmap && modmap->max_keypermod > 0) {
- max = nelem(masks) * modmap->max_keypermod;
- for(i = 0; i < max; i++)
- if(modmap->modifiermap[i] == kcode)
- numlock = masks[i / modmap->max_keypermod];
- }
- XFreeModifiermap(modmap);
-}
-
/*
* To do: Find my red black tree implementation.
*/
@@ -50,7 +28,7 @@
int i, nlines, nwords;
if(!numlock)
- init_numlock();
+ numlock = numlockmask();
nlines = tokenize(lines, nelem(lines), spec, '\n');
for(i=0; i < nlines; i++) {
diff -r 0b563245988e -r 274c5bf77c98 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Fri Jun 11 23:48:29 2010 -0400
+++ b/cmd/wmii/fns.h Mon Jun 14 10:30:23 2010 -0400
@@ -10,8 +10,8 @@
# pragma varargck argpos event 1
# pragma varargck argpos warning 1
#
-# pragma varargck type "a" Area*
-# pragma varargck type "C" Client*
+# pragma varargck type "a" Area*
+# pragma varargck type "C" Client*
# pragma varargck type "r" void
#endif
diff -r 0b563245988e -r 274c5bf77c98 cmd/wmii/key.c
--- a/cmd/wmii/key.c Fri Jun 11 23:48:29 2010 -0400
+++ b/cmd/wmii/key.c Mon Jun 14 10:30:23 2010 -0400
@@ -6,30 +6,6 @@
#include <X11/keysym.h>
#include "fns.h"
-void
-init_lock_keys(void) {
- static int masks[] = {
- ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask,
- Mod3Mask, Mod4Mask, Mod5Mask
- };
- XModifierKeymap *modmap;
- KeyCode numlock;
- int i, max;
-
- numlock_mask = 0;
- modmap = XGetModifierMapping(display);
- numlock = keycode("Num_Lock");
- if(numlock)
- if(modmap && modmap->max_keypermod > 0) {
- max = nelem(masks) * modmap->max_keypermod;
- for(i = 0; i < max; i++)
- if(modmap->modifiermap[i] == numlock)
- numlock_mask = masks[i / modmap->max_keypermod];
- }
- XFreeModifiermap(modmap);
- valid_mask = 255 & ~(numlock_mask | LockMask);
-}
-
static void
freekey(Key *k) {
Key *n;
@@ -43,7 +19,7 @@
static void
_grab(XWindow w, int keycode, uint mod) {
XGrabKey(display, keycode, mod, w,
- true, GrabModeAsync, GrabModeAsync);
+ true, GrabModeAsync, GrabModeAsync);
}
static void
@@ -66,12 +42,12 @@
}
}
-static Key *
+static Key*
name2key(const char *name) {
Key *k;
for(k=key; k; k=k->lnext)
- if(!strncmp(k->name, name, sizeof k->name))
+ if(!strcmp(k->name, name))
return k;
return nil;
}
@@ -218,22 +194,21 @@
Key *k;
char *l, *p;
- init_lock_keys();
+ numlock_mask = numlockmask();
+ valid_mask = 0xff & ~(numlock_mask | LockMask);
while((k = key)) {
key = key->lnext;
ungrabkey(k);
freekey(k);
}
- for(l = p = def.keys; p && *p;) {
+ for(l = p = def.keys; p && *p; p++) {
if(*p == '\n') {
*p = 0;
if((k = getkey(l)))
grabkey(k);
*p = '\n';
- l = ++p;
+ l = p + 1;
}
- else
- p++;
}
if(l < p && strlen(l)) {
if((k = getkey(l)))
diff -r 0b563245988e -r 274c5bf77c98 cmd/wmii/main.c
--- a/cmd/wmii/main.c Fri Jun 11 23:48:29 2010 -0400
+++ b/cmd/wmii/main.c Mon Jun 14 10:30:23 2010 -0400
@@ -92,9 +92,9 @@
setenv("WMII_ADDRESS", address, true);
else
address = smprint("unix!%s/wmii", ns_path);
- setenv("WMII_CONFPATH", sxprint("%s/.wmii%s:%s/wmii%s",
- getenv("HOME"), CONFVERSION,
- CONFPREFIX, CONFVERSION), true);
+ setenv("WMII_CONFPATH",
+ sxprint("%s/.%s:%s", getenv("HOME"), CONFDIR, GLOBALCONF),
+ true);
}
static void
@@ -398,7 +398,7 @@
init_traps();
init_cursors();
- init_lock_keys();
+ update_keys();
ewmh_init();
xext_init();
diff -r 0b563245988e -r 274c5bf77c98 cmd/wmii9menu.c
--- a/cmd/wmii9menu.c Fri Jun 11 23:48:29 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,330 +0,0 @@
-/* Licence
- * =======
- *
- * 9menu is free software, and is Copyright (c) 1994 by David Hogan and
- * Arnold Robbins. Permission is granted to all sentient beings to use
- * this software, to make copies of it, and to distribute those copies,
- * provided that:
- *
- * (1) the copyright and licence notices are left intact
- * (2) the recipients are aware that it is free software
- * (3) any unapproved changes in functionality are either
- * (i) only distributed as patches
- * or (ii) distributed as a new program which is not called 9menu
- * and whose documentation gives credit where it is due
- * (4) the authors are not held responsible for any defects
- * or shortcomings in the software, or damages caused by it.
- *
- * There is no warranty for this software. Have a nice day.
- *
- * --
- * Arnold Robbins
- * arnold_AT_skeeve.com
- *
- * 9menu.c
- *
- * This program puts up a window that is just a menu, and executes
- * commands that correspond to the items selected.
- *
- * Initial idea: Arnold Robbins
- * Version using libXg: Matty Farrow (some ideas borrowed)
- * This code by: David Hogan and Arnold Robbins
- */
-
-/*
- * Heavily modified by Kris Maglione for use with wmii.
- */
-
-#define IXP_NO_P9_
-#define IXP_P9_STRUCTS
-#include <fmt.h>
-#include <ixp.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <stuff/clientutil.h>
-#include <stuff/util.h>
-#include <stuff/x.h>
-
-char version[] = "wmii9menu-"VERSION" "COPYRIGHT", ©1994 David Hogan, Arnold Robbins";
-
-static Window* menuwin;
-
-static CTuple cnorm;
-static CTuple csel;
-static Font* font;
-
-static int wborder;
-
-char buffer[8092];
-char* _buffer;
-
-/* for XSetWMProperties to use */
-int g_argc;
-char **g_argv;
-
-char *initial = "";
-int cur;
-
-static char** labels; /* list of labels and commands */
-static char** commands;
-static int numitems;
-
-void usage(void);
-void run_menu(void);
-void create_window(void);
-void size_window(int, int);
-void redraw(int, int);
-void warpmouse(int, int);
-void memory(void);
-int args(void);
-
-Cursor cursor[1];
-Visual* render_visual;
-
-void init_screens(void);
-void
-init_screens(void) {
- Rectangle *rects;
- Point p;
- int i, n;
-
- rects = xinerama_screens(&n);
- p = querypointer(&scr.root);
- for(i=0; i < n; i++) {
- if(rect_haspoint_p(rects[i], p))
- break;
- }
- if(i == n)
- i = 0;
- scr.rect = rects[i];
-}
-
-/* main --- crack arguments, set up X stuff, run the main menu loop */
-
-int
-main(int argc, char **argv)
-{
- static char *address;
- char *cp;
- int i;
-
- g_argc = argc;
- g_argv = argv;
-
- ARGBEGIN{
- case 'v':
- lprint(1, "%s\n", version);
- return 0;
- case 'a':
- address = EARGF(usage());
- break;
- case 'i':
- initial = EARGF(usage());
- break;
- default:
- usage();
- }ARGEND;
-
- if(argc == 0)
- usage();
-
- initdisplay();
- xext_init();
- init_screens();
- create_window();
-
- numitems = argc;
-
- labels = emalloc(numitems * sizeof *labels);
- commands = emalloc(numitems * sizeof *labels);
-
- for(i = 0; i < numitems; i++) {
- labels[i] = argv[i];
- if((cp = strchr(labels[i], ':')) != nil) {
- *cp++ = '\0';
- commands[i] = cp;
- } else
- commands[i] = labels[i];
- if(strcmp(labels[i], initial) == 0)
- cur = i;
- }
-
- client_init(address);
-
- wborder = strtol(readctl("border "), nil, 10);
- loadcolor(&cnorm, readctl("normcolors "));
- loadcolor(&csel, readctl("focuscolors "));
- font = loadfont(readctl("font "));
- if(!font)
- fatal("Can't load font");
-
- run_menu();
-
- XCloseDisplay(display);
- return 0;
-}
-
-/* usage --- print a usage message and die */
-
-void
-usage(void)
-{
- lprint(2, "usage: %s -v\n", argv0);
- lprint(2, " %s [-a <address>] [-i <arg>] menitem[:command] ...\n", argv0);
- exit(0);
-}
-
-/* run_menu --- put up the window, execute selected commands */
-
-enum {
- MouseMask =
- ButtonPressMask
- | ButtonReleaseMask
- | ButtonMotionMask
- | PointerMotionMask,
- MenuMask =
- MouseMask
- | StructureNotifyMask
- | ExposureMask
-};
-
-void
-run_menu(void)
-{
- XEvent ev;
- int i, old, wide, high;
-
- wide = 0;
- high = labelh(font);
- for(i = 0; i < numitems; i++)
- wide = max(wide, textwidth(font, labels[i]));
- wide += font->height & ~1;
-
- size_window(wide, high);
- warpmouse(wide, high);
-
- for(;;) {
- XNextEvent(display, &ev);
- switch (ev.type) {
- default:
- lprint(2, "%s: unknown ev.type %d\n", argv0, ev.type);
- break;
- case ButtonRelease:
- i = ev.xbutton.y / high;
- if(ev.xbutton.x < 0 || ev.xbutton.x > wide)
- return;
- else if(i < 0 || i >= numitems)
- return;
-
- lprint(1, "%s\n", commands[i]);
- return;
- case ButtonPress:
- case MotionNotify:
- old = cur;
- cur = ev.xbutton.y / high;
- if(ev.xbutton.x < 0 || ev.xbutton.x > wide)
- cur = ~0;
- if(cur == old)
- break;
- redraw(high, wide);
- break;
- case MapNotify:
- redraw(high, wide);
- break;
- case Expose:
- redraw(high, wide);
- break;
- case ConfigureNotify:
- case MappingNotify:
- break;
- }
- }
-}
-
-/* set_wm_hints --- set all the window manager hints */
-
-void
-create_window(void)
-{
- WinAttr wa = { 0 };
- XEvent e;
-
- wa.override_redirect = true;
- menuwin = createwindow(&scr.root, Rect(-1, -1, 0, 0),
- scr.depth, InputOutput,
- &wa, CWOverrideRedirect);
- selectinput(menuwin, MenuMask);
- mapwin(menuwin);
- XMaskEvent(display, StructureNotifyMask, &e);
- if(!grabpointer(menuwin, nil, 0, MouseMask))
- fatal("Failed to grab the mouse\n");
- XSetCommand(display, menuwin->xid, g_argv, g_argc);
-}
-
-void
-size_window(int wide, int high)
-{
- Rectangle r;
- Point p;
- int h;
-
- h = high * numitems;
- r = Rect(0, 0, wide, h);
-
- p = querypointer(&scr.root);
- p.x -= wide / 2;
- p.x = max(p.x, scr.rect.min.x);
- p.x = min(p.x, scr.rect.max.x - wide);
-
- p.y -= cur * high + high / 2;
- p.y = max(p.y, scr.rect.min.y);
- p.y = min(p.y, scr.rect.max.y - h);
-
- reshapewin(menuwin, rectaddpt(r, p));
-
- //XSetWindowBackground(display, menuwin->xid, cnorm.bg);
- setborder(menuwin, 1, cnorm.border);
-}
-
-/* redraw --- actually redraw the menu */
-
-void
-redraw(int high, int wide)
-{
- Rectangle r;
- CTuple *c;
- int i;
-
- r = Rect(0, 0, wide, high);
- for(i = 0; i < numitems; i++) {
- if(cur == i)
- c = &csel;
- else
- c = &cnorm;
- r = rectsetorigin(r, Pt(0, i * high));
- fill(menuwin, r, c->bg);
- drawstring(menuwin, font, r, Center, labels[i], c->fg);
- }
-}
-
-/* warpmouse --- bring the mouse to the menu */
-
-void
-warpmouse(int wide, int high)
-{
- Point p;
- int offset;
-
- /* move tip of pointer into middle of menu item */
- offset = labelh(font) / 2;
- offset += 6; /* fudge factor */
-
- p = Pt(wide / 2, cur*high - high/2 + offset);
- p = addpt(p, menuwin->r.min);
-
- warppointer(p);
-}
-
diff -r 0b563245988e -r 274c5bf77c98 cmd/x11/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmd/x11/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -0,0 +1,18 @@
+ROOT= ../..
+include $(ROOT)/mk/hdr.mk
+include $(ROOT)/mk/wmii.mk
+
+TARG = wikeyname \
+ wmii9menu
+
+PACKAGES += $(X11PACKAGES)
+
+LIB = $(LIBS9) $(LIBIXP)
+LIBS += $(LIB)
+CFLAGS += $(INCX11)
+
+wiclick.out: wiclick.o
+ $(LINK) $@ $< -lXtst
+
+include $(ROOT)/mk/many.mk
+
diff -r 0b563245988e -r 274c5bf77c98 cmd/x11/setfocus.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmd/x11/setfocus.c Mon Jun 14 10:30:23 2010 -0400
@@ -0,0 +1,27 @@
+/* Copyight 2008 Kris Maglione <maglione.k at Gmail>
+ * See LICENSE file for license details.
+ */
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stuff/x.h>
+#include <stuff/util.h>
+#include <fmt.h>
+
+int
+main(int argc, char *argv[]) {
+ XWindow w;
+
+ ARGBEGIN{
+ }ARGEND;
+
+ initdisplay();
+
+ if(!getulong(EARGF(exit(1)), &w))
+ exit(1);
+
+ XSetInputFocus(display, w, RevertToParent, CurrentTime);
+ XCloseDisplay(display);
+}
+
diff -r 0b563245988e -r 274c5bf77c98 cmd/x11/wikeyname.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmd/x11/wikeyname.c Mon Jun 14 10:30:23 2010 -0400
@@ -0,0 +1,72 @@
+/* Copyright ©2010 Kris Maglione <maglione.k at Gmail>
+ * See LICENSE file for license details.
+ */
+#include <stuff/util.h>
+#include <stuff/x.h>
+#include <fmt.h>
+#include <locale.h>
+
+static const char version[] = "wikeyname-"VERSION", "COPYRIGHT"\n";
+
+static Handlers handlers;
+static char* keyname;
+static int nkeys;
+
+static void
+usage(void) {
+ fprint(2, "usage: wikeyname\n");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[]) {
+
+ setlocale(LC_CTYPE, "");
+
+ ARGBEGIN{
+ default: usage();
+ }ARGEND;
+
+ if(argc)
+ usage();
+
+ fmtinstall('K', fmtkey);
+ initdisplay();
+
+ selectinput(&scr.root, KeyPressMask|KeyReleaseMask);
+ sethandler(&scr.root, &handlers);
+ if(!grabkeyboard(&scr.root))
+ fatal("can't grab keyboard\n");
+
+ event_loop();
+ print("%s\n", keyname);
+
+ XCloseDisplay(display);
+ return 0;
+}
+
+static bool
+kdown_event(Window *w, void *aux, XKeyEvent *ev) {
+
+ USED(w, aux);
+ nkeys++;
+ free(keyname);
+ keyname = smprint("%K", ev);
+ return false;
+}
+
+static bool
+kup_event(Window *w, void *aux, XKeyEvent *ev) {
+
+ USED(w, aux, ev);
+ if(keyname != nil && --nkeys <= 0)
+ event_looprunning = false;
+ return false;
+}
+
+
+static Handlers handlers = {
+ .kup = kup_event,
+ .kdown = kdown_event,
+};
+
diff -r 0b563245988e -r 274c5bf77c98 cmd/x11/wiwarp.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmd/x11/wiwarp.c Mon Jun 14 10:30:23 2010 -0400
@@ -0,0 +1,34 @@
+/* Copyight 2008 Kris Maglione <maglione.k at Gmail>
+ * See LICENSE file for license details.
+ */
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stuff/x.h>
+#include <stuff/util.h>
+#include <fmt.h>
+
+int
+main(int argc, char *argv[]) {
+ Point pt;
+
+ ARGBEGIN{
+ }ARGEND;
+
+ initdisplay();
+
+ if(argc) {
+ if(!getint(EARGF(exit(1)), &pt.x))
+ exit(1);
+ if(!getint(EARGF(exit(1)), &pt.y))
+ exit(1);
+ }else {
+ pt = querypointer(&scr.root);
+ lprint(1, "%d %d\n", pt.x, pt.y);
+ }
+
+ warppointer(pt);
+ XCloseDisplay(display);
+}
+
diff -r 0b563245988e -r 274c5bf77c98 cmd/x11/wmii9menu.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmd/x11/wmii9menu.c Mon Jun 14 10:30:23 2010 -0400
@@ -0,0 +1,330 @@
+/* Licence
+ * =======
+ *
+ * 9menu is free software, and is Copyright (c) 1994 by David Hogan and
+ * Arnold Robbins. Permission is granted to all sentient beings to use
+ * this software, to make copies of it, and to distribute those copies,
+ * provided that:
+ *
+ * (1) the copyright and licence notices are left intact
+ * (2) the recipients are aware that it is free software
+ * (3) any unapproved changes in functionality are either
+ * (i) only distributed as patches
+ * or (ii) distributed as a new program which is not called 9menu
+ * and whose documentation gives credit where it is due
+ * (4) the authors are not held responsible for any defects
+ * or shortcomings in the software, or damages caused by it.
+ *
+ * There is no warranty for this software. Have a nice day.
+ *
+ * --
+ * Arnold Robbins
+ * arnold_AT_skeeve.com
+ *
+ * 9menu.c
+ *
+ * This program puts up a window that is just a menu, and executes
+ * commands that correspond to the items selected.
+ *
+ * Initial idea: Arnold Robbins
+ * Version using libXg: Matty Farrow (some ideas borrowed)
+ * This code by: David Hogan and Arnold Robbins
+ */
+
+/*
+ * Heavily modified by Kris Maglione for use with wmii.
+ */
+
+#define IXP_NO_P9_
+#define IXP_P9_STRUCTS
+#include <fmt.h>
+#include <ixp.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <stuff/clientutil.h>
+#include <stuff/util.h>
+#include <stuff/x.h>
+
+char version[] = "wmii9menu-"VERSION" "COPYRIGHT", ©1994 David Hogan, Arnold Robbins";
+
+static Window* menuwin;
+
+static CTuple cnorm;
+static CTuple csel;
+static Font* font;
+
+static int wborder;
+
+char buffer[8092];
+char* _buffer;
+
+/* for XSetWMProperties to use */
+int g_argc;
+char **g_argv;
+
+char *initial = "";
+int cur;
+
+static char** labels; /* list of labels and commands */
+static char** commands;
+static int numitems;
+
+void usage(void);
+void run_menu(void);
+void create_window(void);
+void size_window(int, int);
+void redraw(int, int);
+void warpmouse(int, int);
+void memory(void);
+int args(void);
+
+Cursor cursor[1];
+Visual* render_visual;
+
+void init_screens(void);
+void
+init_screens(void) {
+ Rectangle *rects;
+ Point p;
+ int i, n;
+
+ rects = xinerama_screens(&n);
+ p = querypointer(&scr.root);
+ for(i=0; i < n; i++) {
+ if(rect_haspoint_p(rects[i], p))
+ break;
+ }
+ if(i == n)
+ i = 0;
+ scr.rect = rects[i];
+}
+
+/* main --- crack arguments, set up X stuff, run the main menu loop */
+
+int
+main(int argc, char **argv)
+{
+ static char *address;
+ char *cp;
+ int i;
+
+ g_argc = argc;
+ g_argv = argv;
+
+ ARGBEGIN{
+ case 'v':
+ lprint(1, "%s\n", version);
+ return 0;
+ case 'a':
+ address = EARGF(usage());
+ break;
+ case 'i':
+ initial = EARGF(usage());
+ break;
+ default:
+ usage();
+ }ARGEND;
+
+ if(argc == 0)
+ usage();
+
+ initdisplay();
+ xext_init();
+ init_screens();
+ create_window();
+
+ numitems = argc;
+
+ labels = emalloc(numitems * sizeof *labels);
+ commands = emalloc(numitems * sizeof *labels);
+
+ for(i = 0; i < numitems; i++) {
+ labels[i] = argv[i];
+ if((cp = strchr(labels[i], ':')) != nil) {
+ *cp++ = '\0';
+ commands[i] = cp;
+ } else
+ commands[i] = labels[i];
+ if(strcmp(labels[i], initial) == 0)
+ cur = i;
+ }
+
+ client_init(address);
+
+ wborder = strtol(readctl("border "), nil, 10);
+ loadcolor(&cnorm, readctl("normcolors "));
+ loadcolor(&csel, readctl("focuscolors "));
+ font = loadfont(readctl("font "));
+ if(!font)
+ fatal("Can't load font");
+
+ run_menu();
+
+ XCloseDisplay(display);
+ return 0;
+}
+
+/* usage --- print a usage message and die */
+
+void
+usage(void)
+{
+ lprint(2, "usage: %s -v\n", argv0);
+ lprint(2, " %s [-a <address>] [-i <arg>] menitem[:command] ...\n", argv0);
+ exit(0);
+}
+
+/* run_menu --- put up the window, execute selected commands */
+
+enum {
+ MouseMask =
+ ButtonPressMask
+ | ButtonReleaseMask
+ | ButtonMotionMask
+ | PointerMotionMask,
+ MenuMask =
+ MouseMask
+ | StructureNotifyMask
+ | ExposureMask
+};
+
+void
+run_menu(void)
+{
+ XEvent ev;
+ int i, old, wide, high;
+
+ wide = 0;
+ high = labelh(font);
+ for(i = 0; i < numitems; i++)
+ wide = max(wide, textwidth(font, labels[i]));
+ wide += font->height & ~1;
+
+ size_window(wide, high);
+ warpmouse(wide, high);
+
+ for(;;) {
+ XNextEvent(display, &ev);
+ switch (ev.type) {
+ default:
+ lprint(2, "%s: unknown ev.type %d\n", argv0, ev.type);
+ break;
+ case ButtonRelease:
+ i = ev.xbutton.y / high;
+ if(ev.xbutton.x < 0 || ev.xbutton.x > wide)
+ return;
+ else if(i < 0 || i >= numitems)
+ return;
+
+ lprint(1, "%s\n", commands[i]);
+ return;
+ case ButtonPress:
+ case MotionNotify:
+ old = cur;
+ cur = ev.xbutton.y / high;
+ if(ev.xbutton.x < 0 || ev.xbutton.x > wide)
+ cur = ~0;
+ if(cur == old)
+ break;
+ redraw(high, wide);
+ break;
+ case MapNotify:
+ redraw(high, wide);
+ break;
+ case Expose:
+ redraw(high, wide);
+ break;
+ case ConfigureNotify:
+ case MappingNotify:
+ break;
+ }
+ }
+}
+
+/* set_wm_hints --- set all the window manager hints */
+
+void
+create_window(void)
+{
+ WinAttr wa = { 0 };
+ XEvent e;
+
+ wa.override_redirect = true;
+ menuwin = createwindow(&scr.root, Rect(-1, -1, 0, 0),
+ scr.depth, InputOutput,
+ &wa, CWOverrideRedirect);
+ selectinput(menuwin, MenuMask);
+ mapwin(menuwin);
+ XMaskEvent(display, StructureNotifyMask, &e);
+ if(!grabpointer(menuwin, nil, 0, MouseMask))
+ fatal("Failed to grab the mouse\n");
+ XSetCommand(display, menuwin->xid, g_argv, g_argc);
+}
+
+void
+size_window(int wide, int high)
+{
+ Rectangle r;
+ Point p;
+ int h;
+
+ h = high * numitems;
+ r = Rect(0, 0, wide, h);
+
+ p = querypointer(&scr.root);
+ p.x -= wide / 2;
+ p.x = max(p.x, scr.rect.min.x);
+ p.x = min(p.x, scr.rect.max.x - wide);
+
+ p.y -= cur * high + high / 2;
+ p.y = max(p.y, scr.rect.min.y);
+ p.y = min(p.y, scr.rect.max.y - h);
+
+ reshapewin(menuwin, rectaddpt(r, p));
+
+ //XSetWindowBackground(display, menuwin->xid, cnorm.bg);
+ setborder(menuwin, 1, cnorm.border);
+}
+
+/* redraw --- actually redraw the menu */
+
+void
+redraw(int high, int wide)
+{
+ Rectangle r;
+ CTuple *c;
+ int i;
+
+ r = Rect(0, 0, wide, high);
+ for(i = 0; i < numitems; i++) {
+ if(cur == i)
+ c = &csel;
+ else
+ c = &cnorm;
+ r = rectsetorigin(r, Pt(0, i * high));
+ fill(menuwin, r, c->bg);
+ drawstring(menuwin, font, r, Center, labels[i], c->fg);
+ }
+}
+
+/* warpmouse --- bring the mouse to the menu */
+
+void
+warpmouse(int wide, int high)
+{
+ Point p;
+ int offset;
+
+ /* move tip of pointer into middle of menu item */
+ offset = labelh(font) / 2;
+ offset += 6; /* fudge factor */
+
+ p = Pt(wide / 2, cur*high - high/2 + offset);
+ p = addpt(p, menuwin->r.min);
+
+ warppointer(p);
+}
+
diff -r 0b563245988e -r 274c5bf77c98 debian/copyright
--- a/debian/copyright Fri Jun 11 23:48:29 2010 -0400
+++ b/debian/copyright Mon Jun 14 10:30:23 2010 -0400
@@ -11,18 +11,18 @@
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
+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 or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
-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 OR COPYRIGHT HOLDERS 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
+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 OR COPYRIGHT HOLDERS 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.
Original debian packaging is (C) 2005-2007, Daniel Baumann <daniel_AT_debian.org>
diff -r 0b563245988e -r 274c5bf77c98 doc/wmii.tex
--- a/doc/wmii.tex Fri Jun 11 23:48:29 2010 -0400
+++ b/doc/wmii.tex Mon Jun 14 10:30:23 2010 -0400
@@ -920,7 +920,7 @@
\item[label] The client's window title. May be written to
change the client's title.
\index{filesystem!/client/*/@\clientlabel!label}
- \item[tags]
+ \item[tags]
\index{filesystem!/client/*/@\clientlabel!tags}
The client's tags. Tag names are separated by |+|
signs. Tags beginning and ending with |/| are treated as
@@ -1006,7 +1006,7 @@
in these directories are:
\begin{description}
- \item[ctl]
+ \item[ctl]
The view's control file. The properties are:
\index{filesystem!/tag/*/@\taglabel!ctl|(}
\begin{description}
diff -r 0b563245988e -r 274c5bf77c98 img/wmii.eps
--- a/img/wmii.eps Fri Jun 11 23:48:29 2010 -0400
+++ b/img/wmii.eps Mon Jun 14 10:30:23 2010 -0400
@@ -1,5 +1,5 @@
%!PS-Adobe-2.0 EPSF-1.2
-%%BoundingBox: -1 0 51 27
+%%BoundingBox: -1 0 51 27
%%Creator: MetaPost
%%CreationDate: 2007.02.27:1944
%%Pages: 1
diff -r 0b563245988e -r 274c5bf77c98 include/stuff/x.h
--- a/include/stuff/x.h Fri Jun 11 23:48:29 2010 -0400
+++ b/include/stuff/x.h Mon Jun 14 10:30:23 2010 -0400
@@ -18,6 +18,8 @@
/* printevent.c */
int fmtevent(Fmt*);
+int fmtkey(Fmt*);
+
/* xext.c */
void randr_event(XEvent*);
bool render_argb_p(Visual*);
diff -r 0b563245988e -r 274c5bf77c98 include/stuff/x11.h
--- a/include/stuff/x11.h Fri Jun 11 23:48:29 2010 -0400
+++ b/include/stuff/x11.h Mon Jun 14 10:30:23 2010 -0400
@@ -201,7 +201,7 @@
# pragma varargck type "A" Atom
# pragma varargck type "P" Point
# pragma varargck type "R" Rectangle
-# pragma varargck type "W" Window*
+# pragma varargck type "W" Window*
#endif
Display *display;
@@ -236,10 +236,10 @@
void changeprop_textlist(Window*, const char*, const char*, char*[]);
void changeprop_ulong(Window*, const char*, const char*, ulong[], int);
void changeproperty(Window*, const char*, const char*, int width, const uchar*, int);
+void cleanupwindow(Window*);
void clientmessage(Window*, const char*, long, int, ClientMessageData);
void copyimage(Image*, Rectangle, Image*, Point);
Window* createwindow(Window*, Rectangle, int depth, uint class, WinAttr*, int valuemask);
-void cleanupwindow(Window*);
Window* createwindow_visual(Window*, Rectangle, int depth, Visual*, uint class, WinAttr*, int);
void delproperty(Window*, const char*);
void destroywindow(Window*);
@@ -272,6 +272,7 @@
void lowerwin(Window*);
int mapwin(Window*);
void movewin(Window*, Point);
+int numlockmask(void);
bool parsecolor(const char *name, Color*);
bool parsekey(char*, int*, char**);
ulong pixelvalue(Color);
diff -r 0b563245988e -r 274c5bf77c98 lib/libbio/bcat.c
--- a/lib/libbio/bcat.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libbio/bcat.c Mon Jun 14 10:30:23 2010 -0400
@@ -14,7 +14,7 @@
fprint(2, "writing during %s: %r\n", name);
}
if(n < 0)
- fprint(2, "reading %s: %r\n", name);
+ fprint(2, "reading %s: %r\n", name);
}
int
diff -r 0b563245988e -r 274c5bf77c98 lib/libbio/brdstr.c
--- a/lib/libbio/brdstr.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libbio/brdstr.c Mon Jun 14 10:30:23 2010 -0400
@@ -100,7 +100,7 @@
}
ip += j;
}
-
+
/*
* full buffer without finding; add to user string and continue
*/
diff -r 0b563245988e -r 274c5bf77c98 lib/libbio/bvprint.c
--- a/lib/libbio/bvprint.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libbio/bvprint.c Mon Jun 14 10:30:23 2010 -0400
@@ -1,7 +1,7 @@
#include "plan9.h"
#include <bio.h>
-static int
+static int
fmtBflush(Fmt *f)
{
Biobuf *bp;
diff -r 0b563245988e -r 274c5bf77c98 lib/libfmt/fltfmt.c
--- a/lib/libfmt/fltfmt.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libfmt/fltfmt.c Mon Jun 14 10:30:23 2010 -0400
@@ -35,22 +35,22 @@
*/
static double pows10[] =
{
- 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
- 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
- 1e20, 1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29,
- 1e30, 1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39,
- 1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49,
- 1e50, 1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59,
- 1e60, 1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69,
- 1e70, 1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79,
- 1e80, 1e81, 1e82, 1e83, 1e84, 1e85, 1e86, 1e87, 1e88, 1e89,
- 1e90, 1e91, 1e92, 1e93, 1e94, 1e95, 1e96, 1e97, 1e98, 1e99,
- 1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109,
- 1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119,
- 1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129,
- 1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139,
- 1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149,
- 1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159,
+ 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
+ 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
+ 1e20, 1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29,
+ 1e30, 1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39,
+ 1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49,
+ 1e50, 1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59,
+ 1e60, 1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69,
+ 1e70, 1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79,
+ 1e80, 1e81, 1e82, 1e83, 1e84, 1e85, 1e86, 1e87, 1e88, 1e89,
+ 1e90, 1e91, 1e92, 1e93, 1e94, 1e95, 1e96, 1e97, 1e98, 1e99,
+ 1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109,
+ 1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119,
+ 1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129,
+ 1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139,
+ 1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149,
+ 1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159,
};
#define pow10(x) fmtpow10(x)
diff -r 0b563245988e -r 274c5bf77c98 lib/libfmt/nan64.c
--- a/lib/libfmt/nan64.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libfmt/nan64.c Mon Jun 14 10:30:23 2010 -0400
@@ -1,6 +1,6 @@
/*
* 64-bit IEEE not-a-number routines.
- * This is big/little-endian portable assuming that
+ * This is big/little-endian portable assuming that
* the 64-bit doubles and 64-bit integers have the
* same byte ordering.
*/
diff -r 0b563245988e -r 274c5bf77c98 lib/libfmt/runevsmprint.c
--- a/lib/libfmt/runevsmprint.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libfmt/runevsmprint.c Mon Jun 14 10:30:23 2010 -0400
@@ -12,9 +12,9 @@
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
/*
- * Plan 9 port version must include libc.h in order to
+ * Plan 9 port version must include libc.h in order to
* get Plan 9 debugging malloc, which sometimes returns
- * different pointers than the standard malloc.
+ * different pointers than the standard malloc.
*/
#include <stdlib.h>
#include <string.h>
diff -r 0b563245988e -r 274c5bf77c98 lib/libfmt/vsmprint.c
--- a/lib/libfmt/vsmprint.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libfmt/vsmprint.c Mon Jun 14 10:30:23 2010 -0400
@@ -12,9 +12,9 @@
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
/*
- * Plan 9 port version must include libc.h in order to
+ * Plan 9 port version must include libc.h in order to
* get Plan 9 debugging malloc, which sometimes returns
- * different pointers than the standard malloc.
+ * different pointers than the standard malloc.
*/
#include <stdlib.h>
#include <string.h>
diff -r 0b563245988e -r 274c5bf77c98 lib/libregexp/regcomp.c
--- a/lib/libregexp/regcomp.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libregexp/regcomp.c Mon Jun 14 10:30:23 2010 -0400
@@ -110,7 +110,7 @@
while(*s)
*cp++ = *s++;
*cp++ = c;
- *cp = '\0';
+ *cp = '\0';
rcerror(buf);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libregexp/regsub.c
--- a/lib/libregexp/regsub.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libregexp/regsub.c Mon Jun 14 10:30:23 2010 -0400
@@ -46,7 +46,7 @@
*dp++ = *sp;
break;
}
- }else if(*sp == '&'){
+ }else if(*sp == '&'){
if(mp[0].s.sp != 0 && mp!=0 && ms>0)
if(mp[0].s.sp != 0)
for(ssp = mp[0].s.sp;
diff -r 0b563245988e -r 274c5bf77c98 lib/libregexp/rregsub.c
--- a/lib/libregexp/rregsub.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libregexp/rregsub.c Mon Jun 14 10:30:23 2010 -0400
@@ -46,7 +46,7 @@
*dp++ = *sp;
break;
}
- }else if(*sp == '&'){
+ }else if(*sp == '&'){
if(mp[0].s.rsp != 0 && mp!=0 && ms>0)
if(mp[0].s.rsp != 0)
for(ssp = mp[0].s.rsp;
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/clientmessage.c
--- a/lib/libstuff/event/clientmessage.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/clientmessage.c Mon Jun 14 10:30:23 2010 -0400
@@ -7,6 +7,6 @@
event_clientmessage(XClientMessageEvent *ev) {
Window *w;
- if((w = findwin(ev->window)))
+ if((w = findwin(ev->window)))
event_handle(w, message, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/destroynotify.c
--- a/lib/libstuff/event/destroynotify.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/destroynotify.c Mon Jun 14 10:30:23 2010 -0400
@@ -7,6 +7,6 @@
event_destroynotify(XDestroyWindowEvent *ev) {
Window *w;
- if((w = findwin(ev->window)))
+ if((w = findwin(ev->window)))
event_handle(w, destroy, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/enternotify.c
--- a/lib/libstuff/event/enternotify.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/enternotify.c Mon Jun 14 10:30:23 2010 -0400
@@ -12,6 +12,6 @@
if(ev->mode != NotifyNormal)
return;
- if((w = findwin(ev->window)))
+ if((w = findwin(ev->window)))
event_handle(w, enter, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/expose.c
--- a/lib/libstuff/event/expose.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/expose.c Mon Jun 14 10:30:23 2010 -0400
@@ -7,6 +7,6 @@
event_expose(XExposeEvent *ev) {
Window *w;
- if(ev->count == 0 && (w = findwin(ev->window)))
+ if(ev->count == 0 && (w = findwin(ev->window)))
event_handle(w, expose, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/focusin.c
--- a/lib/libstuff/event/focusin.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/focusin.c Mon Jun 14 10:30:23 2010 -0400
@@ -22,6 +22,6 @@
if((ev->mode == NotifyWhileGrabbed))
return;
- if((w = findwin(ev->window)))
+ if((w = findwin(ev->window)))
event_handle(w, focusin, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/focusout.c
--- a/lib/libstuff/event/focusout.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/focusout.c Mon Jun 14 10:30:23 2010 -0400
@@ -14,6 +14,6 @@
||(ev->detail == NotifyAncestor)))
return;
- if((w = findwin(ev->window)))
+ if((w = findwin(ev->window)))
event_handle(w, focusout, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/leavenotify.c
--- a/lib/libstuff/event/leavenotify.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/leavenotify.c Mon Jun 14 10:30:23 2010 -0400
@@ -9,6 +9,6 @@
if(!ev->send_event)
event_xtime = ev->time;
- if((w = findwin(ev->window)))
+ if((w = findwin(ev->window)))
event_handle(w, leave, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/propertynotify.c
--- a/lib/libstuff/event/propertynotify.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/propertynotify.c Mon Jun 14 10:30:23 2010 -0400
@@ -9,6 +9,6 @@
if(!ev->send_event)
event_xtime = ev->time;
- if((w = findwin(ev->window)))
+ if((w = findwin(ev->window)))
event_handle(w, property, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/selection.c
--- a/lib/libstuff/event/selection.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/selection.c Mon Jun 14 10:30:23 2010 -0400
@@ -9,7 +9,7 @@
if(!ev->send_event)
event_xtime = ev->time;
- if((w = findwin(ev->requestor)))
+ if((w = findwin(ev->requestor)))
event_handle(w, selection, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/selectionclear.c
--- a/lib/libstuff/event/selectionclear.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/selectionclear.c Mon Jun 14 10:30:23 2010 -0400
@@ -9,6 +9,6 @@
if(!ev->send_event)
event_xtime = ev->time;
- if((w = findwin(ev->window)))
+ if((w = findwin(ev->window)))
event_handle(w, selectionclear, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/event/selectionrequest.c
--- a/lib/libstuff/event/selectionrequest.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/event/selectionrequest.c Mon Jun 14 10:30:23 2010 -0400
@@ -9,7 +9,7 @@
if(!ev->send_event)
event_xtime = ev->time;
- if((w = findwin(ev->owner)))
+ if((w = findwin(ev->owner)))
event_handle(w, selectionrequest, ev);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/fmt/fmtbufinit.c
--- a/lib/libstuff/fmt/fmtbufinit.c Fri Jun 11 23:48:29 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-#include "fmtdef.h"
-
-void
-vseprint(Fmt *f, char *buf, char *e) {
- Fmt f;
-
- if(e <= buf)
- return nil;
- f.runes = 0;
- f.start = buf;
- f.to = buf;
- f.stop = e - 1;
- f.flush = 0;
- f.farg = nil;
- f.nfmt = 0;
- va_copy(f.args,args);
- dofmt(&f, fmt);
- va_end(f.args);
- *(char*)f.to = '\0';
- return (char*)f.to;
-}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/map.c
--- a/lib/libstuff/map.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/map.c Mon Jun 14 10:30:23 2010 -0400
@@ -19,7 +19,7 @@
static ulong
hash(const char *str) {
ulong h;
-
+
h = 5381;
while (*str != '\0') {
h += h << 5; /* h *= 33 */
@@ -31,7 +31,7 @@
static void
insert(Map *m, MapEnt **e, ulong val, const char *key) {
MapEnt *te;
-
+
m->nmemb++;
te = emallocz(sizeof *te);
te->hash = val;
@@ -61,7 +61,7 @@
MapEnt **e;
ulong h;
int cmp;
-
+
h = hash(str);
e = map_getp(map, h, create);
if(*e && (*e)->key == nil)
@@ -81,7 +81,7 @@
void**
map_get(Map *map, ulong val, bool create) {
MapEnt *e;
-
+
e = *map_getp(map, val, create);
return e ? &e->val : nil;
}
@@ -89,7 +89,7 @@
void**
hash_get(Map *map, const char *str, bool create) {
MapEnt *e;
-
+
e = *hash_getp(map, str, create);
return e ? &e->val : nil;
}
@@ -98,7 +98,7 @@
map_rm(Map *map, ulong val) {
MapEnt **e, *te;
void *ret;
-
+
ret = nil;
e = map_getp(map, val, 0);
if(*e) {
@@ -115,7 +115,7 @@
hash_rm(Map *map, const char *str) {
MapEnt **e, *te;
void *ret;
-
+
ret = nil;
e = hash_getp(map, str, 0);
if(*e) {
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/printevent.c
--- a/lib/libstuff/printevent.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/printevent.c Mon Jun 14 10:30:23 2010 -0400
@@ -10,11 +10,11 @@
* readable form, Part01/01 Message-ID: <1935_AT_wyse.wyse.com> Date: 22 Dec 88
* 19:28:25 GMT Organization: Wyse Technology, San Jose Lines: 1093 Approved:
* mikew_AT_wyse.com
- *
+ *
* Submitted-by: richsun!darkstar!ken Posting-number: Volume 2, Issue 56
* Archive-name: showevent/part01
- *
- *
+ *
+ *
* There are times during debugging when it would be real useful to be able to
* print the fields of an event in a human readable form. Too many times I
* found myself scrounging around in section 8 of the Xlib manual looking for
@@ -29,13 +29,13 @@
* functions are not complicated, in fact, they are mind-numbingly boring -
* but that's just the point nobody wants to spend the time writing functions
* like this, they just want to have them when they need them.
- *
+ *
* A simple, sample program is included which does little else but to
* demonstrate the use of these two functions. These functions have saved me
* many an hour during debugging and I hope you find some benefit to these.
* If you have any comments, suggestions, improvements, or if you find any
* blithering errors you can get it touch with me at the following location:
- *
+ *
* ken_AT_richsun.UUCP
*/
@@ -931,7 +931,7 @@
int (*fn)(Fmt*, XEvent*);
};
-int
+int
fmtevent(Fmt *fmt) {
XEvent *e;
XAnyEvent *ev;
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/util/estrndup.c
--- a/lib/libstuff/util/estrndup.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/util/estrndup.c Mon Jun 14 10:30:23 2010 -0400
@@ -6,7 +6,7 @@
char*
estrndup(const char *str, uint len) {
char *ret;
-
+
len = min(len, strlen(str));
ret = emalloc(len + 1);
memcpy(ret, str, len);
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/util/getbase.c
--- a/lib/libstuff/util/getbase.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/util/getbase.c Mon Jun 14 10:30:23 2010 -0400
@@ -5,7 +5,7 @@
#include <string.h>
#include <stuff/util.h>
-#define strbcmp(str, const) (strncmp((str), (const), sizeof(const)-1))
+#define strbcmp(str, const) (strncmp((str), (const), sizeof(const)-1))
int
getbase(const char **s, long *sign) {
const char *p;
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/util/strcasestr.c
--- a/lib/libstuff/util/strcasestr.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/util/strcasestr.c Mon Jun 14 10:30:23 2010 -0400
@@ -22,4 +22,4 @@
}
}
return nil;
-}
+}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/util/utflcpy.c
--- a/lib/libstuff/util/utflcpy.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/util/utflcpy.c Mon Jun 14 10:30:23 2010 -0400
@@ -5,7 +5,7 @@
int
utflcpy(char *to, const char *from, int l) {
char *p;
-
+
p = utfecpy(to, to+l, from);
return p-to;
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/convpts.c
--- a/lib/libstuff/x11/convpts.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/convpts.c Mon Jun 14 10:30:23 2010 -0400
@@ -7,7 +7,7 @@
convpts(Point *pt, int np) {
XPoint *rp;
int i;
-
+
rp = emalloc(np * sizeof *rp);
for(i = 0; i < np; i++) {
rp[i].x = pt[i].x;
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/drawing/drawpoly.c
--- a/lib/libstuff/x11/drawing/drawpoly.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/drawing/drawpoly.c Mon Jun 14 10:30:23 2010 -0400
@@ -6,7 +6,7 @@
void
drawpoly(Image *dst, Point *pt, int np, int cap, int w, Color col) {
XPoint *xp;
-
+
xp = convpts(pt, np);
XSetLineAttributes(display, dst->gc, w, LineSolid, cap, JoinMiter);
setgccol(dst, col);
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/errors.c
--- a/lib/libstuff/x11/errors.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/errors.c Mon Jun 14 10:30:23 2010 -0400
@@ -32,11 +32,10 @@
int
traperrors(bool enable) {
-
+
sync();
_trap_errors = enable;
if (enable)
nerrors = 0;
return nerrors;
-
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/initdisplay.c
--- a/lib/libstuff/x11/initdisplay.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/initdisplay.c Mon Jun 14 10:30:23 2010 -0400
@@ -55,16 +55,16 @@
scr.visual32 = DefaultVisual(display, scr.screen);
scr.gc = DefaultGC(display, scr.screen);
scr.depth = DefaultDepth(display, scr.screen);
-
+
scr.white = WhitePixel(display, scr.screen);
scr.black = BlackPixel(display, scr.screen);
-
+
scr.root.xid = RootWindow(display, scr.screen);
scr.root.r = Rect(0, 0,
DisplayWidth(display, scr.screen),
DisplayHeight(display, scr.screen));
scr.rect = scr.root.r;
-
+
scr.root.parent = &scr.root;
windowmap.bucket = wbucket;
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/keys/parsekey.c
--- a/lib/libstuff/x11/keys/parsekey.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/keys/parsekey.c Mon Jun 14 10:30:23 2010 -0400
@@ -3,8 +3,6 @@
*/
#include "../x11.h"
-typedef struct KMask KMask;
-
char *modkey_names[] = {
"Shift",
"",
@@ -41,3 +39,43 @@
else
return i == nkeys;
}
+
+int
+numlockmask(void) {
+ static int masks[] = {
+ ShiftMask, LockMask, ControlMask, Mod1Mask,
+ Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
+ };
+ XModifierKeymap *modmap;
+ KeyCode kcode;
+ int i, max, numlock;
+
+ numlock = 0;
+ modmap = XGetModifierMapping(display);
+ kcode = keycode("Num_Lock");
+ if(kcode && modmap && modmap->max_keypermod > 0) {
+ max = nelem(masks) * modmap->max_keypermod;
+ for(i = 0; i < max && !numlock; i++)
+ if(modmap->modifiermap[i] == kcode)
+ numlock = masks[i / modmap->max_keypermod];
+ }
+ XFreeModifiermap(modmap);
+ return numlock;
+}
+
+int
+fmtkey(Fmt *f) {
+ XKeyEvent *ev;
+ char *key;
+ int nfmt;
+
+ ev = va_arg(f->args, XKeyEvent*);
+ key = XKeysymToString(XKeycodeToKeysym(display, ev->keycode, 0));
+
+ nfmt = f->nfmt;
+ unmask(f, ev->state, modkey_names, '-');
+ if(f->nfmt > nfmt)
+ fmtrune(f, '-');
+ return fmtstrcpy(f, key);
+}
+
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/mouse/grabpointer.c
--- a/lib/libstuff/x11/mouse/grabpointer.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/mouse/grabpointer.c Mon Jun 14 10:30:23 2010 -0400
@@ -6,7 +6,7 @@
int
grabpointer(Window *w, Window *confine, Cursor cur, int mask) {
XWindow cw;
-
+
cw = None;
if(confine)
cw = confine->xid;
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/mouse/pointerscreen.c
--- a/lib/libstuff/x11/mouse/pointerscreen.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/mouse/pointerscreen.c Mon Jun 14 10:30:23 2010 -0400
@@ -9,7 +9,7 @@
Point pt;
uint ui;
int i;
-
+
return XQueryPointer(display, scr.root.xid, &win, &win, &i, &i,
&pt.x, &pt.y, &ui);
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/mouse/querypointer.c
--- a/lib/libstuff/x11/mouse/querypointer.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/mouse/querypointer.c Mon Jun 14 10:30:23 2010 -0400
@@ -9,7 +9,7 @@
Point pt;
uint ui;
int i;
-
+
XQueryPointer(display, w->xid, &win, &win, &i, &i, &pt.x, &pt.y, &ui);
return pt;
}
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/windows/findwin.c
--- a/lib/libstuff/x11/windows/findwin.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/windows/findwin.c Mon Jun 14 10:30:23 2010 -0400
@@ -8,7 +8,7 @@
findwin(XWindow xw) {
Window *w;
void **e;
-
+
e = map_get(&windowmap, (ulong)xw, false);
if(e) {
w = *e;
diff -r 0b563245988e -r 274c5bf77c98 lib/libstuff/x11/xatom.c
--- a/lib/libstuff/x11/xatom.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libstuff/x11/xatom.c Mon Jun 14 10:30:23 2010 -0400
@@ -6,7 +6,7 @@
Atom
xatom(const char *name) {
void **e, **f;
-
+
e = hash_get(&atommap, name, true);
if(*e == nil) {
*e = (void*)XInternAtom(display, name, false);
diff -r 0b563245988e -r 274c5bf77c98 lib/libutf/runestrdup.c
--- a/lib/libutf/runestrdup.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libutf/runestrdup.c Mon Jun 14 10:30:23 2010 -0400
@@ -15,8 +15,8 @@
#include <plan9.h>
Rune*
-runestrdup(const Rune *s)
-{
+runestrdup(const Rune *s)
+{
Rune *ns;
ns = malloc(sizeof(Rune)*(runestrlen(s) + 1));
diff -r 0b563245988e -r 274c5bf77c98 lib/libwmii_hack/x11.c
--- a/lib/libwmii_hack/x11.c Fri Jun 11 23:48:29 2010 -0400
+++ b/lib/libwmii_hack/x11.c Mon Jun 14 10:30:23 2010 -0400
@@ -9,7 +9,7 @@
xatom(Display *display, char *name) {
/* Blech. I don't trust Xlib's cacheing.
MapEnt *e;
-
+
e = hash_get(&amap, name, 1);
if(e->val == nil)
e->val = (void*)XInternAtom(display, name, False);
diff -r 0b563245988e -r 274c5bf77c98 man/wmii.1
--- a/man/wmii.1 Fri Jun 11 23:48:29 2010 -0400
+++ b/man/wmii.1 Mon Jun 14 10:30:23 2010 -0400
@@ -51,7 +51,6 @@
unix!/tmp/ns.\fB$USER\fR.\fB${DISPLAY\fR%.0\fB}\fR/wmii
.fi
-
which opens a unix socket per Plan 9 Port conventions. To
open a TCP socket, listening at port 4332 on the loopback
interface, use:
@@ -60,7 +59,6 @@
tcp!localhost!4332
.fi
-
\fB$WMII_NAMESPACE\fR is automatically set to this value.
.TP
@@ -265,14 +263,12 @@
/\fI<regex>\fR/ -> \fI<width>\fR\fI[+\fI<width>\fR]\fR*
.fi
-
Where,
.nf
\fI<width>\fR := \fI<percent of screen>\fR | \fI<pixels>\fRpx
.fi
-
When a new column, \fI<n>\fR, is created on a view whose name
matches \fI<regex>\fR, it is given the \fI<n>\fRth supplied \fI<width>\fR.
If there is no \fI<n>\fRth width, it is given 1/\fI<ncol>\fRth of the
@@ -290,7 +286,6 @@
/\fI<regex>\fR/ \fI<key>\fR=\fI<value>\fR ...
.fi
-
where each \fI<key>\fR represents a command in the clients \fIctl\fR
file, and each \fI<value>\fR represents the value to assign to it.
The rules are applied when the client is first started and
@@ -405,7 +400,9 @@
changes automatically whenever the window is
moved between the floating and managed layers.
However, setting a value of \fIalways\fR or \fInever\fR
-overrides this behavior.
+overrides this behavior. Additionally, dialogs,
+menus, docks, and splash screens will always
+float unless this value is set to \fInever\fR.
.TP
fullscreen \fI<on | off | toggle>\fR
Sets the client's fullscreen state.
@@ -519,7 +516,6 @@
area ::= \fI<area_spec>\fR | \fI<screen_spec>\fR:\fI<area_spec>\fR
.fi
-
When \fI<screen_spec>\fR is omitted and \fI<area_spec>\fR is not "sel",
0 is assumed. "sel" by itself represents the selected client no
matter which screen it is on.
@@ -528,7 +524,6 @@
area_spec ::= "~" | \fI<number>\fR | "sel"
.fi
-
Where "~" represents the floating area and \fI<number>\fR represents a column
index, starting at one.
@@ -536,7 +531,6 @@
screen_spec ::= \fI<number>\fR
.fi
-
Where \fI<number>\fR representes the 0\-based Xinerama screen number.
.TP
@@ -547,7 +541,6 @@
frame ::= \fI<area>\fR \fI<index>\fR | \fI<area>\fR sel | client \fI<window-id>\fR
.fi
-
Where \fI<index>\fR represents the nth frame of \fI<area>\fR or \fI<window\-id>\fR is
the X11 window id of the given client.
@@ -559,7 +552,6 @@
amount ::= \fI<number>\fR | \fI<number>\fRpx
.fi
-
If "px" is given, \fI<number>\fR is interperated as an exact pixel count.
Otherwise, it's interperated as a "reasonable" amount, which is
usually either the height of a window's title bar, or its sizing
@@ -624,6 +616,7 @@
wimenu(1), wmii9menu(1), witray(1), wmiir(1), wihack(1)
.P
@DOCDIR@/wmii.pdf
+@DOCDIR@/FAQ
.P
\fI[1]\fR http://www.suckless.org/wiki/wmii/tips/9p_tips
diff -r 0b563245988e -r 274c5bf77c98 man/wmii.man1
--- a/man/wmii.man1 Fri Jun 11 23:48:29 2010 -0400
+++ b/man/wmii.man1 Mon Jun 14 10:30:23 2010 -0400
@@ -50,13 +50,11 @@
`<protocol>!<address>`. The default is of the form:
``` unix!/tmp/ns.$USER.${DISPLAY%.0}/wmii
-
which opens a unix socket per Plan 9 Port conventions. To
open a TCP socket, listening at port 4332 on the loopback
interface, use:
``` tcp!localhost!4332
-
$WMII_NAMESPACE is automatically set to this value.
: -r <wmiirc>
@@ -232,11 +230,9 @@
Rules have the form:
``` /<regex>/ -> <width>[+<width>]*
-
Where,
``` <width> := <percent of screen> | <pixels>px
-
When a new column, <n>, is created on a view whose name
matches <regex>, it is given the <n>th supplied <width>.
If there is no <n>th width, it is given 1/<ncol>th of the
@@ -250,7 +246,6 @@
specified as:
``` /<regex>/ <key>=<value> ...
-
where each <key> represents a command in the clients _ctl_
file, and each <value> represents the value to assign to it.
The rules are applied when the client is first started and
@@ -351,7 +346,9 @@
changes automatically whenever the window is
moved between the floating and managed layers.
However, setting a value of _always_ or _never_
- overrides this behavior.
+ overrides this behavior. Additionally, dialogs,
+ menus, docks, and splash screens will always
+ float unless this value is set to _never_.
: fullscreen <on | off | toggle>
Sets the client's fullscreen state.
: group <group id>
@@ -375,7 +372,7 @@
: urgent <on | off | toggle>
Set or unset the client's urgent hint.
<<
-
+
: label
Set or read a client's label (title).
: props
@@ -435,25 +432,21 @@
Selects a column or the floating area.
``` area ::= <area_spec> | <screen_spec>:<area_spec>
-
When <screen_spec> is omitted and <area_spec> is not "sel",
0 is assumed. "sel" by itself represents the selected client no
matter which screen it is on.
``` area_spec ::= "~" | <number> | "sel"
-
Where "~" represents the floating area and <number> represents a column
index, starting at one.
``` screen_spec ::= <number>
-
Where <number> representes the 0-based Xinerama screen number.
: frame
Selects a client window.
``` frame ::= <area> <index> | <area> sel | client <window-id>
-
Where <index> represents the nth frame of <area> or <window-id> is
the X11 window id of the given client.
@@ -461,7 +454,6 @@
The amount to grow or nudge something.
``` amount ::= <number> | <number>px
-
If "px" is given, <number> is interperated as an exact pixel count.
Otherwise, it's interperated as a "reasonable" amount, which is
usually either the height of a window's title bar, or its sizing
@@ -517,6 +509,7 @@
= SEE ALSO =
wimenu(1), wmii9menu(1), witray(1), wmiir(1), wihack(1) +
@DOCDIR@/wmii.pdf
+@DOCDIR@/FAQ
[1] http://www.suckless.org/wiki/wmii/tips/9p_tips +
[2] @DOCDIR@/wmii.pdf
diff -r 0b563245988e -r 274c5bf77c98 mk/lib.mk
--- a/mk/lib.mk Fri Jun 11 23:48:29 2010 -0400
+++ b/mk/lib.mk Mon Jun 14 10:30:23 2010 -0400
@@ -2,7 +2,7 @@
LIB = $(PTARG).a
OFILES = $(OBJ:=.o)
-all: $(HFILES) $(LIB)
+all: $(HFILES) $(LIB)
install: $(PTARG).install
uninstall: $(PTARG).uninstall
diff -r 0b563245988e -r 274c5bf77c98 mk/so.mk
--- a/mk/so.mk Fri Jun 11 23:48:29 2010 -0400
+++ b/mk/so.mk Mon Jun 14 10:30:23 2010 -0400
@@ -3,7 +3,7 @@
SONAME = $(TARG).$(SOEXT)
OFILES_PIC = $(OBJ:=.o_pic)
-all: $(HFILES) $(SO)
+all: $(HFILES) $(SO)
install: $(SOPTARG).install
uninstall: $(SOPTARG).uninstall
diff -r 0b563245988e -r 274c5bf77c98 mk/wmii.mk
--- a/mk/wmii.mk Fri Jun 11 23:48:29 2010 -0400
+++ b/mk/wmii.mk Mon Jun 14 10:30:23 2010 -0400
@@ -1,26 +1,31 @@
VERS = hg$$(hg identify -n)
VERS = $$(test -n "$$WMII_HGVERSION" && echo $$WMII_HGVERSION || \
- hg log -r $$(hg id 2>/dev/null | awk -F'[+ ]' '{print $$1}') --template 'hg{rev}' 2>/dev/null)
+ echo -n "hg$$(hg id -n 2>/dev/null)")
WMII_HGVERSION = $(VERS)
WMII_HGVERSION := $(shell echo $(VERS))
WMII_HGVERSION != echo $(VERS)
VERSION = $(WMII_HGVERSION)
-CONFVERSION = -hg
COPYRIGHT = ©2010 Kris Maglione
+CONFDIR = wmii-hg
+LOCALCONF = ~/.$(CONFDIR)
+GLOBALCONF = $(ETC)/$(CONFDIR)
+
.MAKE.EXPORTED += WMII_HGVERSION
SUBMAKE_EXPORT = WMII_HGVERSION=$(WMII_HGVERSION)
LIBS9 = $(ROOT)/lib/libstuff.a $(ROOT)/lib/libregexp9.a $(ROOT)/lib/libbio.a $(ROOT)/lib/libfmt.a $(ROOT)/lib/libutf.a
CFLAGS += '-DVERSION=\"$(VERSION)\"' '-DCOPYRIGHT=\"$(COPYRIGHT)\"' \
- '-DCONFVERSION=\"$(CONFVERSION)\"' '-DCONFPREFIX=\"$(ETC)\"'
+ '-DCONFDIR=\"$(CONFDIR)\"' '-DCONFPREFIX=\"$(ETC)\"' \
+ '-DLOCALCONF=\"$(LOCALCONF)\"' '-DGLOBALCONF=\"$(GLOBALCONF)\"'
+
FILTER = sed "s|@CONFPREFIX@|$(ETC)|g; \
- s|@GLOBALCONF@|$(ETC)/wmii$(CONFVERSION)|g; \
- s|@LOCALCONF@|~/.wmii$(CONFVERSION)|g; \
- s|@CONFVERSION@|$(CONFVERSION)|g; \
+ s|@GLOBALCONF@|$(GLOBALCONF)|g; \
+ s|@LOCALCONF@|$(LOCALCONF)|g; \
+ s|@CONFDIR@|$(CONFDIR)|g; \
s|@DOCDIR@|$(DOC)|g; \
s|@ALTDOC@|$(DOC)/alternative_wmiircs|g; \
s|@EXAMPLES@|$(DOC)/examples|g; \
diff -r 0b563245988e -r 274c5bf77c98 rc/Makefile
--- a/rc/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ b/rc/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -2,7 +2,7 @@
include $(ROOT)/mk/hdr.mk
include $(ROOT)/mk/wmii.mk
-BIN = $(ETC)/wmii$(CONFVERSION)
+BIN = $(GLOBALCONF)
TARG = wmiirc \
welcome
diff -r 0b563245988e -r 274c5bf77c98 rc/sh.wmii
--- a/rc/sh.wmii Fri Jun 11 23:48:29 2010 -0400
+++ b/rc/sh.wmii Mon Jun 14 10:30:23 2010 -0400
@@ -227,8 +227,8 @@
}
fn actionlist {
- { rescue '*' {} {
- proglist ${hostenv WMII_CONFPATH}
+ { rescue '*' {} {
+ proglist ${hostenv WMII_CONFPATH}
}
getfuns Action
} | sort | uniq
diff -r 0b563245988e -r 274c5bf77c98 test/Makefile
--- a/test/Makefile Fri Jun 11 23:48:29 2010 -0400
+++ b/test/Makefile Mon Jun 14 10:30:23 2010 -0400
@@ -5,7 +5,7 @@
OFILES = ../cmd/util.o \
../cmd/wmii/map.o \
- ../cmd/wmii/x11.o
+ ../cmd/wmii/x11.o
LDFLAGS += $(OFILES) -lfmt -lutf -lbio $(LIBX11) -lXext
CFLAGS += $(INCX11)
diff -r 0b563245988e -r 274c5bf77c98 test/event.b
--- a/test/event.b Fri Jun 11 23:48:29 2010 -0400
+++ b/test/event.b Mon Jun 14 10:30:23 2010 -0400
@@ -66,7 +66,7 @@
fd := open(file, OREAD);
if(fd == nil)
return ("", 0);
-
+
ret := "";
buf := array[512] of byte;
while((n := read(fd, buf, len buf)) > 0)
@@ -115,7 +115,7 @@
}
relist = reverse(relist);
-
+
line: for(;;) {
lin := <-line;
if(lin == nil)
diff -r 0b563245988e -r 274c5bf77c98 util/genconfig
--- a/util/genconfig Fri Jun 11 23:48:29 2010 -0400
+++ b/util/genconfig Mon Jun 14 10:30:23 2010 -0400
@@ -96,7 +96,7 @@
unset val
if [ -z "$def" -o -n "$force" ]; then
echo "$@"
- echo -n "$var[$def]$(equals) "
+ echo -n "$var[$def]$(equals) "
read val
echo
fi
@@ -158,7 +158,7 @@
echo
fi
-prompt INCPATH Search path for include files
+prompt INCPATH Search path for include files
prompt LIBS Libraries to be linked with every executable
prompt CFLAGS Flags for the C compiler
diff -r 0b563245988e -r 274c5bf77c98 util/link
--- a/util/link Fri Jun 11 23:48:29 2010 -0400
+++ b/util/link Mon Jun 14 10:30:23 2010 -0400
@@ -27,9 +27,9 @@
[ -n "$noisycc" ] && echo $LD -o $outfile $ofiles $LDFLAGS $args
$LD -o $outfile $ofiles $LDFLAGS $args >$xtmp 2>&1
status=$?
-[ $? -eq 0 ] || $LD -o $outfile $ofiles $LDFLAGS $args >&2
+[ $status -eq 0 ] || $LD -o $outfile $ofiles $LDFLAGS $args >&2
-sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . |
+sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . |
egrep -v 'is almost always misused|is dangerous, better use|in statically linked applications requires at runtime'
rm -f $xtmp
Received on Mon Jun 14 2010 - 14:30:35 UTC
This archive was generated by hypermail 2.2.0 : Mon Jun 14 2010 - 14:36:04 UTC