~ubuntu-branches/ubuntu/precise/libxklavier/precise

« back to all changes in this revision

Viewing changes to .pc/00git_introspection.patch/libxklavier/xkl_engine.h

  • Committer: Package Import Robot
  • Author(s): Martin Pitt, Josselin Mouette, Martin Pitt
  • Date: 2012-01-16 16:18:44 UTC
  • mfrom: (8.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20120116161844-wr5ylpfmb21s90yi
Tags: 5.1-3
[ Josselin Mouette ]
* Update repository URL.

[ Martin Pitt ]
* Add gobject-introspection support: (LP: #800561)
  - Add 00git_introspection.patch: Already accepted upstream, backported
    to 5.1.
  - debian/control.in: Add gir1.2-xkl-1.0 binary package and GI build
    dependencies. Also add dh-autoreconf build dependency.
  - debian/rules: Use dh-autoreconf cdbs module.
  - debian/rules: Bump shlibs to this version, as the patch adds a few new
    methods and the library bumped minor version.
  - Add debian/gir1.2-xkl-1.0.install: Install typelib.
  - debian/libxklavier-dev.install: Install .gir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2002-2006 Sergey V. Udaltsov <svu@gnome.org>
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with this library; if not, write to the
 
16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
#ifndef __XKL_ENGINE_H__
 
21
#define __XKL_ENGINE_H__
 
22
 
 
23
#include <X11/Xlib.h>
 
24
 
 
25
#include <glib-object.h>
 
26
 
 
27
#ifdef __cplusplus
 
28
extern "C" {
 
29
#endif
 
30
 
 
31
        typedef struct _XklEngine XklEngine;
 
32
        typedef struct _XklEnginePrivate XklEnginePrivate;
 
33
        typedef struct _XklEngineClass XklEngineClass;
 
34
 
 
35
#define XKL_TYPE_ENGINE             (xkl_engine_get_type ())
 
36
#define XKL_ENGINE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), XKL_TYPE_ENGINE, XklEngine))
 
37
#define XKL_ENGINE_CLASS(obj)       (G_TYPE_CHECK_CLASS_CAST ((obj), XKL_TYPE_ENGINE,  XklEngineClass))
 
38
#define XKL_IS_ENGINE(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XKL_TYPE_ENGINE))
 
39
#define XKL_IS_ENGINE_CLASS(obj)    (G_TYPE_CHECK_CLASS_TYPE ((obj), XKL_TYPE_ENGINE))
 
40
#define XKL_ENGINE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), XKL_TYPE_ENGINE, XklEngineClass))
 
41
 
 
42
/**
 
43
 * The type of the keyboard state change
 
44
 *   @GROUP_CHANGED: Group was changed
 
45
 *   @INDICATORS_CHANGED: Indicators were changed
 
46
 */
 
47
        typedef enum {
 
48
                GROUP_CHANGED,
 
49
                INDICATORS_CHANGED
 
50
        } XklEngineStateChange;
 
51
 
 
52
/**
 
53
 * A set of flags used to indicate the capabilities of the active backend
 
54
 *   @XKLF_CAN_TOGGLE_INDICATORS: Backend allows to toggls indicators on/off
 
55
 *   @XKLF_CAN_OUTPUT_CONFIG_AS_ASCII: Backend allows writing ASCII representation of the configuration
 
56
 *   @XKLF_CAN_OUTPUT_CONFIG_AS_BINARY: Backend allows writing binary representation of the configuration
 
57
 *   @XKLF_MULTIPLE_LAYOUTS_SUPPORTED: Backend supports multiple layouts
 
58
 *   @XKLF_REQUIRES_MANUAL_LAYOUT_MANAGEMENT: Backend requires manual configuration, some daemon should do 
 
59
 *                                   xkl_start_listen(engine,XKLL_MANAGE_LAYOUTS);
 
60
 *   @XKLF_DEVICE_DISCOVERY: Backend supports device discovery, can notify
 
61
 */
 
62
        typedef enum {
 
63
                XKLF_CAN_TOGGLE_INDICATORS = 1 << 0,
 
64
                XKLF_CAN_OUTPUT_CONFIG_AS_ASCII = 1 << 1,
 
65
                XKLF_CAN_OUTPUT_CONFIG_AS_BINARY = 1 << 2,
 
66
                XKLF_MULTIPLE_LAYOUTS_SUPPORTED = 1 << 3,
 
67
                XKLF_REQUIRES_MANUAL_LAYOUT_MANAGEMENT = 1 << 4,
 
68
                XKLF_DEVICE_DISCOVERY = 1 << 5
 
69
        } XklEngineFeatures;
 
70
 
 
71
/**
 
72
 * XKB state. Can be global or per-window
 
73
 */
 
74
        typedef struct {
 
75
/** 
 
76
 * selected group 
 
77
 */
 
78
                gint32 group;
 
79
/**
 
80
 * set of active indicators
 
81
 */
 
82
                guint32 indicators;
 
83
        } XklState;
 
84
 
 
85
/**
 
86
 *      The main Xklavier engine class
 
87
 */
 
88
        struct _XklEngine {
 
89
/**
 
90
 * The superclass object
 
91
 */
 
92
                GObject parent;
 
93
/**
 
94
 * Private data
 
95
 */
 
96
                XklEnginePrivate *priv;
 
97
        };
 
98
 
 
99
/**
 
100
 * The XklEngine class, derived from GObject
 
101
 */
 
102
        struct _XklEngineClass {
 
103
/**
 
104
 * The superclass
 
105
 */
 
106
                GObjectClass parent_class;
 
107
 
 
108
/**
 
109
 * XklEngine::config-notify:
 
110
 * @engine: the object on which the signal is emitted
 
111
 *
 
112
 * Used for notifying application of the XKB configuration change.
 
113
 */
 
114
                void (*config_notify) (XklEngine * engine);
 
115
 
 
116
/**
 
117
 * XklEngine::new_window_notify:
 
118
 * @engine: the object on which the signal is emitted
 
119
 * @win: new window
 
120
 * @parent: new window's parent
 
121
 *
 
122
 * Used for notifying application of new window creation (actually, 
 
123
 * registration).
 
124
 *
 
125
 * Returns: the initial group id for the window (-1 to use the default value)
 
126
 */
 
127
                 gint(*new_window_notify) (XklEngine * engine, Window win,
 
128
                                           Window parent);
 
129
/**
 
130
 * XklEngine::state_notify
 
131
 * @engine: the object on which the signal is emitted
 
132
 * @change_type: mask of changes
 
133
 * @group: new group
 
134
 * @restore: whether this state is restored from
 
135
 * saved state of set as new.
 
136
 *
 
137
 * Used for notifying application of the window state change.
 
138
 */
 
139
                void (*state_notify) (XklEngine * engine,
 
140
                                      XklEngineStateChange change_type,
 
141
                                      gint group, gboolean restore);
 
142
 
 
143
/**
 
144
 * XklEngine::new_device_notify
 
145
 * @engine: the object on which the signal is emitted
 
146
 *
 
147
 * Used for notifying application of the new keyboard attached
 
148
 */
 
149
                void (*new_device_notify) (XklEngine * engine);
 
150
 
 
151
        };
 
152
 
 
153
 
 
154
/**
 
155
 * xkl_engine_get_type:
 
156
 *
 
157
 * Get type info for XklEngine
 
158
 *
 
159
 * Returns: GType for XklEngine
 
160
 */
 
161
        extern GType xkl_engine_get_type(void);
 
162
 
 
163
 
 
164
/**
 
165
 * xkl_engine_get_instance:
 
166
 * @display: the X display used by the application
 
167
 *
 
168
 * Get the instance of the XklEngine. Within a process, there is always once instance.
 
169
 *
 
170
 * Returns: the singleton instance
 
171
 */
 
172
        extern XklEngine *xkl_engine_get_instance(Display * display);
 
173
 
 
174
 
 
175
/**
 
176
 * xkl_engine_get_backend_name:
 
177
 * @engine: the engine
 
178
 * 
 
179
 * What kind of backend is used
 
180
 *
 
181
 * Returns: some string id of the backend
 
182
 */
 
183
        extern const gchar *xkl_engine_get_backend_name(XklEngine *
 
184
                                                        engine);
 
185
 
 
186
/**
 
187
 * xkl_engine_get_features:
 
188
 * @engine: the engine
 
189
 *
 
190
 * Provides information regarding available backend features
 
191
 * (combination of XKLF_* constants)
 
192
 *
 
193
 * Returns: ORed XKLF_* constants
 
194
 */
 
195
        extern guint xkl_engine_get_features(XklEngine * engine);
 
196
 
 
197
/**
 
198
 * xkl_engine_get_max_num_groups:
 
199
 * @engine: the engine
 
200
 *
 
201
 * Provides the information on maximum number of simultaneously supported 
 
202
 * groups (layouts)
 
203
 *
 
204
 * Returns: maximum number of the groups in configuration, 
 
205
 *         0 if no restrictions.
 
206
 */
 
207
        extern guint xkl_engine_get_max_num_groups(XklEngine * engine);
 
208
 
 
209
/**
 
210
 * The listener action modes:
 
211
 *   @XKLL_MANAGE_WINDOW_STATES: The listener process should handle the per-window states 
 
212
 *                       and all the related activity
 
213
 *   @XKLL_TRACK_KEYBOARD_STATE: Just track the state and pass it to the application above.
 
214
 *   @XKLL_MANAGE_LAYOUTS: The listener process should help backend to maintain the configuration
 
215
 *                  (manually switch layouts etc).
 
216
 */
 
217
        typedef enum {
 
218
                XKLL_MANAGE_WINDOW_STATES = 0x01,
 
219
                XKLL_TRACK_KEYBOARD_STATE = 0x02,
 
220
                XKLL_MANAGE_LAYOUTS = 0x04,
 
221
        } XklEngineListenModes;
 
222
 
 
223
/**
 
224
 * xkl_engine_start_listen:
 
225
 * @engine: the engine
 
226
 * @flags: any combination of XKLL_* constants
 
227
 *
 
228
 * Starts listening for XKB-related events
 
229
 *
 
230
 * Returns: 0
 
231
 */
 
232
        extern gint xkl_engine_start_listen(XklEngine * engine,
 
233
                                            guint flags);
 
234
 
 
235
/**
 
236
 * xkl_engine_stop_listen:
 
237
 * @engine: the engine
 
238
 * @flags: any combination of XKLL_* constants
 
239
 *
 
240
 * Stops listening for XKB-related events
 
241
 * Returns: 0
 
242
 */
 
243
        extern gint xkl_engine_stop_listen(XklEngine * engine,
 
244
                                           guint flags);
 
245
 
 
246
/**
 
247
 * xkl_engine_pause_listen:
 
248
 * @engine: the engine
 
249
 *
 
250
 * Temporary pauses listening for XKB-related events
 
251
 *
 
252
 * Returns: 0
 
253
 */
 
254
        extern gint xkl_engine_pause_listen(XklEngine * engine);
 
255
 
 
256
/**
 
257
 * xkl_engine_resume_listen:
 
258
 * @engine: the engine
 
259
 *
 
260
 * Resumes listening for XKB-related events
 
261
 *
 
262
 * Returns: 0
 
263
 */
 
264
        extern gint xkl_engine_resume_listen(XklEngine * engine);
 
265
 
 
266
/**
 
267
 * xkl_engine_grab_key:
 
268
 * @engine: the engine
 
269
 * @keycode: keycode
 
270
 * @modifiers: bitmask of modifiers
 
271
 *
 
272
 * Grabs some key
 
273
 *
 
274
 * Returns: TRUE on success
 
275
 */
 
276
        extern gboolean xkl_engine_grab_key(XklEngine * engine,
 
277
                                            gint keycode, guint modifiers);
 
278
 
 
279
/**
 
280
 * xkl_engine_ungrab_key:
 
281
 * @engine: the engine
 
282
 * @keycode: keycode
 
283
 * @modifiers: bitmask of modifiers
 
284
 *
 
285
 * Ungrabs some key
 
286
 *
 
287
 * Returns: TRUE on success
 
288
 */
 
289
        extern gboolean xkl_engine_ungrab_key(XklEngine * engine,
 
290
                                              gint keycode,
 
291
                                              guint modifiers);
 
292
 
 
293
/**
 
294
 * xkl_engine_filter_events:
 
295
 * @engine: the engine
 
296
 * @evt: delivered X event
 
297
 *
 
298
 * Processes X events. Should be included into the main event cycle of an
 
299
 * application. One of the most important functions. 
 
300
 *
 
301
 * Returns: 0 if the event it processed - 1 otherwise
 
302
 */
 
303
        extern gint xkl_engine_filter_events(XklEngine * engine,
 
304
                                             XEvent * evt);
 
305
 
 
306
/**
 
307
 * xkl_engine_allow_one_switch_to_secondary_group:
 
308
 * @engine: the engine
 
309
 *
 
310
 * Allows to switch (once) to the secondary group
 
311
 *
 
312
 */
 
313
        extern void
 
314
         xkl_engine_allow_one_switch_to_secondary_group(XklEngine *
 
315
                                                        engine);
 
316
 
 
317
/**
 
318
 * xkl_engine_get_current_window:
 
319
 * @engine: the engine
 
320
 *
 
321
 * Returns: currently focused window
 
322
 */
 
323
        extern Window xkl_engine_get_current_window(XklEngine * engine);
 
324
 
 
325
/**
 
326
 * xkl_engine_get_current_state:
 
327
 * @engine: the engine
 
328
 *
 
329
 * Returns: current state of the keyboard.
 
330
 * Returned value is a statically allocated buffer, should not be freed.
 
331
 */
 
332
        extern XklState *xkl_engine_get_current_state(XklEngine * engine);
 
333
 
 
334
/**
 
335
 * xkl_engine_get_window_title:
 
336
 * @engine: the engine
 
337
 * @win: X window
 
338
 *
 
339
 * Returns: the window title of some window or NULL. 
 
340
 * If not NULL, it should be freed with XFree
 
341
 */
 
342
        extern gchar *xkl_engine_get_window_title(XklEngine * engine,
 
343
                                                  Window win);
 
344
 
 
345
/** 
 
346
 * xkl_engine_get_state:
 
347
 * @engine: the engine
 
348
 * @win: window to query
 
349
 * @state_out: structure to store the state
 
350
 * 
 
351
 * Finds the state for a given window (for its "App window").
 
352
 *
 
353
 * Returns: TRUE on success, otherwise FALSE 
 
354
 * (the error message can be obtained using xkl_GetLastError).
 
355
 */
 
356
        extern gboolean xkl_engine_get_state(XklEngine * engine,
 
357
                                             Window win,
 
358
                                             XklState * state_out);
 
359
 
 
360
/**
 
361
 * xkl_engine_delete_state:
 
362
 * @engine: the engine
 
363
 * @win: target window
 
364
 *
 
365
 * Drops the state of a given window (of its "App window").
 
366
 */
 
367
        extern void xkl_engine_delete_state(XklEngine * engine,
 
368
                                            Window win);
 
369
 
 
370
/** 
 
371
 * xkl_engine_save_state:
 
372
 * @engine: the engine
 
373
 * @win: target window
 
374
 * @state: new state of the window
 
375
 *
 
376
 * Stores ths state for a given window
 
377
 */
 
378
        extern void xkl_engine_save_state(XklEngine * engine, Window win,
 
379
                                          XklState * state);
 
380
 
 
381
/**
 
382
 * xkl_engine_set_window_transparent:
 
383
 * @engine: the engine
 
384
 * @win: window do set the flag for.
 
385
 * @transparent: if true, the windows is transparent.
 
386
 *
 
387
 * Sets the "transparent" flag. It means focus switching onto 
 
388
 * this window will never change the state.
 
389
 */
 
390
        extern void xkl_engine_set_window_transparent(XklEngine *
 
391
                                                      engine,
 
392
                                                      Window win,
 
393
                                                      gboolean
 
394
                                                      transparent);
 
395
 
 
396
/**
 
397
 * xkl_engine_is_window_transparent:
 
398
 * @engine: the engine
 
399
 * @win: window to get the transparent flag from.
 
400
 *
 
401
 * Returns: TRUE if the window is "transparent"
 
402
 */
 
403
        extern gboolean xkl_engine_is_window_transparent(XklEngine
 
404
                                                         * engine,
 
405
                                                         Window win);
 
406
 
 
407
/**
 
408
 * xkl_engine_is_window_from_same_toplevel_window:
 
409
 * @engine: the engine
 
410
 * @win1: first window
 
411
 * @win2: second window
 
412
 *
 
413
 * Checks whether 2 windows have the same topmost window
 
414
 *
 
415
 * Returns: TRUE is windows are in the same application
 
416
 */
 
417
        extern gboolean
 
418
            xkl_engine_is_window_from_same_toplevel_window(XklEngine *
 
419
                                                           engine,
 
420
                                                           Window win1,
 
421
                                                           Window win2);
 
422
 
 
423
/**
 
424
 * xkl_engine_get_num_groups:
 
425
 * @engine: the engine
 
426
 *
 
427
 * Returns: the total number of groups in the current configuration 
 
428
 * (keyboard)
 
429
 */
 
430
        extern guint xkl_engine_get_num_groups(XklEngine * engine);
 
431
 
 
432
/**
 
433
 * xkl_engine_get_groups_names:
 
434
 * @engine: the engine
 
435
 *
 
436
 * Returns: the array of group names for the current XKB configuration 
 
437
 * (keyboard).
 
438
 * This array is static, should not be freed
 
439
 */
 
440
        extern const gchar **xkl_engine_get_groups_names(XklEngine *
 
441
                                                         engine);
 
442
 
 
443
/**
 
444
 * xkl_engine_get_indicators_names:
 
445
 * @engine: the engine
 
446
 *
 
447
 * Returns: the array of indicator names for the current XKB configuration 
 
448
 * (keyboard).
 
449
 * This array is static, should not be freed
 
450
 */
 
451
        extern const gchar **xkl_engine_get_indicators_names(XklEngine *
 
452
                                                             engine);
 
453
 
 
454
/**
 
455
 * xkl_engine_get_next_group:
 
456
 * @engine: the engine
 
457
 *
 
458
 * Calculates next group id. Does not change the state of anything.
 
459
 *
 
460
 * Returns: next group id
 
461
 */
 
462
        extern gint xkl_engine_get_next_group(XklEngine * engine);
 
463
 
 
464
/**
 
465
 * xkl_engine_get_prev_group:
 
466
 * @engine: the engine
 
467
 *
 
468
 * Calculates prev group id. Does not change the state of anything.
 
469
 *
 
470
 * Returns: prev group id
 
471
 */
 
472
        extern gint xkl_engine_get_prev_group(XklEngine * engine);
 
473
 
 
474
/**
 
475
 * xkl_engine_get_current_window_group:
 
476
 * @engine: the engine
 
477
 *
 
478
 * Returns: saved group id of the current window. 
 
479
 */
 
480
        extern gint xkl_engine_get_current_window_group(XklEngine *
 
481
                                                        engine);
 
482
 
 
483
/**
 
484
 * xkl_engine_lock_group:
 
485
 * @engine: the engine
 
486
 * @group: group number for locking
 
487
 *
 
488
 * Locks the group. Can be used after xkl_GetXXXGroup functions
 
489
 */
 
490
        extern void xkl_engine_lock_group(XklEngine * engine, gint group);
 
491
 
 
492
/**
 
493
 * xkl_engine_set_group_per_toplevel_window:
 
494
 * @engine: the engine
 
495
 * @is_global: new parameter value
 
496
 *
 
497
 * Sets the configuration parameter: group per application
 
498
 */
 
499
        extern void xkl_engine_set_group_per_toplevel_window(XklEngine *
 
500
                                                             engine,
 
501
                                                             gboolean
 
502
                                                             is_global);
 
503
 
 
504
/**
 
505
 * xkl_engine_is_group_per_toplevel_window:
 
506
 * @engine: the engine
 
507
 * 
 
508
 * Returns: the value of the parameter: group per application
 
509
 */
 
510
        extern gboolean xkl_engine_is_group_per_toplevel_window(XklEngine *
 
511
                                                                engine);
 
512
 
 
513
/**
 
514
 * xkl_engine_set_indicators_handling:
 
515
 * @engine: the engine
 
516
 * @whether_handle: new parameter value
 
517
 *
 
518
 * Sets the configuration parameter: perform indicators handling
 
519
 */
 
520
        extern void xkl_engine_set_indicators_handling(XklEngine * engine,
 
521
                                                       gboolean
 
522
                                                       whether_handle);
 
523
 
 
524
/**
 
525
 * xkl_engine_get_indicators_handling:
 
526
 * @engine: the engine
 
527
 *
 
528
 * Returns: the value of the parameter: perform indicator handling
 
529
 */
 
530
        extern gboolean xkl_engine_get_indicators_handling(XklEngine *
 
531
                                                           engine);
 
532
 
 
533
/**
 
534
 * xkl_engine_set_secondary_groups_mask:
 
535
 * @engine: the engine
 
536
 * @mask: new group mask
 
537
 *
 
538
 * Sets the secondary groups (one bit per group). 
 
539
 * Secondary groups require explicit "allowance" for switching
 
540
 */
 
541
        extern void xkl_engine_set_secondary_groups_mask(XklEngine *
 
542
                                                         engine,
 
543
                                                         guint mask);
 
544
 
 
545
/**
 
546
 * xkl_engine_get_secondary_groups_mask:
 
547
 * @engine: the engine
 
548
 *
 
549
 * Returns: the secondary group mask
 
550
 */
 
551
        extern guint xkl_engine_get_secondary_groups_mask(XklEngine *
 
552
                                                          engine);
 
553
 
 
554
/**
 
555
 * xkl_engine_set_default_group:
 
556
 * @engine: the engine
 
557
 * @group: default group
 
558
 *
 
559
 * Configures the default group set on window creation.
 
560
 * If -1, no default group is used
 
561
 */
 
562
        extern void xkl_engine_set_default_group(XklEngine * engine,
 
563
                                                 gint group);
 
564
 
 
565
/**
 
566
 * xkl_engine_get_default_group:
 
567
 * @engine: the engine
 
568
 *
 
569
 * Returns the default group set on window creation
 
570
 * If -1, no default group is used
 
571
 *
 
572
 * Returns: the default group
 
573
 */
 
574
        extern gint xkl_engine_get_default_group(XklEngine * engine);
 
575
 
 
576
#ifdef __cplusplus
 
577
}
 
578
#endif                          /* __cplusplus */
 
579
#endif