mirror of
https://github.com/robotn/gohook.git
synced 2024-11-21 18:36:51 +08:00
update code style
This commit is contained in:
parent
80d080b140
commit
ef93345f66
@ -203,14 +203,12 @@ UniCharCount keycode_to_unicode(CGEventRef event_ref, UniChar *buffer, UniCharCo
|
|||||||
CFStringUppercase(keytxt, locale);
|
CFStringUppercase(keytxt, locale);
|
||||||
CFRelease(locale);
|
CFRelease(locale);
|
||||||
CFRelease(keytxt);
|
CFRelease(keytxt);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// There was an problem creating the CFMutableStringRef.
|
// There was an problem creating the CFMutableStringRef.
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Make sure the buffer count is zero if an error occurred.
|
// Make sure the buffer count is zero if an error occurred.
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
@ -518,8 +516,7 @@ UInt64 scancode_to_keycode(uint16_t scancode) {
|
|||||||
// Bound check 0 <= keycode < 128
|
// Bound check 0 <= keycode < 128
|
||||||
if (scancode < 128) {
|
if (scancode < 128) {
|
||||||
keycode = keycode_scancode_table[scancode][1];
|
keycode = keycode_scancode_table[scancode][1];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Calculate the upper offset.
|
// Calculate the upper offset.
|
||||||
unsigned short i = (scancode & 0x007F) | 0x80;
|
unsigned short i = (scancode & 0x007F) | 0x80;
|
||||||
|
|
||||||
|
@ -72,8 +72,7 @@ IOHOOK_API screen_data* hook_create_screen_info(unsigned char *count) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_INFO, "%s [%u]: multiple_get_screen_info failed: %ld. Fallback.\n",
|
logger(LOG_LEVEL_INFO, "%s [%u]: multiple_get_screen_info failed: %ld. Fallback.\n",
|
||||||
__FUNCTION__, __LINE__, status);
|
__FUNCTION__, __LINE__, status);
|
||||||
|
|
||||||
|
@ -118,8 +118,7 @@ IOHOOK_API void hook_post_event(iohook_event * const event) {
|
|||||||
events[events_size].ki.wScan = 0; // event->data.keyboard.keycode;
|
events[events_size].ki.wScan = 0; // event->data.keyboard.keycode;
|
||||||
events[events_size].ki.time = 0; // GetSystemTime()
|
events[events_size].ki.time = 0; // GetSystemTime()
|
||||||
events_size++;
|
events_size++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_INFO, "%s [%u]: Unable to lookup scancode: %li\n",
|
logger(LOG_LEVEL_INFO, "%s [%u]: Unable to lookup scancode: %li\n",
|
||||||
__FUNCTION__, __LINE__,
|
__FUNCTION__, __LINE__,
|
||||||
event->data.keyboard.keycode);
|
event->data.keyboard.keycode);
|
||||||
@ -135,8 +134,7 @@ IOHOOK_API void hook_post_event(iohook_event * const event) {
|
|||||||
events[events_size].ki.wScan = 0; // event->data.keyboard.keycode;
|
events[events_size].ki.wScan = 0; // event->data.keyboard.keycode;
|
||||||
events[events_size].ki.time = 0; // GetSystemTime()
|
events[events_size].ki.time = 0; // GetSystemTime()
|
||||||
events_size++;
|
events_size++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_INFO, "%s [%u]: Unable to lookup scancode: %li\n",
|
logger(LOG_LEVEL_INFO, "%s [%u]: Unable to lookup scancode: %li\n",
|
||||||
__FUNCTION__, __LINE__,
|
__FUNCTION__, __LINE__,
|
||||||
event->data.keyboard.keycode);
|
event->data.keyboard.keycode);
|
||||||
|
@ -54,8 +54,7 @@ static inline void dispatch_event(iohook_event *const event) {
|
|||||||
__FUNCTION__, __LINE__, event->type);
|
__FUNCTION__, __LINE__, event->type);
|
||||||
|
|
||||||
dispatcher(event);
|
dispatcher(event);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_WARN, "%s [%u]: No dispatch callback set!\n",
|
logger(LOG_LEVEL_WARN, "%s [%u]: No dispatch callback set!\n",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
@ -113,8 +112,7 @@ static unsigned short int get_scroll_wheel_type() {
|
|||||||
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &wheel_type, 0);
|
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &wheel_type, 0);
|
||||||
if (wheel_type == WHEEL_PAGESCROLL) {
|
if (wheel_type == WHEEL_PAGESCROLL) {
|
||||||
value = WHEEL_BLOCK_SCROLL;
|
value = WHEEL_BLOCK_SCROLL;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
value = WHEEL_UNIT_SCROLL;
|
value = WHEEL_UNIT_SCROLL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,8 +129,7 @@ static unsigned short int get_scroll_wheel_amount() {
|
|||||||
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &wheel_amount, 0);
|
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &wheel_amount, 0);
|
||||||
if (wheel_amount == WHEEL_PAGESCROLL) {
|
if (wheel_amount == WHEEL_PAGESCROLL) {
|
||||||
value = 1;
|
value = 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
value = (unsigned short int) wheel_amount;
|
value = (unsigned short int) wheel_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,8 +300,7 @@ LRESULT CALLBACK keyboard_hook_event_proc(int nCode, WPARAM wParam, LPARAM lPara
|
|||||||
LRESULT hook_result = -1;
|
LRESULT hook_result = -1;
|
||||||
if (nCode < 0 || event.reserved ^ 0x01) {
|
if (nCode < 0 || event.reserved ^ 0x01) {
|
||||||
hook_result = CallNextHookEx(keyboard_event_hhook, nCode, wParam, lParam);
|
hook_result = CallNextHookEx(keyboard_event_hhook, nCode, wParam, lParam);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_DEBUG, "%s [%u]: Consuming the current event. (%li)\n",
|
logger(LOG_LEVEL_DEBUG, "%s [%u]: Consuming the current event. (%li)\n",
|
||||||
__FUNCTION__, __LINE__, (long) hook_result);
|
__FUNCTION__, __LINE__, (long) hook_result);
|
||||||
}
|
}
|
||||||
@ -321,13 +317,11 @@ static void process_button_pressed(MSLLHOOKSTRUCT *mshook, uint16_t button) {
|
|||||||
if (button == click_button && (long int) (timestamp - click_time) <= hook_get_multi_click_time()) {
|
if (button == click_button && (long int) (timestamp - click_time) <= hook_get_multi_click_time()) {
|
||||||
if (click_count < USHRT_MAX) {
|
if (click_count < USHRT_MAX) {
|
||||||
click_count++;
|
click_count++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_WARN, "%s [%u]: Click count overflow detected!\n",
|
logger(LOG_LEVEL_WARN, "%s [%u]: Click count overflow detected!\n",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Reset the click count.
|
// Reset the click count.
|
||||||
click_count = 1;
|
click_count = 1;
|
||||||
|
|
||||||
@ -436,8 +430,7 @@ static void process_mouse_moved(MSLLHOOKSTRUCT *mshook) {
|
|||||||
if (mouse_dragged) {
|
if (mouse_dragged) {
|
||||||
// Create Mouse Dragged event.
|
// Create Mouse Dragged event.
|
||||||
event.type = EVENT_MOUSE_DRAGGED;
|
event.type = EVENT_MOUSE_DRAGGED;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Create a Mouse Moved event.
|
// Create a Mouse Moved event.
|
||||||
event.type = EVENT_MOUSE_MOVED;
|
event.type = EVENT_MOUSE_MOVED;
|
||||||
}
|
}
|
||||||
@ -519,20 +512,17 @@ LRESULT CALLBACK mouse_hook_event_proc(int nCode, WPARAM wParam, LPARAM lParam)
|
|||||||
if (HIWORD(mshook->mouseData) == XBUTTON1) {
|
if (HIWORD(mshook->mouseData) == XBUTTON1) {
|
||||||
set_modifier_mask(MASK_BUTTON4);
|
set_modifier_mask(MASK_BUTTON4);
|
||||||
process_button_pressed(mshook, MOUSE_BUTTON4);
|
process_button_pressed(mshook, MOUSE_BUTTON4);
|
||||||
}
|
} else if (HIWORD(mshook->mouseData) == XBUTTON2) {
|
||||||
else if (HIWORD(mshook->mouseData) == XBUTTON2) {
|
|
||||||
set_modifier_mask(MASK_BUTTON5);
|
set_modifier_mask(MASK_BUTTON5);
|
||||||
process_button_pressed(mshook, MOUSE_BUTTON5);
|
process_button_pressed(mshook, MOUSE_BUTTON5);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Extra mouse buttons.
|
// Extra mouse buttons.
|
||||||
uint16_t button = HIWORD(mshook->mouseData);
|
uint16_t button = HIWORD(mshook->mouseData);
|
||||||
|
|
||||||
// Add support for mouse 4 & 5.
|
// Add support for mouse 4 & 5.
|
||||||
if (button == 4) {
|
if (button == 4) {
|
||||||
set_modifier_mask(MOUSE_BUTTON4);
|
set_modifier_mask(MOUSE_BUTTON4);
|
||||||
}
|
} else if (button == 5) {
|
||||||
else if (button == 5) {
|
|
||||||
set_modifier_mask(MOUSE_BUTTON5);
|
set_modifier_mask(MOUSE_BUTTON5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,20 +551,17 @@ LRESULT CALLBACK mouse_hook_event_proc(int nCode, WPARAM wParam, LPARAM lParam)
|
|||||||
if (HIWORD(mshook->mouseData) == XBUTTON1) {
|
if (HIWORD(mshook->mouseData) == XBUTTON1) {
|
||||||
unset_modifier_mask(MASK_BUTTON4);
|
unset_modifier_mask(MASK_BUTTON4);
|
||||||
process_button_released(mshook, MOUSE_BUTTON4);
|
process_button_released(mshook, MOUSE_BUTTON4);
|
||||||
}
|
} else if (HIWORD(mshook->mouseData) == XBUTTON2) {
|
||||||
else if (HIWORD(mshook->mouseData) == XBUTTON2) {
|
|
||||||
unset_modifier_mask(MASK_BUTTON5);
|
unset_modifier_mask(MASK_BUTTON5);
|
||||||
process_button_released(mshook, MOUSE_BUTTON5);
|
process_button_released(mshook, MOUSE_BUTTON5);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Extra mouse buttons.
|
// Extra mouse buttons.
|
||||||
uint16_t button = HIWORD(mshook->mouseData);
|
uint16_t button = HIWORD(mshook->mouseData);
|
||||||
|
|
||||||
// Add support for mouse 4 & 5.
|
// Add support for mouse 4 & 5.
|
||||||
if (button == 4) {
|
if (button == 4) {
|
||||||
unset_modifier_mask(MOUSE_BUTTON4);
|
unset_modifier_mask(MOUSE_BUTTON4);
|
||||||
}
|
} else if (button == 5) {
|
||||||
else if (button == 5) {
|
|
||||||
unset_modifier_mask(MOUSE_BUTTON5);
|
unset_modifier_mask(MOUSE_BUTTON5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,8 +595,7 @@ LRESULT CALLBACK mouse_hook_event_proc(int nCode, WPARAM wParam, LPARAM lParam)
|
|||||||
LRESULT hook_result = -1;
|
LRESULT hook_result = -1;
|
||||||
if (nCode < 0 || event.reserved ^ 0x01) {
|
if (nCode < 0 || event.reserved ^ 0x01) {
|
||||||
hook_result = CallNextHookEx(mouse_event_hhook, nCode, wParam, lParam);
|
hook_result = CallNextHookEx(mouse_event_hhook, nCode, wParam, lParam);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_DEBUG, "%s [%u]: Consuming the current event. (%li)\n",
|
logger(LOG_LEVEL_DEBUG, "%s [%u]: Consuming the current event. (%li)\n",
|
||||||
__FUNCTION__, __LINE__, (long) hook_result);
|
__FUNCTION__, __LINE__, (long) hook_result);
|
||||||
}
|
}
|
||||||
@ -674,8 +660,7 @@ IOHOOK_API int hook_run() {
|
|||||||
if (hInst != NULL) {
|
if (hInst != NULL) {
|
||||||
// Initialize native input helper functions.
|
// Initialize native input helper functions.
|
||||||
load_input_helper();
|
load_input_helper();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_ERROR, "%s [%u]: Could not determine hInst for SetWindowsHookEx()! (%#lX)\n",
|
logger(LOG_LEVEL_ERROR, "%s [%u]: Could not determine hInst for SetWindowsHookEx()! (%#lX)\n",
|
||||||
__FUNCTION__, __LINE__, (unsigned long) GetLastError());
|
__FUNCTION__, __LINE__, (unsigned long) GetLastError());
|
||||||
|
|
||||||
@ -721,8 +706,7 @@ IOHOOK_API int hook_run() {
|
|||||||
TranslateMessage(&message);
|
TranslateMessage(&message);
|
||||||
DispatchMessage(&message);
|
DispatchMessage(&message);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_ERROR, "%s [%u]: SetWindowsHookEx() failed! (%#lX)\n",
|
logger(LOG_LEVEL_ERROR, "%s [%u]: SetWindowsHookEx() failed! (%#lX)\n",
|
||||||
__FUNCTION__, __LINE__, (unsigned long) GetLastError());
|
__FUNCTION__, __LINE__, (unsigned long) GetLastError());
|
||||||
|
|
||||||
|
@ -315,8 +315,7 @@ unsigned short keycode_to_scancode(DWORD vk_code, DWORD flags) {
|
|||||||
scancode |= 0x0E00;
|
scancode |= 0x0E00;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// logger(LOG_LEVEL_WARN, "%s [%u]: Test2, vk_code %li\n",
|
// logger(LOG_LEVEL_WARN, "%s [%u]: Test2, vk_code %li\n",
|
||||||
// __FUNCTION__, __LINE__, vk_code);
|
// __FUNCTION__, __LINE__, vk_code);
|
||||||
}
|
}
|
||||||
@ -332,8 +331,7 @@ DWORD scancode_to_keycode(unsigned short scancode) {
|
|||||||
// NOTE vk_code >= 0 is assumed because the scancode is unsigned.
|
// NOTE vk_code >= 0 is assumed because the scancode is unsigned.
|
||||||
if (scancode < 128) {
|
if (scancode < 128) {
|
||||||
keycode = keycode_scancode_table[scancode][1];
|
keycode = keycode_scancode_table[scancode][1];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Calculate the upper offset based on the lower half of the scancode + 128.
|
// Calculate the upper offset based on the lower half of the scancode + 128.
|
||||||
unsigned short int i = (scancode & 0x007F) | 0x80;
|
unsigned short int i = (scancode & 0x007F) | 0x80;
|
||||||
|
|
||||||
@ -431,8 +429,7 @@ static int refresh_locale_list() {
|
|||||||
logger(LOG_LEVEL_WARN, "%s [%u]: Locale size mismatch! "
|
logger(LOG_LEVEL_WARN, "%s [%u]: Locale size mismatch! "
|
||||||
"Expected %i, received %i!\n",
|
"Expected %i, received %i!\n",
|
||||||
__FUNCTION__, __LINE__, hkl_size, new_size);
|
__FUNCTION__, __LINE__, hkl_size, new_size);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_INFO, "%s [%u]: Received %i locales.\n",
|
logger(LOG_LEVEL_INFO, "%s [%u]: Received %i locales.\n",
|
||||||
__FUNCTION__, __LINE__, new_size);
|
__FUNCTION__, __LINE__, new_size);
|
||||||
}
|
}
|
||||||
@ -468,8 +465,7 @@ static int refresh_locale_list() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_DEBUG, "%s [%u]: Removing locale ID %#p from the cache.\n",
|
logger(LOG_LEVEL_DEBUG, "%s [%u]: Removing locale ID %#p from the cache.\n",
|
||||||
__FUNCTION__, __LINE__, locale_item->id);
|
__FUNCTION__, __LINE__, locale_item->id);
|
||||||
|
|
||||||
@ -542,8 +538,7 @@ static int refresh_locale_list() {
|
|||||||
if (locale_previous == NULL) {
|
if (locale_previous == NULL) {
|
||||||
// If nothing came before, the list is empty.
|
// If nothing came before, the list is empty.
|
||||||
locale_first = locale_item;
|
locale_first = locale_item;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Append the new locale to the end of the list.
|
// Append the new locale to the end of the list.
|
||||||
locale_previous->next = locale_item;
|
locale_previous->next = locale_item;
|
||||||
}
|
}
|
||||||
@ -557,8 +552,7 @@ static int refresh_locale_list() {
|
|||||||
locale_previous = locale_item;
|
locale_previous = locale_item;
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_ERROR,
|
logger(LOG_LEVEL_ERROR,
|
||||||
"%s [%u]: GetProcAddress() failed for KbdLayerDescriptor!\n",
|
"%s [%u]: GetProcAddress() failed for KbdLayerDescriptor!\n",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
@ -567,22 +561,19 @@ static int refresh_locale_list() {
|
|||||||
free(locale_item);
|
free(locale_item);
|
||||||
locale_item = NULL;
|
locale_item = NULL;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_ERROR,
|
logger(LOG_LEVEL_ERROR,
|
||||||
"%s [%u]: GetSystemDirectory() failed!\n",
|
"%s [%u]: GetSystemDirectory() failed!\n",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_ERROR,
|
logger(LOG_LEVEL_ERROR,
|
||||||
"%s [%u]: Could not find keyboard map for locale %#p!\n",
|
"%s [%u]: Could not find keyboard map for locale %#p!\n",
|
||||||
__FUNCTION__, __LINE__, hkl_list[i]);
|
__FUNCTION__, __LINE__, hkl_list[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_ERROR,
|
logger(LOG_LEVEL_ERROR,
|
||||||
"%s [%u]: GetKeyboardLayoutList() failed!\n",
|
"%s [%u]: GetKeyboardLayoutList() failed!\n",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
@ -627,8 +618,7 @@ SIZE_T keycode_to_unicode(DWORD keycode, PWCHAR buffer, SIZE_T size) {
|
|||||||
// If they layout changes the dead key state needs to be reset.
|
// If they layout changes the dead key state needs to be reset.
|
||||||
// This is consistent with the way Windows handles locale changes.
|
// This is consistent with the way Windows handles locale changes.
|
||||||
deadChar = WCH_NONE;
|
deadChar = WCH_NONE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger(LOG_LEVEL_DEBUG,
|
logger(LOG_LEVEL_DEBUG,
|
||||||
"%s [%u]: Refreshing locale cache.\n",
|
"%s [%u]: Refreshing locale cache.\n",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
@ -669,11 +659,9 @@ SIZE_T keycode_to_unicode(DWORD keycode, PWCHAR buffer, SIZE_T size) {
|
|||||||
if (state & ~SHRT_MAX) {
|
if (state & ~SHRT_MAX) {
|
||||||
if (pVkToBit[i].Vk == VK_SHIFT) {
|
if (pVkToBit[i].Vk == VK_SHIFT) {
|
||||||
is_shift = true;
|
is_shift = true;
|
||||||
}
|
} else if (pVkToBit[i].Vk == VK_CONTROL) {
|
||||||
else if (pVkToBit[i].Vk == VK_CONTROL) {
|
|
||||||
is_ctrl = true;
|
is_ctrl = true;
|
||||||
}
|
} else if (pVkToBit[i].Vk == VK_MENU) {
|
||||||
else if (pVkToBit[i].Vk == VK_MENU) {
|
|
||||||
is_alt = true;
|
is_alt = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -720,8 +708,7 @@ SIZE_T keycode_to_unicode(DWORD keycode, PWCHAR buffer, SIZE_T size) {
|
|||||||
if ((((PVK_TO_WCHARS) pCurrentVkToWchars)->Attributes == CAPLOK) && capsLock) {
|
if ((((PVK_TO_WCHARS) pCurrentVkToWchars)->Attributes == CAPLOK) && capsLock) {
|
||||||
if (is_shift && mod > 0) {
|
if (is_shift && mod > 0) {
|
||||||
mod -= 1;
|
mod -= 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mod += 1;
|
mod += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -739,8 +726,7 @@ SIZE_T keycode_to_unicode(DWORD keycode, PWCHAR buffer, SIZE_T size) {
|
|||||||
// No previous dead key was set so cache the next
|
// No previous dead key was set so cache the next
|
||||||
// wchar so we know what to do next time its pressed.
|
// wchar so we know what to do next time its pressed.
|
||||||
deadChar = ((PVK_TO_WCHARS) pCurrentVkToWchars)->wch[mod];
|
deadChar = ((PVK_TO_WCHARS) pCurrentVkToWchars)->wch[mod];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (size >= 2) {
|
if (size >= 2) {
|
||||||
// Received a second dead key.
|
// Received a second dead key.
|
||||||
memset(buffer, deadChar, 2);
|
memset(buffer, deadChar, 2);
|
||||||
@ -751,8 +737,7 @@ SIZE_T keycode_to_unicode(DWORD keycode, PWCHAR buffer, SIZE_T size) {
|
|||||||
charCount = 2;
|
charCount = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (unicode != WCH_NONE) {
|
||||||
else if (unicode != WCH_NONE) {
|
|
||||||
// We are not WCH_NONE or WCH_DEAD
|
// We are not WCH_NONE or WCH_DEAD
|
||||||
if (size >= 1) {
|
if (size >= 1) {
|
||||||
buffer[0] = unicode;
|
buffer[0] = unicode;
|
||||||
@ -761,8 +746,7 @@ SIZE_T keycode_to_unicode(DWORD keycode, PWCHAR buffer, SIZE_T size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Add sizeof WCHAR because we are really an array of WCHAR[n] not WCHAR[]
|
// Add sizeof WCHAR because we are really an array of WCHAR[n] not WCHAR[]
|
||||||
pCurrentVkToWchars += sizeof(VK_TO_WCHARS) + (sizeof(WCHAR) * n);
|
pCurrentVkToWchars += sizeof(VK_TO_WCHARS) + (sizeof(WCHAR) * n);
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,7 @@ static BOOL CALLBACK monitor_enum_proc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT
|
|||||||
|
|
||||||
if (screens->data == NULL) {
|
if (screens->data == NULL) {
|
||||||
screens->data = (screen_data *) malloc(sizeof(screen_data));
|
screens->data = (screen_data *) malloc(sizeof(screen_data));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
screens->data = (screen_data *) realloc(screens, sizeof(screen_data) * screens->count);
|
screens->data = (screen_data *) realloc(screens, sizeof(screen_data) * screens->count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user