cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

keydef.h (2320B)


      1/*
      2 * Licensed to the Apache Software Foundation (ASF) under one
      3 * or more contributor license agreements.  See the NOTICE file
      4 * distributed with this work for additional information
      5 * regarding copyright ownership.  The ASF licenses this file
      6 * to you under the Apache License, Version 2.0 (the
      7 * "License"); you may not use this file except in compliance
      8 * with the License.  You may obtain a copy of the License at
      9 *
     10 *   http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing,
     13 * software distributed under the License is distributed on an
     14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     15 * KIND, either express or implied.  See the License for the
     16 * specific language governing permissions and limitations
     17 * under the License.
     18 */
     19
     20#ifndef GUACLOG_KEYDEF_H
     21#define GUACLOG_KEYDEF_H
     22
     23#include "config.h"
     24
     25#include <stdbool.h>
     26
     27/**
     28 * A mapping of X11 keysym to its corresponding human-readable name.
     29 */
     30typedef struct guaclog_keydef {
     31
     32    /**
     33     * The X11 keysym of the key.
     34     */
     35    int keysym;
     36
     37    /**
     38     * A human-readable name for the key.
     39     */
     40    char* name;
     41
     42    /**
     43     * The value which would be typed in a typical text editor, if any. If the
     44     * key is not associated with any typable value, or if the typable value is
     45     * not generally useful in an auditing context, this will be NULL.
     46     */
     47    char* value;
     48
     49    /**
     50     * Whether this key is a modifier which may affect the interpretation of
     51     * other keys, and thus should be tracked as it is held down.
     52     */
     53    bool modifier;
     54
     55} guaclog_keydef;
     56
     57/**
     58 * Creates a new guaclog_keydef which represents the key having the given
     59 * keysym. The resulting guaclog_keydef must eventually be freed through a
     60 * call to guaclog_keydef_free().
     61 *
     62 * @param keysym
     63 *     The X11 keysym of the key.
     64 *
     65 * @return
     66 *     A new guaclog_keydef which represents the key having the given keysym,
     67 *     or NULL if no such key is known.
     68 */
     69guaclog_keydef* guaclog_keydef_alloc(int keysym);
     70
     71/**
     72 * Frees all resources associated with the given guaclog_keydef. If the given
     73 * guaclog_keydef is NULL, this function has no effect.
     74 *
     75 * @param keydef
     76 *     The guaclog_keydef to free, which may be NULL.
     77 */
     78void guaclog_keydef_free(guaclog_keydef* keydef);
     79
     80#endif
     81