ventriloctrl-0.5-r1

Published: 28.04.2010

patched version of Ventrilo on Wine PTT button controller

Project homepage: such page doesn't exist or I wasn't able to find it.

This is very simple program which is passing defined key code to Ventrilo program running on Wine. This way the user is able to use push to talk button with Ventrilo on Linux. Without it Ventrilo running on wine is aware on keys your are pressing only if the Ventrilo window has focus in system, when it lost focus you loose the abilty to use PTT.

The provided here ebuild installs this helper program along side with the patch I created. I wrote the patch addressing an issue I had. Many ventrilo servers are putting people in AFK status, removing them from current channel if Ventrilo is unable recognize any keys that are being pressed in system. This simple application is passing only one key, and only if you want to talk. If you do not talk at all it's possible (that was my issue) you will be kicked off from channel you ware in to AFK channel. My patch is doing simple thing insted of passing just one event (Capital A keycode) to Ventrilo window when you are using PTT button patched program will send a second key event (Capital B key code) for every event generated by choosen device. That should prevent putting you at AFK channel as long as you are using your device (mouse or keyboard).

View the source of prevent_oss_muting.patch
  1. --- a/ventriloctrl-0.5/ventriloctrl.c 2008-08-23 10:23:03.000000000 +0200
  2. +++ b/ventriloctrl-0.5/ventriloctrl.c 2009-06-20 01:40:40.000000000 +0200
  3. @@ -16,6 +16,7 @@
  4. /* Configuration */
  5. #define SIMULATEKEY XK_A // Simulate Key Press
  6. #define VENTRILO "Ventrilo" // Ventrilo Window Name
  7. +#define OTHERKEY XK_B //Key send to Ventrillo if other key is being pressed
  8.  
  9. /* Global Variables */
  10. Display *display;
  11. @@ -54,14 +55,14 @@
  12. {
  13. // Variables
  14. int i;
  15. -
  16. +
  17. // Get the "Window" Tree
  18. Window root;
  19. Window parent;
  20. Window *children = 0;
  21. unsigned int childrenCount = 0;
  22. XQueryTree(display, parentWindow, &root, &parent, &children, &childrenCount);
  23. -
  24. +
  25. // Crawl the "Window" Tree
  26. char *window_name = 0;
  27. Window *window = 0;
  28. @@ -74,7 +75,7 @@
  29. }
  30. XFree(window_name);
  31. }
  32. -
  33. +
  34. // Crawl the Child and Look For "windowName"
  35. window = find_window(display, children[i], windowName);
  36. if (window != 0) {
  37. @@ -82,10 +83,10 @@
  38. return window;
  39. }
  40. }
  41. -
  42. +
  43. // Free the Children! lol
  44. if (children != 0) XFree(children);
  45. -
  46. +
  47. // Return
  48. return 0;
  49. }
  50. @@ -94,42 +95,43 @@
  51. {
  52. // Usage
  53. printf("\n");
  54. -
  55. +
  56. // Initialize "Display"
  57. display = XOpenDisplay(0);
  58. if (display == NULL) {
  59. printf("Error: Could not open display!\n");
  60. return 1;
  61. }
  62. -
  63. +
  64. // Initialize Root "Window"
  65. window = XDefaultRootWindow(display);
  66. if (!window) {
  67. printf("Error: Could not grab root window!\n");
  68. return 2;
  69. }
  70. -
  71. +
  72. // Initialize Ventrilo "Window"
  73. windowVentrilo = find_window(display, window, VENTRILO);
  74. if (!windowVentrilo) {
  75. printf("Error: Could not find Ventrilo window!\n");
  76. return 3;
  77. }
  78. -
  79. +
  80. // Convert Key String to Number
  81. unsigned int key = atoi(argv[2]);
  82. unsigned int simulatekey = XKeysymToKeycode(display, SIMULATEKEY);
  83. -
  84. + unsigned int otherkey = XKeysymToKeycode(display, OTHERKEY);
  85. +
  86. // Open the Input
  87. int device = open(argv[1], O_RDONLY);
  88. -
  89. +
  90. // Loop
  91. struct input_event ev;
  92. XKeyEvent event;
  93. while (ventrilo_still_running()) {
  94. // Read from the Input
  95. read(device, &ev, sizeof(struct input_event));
  96. -
  97. +
  98. // Check Input
  99. if (ev.type == 1 && ev.code == key) {
  100. // Simulate Key Press/Release
  101. @@ -141,8 +143,18 @@
  102. }
  103. XFlush(display);
  104. }
  105. + else if (ev.type == 1 && ev.code != key) {
  106. + // Send other key (this should prevent putting the user on afk status)
  107. + event = create_key_event(display, *windowVentrilo, window, ev.value, otherkey, 0);
  108. + if (ev.value == 1) {
  109. + XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *) &event);
  110. + } else {
  111. + XSendEvent(event.display, event.window, True, KeyReleaseMask, (XEvent *) &event);
  112. + }
  113. + XFlush(display);
  114. + }
  115. }
  116. -
  117. +
  118. // Return
  119. return 0;
  120. }
  121. @@ -156,20 +168,20 @@
  122. printf("then execute the command listed.\n");
  123. printf("Press Ctrl+C when finished.\n");
  124. printf("\n");
  125. -
  126. +
  127. // Open the Input
  128. int device = open(argv[1], O_RDONLY);
  129. -
  130. +
  131. // Loop
  132. struct input_event ev;
  133. while (1) {
  134. // Read from the Input
  135. read(device, &ev, sizeof(struct input_event));
  136. -
  137. +
  138. // Print the Command
  139. if (ev.type == 1 && ev.value == 1) printf("%s %s %i\n", argv[0], argv[1], ev.code);
  140. }
  141. -
  142. +
  143. // Return
  144. return 0;
  145. }
  146. @@ -180,7 +192,7 @@
  147. // Programs
  148. if(argc == 2) return findkey(argc, argv); // Find Key
  149. if(argc == 3) return ventriloctl(argc, argv); // Ventrilo Ctrl
  150. -
  151. +
  152. // Usage
  153. printf("\n");
  154. printf("Usage: %s <device> [key]\n", argv[0]);
  155. @@ -188,7 +200,7 @@
  156. printf("Running this program without 'key' specified\n");
  157. printf("will run the 'FindKey' sub-program.\n");
  158. printf("\n");
  159. -
  160. +
  161. // Return
  162. return 0;
  163. }

