about summary refs log tree commit diff stats
path: root/float.h
diff options
context:
space:
mode:
Diffstat (limited to 'float.h')
-rw-r--r--float.h5
1 files changed, 0 insertions, 5 deletions
diff --git a/float.h b/float.h
deleted file mode 100644
index 6acbe64..0000000
--- a/float.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-
-/* float.c */
-void floating(void);			/* arranges all windows floating */
-void togglemax(const char *arg);	/* toggles maximization of floating client */
>100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
cb23a958d35684b0317'>3ea48208 ^

9506fb8e ^



3ea48208 ^
9506fb8e ^












9506fb8e ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71




                                             
                                        
 


                                                                                   

































                                                                               
                                          
                                  
                                          
                                                         

                                          



                                                                                 
                                         












                                                          


                              
class CommandList():
	def __init__(self):
		self.commandlist = []
		self.paths = {}
		self.dummies_in_paths = False
		self.dummy_object = None

	# We need to know when to clear the keybuffer (when a wrong key is pressed)
	# and when to wait for the rest of the key combination. For "gg" we
	# will assign "g" to a dummy which tells the program not to do the latter.
	def rebuild_paths(self):
		paths = self.paths

		if self.dummies_in_paths:
			self.remove_dummies()
		
		for cmd in self.commandlist:
			for key in cmd.keys:
				path = []
				for path in self.keypath(key):
					try: paths[path]
					except KeyError:
						paths[path] = self.dummy_object

		self.dummies_in_paths = True

	def keypath(self, tup):
		current = []
		all = []
		
		for i in range(len(tup) - 1):
			current.append(tup[i])
			all.append(tuple(current))

		return all

	def remove_dummies(self):
		for k in tuple(paths.keys()):
			if paths[k] == self.dummy_object: del paths[k]
		self.dummies_in_paths = False


	def str_to_tuple(self, obj):
		"""splits a string into a tuple of integers"""
		if isinstance(obj, tuple):
			return obj
		elif isinstance(obj, str):
			return tuple(map(ord, list(obj)))
		elif isinstance(obj, int):
			return (obj, )
		else:
			raise TypeError('need a str or a tuple for str_to_tuple')
	
	def bind(self, fnc, *keys):
		if len(keys) == 0: return
		keys = tuple(map(self.str_to_tuple, keys))
		cmd = Command(fnc, keys)
		cmd.commandlist = self
		self.commandlist.append(cmd)
		for key in keys:
			self.paths[key] = cmd
	
class Command():
	def __init__(self, fnc, keys):
		self.fnc = fnc
		self.keys = keys
		self.commandlist = None

	def execute(self, fm):
		self.fnc(fm)