<commit_before>#include "E_Illume.h"
#include "e_kbd.h"

EAPI int 
e_illume_border_is_dialog(E_Border *bd) 
{
   int isdialog = 0, i;

   if (bd->client.icccm.transient_for != 0) isdialog = 1;
   if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
     {
	isdialog = 1;
	if (bd->client.netwm.extra_types)
	  {
	     for (i = 0; i < bd->client.netwm.extra_types_num; i++)
	       {
		  if (bd->client.netwm.extra_types[i] == 
		      ECORE_X_WINDOW_TYPE_UNKNOWN) continue;
		  if ((bd->client.netwm.extra_types[i] !=
		       ECORE_X_WINDOW_TYPE_DIALOG) &&
		      (bd->client.netwm.extra_types[i] !=
		       ECORE_X_WINDOW_TYPE_SPLASH))
		    {
		       return 0;
		    }
	       }
	  }
     }
   return isdialog;
}

EAPI int 
e_illume_border_is_keyboard(E_Border *bd) 
{
   if (bd->client.vkbd.vkbd) return 1;
   if (il_cfg->policy.vkbd.match.title) 
     {
        char *title;
        int ret = 0;

        title = ecore_x_icccm_title_get(bd->client.win);
        if ((title) && 
            (!strcmp(title, il_cfg->policy.vkbd.title))) 
          ret = 1;
        if (title) free(title);
        if (ret) return ret;
     }
   if (il_cfg->policy.vkbd.match.name) 
     {
        if ((bd->client.icccm.name) && 
            (!strcmp(bd->client.icccm.name, il_cfg->policy.vkbd.name)))
          return 1;
     }
   if (il_cfg->policy.vkbd.match.class) 
     {
        if ((bd->client.icccm.class) && 
            (!strcmp(bd->client.icccm.class, il_cfg->policy.vkbd.class)))
          return 1;
     }
   if ((bd->client.icccm.name) && 
       ((!strcmp(bd->client.icccm.name, "multitap-pad")))
       && (bd->client.netwm.state.skip_taskbar)
       && (bd->client.netwm.state.skip_pager)) 
     return 1;
   return 0;
}

EAPI int 
e_illume_border_is_bottom_panel(E_Border *bd) 
{
   if (il_cfg->policy.softkey.match.title) 
     {
        char *title;
        int ret = 0;

        title = ecore_x_icccm_title_get(bd->client.win);
        if ((title) && 
            (!strcmp(title, il_cfg->policy.softkey.title))) 
          ret = 1;
        if (title) free(title);
        if (ret) return ret;
     }
   if (il_cfg->policy.softkey.match.name) 
     {
        if ((bd->client.icccm.name) && 
            (!strcmp(bd->client.icccm.name, il_cfg->policy.softkey.name)))
          return 1;
     }
   if (il_cfg->policy.softkey.match.class) 
     {
        if ((bd->client.icccm.class) && 
            (!strcmp(bd->client.icccm.class, il_cfg->policy.softkey.class)))
          return 1;
     }
   if (((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK) ||
        (bd->client.qtopia.soft_menu)))
     return 1;
   return 0;
}

EAPI int 
e_illume_border_is_top_shelf(E_Border *bd) 
{
   if (il_cfg->policy.indicator.match.title) 
     {
        char *title;
        int ret = 0;

        title = ecore_x_icccm_title_get(bd->client.win);
        if ((title) && 
            (!strcmp(title, il_cfg->policy.indicator.title))) 
          ret = 1;
        if (title) free(title);
        if (ret) return ret;
     }
   if (il_cfg->policy.indicator.match.name) 
     {
        if ((bd->client.icccm.name) && 
            (!strcmp(bd->client.icccm.name, il_cfg->policy.indicator.name)))
          return 1;
     }
   if (il_cfg->policy.indicator.match.class) 
     {
        if ((bd->client.icccm.class) && 
            (!strcmp(bd->client.icccm.class, il_cfg->policy.indicator.class)))
          return 1;
     }
   return 0;
}

