int CALLBACK WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
)
{
    MSG msg;
    /* int i, j; */
    /* char str[256]; */
    key_binds_count = 0;
    read_config( "./key_binds", key_binds, MAX_KEY_BINDS, &key_binds_count );

    /* for ( i = 0; i < key_binds_count; ++i ) */
    /* { */
    /*     KeyBind *current = &key_binds[ i ]; */
    /*     sprintf( str, "[%d] = ", current->vk_code ); */
    /*     OutputDebugString( str ); */
    /*     for ( j = 0; j < current->key_combo_length; ++j ) */
    /*     { */
    /*         sprintf( str, "%d", current->key_combo_vk[ j ] ); */
    /*         OutputDebugString( str ); */
    /*         if ( j != current->key_combo_length - 1 ) */
    /*         { */
    /*             OutputDebugString( " + " ); */
    /*         } */
    /*     } */
    /*     OutputDebugString( "\n" ); */
    /* } */

    hook_handle = SetWindowsHookEx(
        WH_KEYBOARD_LL,
        (HOOKPROC)hook,
        hInstance,
        0
    );

    while( 1 )
    {
        PeekMessage( &msg, 0, 0, 0, PM_REMOVE );
        TranslateMessage( &msg );
        DispatchMessage( &msg );

        if ( is_space_down && delayed_keys_count && !is_need_delay( GetTickCount() ) )
        {
            resolve_delays_keys_as_combo();
        }

        Sleep( 10 );
    }

    UnhookWindowsHookEx( hook_handle );

    return 0;
}
BOOL process_not_space_down( PKBDLLHOOKSTRUCT key_info )
{
    BOOL need_prevent = FALSE;
    is_something_was_pressed = TRUE;
    if ( is_need_delay( key_info->time ) )
    {
        add_to_delayed_keys( key_info );
        need_prevent = TRUE;
    }
    else
    {
        if ( is_down( key_info ) )
        {
            resolve_as_combo( key_info );
        }
        need_prevent = TRUE;
    }
    return need_prevent;
}
Example #3
0
static bool image_paging_updown_smooth(bool is_forward)
{
	if (in_move_z_mode)
		return splashz();

	if (is_need_delay())
		return false;

	switch (ypos) {
		case 0:
		case 1:
			if (is_forward) {
				if (!image_paging_movedown_smooth()) {
					return false;
				}
			} else {
				if (!image_paging_moveup_smooth()) {
					return false;
				}
			}
			break;
		case 2:
			if (is_forward) {
				if (!image_paging_moveup_smooth()) {
					return false;
				}
			} else {
				if (!image_paging_movedown_smooth()) {
					return false;
				}
			}
			break;
	}

	g_imgpaging_count = config.imgpaging_duration;
	xrKernelDelayThread(100000 * config.imgpaging_duration);

	if (!in_move_z_mode) {
		return enter_z_mode(is_forward, false);
	}

	return true;
}