mutter/clutter/evdev/clutter-xkb-utils.h
Giovanni Campagna 59f1e531f9 ClutterEvent: add API to query the full keyboard state when the event was generated
When talking to other applications or serializing the modifier
state (and in particular when implementing a wayland compositor),
the effective modifier state alone is not sufficient, one needs
to know the base, latched and locked modifiers.

Previously one could do with backend specific functionality
such as clutter_device_manager_evdev_get_xkb_state(), but the
problem is that the internal data structures are updated as
soon as the events are fetched from the upstream source, but
the events are reported to the application some time later,
and thus the two can get out of sync.
This way, on the other hand, the information is cached in the
event, and provided to the application with the value that
was current when the event was generated.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:18:23 +02:00

51 lines
2.1 KiB
C

/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* Authors:
* Damien Lespiau <damien.lespiau@intel.com>
*/
#ifndef __CLUTTER_XKB_UTILS_H__
#define __CLUTTER_XKB_UTILS_H__
#include <xkbcommon/xkbcommon.h>
#include "clutter-stage.h"
#include "clutter-event.h"
#include "clutter-input-device.h"
ClutterEvent * _clutter_key_event_new_from_evdev (ClutterInputDevice *device,
ClutterInputDevice *core_keyboard,
ClutterStage *stage,
struct xkb_state *xkb_state,
uint32_t button_state,
uint32_t _time,
uint32_t key,
uint32_t state);
struct xkb_state * _clutter_xkb_state_new (const gchar *model,
const gchar *layout,
const gchar *variant,
const gchar *options);
void _clutter_xkb_translate_state (ClutterEvent *event,
struct xkb_state *xkb_state,
uint32_t button_state);
#endif /* __CLUTTER_XKB_UTILS_H__ */