Exemplo n.º 1
0
void sendChar(u8 chr)
{
  keyboardBuffer[0]=0;
	keyboardBuffer[3]=0;
		
	if (chr>='A'&&chr<='Z')
	{
		keyboardBuffer[0]=MOD_SHIFT_LEFT;
		keyboardBuffer[3]=chr-61;
	}
	else if (chr>='a'&&chr<='z')
	{
		keyboardBuffer[3]=chr-93;
	}
	else if (chr>='0'&&chr<='9')
	{
		if (chr=='0')
		  keyboardBuffer[3]=39;
		else
		  keyboardBuffer[3]=chr-19;
	}
  else if (chr== ' ')
  {
    keyboardBuffer[3] = KEY_SPACE;
  }
  sendKeys(keyboardBuffer);

  keyboardBuffer[0]=0;
  keyboardBuffer[3]=0;
	
  sendKeys(keyboardBuffer);

}
Exemplo n.º 2
0
void sendTab (void)
{
  keyboardBuffer[3] = KEY_TAB;
  sendKeys(keyboardBuffer);

  keyboardBuffer[0]=0;
  keyboardBuffer[3]=0;
  sendKeys(keyboardBuffer);
}
Exemplo n.º 3
0
void sendEnter()
{
  keyboardBuffer[3]=KEY_RETURN;
  sendKeys(keyboardBuffer);

  keyboardBuffer[0]=0;
  keyboardBuffer[3]=0;
  sendKeys(keyboardBuffer);
}
Exemplo n.º 4
0
int main(int argc, char** argv) {
	int n, fd;
        long dec, enc; 
        struct Arguments args;
	pthread_t readThread, writeThread;
        long a, b; // two prime numbers
	if(argc < 5) {
	   printf("file portNum hostName prime1 prime2\n");
	   exit(0);
	}
        a = atoi(argv[3]) + 6;
        b = atoi(argv[4]) + 6; 
        generatePrimeNumbers(&a, &b);
        generateKeys(a, b, &args.my_e, &args.my_d, &args.my_c);
        args.run = 1;  
	
        fd = connectTo(argv[2], atoi(argv[1]));
        args.connfd = fd;
        sendKeys(&args);
        receiveKeys(&args);
        
        pthread_create(&readThread, NULL, readData, &args);
        pthread_create(&writeThread, NULL, writeData, &args);
        pthread_join(readThread, NULL);
        pthread_cancel(writeThread);
	close(fd);
}
Exemplo n.º 5
0
static void dokey(rfbBool down, rfbKeySym key, rfbClientPtr cl)
{
    //if(down)
    //{
        sendKeys((int)key, (bool)down);
    //}
    return;
}
Exemplo n.º 6
0
/* void SendKeys (in nsISupports aNode, in wstring value); */
NS_IMETHODIMP nsNativeEvents::SendKeys(nsISupports *aNode, const PRUnichar *value)
{
	AccessibleDocumentWrapper doc(aNode);

	void* windowHandle = doc.getWindowHandle();

	if (!windowHandle) {
		return NS_ERROR_NULL_POINTER;
	}

	sendKeys(windowHandle, value, 0);

	return NS_OK;
}
Exemplo n.º 7
0
/* void SendKeys (in nsISupports aNode, in wstring value); */
NS_IMETHODIMP nsNativeEvents::SendKeys(nsISupports *aNode,
                                       const PRUnichar *value)
{
	nsCOMPtr<nsIConsoleService> aConsoleService =
    do_GetService( "@mozilla.org/consoleservice;1" );
	
	aConsoleService->LogStringMessage(NS_LITERAL_STRING( "Starting to send keys. First of all, process the node").get());

        LOG(DEBUG) << "---------- Got to start of callback. aNode: " << aNode
                   << " ----------";
        NS_LossyConvertUTF16toASCII ascii_keys(value);
        LOG(DEBUG) << "Ascii keys: " << ascii_keys.get();
        LOG(DEBUG) << "Ascii string length: " << strlen(ascii_keys.get());
        int i = 0;
        while (value[i] != '\0') {
          LOG(DEBUG) << value[i] << " ";
          i++;
        }

		WINDOW_HANDLE windowHandle = aNode;
//		if (aNode) {
//			AccessibleDocumentWrapper doc(aNode);
//
//			WINDOW_HANDLE windowHandle = doc.getWindowHandle();
//
//			if (!windowHandle) {
//				LOG(WARN) << "Sorry, window handle is null.";
//				return NS_ERROR_NULL_POINTER;
//			}
//		}
	
        // Note that it's OK to send wchar_t even though wchar_t is *usually*
        // 32 bit, because this code (and any code that links with it) *MUST*
        // be compiled with -fshort-wchar, so it's actually 16 bit and,
        // incidentally, just like PRUnichar. This, of course, breaks any
        // library function that uses wchar_t.
#ifdef BUILD_ON_UNIX
        assert(sizeof(PRUnichar) == sizeof(wchar_t));
        const wchar_t* valuePtr = (const wchar_t*) value;
#else
        const PRUnichar* valuePtr = value;
#endif
        sendKeys(windowHandle, valuePtr, 0);

        LOG(DEBUG) << "Sent keys sucessfully.";

        return NS_OK;
}
/* void SendKeys (in nsISupports aNode, in wstring value); */
NS_IMETHODIMP nsNativeKeyboard::SendKeys(nsISupports *aNode,
    const PRUnichar *value,
    bool releaseModifiers)
{
  LOG(DEBUG) << "---------- Got to start of callback. aNode: " << aNode
    << " ----------";
  NS_LossyConvertUTF16toASCII ascii_keys(value);
  LOG(DEBUG) << "Ascii keys: " << ascii_keys.get();
  LOG(DEBUG) << "Ascii string length: " << strlen(ascii_keys.get());
  int i = 0;
  while (value[i] != '\0') {
    LOG(DEBUG) << value[i] << " ";
    i++;
  }

  AccessibleDocumentWrapper doc(aNode);

  WINDOW_HANDLE windowHandle = doc.getWindowHandle();

  if (!windowHandle) {
    LOG(WARN) << "Sorry, window handle is null.";
    return NS_ERROR_NULL_POINTER;
  }

  // Note that it's OK to send wchar_t even though wchar_t is *usually*
  // 32 bit, because this code (and any code that links with it) *MUST*
  // be compiled with -fshort-wchar, so it's actually 16 bit and,
  // incidentally, just like PRUnichar. This, of course, breaks any
  // library function that uses wchar_t.
#ifdef BUILD_ON_UNIX
  assert(sizeof(PRUnichar) == sizeof(wchar_t));
  const wchar_t* valuePtr = (const wchar_t*) value;
#else
  const PRUnichar* valuePtr = value;
#endif
  sendKeys(windowHandle, valuePtr, 0);

  if (releaseModifiers) {
    LOG(DEBUG) << "Also releasing modifiers.";
    releaseModifierKeys(windowHandle, 0);
  }

  LOG(DEBUG) << "Sent keys sucessfully.";

  return NS_OK;
}
Exemplo n.º 9
0
void EIOS_SendString(Target t, char* str, int keywait, int keymodwait) {
    sendKeys(str,keywait,keymodwait);
}
Exemplo n.º 10
0
void MainWindow::keysNeeded()
{
  emit sendKeys(new KeyPressedFrame(keystate)) ;
}
Exemplo n.º 11
0
int main(void) {
	acInit();
	gfxInitDefault();
	
	gfxSetDoubleBuffering(GFX_TOP, false);
	gfxSetDoubleBuffering(GFX_BOTTOM, false);
	
	if(setjmp(exitJmp)) goto exit;
	
	preRenderKeyboard();
	
	clearScreen();
	drawString(10, 10, "Initing FS...");
	gfxFlushBuffers();
	gfxSwapBuffers();
	
	fsInit();
	
	clearScreen();
	drawString(10, 10, "Initing SOC...");
	gfxFlushBuffers();
	gfxSwapBuffers();
	
	SOC_Initialize((u32 *)memalign(0x1000, 0x100000), 0x100000);
	
	u32 wifiStatus = 0;
	ACU_GetWifiStatus(NULL, &wifiStatus);
	if(!wifiStatus) {
		hang("No WiFi! Is your wireless slider on?");
	}
	
	clearScreen();
	drawString(10, 10, "Reading settings...");
	gfxFlushBuffers();
	gfxSwapBuffers();
	
	if(!readSettings()) {
		hang("Could not read 3DSController.ini!");
	}
	
	clearScreen();
	drawString(10, 10, "Connecting to %s on port %d...", settings.IPString, settings.port);
	gfxFlushBuffers();
	gfxSwapBuffers();
	
	openSocket(settings.port);
	sendConnectionRequest();
	
	clearScreen();
	gfxFlushBuffers();
	gfxSwapBuffers();
	
	disableBacklight();
	
	while(aptMainLoop()) {
		hidScanInput();
		irrstScanInput();
		
		u32 kHeld = hidKeysHeld();
		circlePosition circlePad;
		circlePosition cStick;
		hidCstickRead(&cStick);
		hidCircleRead(&circlePad);
		touchPosition touch;
		touchRead(&touch);
		
		clearScreen();
		
		if((kHeld & KEY_L) && (kHeld & KEY_R) && (kHeld & KEY_X)) {
			if(keyboardToggle) {
				keyboardActive = !keyboardActive;
				keyboardToggle = false;
				
				if(keyboardActive) enableBacklight();
			}
		}
		else keyboardToggle = true;
		
		if(keyboardActive) {
			drawKeyboard();
			
			if(touch.px >= 1 && touch.px <= 312 && touch.py >= 78 && touch.py <= 208) {
				int x = (int)((float)touch.px * 12.0f / 320.0f);
				int y = (int)((float)(touch.py - 78) * 12.0f / 320.0f);
				int width = 24;
				int height = 24;
				
				if(keyboardChars[x + y * 12] == ' ') {
					while(keyboardChars[(x - 1) + y * 12] == ' ') x--;
					
					width = (int)(5.0f * 320.0f / 12.0f) - 1;
				}
				
				else if(keyboardChars[x + y * 12] == '\13') {
					while(keyboardChars[(x - 1) + y * 12] == '\13') x--;
					while(keyboardChars[x + (y - 1) * 12] == '\13') y--;
					
					width = (int)(2.0f * 320.0f / 12.0f) - 1;
					height = (int)(3.0f * 320.0f / 12.0f) - 1;
				}
				
				if(keyboardChars[x + y * 12]) drawBox((int)((float)x * 320.0f / 12.0f) + 1, (int)(78.0f + (float)y * 320.0f / 12.0f) + 1, width, height, 31, 31, 0);
			}
		}
		
		sendKeys(kHeld, circlePad, touch, cStick);
		
		//receiveBuffer(sizeof(struct packet));
		
		if((kHeld & KEY_START) && (kHeld & KEY_SELECT)) longjmp(exitJmp, 1);
		
		gfxFlushBuffers();
		gspWaitForVBlank();
		gfxSwapBuffers();
	}
	
	exit:
	
	enableBacklight();
	
	SOC_Shutdown();
	
	svcCloseHandle(fileHandle);
	fsExit();
	
	gfxExit();
	acExit();
	
	return 0;
}