summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@enlightenment.org>2013-11-21 12:38:35 -0500
committerMike Blumenkrantz <zmike@enlightenment.org>2013-11-21 12:38:35 -0500
commit848dec15fb4882691dd0982aab41780b65bd6ce4 (patch)
treed6a213c8b34c75688c0cfc28e6173b3239aab383
parentdf4b3baf300ec1570ba394de4dbfc272bc5dc539 (diff)
revise d739ed0e2ecd8eab1bdf4d30b5fd40faba4c0533 to not break changing focus policies
thise commit added focus_policy member to E_Border as something to be used for setting a per-window focus policy. setting it on each window is a huge pain if the global policy ever changes, so it's better to use this member only as an override for the global policy which can be checked to see if it's been set
-rw-r--r--src/bin/e_border.c4
-rw-r--r--src/bin/e_border.h15
-rw-r--r--src/bin/e_focus.c14
3 files changed, 22 insertions, 11 deletions
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
index 462c8e015..40ee0cfa7 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -420,7 +420,7 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal)
420 ecore_x_window_shadow_tree_flush(); 420 ecore_x_window_shadow_tree_flush();
421 e_object_del_func_set(E_OBJECT(bd), E_OBJECT_CLEANUP_FUNC(_e_border_del)); 421 e_object_del_func_set(E_OBJECT(bd), E_OBJECT_CLEANUP_FUNC(_e_border_del));
422 422
423 bd->focus_policy = e_config->focus_policy; 423 bd->focus_policy_override = E_FOCUS_LAST;
424 bd->w = 1; 424 bd->w = 1;
425 bd->h = 1; 425 bd->h = 1;
426 /* FIXME: ewww - round trip */ 426 /* FIXME: ewww - round trip */
@@ -7284,7 +7284,7 @@ _e_border_eval0(E_Border *bd)
7284 } 7284 }
7285 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DESKTOP) 7285 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DESKTOP)
7286 { 7286 {
7287 bd->focus_policy = E_FOCUS_CLICK; 7287 bd->focus_policy_override = E_FOCUS_CLICK;
7288 e_focus_setup(bd); 7288 e_focus_setup(bd);
7289 if (!bd->client.netwm.state.skip_pager) 7289 if (!bd->client.netwm.state.skip_pager)
7290 { 7290 {
diff --git a/src/bin/e_border.h b/src/bin/e_border.h
index 0b28fe7d2..fff74992f 100644
--- a/src/bin/e_border.h
+++ b/src/bin/e_border.h
@@ -46,7 +46,8 @@ typedef enum _E_Focus_Policy
46{ 46{
47 E_FOCUS_CLICK, 47 E_FOCUS_CLICK,
48 E_FOCUS_MOUSE, 48 E_FOCUS_MOUSE,
49 E_FOCUS_SLOPPY 49 E_FOCUS_SLOPPY,
50 E_FOCUS_LAST
50} E_Focus_Policy; 51} E_Focus_Policy;
51 52
52typedef enum _E_Urgency_Policy 53typedef enum _E_Urgency_Policy
@@ -667,7 +668,7 @@ struct _E_Border
667 Eina_Bool argb; 668 Eina_Bool argb;
668 669
669 int tmp_input_hidden; 670 int tmp_input_hidden;
670 int focus_policy; 671 E_Focus_Policy focus_policy_override;
671}; 672};
672 673
673struct _E_Border_Pending_Move_Resize 674struct _E_Border_Pending_Move_Resize
@@ -857,6 +858,16 @@ e_border_inset_height_get(const E_Border *bd)
857 return bd->client_inset.t + bd->client_inset.b; 858 return bd->client_inset.t + bd->client_inset.b;
858} 859}
859 860
861/* e_config not available everywhere e_border.h is used...
862static inline Eina_Bool
863e_border_focus_policy_click(const E_Border *bd)
864{
865 return ((bd->focus_policy_override == E_FOCUS_CLICK) || (e_config->focus_policy == E_FOCUS_CLICK));
866}
867*/
868#define e_border_focus_policy_click(bd) \
869 ((bd->focus_policy_override == E_FOCUS_CLICK) || (e_config->focus_policy == E_FOCUS_CLICK))
870
860/* macro for finding misuse of changed flag */ 871/* macro for finding misuse of changed flag */
861#if 0 872#if 0
862# define BD_CHANGED(BD) \ 873# define BD_CHANGED(BD) \
diff --git a/src/bin/e_focus.c b/src/bin/e_focus.c
index 3a45779e6..11836fee2 100644
--- a/src/bin/e_focus.c
+++ b/src/bin/e_focus.c
@@ -27,8 +27,8 @@ e_focus_idler_before(void)
27EAPI void 27EAPI void
28e_focus_event_mouse_in(E_Border *bd) 28e_focus_event_mouse_in(E_Border *bd)
29{ 29{
30 if ((bd->focus_policy == E_FOCUS_MOUSE) || 30 if ((e_config->focus_policy == E_FOCUS_MOUSE) ||
31 (bd->focus_policy == E_FOCUS_SLOPPY)) 31 (e_config->focus_policy == E_FOCUS_SLOPPY))
32 { 32 {
33 e_border_focus_set(bd, 1, 1); 33 e_border_focus_set(bd, 1, 1);
34 } 34 }
@@ -49,7 +49,7 @@ e_focus_event_mouse_in(E_Border *bd)
49EAPI void 49EAPI void
50e_focus_event_mouse_out(E_Border *bd) 50e_focus_event_mouse_out(E_Border *bd)
51{ 51{
52 if (bd->focus_policy == E_FOCUS_MOUSE) 52 if (e_config->focus_policy == E_FOCUS_MOUSE)
53 { 53 {
54 if (!bd->lock_focus_in) 54 if (!bd->lock_focus_in)
55 { 55 {
@@ -65,7 +65,7 @@ e_focus_event_mouse_down(E_Border *bd)
65{ 65{
66 if (!bd->focused) 66 if (!bd->focused)
67 { 67 {
68 if (bd->focus_policy == E_FOCUS_CLICK) 68 if (e_border_focus_policy_click(bd))
69 e_border_focus_set(bd, 1, 1); 69 e_border_focus_set(bd, 1, 1);
70 else if (e_config->always_click_to_focus) 70 else if (e_config->always_click_to_focus)
71 e_border_focus_set(bd, 1, 1); 71 e_border_focus_set(bd, 1, 1);
@@ -85,7 +85,7 @@ e_focus_event_mouse_up(E_Border *bd __UNUSED__)
85EAPI void 85EAPI void
86e_focus_event_focus_in(E_Border *bd) 86e_focus_event_focus_in(E_Border *bd)
87{ 87{
88 if ((bd->focus_policy == E_FOCUS_CLICK) && 88 if ((e_border_focus_policy_click(bd)) &&
89 (!e_config->always_click_to_raise) && 89 (!e_config->always_click_to_raise) &&
90 (!e_config->always_click_to_focus)) 90 (!e_config->always_click_to_focus))
91 { 91 {
@@ -104,7 +104,7 @@ e_focus_event_focus_in(E_Border *bd)
104EAPI void 104EAPI void
105e_focus_event_focus_out(E_Border *bd) 105e_focus_event_focus_out(E_Border *bd)
106{ 106{
107 if ((bd->focus_policy == E_FOCUS_CLICK) && 107 if ((e_border_focus_policy_click(bd)) &&
108 (!e_config->always_click_to_raise) && 108 (!e_config->always_click_to_raise) &&
109 (!e_config->always_click_to_focus)) 109 (!e_config->always_click_to_focus))
110 { 110 {
@@ -128,7 +128,7 @@ e_focus_event_focus_out(E_Border *bd)
128EAPI void 128EAPI void
129e_focus_setup(E_Border *bd) 129e_focus_setup(E_Border *bd)
130{ 130{
131 if ((bd->focus_policy == E_FOCUS_CLICK) || 131 if ((e_border_focus_policy_click(bd)) ||
132 (e_config->always_click_to_raise) || 132 (e_config->always_click_to_raise) ||
133 (e_config->always_click_to_focus)) 133 (e_config->always_click_to_focus))
134 { 134 {