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 __XKLAVIER_PRIVATE_XMM_H__
21 #define __XKLAVIER_PRIVATE_XMM_H__
22 
23 typedef struct _XmmShortcut {
24 	guint keysym;
25 	guint modifiers;
26 } XmmShortcut;
27 
28 #define MAX_SHORTCUTS_PER_OPTION 4
29 typedef struct _XmmSwitchOption {
30 	XmmShortcut shortcuts[MAX_SHORTCUTS_PER_OPTION + 1];
31 	gint shortcut_steps[MAX_SHORTCUTS_PER_OPTION + 1];
32 } XmmSwitchOption;
33 
34 typedef struct _XklXmm {
35 	gchar *current_rules;
36 
37 	XklConfigRec current_config;
38 
39 	Atom state_atom;
40 
41 	GHashTable *switch_options;
42 } XklXmm;
43 
44 /* in the ideal world this should be a hashmap */
45 extern void xkl_xmm_grab_ignoring_indicators(XklEngine * engine,
46 					     gint keycode,
47 					     guint modifiers);
48 
49 extern void xkl_xmm_ungrab_ignoring_indicators(XklEngine * engine,
50 					       gint keycode,
51 					       guint modifiers);
52 
53 extern void xkl_xmm_shortcuts_grab(XklEngine * engine);
54 
55 extern void xkl_xmm_shortcuts_ungrab(XklEngine * engine);
56 
57 extern const gchar *xkl_xmm_shortcut_get_current_option_name(XklEngine *
58 							     engine);
59 
60 XmmSwitchOption *xkl_xmm_shortcut_get_current(XklEngine * engine);
61 
62 extern void xkl_xmm_actualize_group(XklEngine * engine, gint group);
63 
64 const XmmSwitchOption *xkl_xmm_find_switch_option(XklEngine * engine,
65 						  gint keycode,
66 						  guint state,
67 						  gint *
68 						  current_shortcut_out);
69 
70 extern void xkl_xmm_init_switch_options(XklXmm * xmm);
71 
72 extern void xkl_xmm_term_switch_options(XklXmm * xmm);
73 /* Start VTable methods */
74 
75 extern gboolean xkl_xmm_activate_config_rec(XklEngine * engine,
76 					    const XklConfigRec * data);
77 
78 extern void xkl_xmm_init_config_registry(XklConfigRegistry * config);
79 
80 extern gboolean xkl_xmm_load_config_registry(XklConfigRegistry * config,
81 					     gboolean if_extras_needed);
82 
83 extern gint xkl_xmm_process_x_event(XklEngine * engine, XEvent * kev);
84 
85 extern void xkl_xmm_free_all_info(XklEngine * engine);
86 
87 extern const gchar **xkl_xmm_get_groups_names(XklEngine * engine);
88 
89 extern guint xkl_xmm_get_max_num_groups(XklEngine * engine);
90 
91 extern guint xkl_xmm_get_num_groups(XklEngine * engine);
92 
93 extern void xkl_xmm_lock_group(XklEngine * engine, gint group);
94 
95 extern void xkl_xmm_get_server_state(XklEngine * engine,
96 				     XklState * current_state_out);
97 
98 extern gboolean xkl_xmm_if_cached_info_equals_actual(XklEngine * engine);
99 
100 extern gboolean xkl_xmm_load_all_info(XklEngine * engine);
101 
102 extern gint xkl_xmm_listen_pause(XklEngine * engine);
103 
104 extern gint xkl_xmm_listen_resume(XklEngine * engine);
105 
106 extern void xkl_xmm_set_indicators(XklEngine * engine,
107 				   const XklState * window_state);
108 
109 extern void xkl_xmm_term(XklEngine * engine);
110 
111 /* End of VTable methods */
112 
113 #endif
114