You can access the patch file on my svn server by following this link.

To use this ebuild run following commands in terminal:

echo "=media-sound/ventriloctrl-0.5-r1" >> /etc/portage/package.keywords 
emerge -av =media-sound/ventriloctrl-0.5-r1

View the source of the ebuild
  1. # Copyright 1999-2010 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: $ KardasA
  4.  
  5. EAPI="2"
  6.  
  7. inherit eutils
  8.  
  9. DESCRIPTION="Ventrilo on Wine PTT button controller"
  10. HOMEPAGE=""
  11. SRC_URI="http://www.calebgray.com/uploads/ventriloctrl/${P}.zip"
  12. SLOT="0"
  13. LICENSE="as-is"
  14. RESTRICT="mirror"
  15. KEYWORDS="~amd64 ~x86"
  16. IUSE=""
  17.  
  18. DEPEND=""
  19.  
  20. RDEPEND="${DEPEND}"
  21.  
  22. src_prepare() {
  23. epatch "${FILESDIR}"/prevent_afk.patch
  24. }
  25.  
  26. src_install() {
  27. exeinto /usr/bin
  28. doexe "${PN}"
  29. dodoc README LICENCE
  30. }

Here is the list of all the ventriloctrl ebuild versions that are available in my overlay:



Comments

If you have found something wrong with the information provided above or maybe you just want to speak your mind about it, feel free to leave a comment.
All comments will show up on page after being approved. Sorry for such policy but I want to make sure that my site will be free of abusive or vulgar content. I don't mind being criticized just do it using right words.

Leave a comment