"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "reader.c" between
key-scripter-2.0.tar.xz and key-scripter-2.1.tar.xz

About: Key Scripter listens to key press/release events from a keyboard device and allows sending fake key events to an X display.

reader.c  (key-scripter-2.0.tar.xz):reader.c  (key-scripter-2.1.tar.xz)
skipping to change at line 18 skipping to change at line 18
#include <stdio.h> #include <stdio.h>
#include "scripter.h" #include "scripter.h"
#include "reader.h" #include "reader.h"
bool processKeyEvent(unsigned keyCode, bool pressed); bool processKeyEvent(unsigned keyCode, bool pressed);
bool processMouseButtonEvent(unsigned buttonNumber, bool pressed); bool processMouseButtonEvent(unsigned buttonNumber, bool pressed);
bool processMouseWheelEvent(unsigned clicks, bool forwardRotation); bool processMouseWheelEvent(unsigned clicks, bool forwardRotation);
bool receiveEventsFromStardardInput(); bool receiveEventsFromStardardInput();
char readStandardInputCharacter(); char readStandardInputCharacter();
char character; char inputCharacter;
bool terminated; bool terminated;
#ifndef _WINDOWS #ifndef _WINDOWS
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <termios.h> #include <termios.h>
#include <linux/input.h> #include <linux/input.h>
skipping to change at line 522 skipping to change at line 522
char codePoint[6]; char codePoint[6];
codePoint[0] = 0; codePoint[0] = 0;
unsigned long delay = 0; unsigned long delay = 0;
if (readStandardInputCharacter() == 'U') { if (readStandardInputCharacter() == 'U') {
codePoint[0] = 'U'; codePoint[0] = 'U';
value = 1; value = 1;
while (!characterIsWordSeparator(readStandardInputCharacter())) while (!characterIsWordSeparator(readStandardInputCharacter()))
if (value < sizeof(codePoint) - 1) if (value < sizeof(codePoint) - 1)
codePoint[value++] = character; codePoint[value++] = inputCharacter;
codePoint[value] = 0; codePoint[value] = 0;
} else } else
while (character >= '0' && character <= '9') { while (inputCharacter >= '0' && inputCharacter <= '9') {
value = value * 10 + (character - '0'); value = value * 10 + (inputCharacter - '0');
readStandardInputCharacter(); readStandardInputCharacter();
} }
if (character == '/') if (inputCharacter == '/')
while (readStandardInputCharacter() >= '0' && character <= '9') while (readStandardInputCharacter() >= '0' && inputCharacter <=
delay = delay * 10 + (character - '0'); '9')
delay = delay * 10 + (inputCharacter - '0');
if (value > 0) if (value > 0)
switch (command) { switch (command) {
case 'p': case 'p':
if (value <= MAXIMUM_KEY_CODE) if (value <= MAXIMUM_KEY_CODE)
processKeyPress(value, delay); processKeyPress(value, delay);
break; break;
case 'r': case 'r':
if (value <= MAXIMUM_KEY_CODE) if (value <= MAXIMUM_KEY_CODE)
skipping to change at line 565 skipping to change at line 565
case 's': case 's':
sleepMillis(value); sleepMillis(value);
} }
} else } else
if (command == 'm') { if (command == 'm') {
command = readStandardInputCharacter(); command = readStandardInputCharacter();
if (command == 'p' || command == 'r' || command == 'c' || command == 'w' && ((command = readStandardInputCharacter()) == 'f' || command == 'b')) { if (command == 'p' || command == 'r' || command == 'c' || command == 'w' && ((command = readStandardInputCharacter()) == 'f' || command == 'b')) {
unsigned value = 0; unsigned value = 0;
unsigned long delay = 0; unsigned long delay = 0;
while (readStandardInputCharacter() >= '0' && character <= '9') while (readStandardInputCharacter() >= '0' && inputCharacter <=
value = value * 10 + (character - '0'); '9')
value = value * 10 + (inputCharacter - '0');
if (character == '/') if (inputCharacter == '/')
while (readStandardInputCharacter() >= '0' && character <= ' while (readStandardInputCharacter() >= '0' && inputCharacter
9') <= '9')
delay = delay * 10 + (character - '0'); delay = delay * 10 + (inputCharacter - '0');
if (value > 0) if (value > 0)
switch (command) { switch (command) {
case 'p': case 'p':
if (value <= MAXIMUM_MOUSE_BUTTON) if (value <= MAXIMUM_MOUSE_BUTTON)
processMouseButtonPress(value, delay); processMouseButtonPress(value, delay);
break; break;
case 'r': case 'r':
if (value <= MAXIMUM_MOUSE_BUTTON) if (value <= MAXIMUM_MOUSE_BUTTON)
skipping to change at line 599 skipping to change at line 599
case 'f': case 'f':
processForwardMouseWheelRotation(value, delay); processForwardMouseWheelRotation(value, delay);
break; break;
case 'b': case 'b':
processBackwardMouseWheelRotation(value, delay); processBackwardMouseWheelRotation(value, delay);
} }
} }
} }
while (!characterIsSpace(character)) while (!characterIsSpace(inputCharacter))
readStandardInputCharacter(); readStandardInputCharacter();
} }
return true; return true;
} }
char readStandardInputCharacter() { char readStandardInputCharacter() {
while (true) { while (true) {
char buffer[1]; char buffer[1];
int result = read(STDIN_FILENO, buffer, 1); int result = read(STDIN_FILENO, buffer, 1);
if (result == 1) if (result == 1)
return character = buffer[0]; return inputCharacter = buffer[0];
sleepMillis(1); sleepMillis(1);
} }
} }
 End of changes. 8 change blocks. 
15 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)