Subversion Repositories KardasA Overlay

Compare Revisions

Ignore whitespace Rev 34 → Rev 35

/media-sound/ventriloctrl/files/prevent_afk.patch
0,0 → 1,163
--- a/ventriloctrl-0.5/ventriloctrl.c 2008-08-23 10:23:03.000000000 +0200
+++ b/ventriloctrl-0.5/ventriloctrl.c 2009-06-20 01:40:40.000000000 +0200
@@ -16,6 +16,7 @@
/* Configuration */
#define SIMULATEKEY XK_A // Simulate Key Press
#define VENTRILO "Ventrilo" // Ventrilo Window Name
+#define OTHERKEY XK_B //Key send to Ventrillo if other key is being pressed
/* Global Variables */
Display *display;
@@ -54,14 +55,14 @@
{
// Variables
int i;
-
+
// Get the "Window" Tree
Window root;
Window parent;
Window *children = 0;
unsigned int childrenCount = 0;
XQueryTree(display, parentWindow, &root, &parent, &children, &childrenCount);
-
+
// Crawl the "Window" Tree
char *window_name = 0;
Window *window = 0;
@@ -74,7 +75,7 @@
}
XFree(window_name);
}
-
+
// Crawl the Child and Look For "windowName"
window = find_window(display, children[i], windowName);
if (window != 0) {
@@ -82,10 +83,10 @@
return window;
}
}
-
+
// Free the Children! lol
if (children != 0) XFree(children);
-
+
// Return
return 0;
}
@@ -94,42 +95,43 @@
{
// Usage
printf("\n");
-
+
// Initialize "Display"
display = XOpenDisplay(0);
if (display == NULL) {
printf("Error: Could not open display!\n");
return 1;
}
-
+
// Initialize Root "Window"
window = XDefaultRootWindow(display);
if (!window) {
printf("Error: Could not grab root window!\n");
return 2;
}
-
+
// Initialize Ventrilo "Window"
windowVentrilo = find_window(display, window, VENTRILO);
if (!windowVentrilo) {
printf("Error: Could not find Ventrilo window!\n");
return 3;
}
-
+
// Convert Key String to Number
unsigned int key = atoi(argv[2]);
unsigned int simulatekey = XKeysymToKeycode(display, SIMULATEKEY);
-
+ unsigned int otherkey = XKeysymToKeycode(display, OTHERKEY);
+
// Open the Input
int device = open(argv[1], O_RDONLY);
-
+
// Loop
struct input_event ev;
XKeyEvent event;
while (ventrilo_still_running()) {
// Read from the Input
read(device, &ev, sizeof(struct input_event));
-
+
// Check Input
if (ev.type == 1 && ev.code == key) {
// Simulate Key Press/Release
@@ -141,8 +143,18 @@
}
XFlush(display);
}
+ else if (ev.type == 1 && ev.code != key) {
+ // Send other key (this should prevent putting the user on afk status)
+ event = create_key_event(display, *windowVentrilo, window, ev.value, otherkey, 0);
+ if (ev.value == 1) {
+ XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *) &event);
+ } else {
+ XSendEvent(event.display, event.window, True, KeyReleaseMask, (XEvent *) &event);
+ }
+ XFlush(display);
+ }
}
-
+
// Return
return 0;
}
@@ -156,20 +168,20 @@
printf("then execute the command listed.\n");
printf("Press Ctrl+C when finished.\n");
printf("\n");
-
+
// Open the Input
int device = open(argv[1], O_RDONLY);
-
+
// Loop
struct input_event ev;
while (1) {
// Read from the Input
read(device, &ev, sizeof(struct input_event));
-
+
// Print the Command
if (ev.type == 1 && ev.value == 1) printf("%s %s %i\n", argv[0], argv[1], ev.code);
}
-
+
// Return
return 0;
}
@@ -180,7 +192,7 @@
// Programs
if(argc == 2) return findkey(argc, argv); // Find Key
if(argc == 3) return ventriloctl(argc, argv); // Ventrilo Ctrl
-
+
// Usage
printf("\n");
printf("Usage: %s <device> [key]\n", argv[0]);
@@ -188,7 +200,7 @@
printf("Running this program without 'key' specified\n");
printf("will run the 'FindKey' sub-program.\n");
printf("\n");
-
+
// Return
return 0;
}
/media-sound/ventriloctrl/Manifest
0,0 → 1,3
AUX prevent_afk.patch 3612 RMD160 378d8cd7f9c77dc4a0300a68871dce33a5695b43 SHA1 e94c22d9b65e501afe52342c36113419f64cdfdf SHA256 a296e8a3d99d8f0c805e000dfe835d8cb798f1b7597e0efa8097626eab53c0cd
DIST ventriloctrl-0.5.zip 5024 RMD160 f8a1b662069cb5699736777819d08e7ad76beeee SHA1 c0cf873c0a78e2c18f48a625d2d3b8f32b103443 SHA256 abb6b7ee512a4c7dfb74729c61591fed5815a2fc6be5557538e9a0e6e34b8945
EBUILD ventriloctrl-0.5-r1.ebuild 525 RMD160 0b1796830c8004e01b0f0372a050c2af80c25735 SHA1 73bab29088dcad34c53ca80534c93b53f196ccd0 SHA256 1ddb184303a99e215631a882e310371b031ae352041114d4ec6f42f9af4a3eb3
/media-sound/ventriloctrl/ventriloctrl-0.5-r1.ebuild
0,0 → 1,30
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $ KardasA
 
EAPI="2"
 
inherit eutils
 
DESCRIPTION="Ventrilo on Wine PTT button controller"
HOMEPAGE=""
SRC_URI="http://www.calebgray.com/uploads/ventriloctrl/${P}.zip"
SLOT="0"
LICENSE="as-is"
RESTRICT="mirror"
KEYWORDS="~amd64 ~x86"
IUSE=""
 
DEPEND=""
 
RDEPEND="${DEPEND}"
 
src_prepare() {
epatch "${FILESDIR}"/prevent_afk.patch
}
 
src_install() {
exeinto /usr/bin
doexe "${PN}"
dodoc README LICENCE
}