- add the ability to change the initial window placement policy. currenlty

the default smart placement and place under cursor are available.

- configurable through enlightenment_remove -window-placement-set/get


SVN revision: 16702
This commit is contained in:
Dan Sinclair 2005-09-13 05:19:25 +00:00 committed by Dan Sinclair
parent d53932024a
commit 3dc4584f68
8 changed files with 99 additions and 6 deletions

View File

@ -5004,12 +5004,20 @@ _e_border_eval(E_Border *bd)
new_y = bd->zone->y + (rand() % (bd->zone->h - bd->h));
else
new_y = bd->zone->y;
skiplist = evas_list_append(skiplist, bd);
e_place_zone_region_smart(bd->zone, skiplist,
bd->x, bd->y, bd->w, bd->h,
&new_x, &new_y);
evas_list_free(skiplist);
if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)
{
skiplist = evas_list_append(skiplist, bd);
e_place_zone_region_smart(bd->zone, skiplist,
bd->x, bd->y, bd->w, bd->h,
&new_x, &new_y);
evas_list_free(skiplist);
}
else
{
e_place_zone_cursor(bd->zone, bd->x, bd->w, bd->client_inset.t,
&new_x, &new_y);
}
bd->x = new_x;
bd->y = new_y;
bd->changes.pos = 1;

View File

@ -58,6 +58,11 @@ typedef enum _E_Fullscreen
E_FULLSCREEN_ZOOM
} E_Fullscreen;
typedef enum _E_Window_Placement
{
E_WINDOW_PLACEMENT_SMART,
E_WINDOW_PLACEMENT_CURSOR
} E_Window_Placement;
typedef struct _E_Border E_Border;

View File

@ -255,6 +255,7 @@ e_config_init(void)
E_CONFIG_LIST(D, T, path_append_icons, _e_config_path_append_edd); /**/
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, window_placement_policy, INT);
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); /**/
@ -372,6 +373,7 @@ e_config_init(void)
e_config->evas_engine_popups = E_EVAS_ENGINE_DEFAULT;
e_config->evas_engine_drag = E_EVAS_ENGINE_DEFAULT;
e_config->language = strdup("");
e_config->window_placement_policy = E_WINDOW_PLACEMENT_SMART;
e_config->focus_policy = E_FOCUS_MOUSE;
e_config->focus_setting = E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED;
e_config->pass_click_on = 1;
@ -946,6 +948,7 @@ e_config_init(void)
E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64);
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->window_placement_policy, 0, 1);
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);

View File

@ -99,6 +99,7 @@ struct _E_Config
Evas_List *path_append_icons;
Evas_List *path_append_modules;
Evas_List *path_append_backgrounds;
int window_placement_policy;
int focus_policy;
int focus_setting;
int pass_click_on;

View File

@ -5015,3 +5015,57 @@ break;
END_INT;
#endif
#undef HDL
/****************************************************************************/
#define HDL E_IPC_OP_WINDOW_PLACEMENT_POLICY_SET
#if (TYPE == E_REMOTE_OPTIONS)
OP("-window-placement-policy-set", 1, "Set the window placement policy. OPT1 = SMART or CURSOR", 0, HDL)
#elif (TYPE == E_REMOTE_OUT)
REQ_INT_START(HDL)
int value = 0;
if (!strcmp(params[0], "SMART")) value = E_WINDOW_PLACEMENT_SMART;
else if (!strcmp(params[0], "CURSOR")) value = E_WINDOW_PLACEMENT_CURSOR;
else
{
printf("window placement policy must be SMART or CURSOR\n");
exit(-1);
}
REQ_INT_END(value, HDL);
#elif (TYPE == E_WM_IN)
START_INT(value, HDL);
e_config->window_placement_policy = value;
E_CONFIG_LIMIT(e_config->window_placement_policy, 0, 1);
SAVE;
END_INT
#elif (TYPE == E_REMOTE_IN)
#endif
#undef HDL
/****************************************************************************/
#define HDL E_IPC_OP_WINDOW_PLACEMENT_POLICY_GET
#if (TYPE == E_REMOTE_OPTIONS)
OP("-window-placement-policy-get", 0, "Get window placement policy", 1, HDL)
#elif (TYPE == E_REMOTE_OUT)
REQ_NULL(HDL);
#elif (TYPE == E_WM_IN)
SEND_INT(e_config->window_placement_policy, E_IPC_OP_WINDOW_PLACEMENT_POLICY_GET_REPLY, HDL);
#elif (TYPE == E_REMOTE_IN)
#endif
#undef HDL
/****************************************************************************/
#define HDL E_IPC_OP_WINDOW_PLACEMENT_POLICY_GET_REPLY
#if (TYPE == E_REMOTE_OPTIONS)
#elif (TYPE == E_REMOTE_OUT)
#elif (TYPE == E_WM_IN)
#elif (TYPE == E_REMOTE_IN)
START_INT(policy, HDL);
if (policy == E_WINDOW_PLACEMENT_SMART)
printf("REPLY: SMART\n");
else if (policy == E_WINDOW_PLACEMENT_CURSOR)
printf("REPLY: CURSOR\n");
END_INT
#endif
#undef HDL

View File

@ -257,3 +257,8 @@
#define E_IPC_OP_MODAL_WINDOWS_SET 255
#define E_IPC_OP_MODAL_WINDOWS_GET 256
#define E_IPC_OP_MODAL_WINDOWS_GET_REPLY 257
#define E_IPC_OP_WINDOW_PLACEMENT_POLICY_SET 258
#define E_IPC_OP_WINDOW_PLACEMENT_POLICY_GET 259
#define E_IPC_OP_WINDOW_PLACEMENT_POLICY_GET_REPLY 260

View File

@ -449,3 +449,19 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w
*ry += zone->y;
return 1;
}
int
e_place_zone_cursor(E_Zone *zone, int x, int w, int it, int *rx, int *ry)
{
int cursor_x = 0, cursor_y = 0;
E_OBJECT_CHECK(zone);
ecore_x_pointer_xy_get(zone->container->win, &cursor_x, &cursor_y);
*rx = cursor_x - ((w - x) >> 1);
*ry = cursor_y - (it >> 1);
return 1;
}

View File

@ -8,6 +8,7 @@
EAPI void e_place_zone_region_smart_cleanup(E_Zone *zone);
EAPI int e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w, int h, int *rx, int *ry);
EAPI int e_place_zone_cursor(E_Zone *zone, int x, int w, int it, int *rx, int *ry);
#endif
#endif