Changeset 55:fa05d8dd30a2 in xplra
- Timestamp:
- 02/16/13 18:14:55 (12 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/client/c/hu/varadiistvan/xplra/xplra.cc
r40 r55 1309 1309 //------------------------------------------------------------------------------ 1310 1310 1311 extern "C" int xplra_register_hotkeys(int connectionID, 1312 const uint16_t* codes, size_t length) 1313 { 1314 Connection* connection = ConnectionSlot::getValue(connectionID); 1315 if (connection==0) return -1; 1316 1317 try { 1318 connection->registerHotkeys(codes, length); 1319 return 0; 1320 } catch(...) { 1321 connection->handleException(); 1322 return -1; 1323 } 1324 } 1325 1326 /*----------------------------------------------------------------------------*/ 1327 1328 extern "C" int xplra_query_hotkeys(int connectionID, 1329 uint8_t* states, size_t length) 1330 { 1331 Connection* connection = ConnectionSlot::getValue(connectionID); 1332 if (connection==0) return -1; 1333 1334 try { 1335 connection->queryHotkeys(states, length); 1336 return 0; 1337 } catch(...) { 1338 connection->handleException(); 1339 return -1; 1340 } 1341 } 1342 1343 /*----------------------------------------------------------------------------*/ 1344 1345 extern "C" int xplra_unregister_hotkeys(int connectionID) 1346 { 1347 Connection* connection = ConnectionSlot::getValue(connectionID); 1348 if (connection==0) return -1; 1349 1350 try { 1351 connection->unregisterHotkeys(); 1352 return 0; 1353 } catch(...) { 1354 connection->handleException(); 1355 return -1; 1356 } 1357 } 1358 1359 //------------------------------------------------------------------------------ 1360 //------------------------------------------------------------------------------ 1361 1311 1362 extern "C" int xplra_disconnect(int connectionID) 1312 1363 { -
src/client/c/hu/varadiistvan/xplra/xplra.h
r40 r55 99 99 /*----------------------------------------------------------------------------*/ 100 100 101 /** Hotkey modifier: Shift */ 102 #define HOTKEY_MODIFIER_SHIFT 0x01 103 104 /** Hotkey modifier: Control */ 105 #define HOTKEY_MODIFIER_CONTROL 0x02 106 107 /*----------------------------------------------------------------------------*/ 108 101 109 #define INVALID_DATAREF_ID ((size_t)-1) 102 110 … … 751 759 752 760 /** 761 * Register the given hotkey codes for listening. If there is an 762 * existing set of hotkeys registered, those will be overwritten. 763 */ 764 int xplra_register_hotkeys(int connectionID, 765 const uint16_t* codes, size_t length); 766 767 /*----------------------------------------------------------------------------*/ 768 769 /** 770 * Query the registered hotkeys whether they were pressed. 771 */ 772 int xplra_query_hotkeys(int connectionID, uint8_t* states, size_t length); 773 774 /*----------------------------------------------------------------------------*/ 775 776 /** 777 * Unregister the hotkeys. 778 */ 779 int xplra_unregister_hotkeys(int connectionID); 780 781 /*----------------------------------------------------------------------------*/ 782 /*----------------------------------------------------------------------------*/ 783 784 /** 753 785 * Destroy the connection with the given ID. 754 786 * -
test/Makefile.am
r54 r55 6 6 endif 7 7 8 noinst_PROGRAMS=ctest basictest basicctest multigettest multigetctest multisettest multisetctest hotkeytest 8 noinst_PROGRAMS=ctest basictest basicctest multigettest multigetctest multisettest multisetctest hotkeytest hotkeyctest 9 9 10 10 ctest_SOURCES=ctest.c … … 36 36 hotkeytest_SOURCES=hotkeytest.cc 37 37 38 hotkeyctest_SOURCES=hotkeyctest.c 39 if TARGET_API_WIN32 40 hotkeyctest_LDFLAGS=-lstdc++ 41 endif 42 38 43 EXTRA_DIST=\ 39 44 runpy.sh \ -
test/basicctest.c
r40 r55 43 43 44 44 #ifdef _WIN32 45 void _sleep(int ms)45 void xplra_sleep(int ms) 46 46 { 47 47 Sleep(ms); 48 48 } 49 49 #else 50 void _sleep(int ms)50 void xplra_sleep(int ms) 51 51 { 52 52 usleep(ms*1000); … … 367 367 368 368 printf("Preparing for the message tests, sleeping for 5 seconds...\n"); 369 _sleep(5*1000);369 xplra_sleep(5*1000); 370 370 371 371 printf("Showing a message for 10 seconds...\n"); … … 375 375 376 376 printf("Sleeping for 3 seconds...\n"); 377 _sleep(3*1000);377 xplra_sleep(3*1000); 378 378 379 379 printf("Showing another message interrupting the previous one for 3 seconds"); … … 383 383 384 384 printf("Sleeping for 5 seconds...\n"); 385 _sleep(5*1000);385 xplra_sleep(5*1000); 386 386 if (xplra_show_message(connectionID, "[basictest] and the tests come to an end!", 5.0)<0) { 387 387 goto error; … … 389 389 390 390 goto cleanup; 391 391 392 error: 392 393 errorString = xplra_get_last_error_string(connectionID);
Note:
See TracChangeset
for help on using the changeset viewer.