summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-05-12 20:47:57 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-05-12 20:54:22 +0200
commitce6d2285f175c95b3b14e31a5c83ff1146d8629b (patch)
treee7e4aa6b08053f7dcc65b1f79b383345d1d5b8fa
parentb5ac82d7488fc9ba0aed41db6f54b6c3657744cd (diff)
e_xkb: split up e_xkb_update
before the function had the semantics that -1 flushes the set of layouts back to the displayservice. Now its done with e_xkb_reconfig.
-rw-r--r--src/bin/e_xkb.c63
-rw-r--r--src/bin/e_xkb.h1
-rw-r--r--src/modules/wizard/page_011.c2
3 files changed, 41 insertions, 25 deletions
diff --git a/src/bin/e_xkb.c b/src/bin/e_xkb.c
index b2fd02ede..8f6e5aac4 100644
--- a/src/bin/e_xkb.c
+++ b/src/bin/e_xkb.c
@@ -1,7 +1,9 @@
1#include "e.h" 1#include "e.h"
2 2
3static void _e_xkb_update_event(int); 3static void _e_xkb_update_event(int);
4static void _e_xkb_type_update(E_Pixmap_Type comp_type, int cur_group); 4
5static void _e_xkb_type_reconfig(E_Pixmap_Type comp_type);
6
5static int _e_xkb_cur_group = -1; 7static int _e_xkb_cur_group = -1;
6static Ecore_Event_Handler *xkb_state_handler = NULL, *xkb_new_keyboard_handler = NULL; 8static Ecore_Event_Handler *xkb_state_handler = NULL, *xkb_new_keyboard_handler = NULL;
7 9
@@ -64,7 +66,7 @@ _xkb_new_keyboard(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA
64 } 66 }
65 67
66 //we have to restore our settings here 68 //we have to restore our settings here
67 e_xkb_update(-1); 69 e_xkb_reconfig();
68 e_xkb_update(e_config->xkb.cur_group); 70 e_xkb_update(e_config->xkb.cur_group);
69 71
70 return ECORE_CALLBACK_PASS_ON; 72 return ECORE_CALLBACK_PASS_ON;
@@ -97,7 +99,7 @@ e_xkb_init(E_Pixmap_Type comp_type)
97 } 99 }
98#endif 100#endif
99 if (e_config->xkb.dont_touch_my_damn_keyboard) return 1; 101 if (e_config->xkb.dont_touch_my_damn_keyboard) return 1;
100 _e_xkb_type_update(comp_type, -1); 102 _e_xkb_type_reconfig(comp_type);
101 if (e_config->xkb.cur_layout) 103 if (e_config->xkb.cur_layout)
102 ecore_timer_add(1.5, _e_xkb_init_timer, e_config->xkb.current_layout); 104 ecore_timer_add(1.5, _e_xkb_init_timer, e_config->xkb.current_layout);
103 else if (e_config->xkb.selected_layout) 105 else if (e_config->xkb.selected_layout)
@@ -120,7 +122,7 @@ e_xkb_shutdown(void)
120} 122}
121 123
122static void 124static void
123_e_x_xkb_update(int cur_group) 125_e_x_xkb_reconfig(void)
124{ 126{
125 E_Config_XKB_Layout *cl; 127 E_Config_XKB_Layout *cl;
126 E_Config_XKB_Option *op; 128 E_Config_XKB_Option *op;
@@ -130,20 +132,6 @@ _e_x_xkb_update(int cur_group)
130 if (e_config->xkb.dont_touch_my_damn_keyboard) return; 132 if (e_config->xkb.dont_touch_my_damn_keyboard) return;
131 if ((!e_config->xkb.used_layouts) && (!e_config->xkb.used_options) && (!e_config->xkb.default_model)) return; 133 if ((!e_config->xkb.used_layouts) && (!e_config->xkb.used_options) && (!e_config->xkb.default_model)) return;
132 if (!getenv("DISPLAY")) return; 134 if (!getenv("DISPLAY")) return;
133 if (cur_group != -1)
134 {
135 _e_xkb_cur_group = cur_group;
136#ifndef HAVE_WAYLAND_ONLY
137 if (e_comp->root)
138 ecore_x_xkb_select_group(cur_group);
139#endif
140 e_deskenv_xmodmap_run();
141 _e_xkb_update_event(cur_group);
142 return;
143 }
144 /* We put an empty -option here in order to override all previously
145 * set options.
146 */
147 135
148 buf = eina_strbuf_new(); 136 buf = eina_strbuf_new();
149 eina_strbuf_append(buf, "setxkbmap "); 137 eina_strbuf_append(buf, "setxkbmap ");
@@ -219,6 +207,25 @@ _e_x_xkb_update(int cur_group)
219} 207}
220 208
221static void 209static void
210_e_x_xkb_update(int cur_group)
211{
212 if (e_config->xkb.dont_touch_my_damn_keyboard) return;
213 if ((!e_config->xkb.used_layouts) && (!e_config->xkb.used_options) && (!e_config->xkb.default_model)) return;
214 if (!getenv("DISPLAY")) return;
215 if (cur_group != -1)
216 {
217 _e_xkb_cur_group = cur_group;
218#ifndef HAVE_WAYLAND_ONLY
219 if (e_comp->root)
220 ecore_x_xkb_select_group(cur_group);
221#endif
222 e_deskenv_xmodmap_run();
223 _e_xkb_update_event(cur_group);
224 return;
225 }
226}
227
228static void
222_e_wl_xkb_update(int cur_group) 229_e_wl_xkb_update(int cur_group)
223{ 230{
224#ifdef HAVE_WAYLAND 231#ifdef HAVE_WAYLAND
@@ -305,18 +312,26 @@ _e_wl_xkb_update(int cur_group)
305} 312}
306 313
307static void 314static void
308_e_xkb_type_update(E_Pixmap_Type comp_type, int cur_group) 315_e_xkb_type_reconfig(E_Pixmap_Type comp_type)
309{ 316{
310 if (comp_type == E_PIXMAP_TYPE_WL) 317 if (comp_type == E_PIXMAP_TYPE_X)
311 _e_wl_xkb_update(cur_group); 318 _e_x_xkb_reconfig();
312 else 319 //we dont need to init wl yet
313 _e_x_xkb_update(cur_group); 320}
321
322E_API void
323e_xkb_reconfig(void)
324{
325 _e_xkb_type_reconfig(e_comp->comp_type);
314} 326}
315 327
316E_API void 328E_API void
317e_xkb_update(int cur_group) 329e_xkb_update(int cur_group)
318{ 330{
319 _e_xkb_type_update(e_comp->comp_type, cur_group); 331 if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
332 _e_wl_xkb_update(cur_group);
333 else
334 _e_x_xkb_update(cur_group);
320} 335}
321 336
322E_API void 337E_API void
diff --git a/src/bin/e_xkb.h b/src/bin/e_xkb.h
index 9520e46e6..49f153fb4 100644
--- a/src/bin/e_xkb.h
+++ b/src/bin/e_xkb.h
@@ -5,6 +5,7 @@
5 5
6E_API int e_xkb_init(E_Pixmap_Type comp_type); 6E_API int e_xkb_init(E_Pixmap_Type comp_type);
7E_API int e_xkb_shutdown(void); 7E_API int e_xkb_shutdown(void);
8E_API void e_xkb_reconfig(void);
8E_API void e_xkb_update(int); 9E_API void e_xkb_update(int);
9E_API void e_xkb_layout_next(void); 10E_API void e_xkb_layout_next(void);
10E_API void e_xkb_layout_prev(void); 11E_API void e_xkb_layout_prev(void);
diff --git a/src/modules/wizard/page_011.c b/src/modules/wizard/page_011.c
index d25a49850..2acaf5dbe 100644
--- a/src/modules/wizard/page_011.c
+++ b/src/modules/wizard/page_011.c
@@ -115,7 +115,7 @@ implement_layout(void)
115 nl->variant = eina_stringshare_add("basic"); 115 nl->variant = eina_stringshare_add("basic");
116 nl->model = eina_stringshare_add("default"); 116 nl->model = eina_stringshare_add("default");
117 e_config->xkb.used_layouts = eina_list_prepend(e_config->xkb.used_layouts, nl); 117 e_config->xkb.used_layouts = eina_list_prepend(e_config->xkb.used_layouts, nl);
118 e_xkb_update(-1); 118 e_xkb_reconfig();
119 } 119 }
120 e_xkb_layout_set(nl); 120 e_xkb_layout_set(nl);
121} 121}