From 0ba99fb510a22794404c41691db411945d417eb1 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 27 Jun 2005 12:05:26 +0000 Subject: [PATCH] focus policy patch - adjusted :) SVN revision: 15544 --- src/bin/e_border.c | 23 ++++++++++++++++++++++- src/bin/e_border.h | 9 +++++++++ src/bin/e_config.c | 10 +++------- src/bin/e_config.h | 3 ++- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 342bb71b1..faf1a946c 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -447,6 +447,8 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map) ecore_x_window_show(bd->client.shell_win); bd->shape = e_container_shape_add(con); + if (e_config->focus_setting != E_FOCUS_NONE) + bd->take_focus = 1; bd->new_client = 1; bd->changed = 1; @@ -4405,7 +4407,26 @@ _e_border_eval(E_Border *bd) } bd->need_shape_export = 0; } - + + if (bd->take_focus) + { + if (e_config->focus_setting == E_FOCUS_NEW_WINDOW) + e_border_focus_set(bd, 1, 1); + else + { + if (bd->client.icccm.transient_for != 0) + { + if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) || + + ((e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED) && + (e_border_find_by_client_window(bd->client.icccm.transient_for) == + e_border_focused_get()))) + e_border_focus_set(bd, 1, 1); + } + } + bd->take_focus = 0; + } + bd->changed = 0; bd->changes.stack = 0; diff --git a/src/bin/e_border.h b/src/bin/e_border.h index 478e718a0..92e7b9ff4 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -33,6 +33,14 @@ typedef enum _E_Focus_Policy E_FOCUS_SLOPPY } E_Focus_Policy; +typedef enum _E_Focus_Setting +{ + E_FOCUS_NONE, + E_FOCUS_NEW_WINDOW, + E_FOCUS_NEW_DIALOG, + E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED +} E_Focus_Setting; + typedef enum _E_Maximize { E_MAXIMIZE_NONE, @@ -275,6 +283,7 @@ struct _E_Border unsigned int delete_requested : 1; unsigned int ping_ok : 1; unsigned int hung : 1; + unsigned int take_focus : 1; E_Maximize maximized; double ping; diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 94da189ee..0fdccf55c 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -141,6 +141,7 @@ e_config_init(void) E_CONFIG_LIST(D, T, path_append_modules, _e_config_path_append_edd); /**/ E_CONFIG_LIST(D, T, path_append_backgrounds, _e_config_path_append_edd); /**/ E_CONFIG_VAL(D, T, focus_policy, INT); /**/ + E_CONFIG_VAL(D, T, focus_setting, INT); /**/ E_CONFIG_VAL(D, T, pass_click_on, INT); E_CONFIG_VAL(D, T, always_click_to_raise, INT); E_CONFIG_VAL(D, T, use_auto_raise, INT); @@ -232,6 +233,7 @@ e_config_init(void) e_config->evas_engine_drag = E_EVAS_ENGINE_DEFAULT; e_config->language = strdup(""); e_config->focus_policy = E_FOCUS_MOUSE; + e_config->focus_setting = E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED; e_config->pass_click_on = 1; e_config->always_click_to_raise = 0; e_config->use_auto_raise = 0; @@ -724,13 +726,6 @@ e_config_init(void) /* CTRL+ALT Delete - logout */ /* CTRL+ALT End - restart */ - /* need a way to display all focused windows nicely - subsystem for - * this that also grabs the modifier on activate (if there are any) so - * on release of modifier(s) OR on any new action this list aborts display - */ - /* ALT Tab - next window focus */ - /* ALT_SHIFT Tab - prev window focus */ - /* need to support fullscreen anyway for this - ie netwm and the border * system need to handle this as well as possibly using xrandr/xvidmode */ @@ -763,6 +758,7 @@ e_config_init(void) E_CONFIG_LIMIT(e_config->use_edge_flip, 0, 1); E_CONFIG_LIMIT(e_config->edge_flip_timeout, 0.0, 2.0); E_CONFIG_LIMIT(e_config->focus_policy, 0, 2); + E_CONFIG_LIMIT(e_config->focus_setting, 0, 3); E_CONFIG_LIMIT(e_config->pass_click_on, 0, 1); E_CONFIG_LIMIT(e_config->always_click_to_raise, 0, 1); E_CONFIG_LIMIT(e_config->use_auto_raise, 0, 1); diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 81be035bd..3fc60308c 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -46,7 +46,7 @@ typedef Eet_Data_Descriptor E_Config_DD; * defaults for e to work - started at 100 when we introduced this config * versioning feature */ -#define E_CONFIG_FILE_VERSION 113 +#define E_CONFIG_FILE_VERSION 114 #define E_EVAS_ENGINE_DEFAULT 0 #define E_EVAS_ENGINE_SOFTWARE_X11 1 @@ -95,6 +95,7 @@ struct _E_Config Evas_List *path_append_modules; Evas_List *path_append_backgrounds; int focus_policy; + int focus_setting; int pass_click_on; int always_click_to_raise; int use_auto_raise;