Github user mike-jumper commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-server/pull/18#discussion_r75055525
  
    --- Diff: src/protocols/rdp/keyboard.c ---
    @@ -0,0 +1,283 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +#include "config.h"
    +
    +#include "client.h"
    +#include "keyboard.h"
    +#include "rdp.h"
    +#include "rdp_keymap.h"
    +
    +#include <freerdp/freerdp.h>
    +#include <freerdp/input.h>
    +#include <guacamole/client.h>
    +
    +#include <pthread.h>
    +#include <stdlib.h>
    +
    +/**
    + * Immediately sends an RDP key event having the given scancode and flags.
    + *
    + * @param rdp_client
    + *     The RDP client instance associated with the RDP session along which 
the
    + *     key event should be sent.
    + *
    + * @param scancode
    + *     The scancode of the key to press or release via the RDP key event.
    + *
    + * @param flags
    + *     Any RDP-specific flags required for the provided scancode to have 
the
    + *     intended meaning, such as KBD_FLAGS_EXTENDED. The possible flags and
    + *     their meanings are dictated by RDP. KBD_FLAGS_DOWN and KBD_FLAGS_UP
    + *     need not be specified here - they will automatically be added 
depending
    + *     on the value specified for the pressed parameter.
    + *
    + * @param pressed
    + *     Non-zero if the key is being pressed, zero if the key is being 
released.
    + */
    +static void guac_rdp_send_key_event(guac_rdp_client* rdp_client,
    +        int scancode, int flags, int pressed) {
    +
    +    /* Determine proper event flag for pressed state */
    +    int pressed_flags;
    +    if (pressed)
    +        pressed_flags = KBD_FLAGS_DOWN;
    +    else
    +        pressed_flags = KBD_FLAGS_RELEASE;
    +
    +    pthread_mutex_lock(&(rdp_client->rdp_lock));
    +
    +    /* Skip if not yet connected */
    +    freerdp* rdp_inst = rdp_client->rdp_inst;
    +    if (rdp_inst == NULL) {
    +        pthread_mutex_unlock(&(rdp_client->rdp_lock));
    +        return;
    +    }
    +
    +    /* Send actual key */
    +    rdp_inst->input->KeyboardEvent(rdp_inst->input,
    +            flags | pressed_flags, scancode);
    +
    +    pthread_mutex_unlock(&(rdp_client->rdp_lock));
    +
    +}
    +
    +/**
    + * Immediately sends an RDP Unicode event having the given Unicode 
codepoint.
    + * Unlike key events, RDP Unicode events do not a pressed or released 
state.
    --- End diff --
    
    It has a verb, but it actually two.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to