summaryrefslogtreecommitdiffstats
path: root/ui/events/ozone/layout/xkb/scoped_xkb.h
blob: 66ec295a6f5c870a00fe8a9b48e48f640185ac67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_EVENTS_OZONE_LAYOUT_XKB_SCOPED_XKB_H_
#define UI_EVENTS_OZONE_LAYOUT_XKB_SCOPED_XKB_H_

#include <xkbcommon/xkbcommon.h>

namespace ui {

// libxkbcommon uses explicit reference counting for its structures,
// so we need to trigger its cleanup.
struct XkbContextDeleter {
  void operator()(xkb_context* context) { xkb_context_unref(context); }
};

struct XkbStateDeleter {
  void operator()(xkb_state* state) { xkb_state_unref(state); }
};

struct XkbKeymapDeleter {
  void operator()(xkb_keymap* keymap) { xkb_keymap_unref(keymap); }
};

}  // namespace ui

#endif  // UI_EVENTS_OZONE_LAYOUT_XKB_SCOPED_XKB_H_