From: Carsten Haitzler Date: Fri, 3 Feb 2006 06:13:32 +0000 (+0000) Subject: anitgadget placement policy X-Git-Tag: submit/efl/20131021.015651~14052 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a17594e55ae3f66c6340c8f97ba9ae27572fe934;p=platform%2Fupstream%2Fenlightenment.git anitgadget placement policy SVN revision: 20221 --- diff --git a/src/bin/e_border.c b/src/bin/e_border.c index aec2198..e7b3e5f 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -5306,7 +5306,7 @@ _e_border_eval(E_Border *bd) else new_y = bd->zone->y; - if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART) + if ((e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)||(e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET)) { skiplist = evas_list_append(skiplist, bd); e_place_zone_region_smart(bd->zone, skiplist, diff --git a/src/bin/e_border.h b/src/bin/e_border.h index 75eeb19..bfb5c1a 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -63,6 +63,7 @@ typedef enum _E_Fullscreen typedef enum _E_Window_Placement { E_WINDOW_PLACEMENT_SMART, + E_WINDOW_PLACEMENT_ANTIGADGET, E_WINDOW_PLACEMENT_CURSOR, E_WINDOW_PLACEMENT_MANUAL } E_Window_Placement; diff --git a/src/bin/e_int_config_window_display.c b/src/bin/e_int_config_window_display.c index a4a8b6d..efa4ec0 100644 --- a/src/bin/e_int_config_window_display.c +++ b/src/bin/e_int_config_window_display.c @@ -152,6 +152,8 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf rg = e_widget_radio_group_new(&(cfdata->placement)); ob = e_widget_radio_add(evas, _("Smart Placement"), E_WINDOW_PLACEMENT_SMART, rg); e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Dont hide Gadgets"), E_WINDOW_PLACEMENT_ANTIGADGET, rg); + e_widget_framelist_object_append(of, ob); ob = e_widget_radio_add(evas, _("Place at mouse pointer"), E_WINDOW_PLACEMENT_CURSOR, rg); e_widget_framelist_object_append(of, ob); ob = e_widget_radio_add(evas, _("Place manually with the mouse"), E_WINDOW_PLACEMENT_MANUAL, rg); diff --git a/src/bin/e_ipc_handlers.h b/src/bin/e_ipc_handlers.h index 6220fe4..268aff5 100644 --- a/src/bin/e_ipc_handlers.h +++ b/src/bin/e_ipc_handlers.h @@ -5804,16 +5804,17 @@ break; /****************************************************************************/ #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, CURSOR or MANUAL", 0, HDL) + OP("-window-placement-policy-set", 1, "Set the window placement policy. OPT1 = SMART, ANTIGADGET, CURSOR or MANUAL", 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 if (!strcmp(params[0], "MANUAL")) value = E_WINDOW_PLACEMENT_MANUAL; + else if (!strcmp(params[0], "ANTIGADGET")) value = E_WINDOW_PLACEMENT_ANTIGADGET; else { - printf("window placement policy must be SMART, CURSOR or MANUAL\n"); + printf("window placement policy must be SMART, ANTIGADGET, CURSOR or MANUAL\n"); exit(-1); } REQ_INT_END(value, HDL); diff --git a/src/bin/e_place.c b/src/bin/e_place.c index 575f0a6..f2c9c9f 100644 --- a/src/bin/e_place.c +++ b/src/bin/e_place.c @@ -90,10 +90,59 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w x -= zone->x; y -= zone->y; + + if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET) + { + Evas_List *l; + int cx1, cx2, cy1, cy2; + + cx1 = zone->x; + cy1 = zone->y; + cx2 = zone->x + zone->w; + cy2 = zone->y + zone->h; - zw = zone->w; - zh = zone->h; - + /* Find the smallest box */ + for (l = zone->container->gadman->clients; l; l = l->next) + { + E_Gadman_Client *gmc; + double ax, ay; + + gmc = l->data; + if ((gmc->zone != zone)) continue; + + ax = gmc->ax; + ay = gmc->ay; + + if (((ax == 0.0) || (ax == 1.0)) && + ((ay == 0.0) || (ay == 1.0))) + { + /* corner gadget */ + /* Fake removal from one alignment :) */ + if (gmc->w > gmc->h) + ax = 0.5; + else + ay = 0.5; + } + + if ((ax == 0.0) && (gmc->x + gmc->w) > cx1) + cx1 = (gmc->x + gmc->w); + else if ((ax == 1.0) && (gmc->x < cx2)) + cx2 = gmc->x; + else if ((ay == 0.0) && ((gmc->y + gmc->h) > cy1)) + cy1 = (gmc->y + gmc->h); + else if ((ay == 1.0) && (gmc->y < cy2)) + cy2 = gmc->y; + } + + + zw = cx2 - cx1; + zh = cy2 - cy1; + } + else + { + zw = zone->w; + zh = zone->h; + } u_x = calloc(zw + 1, sizeof(char)); u_y = calloc(zh + 1, sizeof(char)); @@ -186,8 +235,8 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w { for (i = 0; i < a_w - 1; i++) { - if ((a_x[i] < (zone->w - w)) && - (a_y[j] < (zone->h - h))) + if ((a_x[i] < (zw - w)) && + (a_y[j] < (zh - h))) { int ar = 0; @@ -250,7 +299,7 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w goto done; } } - if ((a_x[i + 1] - w > 0) && (a_y[j] < (zone->h - h))) + if ((a_x[i + 1] - w > 0) && (a_y[j] < (zh - h))) { int ar = 0; @@ -376,7 +425,7 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w goto done; } } - if ((a_x[i] < (zone->w - w)) && (a_y[j + 1] - h > 0)) + if ((a_x[i] < (zw - w)) && (a_y[j + 1] - h > 0)) { int ar = 0;