summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@enlightenment.org>2013-11-21 12:38:35 -0500
committerCedric BAIL <cedric@osg.samsung.com>2015-08-17 18:10:11 +0200
commit22651a4318ea839744578af872ec10f42b1654cc (patch)
tree65e5f211707767d3e34d5f64c162087dfaa9fa1b
parent5f042a480c7e951539904ab2e4ab4968a144cfff (diff)
downloadenlightenment-22651a4318ea839744578af872ec10f42b1654cc.tar.gz
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 fa071224de..21c3914629 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -421,7 +421,7 @@ e_border_new(E_Container *con,
ecore_x_window_shadow_tree_flush();
e_object_del_func_set(E_OBJECT(bd), E_OBJECT_CLEANUP_FUNC(_e_border_del));
- bd->focus_policy = e_config->focus_policy;
+ bd->focus_policy_override = E_FOCUS_LAST;
bd->w = 1;
bd->h = 1;
/* FIXME: ewww - round trip */
@@ -7460,7 +7460,7 @@ _e_border_eval0(E_Border *bd)
}
else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DESKTOP)
{
- bd->focus_policy = E_FOCUS_CLICK;
+ bd->focus_policy_override = E_FOCUS_CLICK;
e_focus_setup(bd);
if (!bd->client.netwm.state.skip_pager)
{
diff --git a/src/bin/e_border.h b/src/bin/e_border.h
index cd084b81c4..ee577e47b7 100644
--- a/src/bin/e_border.h
+++ b/src/bin/e_border.h
@@ -46,7 +46,8 @@ typedef enum _E_Focus_Policy
{
E_FOCUS_CLICK,
E_FOCUS_MOUSE,
- E_FOCUS_SLOPPY
+ E_FOCUS_SLOPPY,
+ E_FOCUS_LAST
} E_Focus_Policy;
typedef enum _E_Urgency_Policy
@@ -669,7 +670,7 @@ struct _E_Border
Eina_Bool argb;
int tmp_input_hidden;
- int focus_policy;
+ E_Focus_Policy focus_policy_override;
};
struct _E_Border_Pending_Move_Resize
@@ -840,6 +841,16 @@ extern EAPI int E_EVENT_BORDER_PROPERTY;
extern EAPI int E_EVENT_BORDER_FULLSCREEN;
extern EAPI int E_EVENT_BORDER_UNFULLSCREEN;
+/* e_config not available everywhere e_border.h is used...
+static inline Eina_Bool
+e_border_focus_policy_click(const E_Border *bd)
+{
+ return ((bd->focus_policy_override == E_FOCUS_CLICK) || (e_config->focus_policy == E_FOCUS_CLICK));
+}
+*/
+#define e_border_focus_policy_click(bd) \
+ ((bd->focus_policy_override == E_FOCUS_CLICK) || (e_config->focus_policy == E_FOCUS_CLICK))
+
/* macro for finding misuse of changed flag */
#if 0
# define BD_CHANGED(BD) \
diff --git a/src/bin/e_focus.c b/src/bin/e_focus.c
index a9a3b022fe..a14988c56d 100644
--- a/src/bin/e_focus.c
+++ b/src/bin/e_focus.c
@@ -27,8 +27,8 @@ e_focus_idler_before(void)
EAPI void
e_focus_event_mouse_in(E_Border *bd)
{
- if ((bd->focus_policy == E_FOCUS_MOUSE) ||
- (bd->focus_policy == E_FOCUS_SLOPPY))
+ if ((e_config->focus_policy == E_FOCUS_MOUSE) ||
+ (e_config->focus_policy == E_FOCUS_SLOPPY))
{
if (bd != e_border_focused_get())
e_border_focus_set(bd, 1, 1);
@@ -53,7 +53,7 @@ e_focus_event_mouse_in(E_Border *bd)
EAPI void
e_focus_event_mouse_out(E_Border *bd)
{
- if (bd->focus_policy == E_FOCUS_MOUSE)
+ if (e_config->focus_policy == E_FOCUS_MOUSE)
{
/* FIXME: this is such a hack. its a big hack around x's async events
* as we dont know always exactly what action causes what event
@@ -82,7 +82,7 @@ e_focus_event_mouse_down(E_Border *bd)
{
if (!bd->focused)
{
- if (bd->focus_policy == E_FOCUS_CLICK)
+ if (e_border_focus_policy_click(bd))
e_border_focus_set(bd, 1, 1);
else if (e_config->always_click_to_focus)
e_border_focus_set(bd, 1, 1);
@@ -102,7 +102,7 @@ e_focus_event_mouse_up(E_Border *bd __UNUSED__)
EAPI void
e_focus_event_focus_in(E_Border *bd)
{
- if ((bd->focus_policy == E_FOCUS_CLICK) &&
+ if ((e_border_focus_policy_click(bd)) &&
(!e_config->always_click_to_raise) &&
(!e_config->always_click_to_focus))
{
@@ -126,7 +126,7 @@ e_focus_event_focus_in(E_Border *bd)
EAPI void
e_focus_event_focus_out(E_Border *bd)
{
- if ((bd->focus_policy == E_FOCUS_CLICK) &&
+ if ((e_border_focus_policy_click(bd)) &&
(!e_config->always_click_to_raise) &&
(!e_config->always_click_to_focus))
{
@@ -150,7 +150,7 @@ e_focus_event_focus_out(E_Border *bd)
EAPI void
e_focus_setup(E_Border *bd)
{
- if ((bd->focus_policy == E_FOCUS_CLICK) ||
+ if ((e_border_focus_policy_click(bd)) ||
(e_config->always_click_to_raise) ||
(e_config->always_click_to_focus))
{