summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2017-10-17 15:17:50 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2017-10-17 17:31:23 +0200
commitaa4c3c9eb783338781ca43fc1f386a38f1ca774c (patch)
treec58b0d2caff1daede9468c35eb13376c4d307620 /src/lib
parent34f11c0a06cf2f56830f55d800079f30ad3b7d35 (diff)
elm_widget: move evaluation for registeration of widget
this is now earlier done, so we can reacted based on that
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/elm_widget.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c
index 24c5285..08c3045 100644
--- a/src/lib/elementary/elm_widget.c
+++ b/src/lib/elementary/elm_widget.c
@@ -377,50 +377,52 @@ _elm_widget_focus_state_apply(Eo *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED, El
377 ); 377 );
378 return EINA_FALSE; 378 return EINA_FALSE;
379} 379}
380
381static void 380static void
382_focus_state_eval(Eo *obj, Elm_Widget_Smart_Data *pd) 381_eval_registration_candidate(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool *should, Eina_Bool *want_full)
383{ 382{
384 Eina_Bool should = EINA_FALSE; 383 *should = *want_full = EINA_FALSE;
385 Eina_Bool want_full = EINA_FALSE; 384 if (pd->can_focus)
386 Elm_Widget_Focus_State configuration; 385 {
387 386 *should = EINA_TRUE;
388 //this would mean we are registering again the root, we dont want that
389 if (pd->manager.manager == obj) return;
390
391 //there are two reasons to be registered, the child count is bigger than 0, or the widget is flagged to be able to handle focus
392 if (pd->can_focus)
393 {
394 should = EINA_TRUE;
395 //can focus can be overridden by the following properties 387 //can focus can be overridden by the following properties
396 388
397 if (_tree_unfocusable(obj)) 389 if (_tree_unfocusable(obj))
398 should = EINA_FALSE; 390 *should = EINA_FALSE;
399 391
400 if (_tree_disabled(obj)) 392 if (_tree_disabled(obj))
401 should = EINA_FALSE; 393 *should = EINA_FALSE;
402 394
403 if (!evas_object_visible_get(obj)) 395 if (!evas_object_visible_get(obj))
404 should = EINA_FALSE; 396 *should = EINA_FALSE;
405 397
406 if (should) 398 if (*should)
407 want_full = EINA_TRUE; 399 *want_full = EINA_TRUE;
408 } 400 }
409 401
410 if (!should && pd->logical.child_count > 0) 402 if (!*should && pd->logical.child_count > 0)
411 { 403 {
412 should = EINA_TRUE; 404 *should = EINA_TRUE;
413 405
414 if (_tree_unfocusable(obj)) 406 if (_tree_unfocusable(obj))
415 should = EINA_FALSE; 407 *should = EINA_FALSE;
416 408
417 if (_tree_disabled(obj)) 409 if (_tree_disabled(obj))
418 should = EINA_FALSE; 410 *should = EINA_FALSE;
419 411
420 if (!evas_object_visible_get(obj)) 412 if (!evas_object_visible_get(obj))
421 should = EINA_FALSE; 413 *should = EINA_FALSE;
422 } 414 }
415}
423 416
417static void
418_focus_state_eval(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool should, Eina_Bool want_full)
419{
420 Elm_Widget_Focus_State configuration;
421
422 //this would mean we are registering again the root, we dont want that
423 if (pd->manager.manager == obj) return;
424
425 //there are two reasons to be registered, the child count is bigger than 0, or the widget is flagged to be able to handle focus
424 if (should) 426 if (should)
425 { 427 {
426 configuration.parent = pd->logical.parent; 428 configuration.parent = pd->logical.parent;
@@ -506,6 +508,9 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
506{ 508{
507 Efl_Ui_Focus_Object *old_parent; 509 Efl_Ui_Focus_Object *old_parent;
508 Efl_Ui_Focus_Object *old_registered_parent, *old_registered_manager; 510 Efl_Ui_Focus_Object *old_registered_parent, *old_registered_manager;
511 Eina_Bool should, want_full;
512
513 _eval_registration_candidate(obj, pd, &should, &want_full);
509 514
510 old_parent = _logical_parent_eval(obj, pd); 515 old_parent = _logical_parent_eval(obj, pd);
511 516
@@ -527,7 +532,7 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
527 old_registered_parent = pd->focus.parent; 532 old_registered_parent = pd->focus.parent;
528 old_registered_manager = pd->focus.manager; 533 old_registered_manager = pd->focus.manager;
529 534
530 _focus_state_eval(obj, pd); 535 _focus_state_eval(obj, pd, should, want_full);
531 536
532 if (old_registered_parent != pd->focus.parent) 537 if (old_registered_parent != pd->focus.parent)
533 { 538 {