ventriloctrl-0.5-r1

Opublikowany: 28.04.2010

spatczowana wersja kontrolera PTT dla Ventrilo na Wine

Strona projektu: taka strona nie istnieje lub nie udało mi się jej znaleźć.

To jest bardzo prosty program, który przekazuje zdefiniowane kody klawiszy do okna programu Ventrilo działającego pod Wine. Dzięki temu użytkownik może używać przycisku PTT (wciśnij aby mówić) z programem Ventrilo na Linuxie. Bez tego programu Ventrilo działające pod wine ma świadomość tego, że wciskasz klawisze tylko jeśli okno programu Ventrilo ma fokus w systemie, kiedy traci fokus ty tracisz możliwość używanie funkcji PTT.

Dostępny tutaj ebuild instaluje ten program pomocniczy wraz z patczem, który stworzyłem. Napisałem patcz, który rozwiązuje problem jaki napotkałem. Wiele serwerów ventrilo przełącza użytkowników do statusu AFK, usuwając ich z kanału, w którym byli. Jeśli Ventrilo nie może rozpoznać generowanych w systemie zdarzeń dla urządzeń wejściowych. Ta prosta aplikacja przekazuje tylko jeden kod klawisza i robi to tylko jeśli chcesz mówić. Jeśli nie mówisz wcale, jest możliwe (i to był mój problem), że zostaniesz wyrzucony z kanału, w którym aktualnie jesteś i przełączony do kanału AFK (z dala od klawiatury). Mój patch zmienia jedną rzecz, zamiast przekazywać tylko jedno zdarzenie (kod klawisza duże A) do okna ventrilo, kiedy użytkownik wciska wybrany klawisz PTT, spatczowany program wyśle drugie zdarzenie (kod klawisza duże B) dla każdego zdarzenia wygenerowanego przez wybrane urządzenie. To powinno wykluczyć przełączanie cię do kanału AFK tak długo jak długo używasz urządzenia wejściowego (myszy lub klawiatury).

View the source of prevent_afk.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. }

Możesz uzyskać dostęp do pliku z patchem na moim serwerze svn podążając za tym linkiem.

Aby wykorzystać ten ebuild wykonaj następujące polecenia w terminalu:

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

Wyświetl kod źródłowy ebuilda
  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. }

Oto lista wszystkich wersji ebuilda ventriloctrl jakie możesz znaleźć w moim overlay'u:



Komentarze

Jeśli znalazłeś jakieś błędy w powyższej informacji lub po prostu chcesz wypowiedzieć swoje zdanie na jej temat, będę wdzięczny za pozostawienie komentarza.
Wszystkie komentarze będą pokazywać się na stronie po tym jak zostaną zatwierdzone. Przepraszam za to ale chcę mieć pewność, że moja strona będzie wolna od obraźliwych lub wulgarnych treści. Nie mam nic przeciwko krytyce ale zrób to właściwie dobierając słowa.

Pozostaw komentarz