about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config.arg.h2
-rw-r--r--config.default.h2
-rw-r--r--dwm.116
-rw-r--r--dwm.h2
-rw-r--r--event.c32
-rw-r--r--tag.c20
6 files changed, 9 insertions, 65 deletions
diff --git a/config.arg.h b/config.arg.h
index c6cb717..17215fb 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -22,10 +22,8 @@ static Key key[] = { \
 	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
 	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
 	{ MODKEY,			XK_3,		view,		{ .i = 2 } }, \
-	{ MODKEY,			XK_h,		viewprev,	{ 0 } }, \
 	{ MODKEY,			XK_j,		focusnext,	{ 0 } }, \
 	{ MODKEY,			XK_k,		focusprev,	{ 0 } }, \
-	{ MODKEY,			XK_l,		viewnext,	{ 0 } }, \
 	{ MODKEY,			XK_m,		togglemax,	{ 0 } }, \
 	{ MODKEY,			XK_p,		spawn, \
 		{ .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null | " \
diff --git a/config.default.h b/config.default.h
index 53b91eb..6a6fb4d 100644
--- a/config.default.h
+++ b/config.default.h
@@ -24,10 +24,8 @@ static Key key[] = { \
 	{ MODKEY,			XK_2,		view,		{ .i = 2 } }, \
 	{ MODKEY,			XK_3,		view,		{ .i = 3 } }, \
 	{ MODKEY,			XK_4,		view,		{ .i = 4 } }, \
-	{ MODKEY,			XK_h,		viewprev,	{ 0 } }, \
 	{ MODKEY,			XK_j,		focusnext,	{ 0 } }, \
 	{ MODKEY,			XK_k,		focusprev,	{ 0 } }, \
-	{ MODKEY,			XK_l,		viewnext,	{ 0 } }, \
 	{ MODKEY,			XK_m,		togglemax,	{ 0 } }, \
 	{ MODKEY,			XK_space,	togglemode,	{ 0 } }, \
 	{ MODKEY,			XK_Return,	zoom,		{ 0 } }, \
diff --git a/dwm.1 b/dwm.1
index da7d6eb..38c50b5 100644
--- a/dwm.1
+++ b/dwm.1
@@ -43,14 +43,6 @@ click on a tag label focuses that
 .B Button2
 click on a tag label toggles that
 .B tag.
-.TP
-.B Button[1,4]
-click on the bar focuses the previous
-.B tag.
-.TP
-.B Button[2,5]
-click on the bar focuses the next
-.B tag.
 .SS Keyboard commands
 .TP
 .B Mod1-Return
@@ -60,10 +52,6 @@ to the
 .B master
 column.
 .TP
-.B Mod1-h
-Focus previous
-.B tag.
-.TP
 .B Mod1-j
 Focus next
 .B window.
@@ -72,10 +60,6 @@ Focus next
 Focus previous
 .B window.
 .TP
-.B Mod1-l
-Focus next
-.B tag.
-.TP
 .B Mod1-m
 Maximize current
 .B window.
diff --git a/dwm.h b/dwm.h
index 8a17368..f9b06d2 100644
--- a/dwm.h
+++ b/dwm.h
@@ -129,8 +129,6 @@ extern void settags(Client *c);
 extern void togglemode(Arg *arg);
 extern void view(Arg *arg);
 extern void toggleview(Arg *arg);
-extern void viewnext(Arg *arg);
-extern void viewprev(Arg *arg);
 
 /* util.c */
 extern void *emallocz(unsigned int size);
diff --git a/event.c b/event.c
index 9da7ac4..bc7d42c 100644
--- a/event.c
+++ b/event.c
@@ -102,30 +102,16 @@ buttonpress(XEvent *e)
 	XButtonPressedEvent *ev = &e->xbutton;
 
 	if(barwin == ev->window) {
-		switch(ev->button) {
-		default:
-			x = 0;
-			for(a.i = 0; a.i < ntags; a.i++) {
-				x += textw(tags[a.i]);
-				if(ev->x < x) {
-					if(ev->button == Button3)
-						toggleview(&a);
-					else
-						view(&a);
-					return;
-				}
+		x = 0;
+		for(a.i = 0; a.i < ntags; a.i++) {
+			x += textw(tags[a.i]);
+			if(ev->x < x) {
+				if(ev->button == Button3)
+					toggleview(&a);
+				else
+					view(&a);
+				return;
 			}
-			if(ev->button == Button1)
-				viewprev(&a);
-			else if(ev->button == Button3)
-				viewnext(&a);
-			break;
-		case Button4:
-			viewprev(&a);
-			break;
-		case Button5:
-			viewnext(&a);
-			break;
 		}
 	}
 	else if((c = getclient(ev->window))) {
diff --git a/tag.c b/tag.c
index 9904dd1..d27d91a 100644
--- a/tag.c
+++ b/tag.c
@@ -263,23 +263,3 @@ toggleview(Arg *arg)
 	arrange(NULL);
 	drawall();
 }
-
-void
-viewnext(Arg *arg)
-{
-	unsigned int i;
-
-	for(i = 0; !seltag[i]; i++);
-	arg->i = (i < ntags-1) ? i+1 : 0;
-	view(arg);
-}
-
-void
-viewprev(Arg *arg)
-{
-	unsigned int i;
-
-	for(i = 0; !seltag[i]; i++);
-	arg->i = (i > 0) ? i-1 : ntags-1;
-	view(arg);
-}
:(after "Types") // A program is a book of 'recipes' (functions) typedef int recipe_number; :(before "End Globals") unordered_map<string, recipe_number> Recipe_number; unordered_map<recipe_number, recipe> Recipe; int Next_recipe_number = 1; :(before "End Types") // Recipes are lists of instructions. To run a recipe, the computer runs its // instructions. struct recipe { string name; vector<instruction> steps; // End Recipe Fields }; :(before "struct recipe") // Each instruction is either of the form: // product1, product2, product3, ... <- operation ingredient1, ingredient2, ingredient3, ... // or just a single 'label' followed by a colon // label: // Labels don't do anything, they're just waypoints. struct instruction { bool is_label; string label; // only if is_label string name; // only if !is_label recipe_number operation; // Recipe_number[name] vector<reagent> ingredients; // only if !is_label vector<reagent> products; // only if !is_label instruction(); void clear(); }; :(before "struct instruction") // Ingredients and products are a single species -- a reagent. Reagents refer // either to numbers or to locations in memory along with 'type' tags telling // us how to interpret them. They also can contain arbitrary other lists of // properties besides types, but we're getting ahead of ourselves. struct reagent { vector<pair<string, vector<string> > > properties; string name; int value; bool initialized; vector<type_number> types; reagent(string s); reagent(); void set_value(int v) { value = v; initialized = true; } string to_string(); }; :(before "struct reagent") struct property { vector<string> values; }; :(before "End Globals") // Locations refer to a common 'memory'. Each location can store a number. unordered_map<int, int> Memory; :(before "End Setup") Memory.clear(); :(after "Types") // Mu types encode how the numbers stored in different parts of memory are // interpreted. A location tagged as a 'character' type will interpret the // number 97 as the letter 'a', while a different location of type 'integer' // would not. // // Unlike most computers today, mu stores types in a single big table, shared // by all the mu programs on the computer. This is useful in providing a // seamless experience to help understand arbitrary mu programs. typedef int type_number; :(before "End Globals") unordered_map<string, type_number> Type_number; unordered_map<type_number, type_info> Type; int Next_type_number = 1; :(code) void setup_types() { Type.clear(); Type_number.clear(); Type_number["literal"] = 0; Type_number["offset"] = 0; Next_type_number = 1; // Mu Types Initialization. int integer = Type_number["integer"] = Next_type_number++; Type[integer].name = "integer"; int address = Type_number["address"] = Next_type_number++; Type[address].name = "address"; int boolean = Type_number["boolean"] = Next_type_number++; Type[boolean].name = "boolean"; // End Mu Types Initialization. } :(before "End Setup") setup_types(); :(before "End Types") // You can construct arbitrary new types. Types are either 'records', containing // 'fields' of other types, or 'array's of a single type repeated over and over. // // For example: // storing bank balance next to a person's name might require a record, and // high scores in a game might need an array of numbers. struct type_info { string name; bool is_record; bool is_array; size_t size; // only if is_record vector<vector<type_number> > elements; // only if is_record vector<string> element_names; // only if is_record vector<type_number> element; // only if is_array // End type_info Fields. type_info() :is_record(false), is_array(false), size(0) {} }; :(before "End Globals") const int IDLE = 0; // always the first entry in the recipe book const int COPY = 1; :(code) // It's all very well to construct recipes out of other recipes, but we need // to know how to do *something* out of the box. For the following // recipes there are only codes, no entries in the book, because mu just knows // what to do for them. void setup_recipes() { Recipe.clear(); Recipe_number.clear(); Next_recipe_number = 0; Recipe_number["idle"] = IDLE; assert(Next_recipe_number == IDLE); Next_recipe_number++; // Primitive Recipe Numbers. Recipe_number["copy"] = COPY; assert(Next_recipe_number == COPY); Next_recipe_number++; // End Primitive Recipe Numbers. } :(before "End Setup") setup_recipes(); //: Helpers :(code) // indent members to avoid generating prototypes for them instruction::instruction() :is_label(false), operation(IDLE) {} void instruction::clear() { is_label=false; label.clear(); operation=IDLE; ingredients.clear(); products.clear(); } // Reagents have the form <name>:<type>:<type>:.../<property>/<property>/... reagent::reagent(string s) :value(0), initialized(false) { istringstream in(s); // properties while (!in.eof()) { istringstream row(slurp_until(in, '/')); string name = slurp_until(row, ':'); vector<string> values; while (!row.eof()) values.push_back(slurp_until(row, ':')); properties.push_back(pair<string, vector<string> >(name, values)); } // structures for the first row of properties name = properties[0].first; for (size_t i = 0; i < properties[0].second.size(); ++i) { types.push_back(Type_number[properties[0].second[i]]); } } reagent::reagent() :value(0), initialized(false) {} string reagent::to_string() { ostringstream out; out << "{name: \"" << name << "\", value: " << value << ", type: "; for (size_t i = 0; i < types.size(); ++i) { out << types[i]; if (i < types.size()-1) out << "-"; } if (!properties.empty()) { out << ", properties: ["; for (size_t i = 0; i < properties.size(); ++i) { out << properties[i].first << ": "; for (size_t j = 0; j < properties[i].second.size(); ++j) { out << properties[i].second[j]; if (j < properties[i].second.size()-1) out << ":"; } if (i < properties.size()-1) out << ", "; else out << "]"; } } out << "}"; return out.str(); } string slurp_until(istream& in, char delim) { ostringstream out; char c; while (in >> c) { if (c == delim) { // drop the delim break; } out << c; } return out.str(); } void dump_memory() { for (unordered_map<int, int>::iterator p = Memory.begin(); p != Memory.end(); ++p) { cout << p->first << ": " << p->second << '\n'; } }