summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-06-02 23:11:16 +0200
committerBoris Faure <billiob@gmail.com>2015-06-02 23:11:16 +0200
commitbac8e078c79c86f856c0a303ca3d1724467d4553 (patch)
treec63b7b2f3db71725c5805365d50e45f102e33dbf /src
parent1f3f779258c86b170edb3e634548a446fe5c9b58 (diff)
add some debug to fix focus issues
Diffstat (limited to 'src')
-rw-r--r--src/bin/win.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/src/bin/win.c b/src/bin/win.c
index 2bfea24..941e954 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -15,6 +15,21 @@
15#include "controls.h" 15#include "controls.h"
16#include "term_container.h" 16#include "term_container.h"
17 17
18/* specific log domain to help debug only terminal code parser */
19int _win_log_dom = -1;
20
21#undef CRITICAL
22#undef ERR
23#undef WRN
24#undef INF
25#undef DBG
26
27#define CRITICAL(...) EINA_LOG_DOM_CRIT(_win_log_dom, __VA_ARGS__)
28#define ERR(...) EINA_LOG_DOM_ERR(_win_log_dom, __VA_ARGS__)
29#define WRN(...) EINA_LOG_DOM_WARN(_win_log_dom, __VA_ARGS__)
30#define INF(...) EINA_LOG_DOM_INFO(_win_log_dom, __VA_ARGS__)
31#define DBG(...) EINA_LOG_DOM_DBG(_win_log_dom, __VA_ARGS__)
32
18#if (ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 8) 33#if (ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 8)
19 #define PANES_TOP "left" 34 #define PANES_TOP "left"
20 #define PANES_BOTTOM "right" 35 #define PANES_BOTTOM "right"
@@ -303,6 +318,8 @@ _solo_unfocus(Term_Container *tc, Term_Container *relative)
303 solo = (Solo*) tc; 318 solo = (Solo*) tc;
304 term = solo->term; 319 term = solo->term;
305 320
321 DBG("tc:%p tc->is_focused:%d from_parent:%d",
322 tc, tc->is_focused, tc->parent == relative);
306 if (!tc->is_focused) 323 if (!tc->is_focused)
307 return; 324 return;
308 325
@@ -329,6 +346,8 @@ _solo_focus(Term_Container *tc, Term_Container *relative)
329 solo = (Solo*) tc; 346 solo = (Solo*) tc;
330 term = solo->term; 347 term = solo->term;
331 348
349 DBG("tc:%p tc->is_focused:%d from_parent:%d",
350 tc, tc->is_focused, tc->parent == relative);
332 if (tc->is_focused) 351 if (tc->is_focused)
333 return; 352 return;
334 353
@@ -411,6 +430,8 @@ _cb_win_focus_in(void *data,
411 Term_Container *tc = (Term_Container*) wn; 430 Term_Container *tc = (Term_Container*) wn;
412 Term *term; 431 Term *term;
413 432
433 DBG("tc:%p tc->is_focused:%d",
434 tc, tc->is_focused);
414 if (!tc->is_focused) 435 if (!tc->is_focused)
415 elm_win_urgent_set(wn->win, EINA_FALSE); 436 elm_win_urgent_set(wn->win, EINA_FALSE);
416 tc->is_focused = EINA_TRUE; 437 tc->is_focused = EINA_TRUE;
@@ -452,6 +473,8 @@ _cb_win_focus_out(void *data, Evas_Object *obj EINA_UNUSED,
452 Win *wn = data; 473 Win *wn = data;
453 Term_Container *tc = (Term_Container*) wn; 474 Term_Container *tc = (Term_Container*) wn;
454 475
476 DBG("tc:%p tc->is_focused:%d",
477 tc, tc->is_focused);
455 tc->unfocus(tc, NULL); 478 tc->unfocus(tc, NULL);
456} 479}
457 480
@@ -465,6 +488,8 @@ _win_is_focused(Win *wn)
465 488
466 tc = (Term_Container*) wn; 489 tc = (Term_Container*) wn;
467 490
491 DBG("tc:%p tc->is_focused:%d",
492 tc, tc->is_focused);
468 return tc->is_focused; 493 return tc->is_focused;
469} 494}
470 495
@@ -795,13 +820,15 @@ _win_close(Term_Container *tc, Term_Container *child EINA_UNUSED)
795} 820}
796 821
797static void 822static void
798_win_focus(Term_Container *tc, Term_Container *child) 823_win_focus(Term_Container *tc, Term_Container *relative)
799{ 824{
800 Win *wn; 825 Win *wn;
801 assert (tc->type == TERM_CONTAINER_TYPE_WIN); 826 assert (tc->type == TERM_CONTAINER_TYPE_WIN);
802 827
803 wn = (Win*) tc; 828 wn = (Win*) tc;
804 if (child != wn->child) 829 DBG("tc:%p tc->is_focused:%d from_child:%d",
830 tc, tc->is_focused, wn->child == relative);
831 if (relative != wn->child)
805 wn->child->focus(wn->child, tc); 832 wn->child->focus(wn->child, tc);
806 833
807 if (!tc->is_focused) elm_win_urgent_set(wn->win, EINA_FALSE); 834 if (!tc->is_focused) elm_win_urgent_set(wn->win, EINA_FALSE);
@@ -816,6 +843,8 @@ _win_unfocus(Term_Container *tc, Term_Container *relative)
816 843
817 wn = (Win*) tc; 844 wn = (Win*) tc;
818 845
846 DBG("tc:%p tc->is_focused:%d from_child:%d",
847 tc, tc->is_focused, wn->child == relative);
819 if (relative != wn->child) 848 if (relative != wn->child)
820 { 849 {
821 tc->is_focused = EINA_FALSE; 850 tc->is_focused = EINA_FALSE;
@@ -1260,6 +1289,8 @@ _split_focus(Term_Container *tc, Term_Container *relative)
1260 assert (tc->type == TERM_CONTAINER_TYPE_SPLIT); 1289 assert (tc->type == TERM_CONTAINER_TYPE_SPLIT);
1261 split = (Split*) tc; 1290 split = (Split*) tc;
1262 1291
1292 DBG("tc:%p tc->is_focused:%d from_parent:%d",
1293 tc, tc->is_focused, tc->parent == relative);
1263 if (tc->parent == relative) 1294 if (tc->parent == relative)
1264 { 1295 {
1265 tc->is_focused = EINA_TRUE; 1296 tc->is_focused = EINA_TRUE;
@@ -1283,6 +1314,8 @@ _split_unfocus(Term_Container *tc, Term_Container *relative)
1283 assert (tc->type == TERM_CONTAINER_TYPE_SPLIT); 1314 assert (tc->type == TERM_CONTAINER_TYPE_SPLIT);
1284 split = (Split*) tc; 1315 split = (Split*) tc;
1285 1316
1317 DBG("tc:%p tc->is_focused:%d from_parent:%d",
1318 tc, tc->is_focused, tc->parent == relative);
1286 if (!tc->is_focused) 1319 if (!tc->is_focused)
1287 return; 1320 return;
1288 1321
@@ -2276,6 +2309,8 @@ _tabs_focus(Term_Container *tc, Term_Container *relative)
2276 assert (tc->type == TERM_CONTAINER_TYPE_TABS); 2309 assert (tc->type == TERM_CONTAINER_TYPE_TABS);
2277 tabs = (Tabs*) tc; 2310 tabs = (Tabs*) tc;
2278 2311
2312 DBG("tc:%p tc->is_focused:%d from_parent:%d",
2313 tc, tc->is_focused, tc->parent == relative);
2279 if (tc->parent == relative) 2314 if (tc->parent == relative)
2280 { 2315 {
2281 if (!tc->is_focused) 2316 if (!tc->is_focused)
@@ -2317,6 +2352,8 @@ _tabs_unfocus(Term_Container *tc, Term_Container *relative)
2317{ 2352{
2318 Tabs *tabs; 2353 Tabs *tabs;
2319 2354
2355 DBG("tc:%p tc->is_focused:%d from_parent:%d",
2356 tc, tc->is_focused, tc->parent == relative);
2320 if (!tc->is_focused) 2357 if (!tc->is_focused)
2321 return; 2358 return;
2322 2359
@@ -2634,6 +2671,7 @@ _term_is_focused(Term *term)
2634 if (!tc) 2671 if (!tc)
2635 return EINA_FALSE; 2672 return EINA_FALSE;
2636 2673
2674 DBG("tc:%p tc->is_focused:%d", tc, tc->is_focused);
2637 return tc->is_focused; 2675 return tc->is_focused;
2638} 2676}
2639 2677
@@ -2671,6 +2709,7 @@ _term_focus(Term *term)
2671 return; 2709 return;
2672 2710
2673 tc = term->container; 2711 tc = term->container;
2712 DBG("tc:%p", tc);
2674 tc->focus(tc, tc); 2713 tc->focus(tc, tc);
2675} 2714}
2676 2715
@@ -2683,6 +2722,7 @@ term_unfocus(Term *term)
2683 return; 2722 return;
2684 2723
2685 tc = term->container; 2724 tc = term->container;
2725 DBG("tc:%p", tc);
2686 tc->unfocus(tc, tc); 2726 tc->unfocus(tc, tc);
2687} 2727}
2688 2728
@@ -3797,6 +3837,7 @@ _cb_options_done(void *data)
3797 return; 3837 return;
3798 } 3838 }
3799 } 3839 }
3840 DBG("tc:%p", tc);
3800 tc->focus(tc, tc); 3841 tc->focus(tc, tc);
3801} 3842}
3802 3843
@@ -3859,6 +3900,12 @@ term_new(Win *wn, Config *config, const char *cmd,
3859 if (!config) abort(); 3900 if (!config) abort();
3860 3901
3861 /* TODO: clean up that */ 3902 /* TODO: clean up that */
3903 if (_win_log_dom < 0)
3904 {
3905 _win_log_dom = eina_log_domain_register("win", NULL);
3906 if (_win_log_dom < 0)
3907 EINA_LOG_CRIT("Could not create logging domain '%s'.", "win");
3908 }
3862 termpty_init(); 3909 termpty_init();
3863 miniview_init(); 3910 miniview_init();
3864 gravatar_init(); 3911 gravatar_init();
@@ -3983,6 +4030,11 @@ windows_free(void)
3983 wn = eina_list_data_get(wins); 4030 wn = eina_list_data_get(wins);
3984 win_free(wn); 4031 win_free(wn);
3985 } 4032 }
4033
4034 /* TODO: ugly */
4035 if (_win_log_dom < 0) return;
4036 eina_log_domain_unregister(_win_log_dom);
4037 _win_log_dom = -1;
3986} 4038}
3987 4039
3988void 4040void