about summary refs log tree commit diff
path: root/Completion/X
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-05-03 02:49:38 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-05-03 02:49:38 +0000
commit26785dfe6b5e36e520934585f91aaa44704bba75 (patch)
tree40f0c08763ae2cf9acff5fd2d578fb5ce197f7c8 /Completion/X
parent4bf9b6583911e3c2163dd6317e32e2a0a76dc0ee (diff)
downloadzsh-26785dfe6b5e36e520934585f91aaa44704bba75.tar.gz
zsh-26785dfe6b5e36e520934585f91aaa44704bba75.tar.xz
zsh-26785dfe6b5e36e520934585f91aaa44704bba75.zip
Merge from trunk of files in 21315.
Diffstat (limited to 'Completion/X')
-rw-r--r--Completion/X/Type/_x_cursor18
-rw-r--r--Completion/X/Type/_x_extension19
-rw-r--r--Completion/X/Type/_x_font16
-rw-r--r--Completion/X/Type/_x_keysym22
4 files changed, 75 insertions, 0 deletions
diff --git a/Completion/X/Type/_x_cursor b/Completion/X/Type/_x_cursor
new file mode 100644
index 000000000..466aea0c2
--- /dev/null
+++ b/Completion/X/Type/_x_cursor
@@ -0,0 +1,18 @@
+#autoload
+
+local expl
+
+if (( ! $+_cursor_cache )); then
+  local file
+
+  file=( /usr/{include,{{X11R6,openwin},local{,/X11{,R6}}}/include}/X11/cursorfont.h(N) )
+
+  if (( $#file )); then
+    _cursor_cache=( "${(@)${(@)${(M@)${(@f)$(< $file[1])}:#*XC_*}[2,-1]#* XC_}% *}" )
+  else
+    _cursor_cache=( X_cursor )
+  fi
+fi
+
+_wanted cursors expl 'cursor name' \
+    compadd "$@" -M 'm:-=_ r:|_=*' -a - _cursor_cache
diff --git a/Completion/X/Type/_x_extension b/Completion/X/Type/_x_extension
new file mode 100644
index 000000000..4e410a82b
--- /dev/null
+++ b/Completion/X/Type/_x_extension
@@ -0,0 +1,19 @@
+#autoload
+
+local expl
+
+_tags extensions || return 1
+
+(( $+_xe_cache )) || _xe_cache=( "${(@)${(@f)$(xdpyinfo)}[(r)number of extensions:*,-1][2,(r)default screen number:*][1,-2]//[      ]}" )
+
+if [[ "$1" = -a ]]; then
+  shift
+
+  _wanted extensions expl 'X extension' \
+      compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - all "$_xe_cache[@]"
+else
+  [[ "$1" = - ]] && shift
+
+  _wanted extensions expl 'X extension' \
+      compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' -a - _xe_cache
+fi
diff --git a/Completion/X/Type/_x_font b/Completion/X/Type/_x_font
new file mode 100644
index 000000000..134cfdf1c
--- /dev/null
+++ b/Completion/X/Type/_x_font
@@ -0,0 +1,16 @@
+#autoload
+
+local expl
+
+_tags fonts || return 1
+
+# This *has* to be improved some day...
+
+if (( ! $+_font_cache )); then
+  typeset -gU _font_cache
+
+ _font_cache=( "${(@)^${(@f)$(_call_program fonts xlsfonts)}%%--*}--" )
+fi
+
+_wanted fonts expl font \
+    compadd -M 'r:|-=* r:|=*' "$@" -S '' -a - _font_cache
diff --git a/Completion/X/Type/_x_keysym b/Completion/X/Type/_x_keysym
new file mode 100644
index 000000000..84212e71b
--- /dev/null
+++ b/Completion/X/Type/_x_keysym
@@ -0,0 +1,22 @@
+#autoload
+
+local expl
+
+_tags keysyms || return 1
+
+if (( ! $+_keysym_cache )); then
+  local file
+
+  file=( /usr/{include,{{X11R6,openwin},local{,/X11{,R6}}}/include}/X11/keysymdef.h(N) )
+
+  if (( $#file )); then
+    _keysym_cache=( "${(@)${(@)${(M@)${(@f)$(< $file[1])}:#\#define[ 	]##XK_*}#\#define[ 	]##XK_}%%[ 	]*}" )
+  else
+    _keysym_cache=( BackSpace Tab Linefeed Clear Return Pause Escape 
+                    Delete Left Right Up Down Space Home Begin End
+		    F{1,2,3,4,5,6,7,8,9,10,11,12} )
+  fi
+fi
+
+_wanted keysyms expl 'key symbol' \
+    compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' -a - _keysym_cache