EAPI int 
e_illume_border_is_home(E_Border *bd) 
{
   if (il_cfg->policy.home.match.title) 
     {
        char *title;
        int ret = 0;

        title = ecore_x_icccm_title_get(bd->client.win);
        if ((title) && 
            (!strcmp(title, il_cfg->policy.home.title))) 
          ret = 1;
        if (title) free(title);
        if (ret) return ret;
     }
   if (il_cfg->policy.home.match.name) 
     {<commit_msg>why do  a server rount trip for every border to get title when it's already stored? bad bad bad! this will cause mucho slowness.<commit_after>#include "E_Illume.h"
#include "e_kbd.h"

EAPI int 
e_illume_border_is_dialog(E_Border *bd) 
{
   int isdialog = 0, i;

   if (bd->client.icccm.transient_for != 0) isdialog = 1;
   if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
     {
	isdialog = 1;
	if (bd->client.netwm.extra_types)
	  {
	     for (i = 0; i < bd->client.netwm.extra_types_num; i++)
	       {
		  if (bd->client.netwm.extra_types[i] == 
		      ECORE_X_WINDOW_TYPE_UNKNOWN) continue;
		  if ((bd->client.netwm.extra_types[i] !=
		       ECORE_X_WINDOW_TYPE_DIALOG) &&
		      (bd->client.netwm.extra_types[i] !=
		       ECORE_X_WINDOW_TYPE_SPLASH))
		    {
		       return 0;
		    }
	       }
	  }
     }
   return isdialog;
}

EAPI int 
e_illume_border_is_keyboard(E_Border *bd) 
{
   if (bd->client.vkbd.vkbd) return 1;
   if (il_cfg->policy.vkbd.match.title) 
     {
        char *title;
        int ret = 0;

        title = bd->client.icccm.title;
        if ((title) && 
            (!strcmp(title, il_cfg->policy.vkbd.title))) 
          ret = 1;
        if (ret) return ret;
     }
   if (il_cfg->policy.vkbd.match.name) 
     {
        if ((bd->client.icccm.name) && 
            (!strcmp(bd->client.icccm.name, il_cfg->policy.vkbd.name)))
          return 1;
     }
   if (il_cfg->policy.vkbd.match.class) 
     {
        if ((bd->client.icccm.class) && 
            (!strcmp(bd->client.icccm.class, il_cfg->policy.vkbd.class)))
          return 1;
     }
   if ((bd->client.icccm.name) && 
       ((!strcmp(bd->client.icccm.name, "multitap-pad")))
       && (bd->client.netwm.state.skip_taskbar)
       && (bd->client.netwm.state.skip_pager)) 
     return 1;
   return 0;
}

EAPI int 
e_illume_border_is_bottom_panel(E_Border *bd) 
{
   if (il_cfg->policy.softkey.match.title) 
     {
        char *title;
        int ret = 0;

        title = bd->client.icccm.title;
        if ((title) && 
            (!strcmp(title, il_cfg->policy.softkey.title))) 
          ret = 1;
        if (title) free(title);
        if (ret) return ret;
     }
   if (il_cfg->policy.softkey.match.name) 
     {
        if ((bd->client.icccm.name) && 
            (!strcmp(bd->client.icccm.name, il_cfg->policy.softkey.name)))
          return 1;
     }
   if (il_cfg->policy.softkey.match.class) 
     {
        if ((bd->client.icccm.class) && 
            (!strcmp(bd->client.icccm.class, il_cfg->policy.softkey.class)))
          return 1;
     }
   if (((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK) ||
        (bd->client.qtopia.soft_menu)))
     return 1;
   return 0;
}

EAPI int 
e_illume_border_is_top_shelf(E_Border *bd) 
{
   if (il_cfg->policy.indicator.match.title) 
     {
        char *title;
        int ret = 0;

        title = bd->client.icccm.title;
        if ((title) && 
            (!strcmp(title, il_cfg->policy.indicator.title))) 
          ret = 1;
        if (title) free(title);
        if (ret) return ret;
     }
   if (il_cfg->policy.indicator.match.name) 
     {
        if ((bd->client.icccm.name) && 
            (!strcmp(bd->client.icccm.name, il_cfg->policy.indicator.name)))
          return 1;
     }
   if (il_cfg->policy.indicator.match.class) 
     {
        if ((bd->client.icccm.class) && 
            (!strcmp(bd->client.icccm.class, il_cfg->policy.indicator.class)))
          return 1;
     }
   return 0;
}

EAPI int 
e_illume_border_is_home(E_Border *bd) 
{
   if (il_cfg->policy.home.match.title) 
     {
        char *title;
        int ret = 0;

        title = bd->client.icccm.title;
        if ((title) && 
            (!strcmp(title, il_cfg->policy.home.title))) 
          ret = 1;
        if (title) free(title);
        if (ret) return ret;
     }
   if (il_cfg->policy.home.match.name) 
     {
{'fraction_non_alphanumeric': 0.15262135922330097, 'fraction_numerical': 0.006731391585760518, 'mean_word_length': 1.9980597594101668, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 105, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3383476', 'n_tokens_mistral': 3073, 'n_tokens_neox': 2914, 'n_words': 462}