This file is indexed.

/usr/include/Nux-4.0/Nux/InputMethodIBus.h is in libnux-4.0-dev 4.0.8+16.04.20160209-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
* Copyright 2010 Inalogic® Inc.
*
* This program 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.1 or 3.0
* of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
* PURPOSE.  See the applicable version of the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of both the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Authored by: Brandon Schaefer <brandontschaefer@gmail.com>
*              Jay Taoko <jaytaoko@inalogic.com>
*
*/


#ifndef INPUTMETHODIBUS_H
#define INPUTMETHODIBUS_H

#include <Nux/TextEntry.h>
#include <ibus.h>

namespace nux
{

  class IBusIMEContext;
  class TextEntry;

  // FIXME This class should be reworked to replace the mouse_state
  // with the hardware key_code.
  class KeyEvent
  {
  public:

    KeyEvent(NuxEventType type,
      unsigned int key_sym,
      unsigned int key_code, unsigned int event_flags, const char* character)
      : type_(type)
      , key_sym_(key_sym)
      , key_code_(key_code)
      , key_modifiers_(event_flags)
      , character_(character ? character : "")
    {
    }

    NuxEventType type() const {return type_;}
    unsigned int key_sym() const {return key_sym_;}
    unsigned int key_code() const {return key_code_;}
    unsigned int flags() const {return key_modifiers_;}
    std::string character() const {return character_;}

    bool IsShiftDown() const { return (key_modifiers_ & KEY_MODIFIER_SHIFT) != 0; }
    bool IsControlDown() const { return (key_modifiers_ & KEY_MODIFIER_CTRL) != 0; }
    bool IsCapsLockDown() const { return (key_modifiers_ & KEY_MODIFIER_CAPS_LOCK) != 0; }
    bool IsAltDown() const { return (key_modifiers_ & KEY_MODIFIER_ALT) != 0; }

  private:
    EventType type_;
    unsigned int key_sym_;
    unsigned int key_code_;
    unsigned int key_modifiers_;
    std::string character_;

    KeyEvent(const KeyEvent&);
    void operator = (const KeyEvent&);
  };

  // Used for passing data to ProcessKeyEventDone function()
  class ProcessKeyEventData
  {
  public:
    ProcessKeyEventData(IBusIMEContext* context,
      const KeyEvent& event)
      : context(context)
      , event(event.type(), event.key_sym(), event.key_code(), event.flags(), event.character().c_str())
    {

    }
    IBusIMEContext* context;
    KeyEvent event;
  };

  // Implements IMEContext to integrate ibus input method framework
  class IBusIMEContext
  {
  public:
    explicit IBusIMEContext(TextEntry* text_entry);
    virtual ~IBusIMEContext();

    // views::IMEContext implementations:
    virtual void Focus();
    virtual void Blur();
    virtual void Reset();
    virtual bool FilterKeyEvent(const KeyEvent& event);
    virtual void SetSurrounding(const std::wstring& text, int cursor_pos);

    bool IsConnected() const;
    bool IsHotkeyEvent(EventType type, unsigned long keysym, unsigned long modifiers) const;

  protected:
    static std::vector<Event> ParseIBusHotkeys(const gchar** keybindings);

  private:
    void CreateContext();
    void DestroyContext();

    void UpdateCursorLocation();
    static void UpdateHotkeys();

    // Event handlers for IBusBus:
    //CHROMEG_CALLBACK_0(IBusIMEContext, void, OnConnected, IBusBus*);
    static void OnConnected_(IBusBus* bus, void* data) {nuxDebugMsg("***IBusIMEContext::OnConnected***"); static_cast<IBusIMEContext*>(data)->OnConnected(bus);}
    void OnConnected(IBusBus *bus);

    //CHROMEG_CALLBACK_0(IBusIMEContext, void, OnDisconnected, IBusBus*);
    static void OnDisconnected_(IBusBus* bus, void* data) {static_cast<IBusIMEContext*>(data)->OnDisconnected(bus);}
    void OnDisconnected(IBusBus *bus);

    static void OnConfigChanged_(IBusConfig* config, gchar* section, gchar* name, GVariant* value, gpointer data) {static_cast<IBusIMEContext*>(data)->OnConfigChanged(config, section, name, value);}
    void OnConfigChanged(IBusConfig* config, gchar* section, gchar* name, GVariant* value);

//     // Event handlers for IBusIMEContext:
    //CHROMEG_CALLBACK_1(IBusIMEContext, void, OnCommitText, IBusInputContext*, IBusText*);
    static void OnCommitText_(IBusInputContext* context, IBusText* text, void* data) {static_cast<IBusIMEContext*>(data)->OnCommitText(context, text);}
    void OnCommitText(IBusInputContext *context, IBusText* text);

    //CHROMEG_CALLBACK_3(IBusIMEContext, void, OnUpdatePreeditText, IBusInputContext*, IBusText*, guint, gboolean);
    static void OnUpdatePreeditText_(IBusInputContext* context, IBusText* text, guint cursor_pos, gboolean visible, void* data) {reinterpret_cast<IBusIMEContext*>(data)->OnUpdatePreeditText(context, text, cursor_pos, visible);}
    void OnUpdatePreeditText(IBusInputContext *context, IBusText* text, guint cursor_pos, gboolean visible);

    //CHROMEG_CALLBACK_0(IBusIMEContext, void, OnShowPreeditText, IBusInputContext*);
    static void OnShowPreeditText_(IBusInputContext* context, void* data) {static_cast<IBusIMEContext*>(data)->OnShowPreeditText(context);}
    void OnShowPreeditText(IBusInputContext *context);

//     CHROMEG_CALLBACK_0(IBusIMEContext, void, OnHidePreeditText, IBusInputContext*);
    static void OnHidePreeditText_(IBusInputContext* context, void* data) {static_cast<IBusIMEContext*>(data)->OnHidePreeditText(context);}
    void OnHidePreeditText(IBusInputContext *context);

//     CHROMEG_CALLBACK_0(IBusIMEContext, void, OnEnable, IBusInputContext*);
    static void OnEnable_(IBusInputContext* context, void* data) {static_cast<IBusIMEContext*>(data)->OnEnable(context);}
    void OnEnable(IBusInputContext *context);

//     CHROMEG_CALLBACK_0(IBusIMEContext, void, OnDisable, IBusInputContext*);
    static void OnDisable_(IBusInputContext* context, void* data) {static_cast<IBusIMEContext*>(data)->OnDisable(context);}
    void OnDisable(IBusInputContext *context);

//     CHROMEG_CALLBACK_0(IBusIMEContext, void, OnDestroy, IBusInputContext*);
    static void OnDestroy_(IBusInputContext* context, void* data) {static_cast<IBusIMEContext*>(data)->OnDestroy(context);}
    void OnDestroy(IBusInputContext *context);

    static void ProcessKeyEventDone(IBusInputContext* context,
      GAsyncResult* res,
      ProcessKeyEventData* data);

    TextEntry* text_entry_;
    IBusInputContext* context_;
    GCancellable* cancellable_;
    bool is_focused_;

    static IBusBus* bus_;
    static std::vector<Event> hotkeys_;

    IBusIMEContext(const IBusIMEContext&);
    void operator = (const IBusIMEContext&);
  };

}
#endif  // INPUTMETHODIBUS_H