Rename lxpanel_button_set_icon2() into lxpanel_button_update_icon().
[lxde/lxpanel.git] / src / plugins / xkb / xkb.h
1 /*
2 //====================================================================
3 // xfce4-xkb-plugin - XFCE4 Xkb Layout Indicator panel plugin
4 // -------------------------------------------------------------------
5 // Alexander Iliev <sasoiliev@mamul.org>
6 // 20-Feb-04
7 // -------------------------------------------------------------------
8 // Parts of this code belong to Michael Glickman <wmalms@yahooo.com>
9 // and his program wmxkb.
10 // WARNING: DO NOT BOTHER Michael Glickman WITH QUESTIONS ABOUT THIS
11 // PROGRAM!!! SEND INSTEAD EMAILS TO <sasoiliev@mamul.org>
12 //====================================================================
13 */
14
15 /* Modified by Hong Jen Yee (PCMan) <pcman.tw@gmail.com> on 2008-04-06 for lxpanel */
16
17 /* Modified by Giuseppe Penone <giuspen@gmail.com> starting from 2012-07 and lxpanel 0.5.10 */
18
19 #ifndef _XKB_PLUGIN_H_
20 #define _XKB_PLUGIN_H_
21
22 #include <X11/Xlib.h>
23 #include <X11/XKBlib.h>
24 #include <gtk/gtk.h>
25 #include <glib.h>
26
27 #include "private.h"
28 #include "misc.h"
29 #include "panel.h"
30 #include "ev.h"
31
32 #include "dbg.h"
33
34 typedef enum {
35 DISP_TYPE_IMAGE=0,
36 DISP_TYPE_TEXT=1,
37 DISP_TYPE_IMAGE_CUST=2
38 } DisplayType;
39
40 typedef struct {
41
42 /* Plugin interface. */
43 Plugin *p_plugin; /* Back pointer to Plugin */
44 GtkWidget *p_label; /* Label containing country name */
45 GtkWidget *p_image; /* Image containing country flag */
46 DisplayType display_type; /* Display layout as image or text */
47 gboolean enable_perwin; /* Enable per window layout */
48 gboolean do_not_reset_opt; /* Do not reset options in setxkbmap */
49 gboolean keep_system_layouts; /* Keey system layouts, skip setxkbmap */
50 guint source_id; /* Source ID for channel listening to XKB events */
51 GtkWidget *p_dialog_config; /* Configuration dialog */
52 GtkListStore *p_liststore_layout;
53 GtkWidget *p_treeview_layout;
54 GtkTreeSelection *p_treeselection_layout;
55 GtkWidget *p_button_kbd_model;
56 GtkWidget *p_button_change_layout;
57 GtkWidget *p_button_rm_layout;
58 GtkWidget *p_frame_kbd_model, *p_frame_kbd_layouts, *p_frame_change_layout;
59 GtkWidget *p_entry_advanced_opt, *p_checkbutton_no_reset_opt;
60
61 /* Mechanism. */
62 int base_event_code; /* Result of initializing Xkb extension */
63 int base_error_code;
64 int current_group_xkb_no; /* Current layout */
65 int group_count; /* Count of groups as returned by Xkb */
66 char *group_names[XkbNumKbdGroups]; /* Group names as returned by Xkb */
67 char *symbol_names[XkbNumKbdGroups]; /* Symbol names as returned by Xkb */
68 GHashTable *p_hash_table_group; /* Hash table to correlate window with layout */
69 gchar *kbd_model;
70 gchar *kbd_layouts;
71 gchar *kbd_variants;
72 gchar *kbd_change_option;
73 gchar *kbd_advanced_options;
74 guchar flag_size;
75 GString *p_gstring_layouts_partial;
76 GString *p_gstring_variants_partial;
77 int num_layouts;
78 gboolean cust_dir_exists;
79
80 } XkbPlugin;
81
82 #define MAX_MARKUP_LEN 64
83 #define MAX_ROW_LEN 64
84
85 extern void xkb_redraw(XkbPlugin * xkb);
86 extern void xkb_setxkbmap(XkbPlugin *p_xkb);
87
88 extern int xkb_get_current_group_xkb_no(XkbPlugin * xkb);
89 extern int xkb_get_group_count(XkbPlugin * xkb);
90 extern const char * xkb_get_symbol_name_by_res_no(XkbPlugin * xkb, int group_res_no);
91 extern const char * xkb_get_current_group_name(XkbPlugin * xkb);
92 extern const char * xkb_get_current_symbol_name(XkbPlugin * xkb);
93 extern const char * xkb_get_current_symbol_name_lowercase(XkbPlugin * xkb);
94 extern void xkb_mechanism_constructor(XkbPlugin * xkb);
95 extern void xkb_mechanism_destructor(XkbPlugin * xkb);
96 extern int xkb_change_group(XkbPlugin * xkb, int increment);
97 extern void xkb_active_window_changed(XkbPlugin * xkb, Window window);
98
99 #endif
100