Esempio n. 1
0
static void
toggle_floating(E_Border *bd)
{
   if (!bd || !_G.tinfo) return;

   if (eina_list_data_find(_G.tinfo->floating_windows, bd) == bd)
   {
      _G.tinfo->floating_windows = eina_list_remove(_G.tinfo->floating_windows, bd);
      if (!tiling_g.config->dont_touch_borders &&
          tiling_g.config->tiling_border &&
          (!bd->bordername || strcmp(bd->bordername, tiling_g.config->tiling_border)))
        change_window_border(bd, tiling_g.config->tiling_border);
      e_border_idler_before();
      rearrange_windows(bd, 0);
   }
   else
   {
      int w = bd->w, h = bd->h;
      /* To give the user a bit of feedback we restore the original border */
      /* TODO: save the original border, don't just restore the default one */
      _G.tinfo->floating_windows = eina_list_prepend(_G.tinfo->floating_windows, bd);
      if (!tiling_g.config->dont_touch_borders &&
          tiling_g.config->floating_border &&
          (!bd->bordername || strcmp(bd->bordername, tiling_g.config->floating_border)))
        change_window_border(bd, tiling_g.config->floating_border);
      e_border_idler_before();
      e_border_resize(bd, w, h);
   }
}
Esempio n. 2
0
EAPI void
e_layout_child_raise_above(Evas_Object *obj, Evas_Object *above)
{
   E_Layout_Item *li;
   
   li = evas_object_data_get(obj, "e_layout_data");
   if (!li) return;
   if (!eina_list_data_find(li->sd->items, above)) return;
   if (!eina_list_data_find(li->sd->items, obj)) return;
   if ((li->sd->items) && eina_list_next(li->sd->items))
     {
	li->sd->items = eina_list_remove(li->sd->items, obj);
	evas_object_stack_above(obj, above);
	li->sd->items = eina_list_append_relative(li->sd->items, obj, above);
     }
}
Esempio n. 3
0
EAPI void
e_layout_child_lower_below(Evas_Object *obj, Evas_Object *below)
{
   E_Layout_Item *li;
   
   li = evas_object_data_get(obj, "e_layout_data");
   if (!li) return;
   if (!eina_list_data_find(li->sd->items, below)) return;
   if (!eina_list_data_find(li->sd->items, obj)) return;
   if ((li->sd->items) && eina_list_next(li->sd->items))
     {
	li->sd->items = eina_list_remove(li->sd->items, obj);
	evas_object_stack_below(obj, below);
	li->sd->items = eina_list_prepend_relative(li->sd->items, obj, below);
     }
}
void
news_config_dialog_item_content_refresh_selected_feeds(News_Item *ni)
{
   E_Config_Dialog_Data *cfdata;
   Evas_Object *ilist;
   int pos, iw, ih;
  
   if (!ni->config_dialog_content) return;
   cfdata = ni->config_dialog_content->cfdata;

   ilist = cfdata->ilist_selected_feeds;
   e_widget_ilist_freeze(ilist);
   /* disable the callback until we finish to refresh the list */
   e_widget_on_change_hook_set(ilist, NULL, NULL);

   e_widget_ilist_clear(ilist);
   if (cfdata->button_rem)
     {
        e_widget_disabled_set(cfdata->button_rem, 1);
        e_widget_disabled_set(cfdata->button_up, 1);
        e_widget_disabled_set(cfdata->button_down, 1);
     }

   cfdata->ilist_selected_feeds_inrefresh = 1;
   pos = -1;
   NEWS_ITEM_FEEDS_FOREACH_BEG(ni);
   {
      Evas_Object *ic = NULL;
      char buf[1024];
        
        if (_feed->icon && _feed->icon[0])
          {
             ic = e_icon_add(evas_object_evas_get(ilist));
             e_icon_file_set(ic, _feed->icon);
          }

        snprintf(buf, sizeof(buf), "%s%s", (_feed->important) ? "[i] " : "", _feed->name);

        e_widget_ilist_append(ilist, ic, buf, NULL, _feed, NULL);
	pos++;

	if (eina_list_data_find(cfdata->ilist_selected_feeds_sel, _feed))
          e_widget_ilist_multi_select(ilist, pos);
   }
   NEWS_ITEM_FEEDS_FOREACH_END();
   cfdata->ilist_selected_feeds_inrefresh = 0;

   e_widget_size_min_get(ilist, &iw, &ih);
   if (iw < 200) iw = 200;
   e_widget_size_min_set(ilist, iw, 250);
   
   e_widget_ilist_go(ilist);
   e_widget_ilist_thaw(ilist);
   _cb_selected_feed_change(cfdata, NULL);
   /* restore the callback */
   e_widget_on_change_hook_set(ilist, _cb_selected_feed_change, cfdata);
}
Esempio n. 5
0
static void
_e_shell_surface_parent_set(E_Client *ec, struct wl_resource *parent_resource)
{
   E_Client *pc;
   uint64_t pwin = 0;

   if (!parent_resource)
     {
        ec->icccm.fetch.transient_for = EINA_FALSE;
        ec->icccm.transient_for = 0;
        if (ec->parent)
          {
             ec->parent->transients =
                eina_list_remove(ec->parent->transients, ec);
             if (ec->parent->modal == ec) ec->parent->modal = NULL;
             ec->parent = NULL;
          }
        return;
     }

   pc = wl_resource_get_user_data(parent_resource);
   if (!pc)
     {
        ERR("Could not get parent resource client");
        return;
     }

   pwin = e_pixmap_window_get(pc->pixmap);

   e_pixmap_parent_window_set(ec->pixmap, pwin);

   /* If we already have a parent, remove it */
   if (ec->parent)
     {
        if (pc != ec->parent)
          {
             ec->parent->transients =
                eina_list_remove(ec->parent->transients, ec);
             if (ec->parent->modal == ec) ec->parent->modal = NULL;
             ec->parent = NULL;
          }
     }

   if ((pc != ec) &&
       (eina_list_data_find(pc->transients, ec) != ec))
     {
        pc->transients = eina_list_append(pc->transients, ec);
        ec->parent = pc;
     }

   ec->icccm.fetch.transient_for = EINA_TRUE;
   ec->icccm.transient_for = pwin;
}
Esempio n. 6
0
void
daemon_note_close(Daemon_Data *dd, E_Notification *n, int reason)
{
  printf("Close notification #%d\n", e_notification_id_get(n));

  if (eina_list_data_find(dd->open_notes, n))
  {
    dd->open_notes = eina_list_remove(dd->open_notes, n);
    e_notification_closed_set(n, 1);
    e_notification_daemon_signal_notification_closed(dd->daemon, e_notification_id_get(n), reason);
    e_notification_unref(n);
  }
}
Esempio n. 7
0
EINTERN Eina_List *
ech_language_enumerate(void)
{
   Eina_List *e_lang_list, *blang_list = NULL;
   FILE *output;
   char line[32];

   e_lang_list = e_intl_language_list();

   /* Get list of all locales and start making map */
#ifdef __OpenBSD__
   output = popen("ls /usr/share/locale", "r");
#else
   output = popen("locale -a", "r");
#endif
   if (!output) return 0;
   while (fscanf(output, "%[^\n]\n", line) == 1)
     {
        E_Locale_Parts *locale_parts;
        char *basic_language;
        unsigned int i = 0;

        locale_parts = e_intl_locale_parts_get(line);

        if (!locale_parts) continue;
        if (locale_parts->mask & E_INTL_LOC_REGION)
          basic_language = e_intl_locale_parts_combine(locale_parts, E_INTL_LOC_LANG | E_INTL_LOC_REGION);
        else
          basic_language = strdup(locale_parts->lang);
        e_intl_locale_parts_free(locale_parts);
        if (!basic_language) continue;
        while (basic_language_predefined_pairs[i].locale_key)
          {
             /* if basic language is supported by E and System*/
             if (!strncmp(basic_language_predefined_pairs[i].locale_key,
                          basic_language, strlen(basic_language)))
               {
                  if ((!blang_list) || (!eina_list_data_find(blang_list, &basic_language_predefined_pairs[i])))
                    blang_list = eina_list_append(blang_list, &basic_language_predefined_pairs[i]);
                  break;
               }
             i++;
          }
        free(basic_language);
     }
   pclose(output);
   E_FREE_LIST(e_lang_list, free);
   return blang_list;
}
Esempio n. 8
0
EAPI void
e_layout_child_raise(Evas_Object *obj)
{
   E_Layout_Item *li;
   
   li = evas_object_data_get(obj, "e_layout_data");
   if (!li) return;
   if (!eina_list_data_find(li->sd->items, obj)) return;
   if ((li->sd->items) && (li->sd->items->next))
     {
	li->sd->items = eina_list_remove(li->sd->items, obj);
	evas_object_raise(obj);
	li->sd->items = eina_list_append(li->sd->items, obj);
     }
}
Esempio n. 9
0
static void
snow_test_constraint_wrap_around_apply(E_Phys_Constraint *con)
{
  Eina_List *l;
  E_Phys_World *world;
  Constraint_Wrap *cw = (Constraint_Wrap *)con;

  if (!con || !con->world) return;
  world = con->world;

  for (l = world->particles; l; l = l->next)
  {
    E_Phys_Particle *p;
    p = l->data;

    if (eina_list_data_find(cw->exclusions, p)) continue;

    /* wrap horizontally, keeping velocity */
    if (p->cur.x < -1 * cw->margin)
    {
      float vx;
      vx = p->cur.x - p->prev.x;
      p->cur.x = world->w + cw->margin + p->cur.x;
      p->prev.x = p->cur.x - vx;
    }
    else if (p->cur.x > world->w + cw->margin)
    {
      float vx;
      vx = p->cur.x - p->prev.x;
      p->cur.x = -1 * cw->margin + (p->cur.x - (world->w + cw->margin));
      p->prev.x = p->cur.x - vx;
    }

    /* when flakes fall off the bottom, start them over at the top */
    if (p->cur.y > world->h)
    {
      p->cur.x = rand_range(-1 * cw->margin, world->w + cw->margin);
      p->cur.y = -1 * cw->margin;
      p->prev.x = p->cur.x; 
      p->prev.y = p->cur.y; 
    }
  }
}
static void
e_phys_constraint_boundary_apply(E_Phys_Constraint *con)
{
  E_Phys_Constraint_Boundary *bound = (E_Phys_Constraint_Boundary *)con;
  E_Phys_World *world = con->world;

  Eina_List *l;
  // keep particles inside world boundaries
  for (l = world->particles; l; l = l->next)
  {
    E_Phys_Particle *p;
    float hw, hh;
    E_Phys_Vector v;

    p = l->data;

    if (eina_list_data_find(bound->exclusions, p)) continue;

    hw = p->w / 2;
    hh = p->h / 2;

    v.x = p->cur.x - p->prev.x;
    v.y = p->cur.y - p->prev.y;

    if (p->cur.x < hw) {
      p->cur.x = hw + (bound->e * (hw - p->cur.x));
      p->prev.x = hw + (bound->e * (hw - p->prev.x));
    } else if (p->cur.x > world->w - hw) {
      p->cur.x = (world->w - hw) + (bound->e * ((world->w - hw) - p->cur.x));
      p->prev.x = (world->w - hw) + (bound->e * ((world->w - hw) - p->cur.x));
    }

    if (p->cur.y - hh < 0) {
      p->cur.y = hh + (bound->e * (hh - p->cur.y));
      p->prev.y = hh + (bound->e * (hh - p->prev.y));
    } else if (p->cur.y > world->h - hh) {
      p->cur.y = (world->h - hh) + (bound->e * ((world->h - hh) - p->cur.y));
      p->prev.y = (world->h - hh) + (bound->e * ((world->h - hh) - p->cur.y));
    }

  }
}
Esempio n. 11
0
void
_ecore_xcb_cookie_cache (unsigned int cookie)
{
   Ecore_Xcb_Data *data;

   if (!_ecore_xcb_cookies)
      return;

   data = (Ecore_Xcb_Data *)malloc(sizeof(Ecore_Xcb_Data));
   if (!data)
      return;

   data->cookie = cookie;

   _ecore_xcb_cookies = eina_list_append(_ecore_xcb_cookies, data);
   if (!eina_list_data_find(_ecore_xcb_cookies, data))
     {
        free(data);
        return;
     }
} /* _ecore_xcb_cookie_cache */
Esempio n. 12
0
static void
_dbus_cb_name_owner_changed(void *data, DBusMessage *msg)
{
   DBusError err;
   Eina_List *l;
   const char *tmp;
   const char *name, *from, *to;

   if (!conn) return;

   dbus_error_init(&err);
   if (!dbus_message_get_args(msg, &err,
			      DBUS_TYPE_STRING, &name,
			      DBUS_TYPE_STRING, &from,
			      DBUS_TYPE_STRING, &to,
			      DBUS_TYPE_INVALID))
     {
	printf("could not get NameOwnerChanged arguments: %s: %s\n",
	    err.name, err.message);
	dbus_error_free(&err);
	return;
     }

   if (strncmp(name, "org.mpris.", 10) != 0)
     return;

   printf("NameOwnerChanged from=[%s] to=[%s]\n", from, to);

   tmp = eina_stringshare_add(name);

   if (to[0] == '\0')
     {
	players = eina_list_remove(players, tmp);

	/* vanished player was current? */
	if (tmp == bus_name)
	  {
	     /* make another player current */
	     if (eina_list_count(players) > 0)
	       {
		  bus_name = players->data;
		  printf("use::%s", bus_name);
		  active = EINA_TRUE;
	       }
	     else
	       {
		  active = EINA_FALSE;
	       }
	  }

	eina_stringshare_del(tmp);
     }
   else
     {
	/* new player appeared? */
	if (!eina_list_data_find(players, tmp))
	  {
	     eina_stringshare_ref(tmp);
	     players = eina_list_append(players, tmp);
	  }

	/* no active player - make player current */
	if (!active)
	  {
	     bus_name = tmp;
	     active = EINA_TRUE;
	  }
     }

   eina_stringshare_del(tmp);
}
Esempio n. 13
0
void
news_config_dialog_item_content_refresh_feeds(News_Item *ni)
{
   E_Config_Dialog_Data *cfdata;
   Eina_List *l, *l2;
   Evas_Object *ilist;
   int pos;
   int iw, ih;
  
   if (!ni->config_dialog_content) return;
   cfdata = ni->config_dialog_content->cfdata;

   ilist = cfdata->ilist_feeds;
   e_widget_ilist_freeze(ilist);
   /* disable the callback until we finish to refresh the list */
   e_widget_on_change_hook_set(ilist, NULL, NULL);

   e_widget_ilist_clear(ilist);
   if (cfdata->button_add)
     e_widget_disabled_set(cfdata->button_add, 1);

   pos = -1;
   for(l=news->config->feed.categories; l; l=eina_list_next(l))
     {
        News_Feed_Category *cat;
        Evas_Object *iccat = NULL;

        cat = eina_list_data_get(l);

        if (!cat->feeds_visible)
          continue;

        if (cat->icon)
          {
             iccat = e_icon_add(evas_object_evas_get(ilist));
             e_icon_file_set(iccat, cat->icon);
          }

        e_widget_ilist_header_append(ilist, iccat, cat->name);
	pos++;

        for(l2=cat->feeds_visible; l2; l2=eina_list_next(l2))
          {
             Evas_Object *ic = NULL;
             News_Feed *f;
             char buf[1024];
             
             f = eina_list_data_get(l2);
             
             if (f->icon && f->icon[0])
               {
                  ic = e_icon_add(evas_object_evas_get(ilist));
                  e_icon_file_set(ic, f->icon);
               }
             
             snprintf(buf, sizeof(buf), "%s%s", (f->important) ? "[i] " : "", f->name);
             
             e_widget_ilist_append(ilist, ic, buf, NULL, f, NULL);
	     pos++;

	     if (eina_list_data_find(cfdata->ilist_feeds_sel, f))
               e_widget_ilist_multi_select(ilist, pos);
          }
     }
   e_widget_ilist_thaw(ilist);

   e_widget_size_min_get(ilist, &iw, &ih);
   if (iw < 200) iw = 200;
   e_widget_size_min_set(ilist, iw, 250);
   
   e_widget_ilist_go(ilist);
   _cb_feed_change(cfdata, NULL);
   /* restore the callback */
   e_widget_on_change_hook_set(ilist, _cb_feed_change, cfdata);
}