<commit_before>#include "e.h"

typedef struct _E_Resist_Rect E_Resist_Rect;

struct _E_Resist_Rect
{
   int x, y, w, h;
   int v1;
   int resist_out;
};

static void _e_resist_rects(Eina_List *rects, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry, int *rw, int *rh);

E_API int
e_resist_client_position(Eina_List *skiplist,
                                   int px, int py, int pw, int ph,
                                   int x, int y, int w, int h,
                                   int *rx, int *ry, int *rw, int *rh)
{
   Eina_List *l, *rects = NULL;
   E_Resist_Rect *r;
   E_Client *ec;
   E_Desk *desk;
   E_Shelf *es;
   E_Zone *zone;

   if (!e_config->use_resist)
     {
        *rx = x;
        *ry = y;
        *rw = w;
        *rh = h;
        return 0;
     }

   /* edges of screen */
#define OBSTACLE(_x, _y, _w, _h, _resist)                         \
  {                                                               \
     r = E_NEW(E_Resist_Rect, 1);                                 \
     r->x = _x; r->y = _y; r->w = _w; r->h = _h; r->v1 = _resist; \
     r->resist_out = 0;                                           \
     rects = eina_list_append(rects, r);                          \
  }
#define HOLDER(_x, _y, _w, _h, _resist)                           \
  {                                                               \
     r = E_NEW(E_Resist_Rect, 1);                                 \
     r->x = _x; r->y = _y; r->w = _w; r->h = _h; r->v1 = _resist; \
     r->resist_out = 1;                                           \
     rects = eina_list_append(rects, r);                          \
  }

   EINA_LIST_FOREACH(e_comp->zones, l, zone)
     {
        HOLDER(zone->x, zone->y, zone->w, zone->h, e_config->desk_resist);
     }
   /* FIXME: need to add resist or complete BLOCKS for things like ibar */
   /* can add code here to add more fake obstacles with custom resist values */
   /* here if need be - ie xinerama middle between screens and panels etc. */
   E_CLIENT_FOREACH(ec)
     {
        if (e_client_util_ignored_get(ec) || (!evas_object_visible_get(ec->frame))) continue;
        if (ec->offer_resistance && (!eina_list_data_find(skiplist, ec)))
          {
             OBSTACLE(ec->x, ec->y, ec->w, ec->h, e_config->window_resist);
          }
     }

   desk = e_desk_current_get(e_zone_current_get());
   l = e_shelf_list_all();
   EINA_LIST_FREE(l, es)
     {
        if (e_shelf_desk_visible(es, desk))
          {
             OBSTACLE(es->x + es->zone->x, es->y + es->zone->y, es->w, es->h,
                      e_config->gadget_resist);
          }
     }
   if (rects)
     {
        _e_resist_rects(rects,
                        px, py, pw, ph,
                        x, y, w, h,
                        rx, ry, rw, rh);

        E_FREE_LIST(rects, E_FREE);
     }
   return 1;
}

E_API int
e_resist_gadman_position(Eina_List *skiplist EINA_UNUSED,
                                   int px, int py, int pw, int ph,
                                   int x, int y, int w, int h,
                                   int *rx, int *ry)
{
   Eina_List *l, *rects = NULL;
   E_Resist_Rect *r;
   E_Shelf *es;

   if (!e_config->use_resist)
     {
        *rx = x;
        *ry = y;
        return 0;<commit_msg>use zone obstacles for resist calculations<commit_after>#include "e.h"

typedef struct _E_Resist_Rect E_Resist_Rect;

struct _E_Resist_Rect
{
   int x, y, w, h;
   int v1;
   int resist_out;
};

static void _e_resist_rects(Eina_List *rects, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry, int *rw, int *rh);

E_API int
e_resist_client_position(Eina_List *skiplist,
                                   int px, int py, int pw, int ph,
                                   int x, int y, int w, int h,
                                   int *rx, int *ry, int *rw, int *rh)
{
   Eina_List *l, *rects = NULL;
   E_Resist_Rect *r;
   E_Client *ec;
   E_Desk *desk;
   E_Zone *zone;

   if (!e_config->use_resist)
     {
        *rx = x;
        *ry = y;
        *rw = w;
        *rh = h;
        return 0;
     }

   /* edges of screen */
#define OBSTACLE(_x, _y, _w, _h, _resist)                         \
  {                                                               \
     r = E_NEW(E_Resist_Rect, 1);                                 \
     r->x = _x; r->y = _y; r->w = _w; r->h = _h; r->v1 = _resist; \
     r->resist_out = 0;                                           \
     rects = eina_list_append(rects, r);                          \
  }
#define HOLDER(_x, _y, _w, _h, _resist)                           \
  {                                                               \
     r = E_NEW(E_Resist_Rect, 1);                                 \
     r->x = _x; r->y = _y; r->w = _w; r->h = _h; r->v1 = _resist; \
     r->resist_out = 1;                                           \
     rects = eina_list_append(rects, r);                          \
  }

   EINA_LIST_FOREACH(e_comp->zones, l, zone)
     {
        HOLDER(zone->x, zone->y, zone->w, zone->h, e_config->desk_resist);
     }
   /* FIXME: need to add resist or complete BLOCKS for things like ibar */
   /* can add code here to add more fake obstacles with custom resist values */
   /* here if need be - ie xinerama middle between screens and panels etc. */
   E_CLIENT_FOREACH(ec)
     {
        if (e_client_util_ignored_get(ec) || (!evas_object_visible_get(ec->frame))) continue;
        if (ec->offer_resistance && (!eina_list_data_find(skiplist, ec)))
          {
             OBSTACLE(ec->x, ec->y, ec->w, ec->h, e_config->window_resist);
          }
     }

   desk = e_desk_current_get(e_zone_current_get());
   {
      E_Zone_Obstacle *obs;

      EINA_INLIST_FOREACH(desk->obstacles, obs)
        OBSTACLE(obs->x, obs->y, obs->w, obs->h, e_config->gadget_resist);
      EINA_INLIST_FOREACH(desk->zone->obstacles, obs)
        OBSTACLE(obs->x, obs->y, obs->w, obs->h, e_config->gadget_resist);
   }
   if (rects)
     {
        _e_resist_rects(rects,
                        px, py, pw, ph,
                        x, y, w, h,
                        rx, ry, rw, rh);

        E_FREE_LIST(rects, E_FREE);
     }
   return 1;
}

E_API int
e_resist_gadman_position(Eina_List *skiplist EINA_UNUSED,
                                   int px, int py, int pw, int ph,
                                   int x, int y, int w, int h,
                                   int *rx, int *ry)
{
   Eina_List *l, *rects = NULL;
   E_Resist_Rect *r;
   E_Shelf *es;

   if (!e_config->use_resist)
     {
        *rx = x;
        *ry = y;
        return 0;
{'fraction_non_alphanumeric': 0.11976498945465501, 'fraction_numerical': 0.0030129557095510697, 'mean_word_length': 1.3004158004158004, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 42, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5749229', 'n_tokens_mistral': 2409, 'n_tokens_neox': 2351, 'n_words': 574}