Running EFL applications under Wayland based on Ubuntu 14.04 : elm example

For correct functionality when running under Wayland you must use the latest versions of all the EFL components under Wayland. As a precursor to these steps you must have downloaded and compiled Wayland as per the building instructions.

example codes

#include <Elementary.h>

static void
on_click(void *data, Evas_Object *obj, void *event_info)
{
   evas_object_del(data);
}

EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *btn;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("Main", "Hello, World!");
   evas_object_resize(win, 1920, 1080);
   elm_win_autodel_set(win, EINA_TRUE);

   btn = elm_button_add(win);
   elm_object_text_set(btn, "Goodbye Cruel World");
   elm_win_resize_object_add(win, btn);
   evas_object_smart_callback_add(btn, "clicked", on_click, win);
   evas_object_show(btn);

   evas_object_show(win);

   elm_run();

   return 0;
}
ELM_MAIN()

compile command

source env.sh
gcc -o elm elm.c pkg-config --cflags --libs elementary

start weston

weston &

run example

./elm
elm

notes

Running EFL applications under Wayland
For applications that use Ecore_Evas directly set the environment variable ECORE_EVAS_ENGINE to either wayland_shm or wayland_egl depending on whether you wish to use the SHM based interface with software rendering or use EGL.
For applications that use Elementary set the environment variable ELM_DISPLAY to wl. You may also set the environment variable ELM_ACCEL to none to use software rendering, or to gl to use hardware accelerated rendering.
For more debug info, please set:
export MESA_DEBUG=1
export EGL_LOG_LEVEL=debug
export LIBGL_DEBUG=verbose
export WAYLAND_DEBUG=1

Running EFL applications under Wayland based on Ubuntu 14.04, compile libdrm, mesa, wayland, weston, efl from sources

For correct functionality when running under Wayland you must use the latest versions of all the EFL components under Wayland. As a precursor to these steps you must have downloaded and compiled Wayland.

Setting up the environment

apt install git autoconf automake libtool autopoint check
Installing in a custom location, system wide install would break things.
export WLD=$HOME/install   # change this to another location if you prefer
export LD_LIBRARY_PATH=$WLD/lib
export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
export PATH=$WLD/bin:$PATH
export ACLOCAL_PATH=$WLD/share/aclocal
export ACLOCAL="aclocal -I $ACLOCAL_PATH"

mkdir -p $WLD/share/aclocal # needed by autotools
Do not set LD_LIBRARY_PATH as your default, it will break things.
Put the above in a script env.sh and source it in the terminal you wish to build the packages.

libdrm

sudo apt-get install xutils-dev libpciaccess-dev
git clone https://anongit.freedesktop.org/git/mesa/drm
cd drm/
source ../env.sh 
./autogen.sh --prefix=$WLD 
make -j128 
make install 

mesa

apt-get install x11proto-dri3-dev:all x11proto-present-dev:all libudev-dev llvm
git clone https://anongit.freedesktop.org/git/mesa/mesa
cd mesa
git checkout mesa-10.1.3
source ../env.sh 
./autogen.sh --prefix=$WLD --enable-egl --enable-opengl  --enable-gles2   --with-egl-platforms=x11,wayland,drm --enable-gbm --enable-shared-glapi   --with-gallium-drivers=r300,r600,swrast,nouveau  --enable-gallium-osmesa --enable-gallium-egl 
 make -j128  
 make install
apply below patch if encountered libdrm/nouveau.h not found error
apply this patch
or just copy
sudo cp /usr/include/libdrm/nouveau/nouveau.h /usr/include/libdrm/

wayland

apt install libffi-dev libexpat-dev libxml2-dev
git clone https://anongit.freedesktop.org/git/wayland/wayland.git
# master head commit 0fa3474be36be5fee98bebb169df68dcf806e3f3
cd wayland
source ../env.sh
./autogen.sh --prefix=$WLD --disable-documentation 
make -j128 
make install

wayland-protocols

git clone https://anongit.freedesktop.org/git/wayland/wayland-protocols.git
cd wayland-protocols
# master, head commit d5ded4ddaf68b161fec23d75204d2153232c3a47
source ../env.sh
./autogen.sh --prefix=$WLD 
make && make install 

libinput

apt install libmtdev-dev libudev-dev libevdev-dev libwacom-dev
git clone https://anongit.freedesktop.org/git/wayland/libinput.git
git checkout 1.7.0 
source ../env.sh
./autogen.sh --prefix=$WLD  --disable-libwacom
make -j128
make install

weston

apt install libegl1-mesa-dev libgles2-mesa-dev libxcursor-dev libcairo2-dev libxcb-composite0-dev libgbm-dev libxkbcommon-dev libjpeg8-dev libpam0g-dev

git clone https://anongit.freedesktop.org/git/wayland/weston
# mater commit 9fe5d5fae9d41bb5f9ec070dbbc0567c738f4141
cd weston
source ../env.sh 
./autogen.sh --prefix=$WLD --disable-setuid-install 
make -j128 
make install 

libxkbcommon

if pkg-config --modversion xkbcommon < 0.5, then compile libxkbcommon

apt-get install libxcb-xkb-dev

git clone https://github.com/xkbcommon/libxkbcommon.git 
cd libxkbcommon
source ../env.sh
./autogen.sh --prefix=$WLD 
make -j128
make install

efl

apt-get install libssl-dev libluajit-5.1-dev libfribidi-dev libgif-dev libtiff-dev libmount-dev libblkid-dev libsndfile1-dev libbullet-dev
apt-get install libgstreamer1*

git clone  https://git.enlightenment.org/core/efl.git/
cd efl
# next commit will require systemd > 209,while ubuntu 14.04 only have 204
git reset --hard cec8a49b51b13670e5adaeb44940f3bece106fb4
source ../env.sh
./autogen.sh --prefix=$WLD --enable-wayland --enable-ecore-wayland --enable-egl --with-opengl=es 
make
make install      

Notes

please confirm that struct wl_egl_window definition in wayland and mesa are same.
struct wl_egl_window {
struct wl_surface *surface;
int width;
int height;
int dx;
int dy;

int attached_width;
int attached_height;

void *private;
void (*resize_callback)(struct wl_egl_window *, void *);
};
otherwise you might got a crash here:
surface->win->surface === 0x3
src/gallium/state_trackers/egl/wayland/native_wayland.c
while try to eglSwapBuffers
wl_surface_attach(surface->win->surface, surface->buffer[WL_BUFFER_FRONT],
surface->dx, surface->dy);
invaid arguments errors

Notes

https://wayland.freedesktop.org/building.htmlhttps://wayland.freedesktop.org/efl.html

Fix : /bin/bash ./config.sub failed

checking build system type... Invalid configuration 4': machine4' not recognized
configure: error: /bin/bash ./config.sub 4 failed

solution:
autoreconf --install
then configure again.

fix error: wl_display@1.error(wl_display@1, 1, "invalid arguments for wl_surface@6.attach")

wl_display@1.error(wl_display@1, 1, "invalid arguments for wl_surface@6.attach")

root cause:
wl_surface_attach(wl_surface* surface, wl_buffer* buffer, int, int);
((wl_proxy*)surface)->display != ((wl_proxy*)buffer)->display
surface's display and buffer's display were not matched.
wayland server can't find the buffer object in surface's client connection.

solution:
correct source code, let wl_surface and wl_buffer use the same display.
By the way, each time you call wl_display_get(NULL).
you will get a new display.

react-native : Progress component

Progress

React component that indicate that the app is loading or there is some activity in the app.
Support iOS and Android

Props

  • animating
    Whether to show the Progress (true, the default) or hide it (false).
  • color
    Color of the progress bar.
  • bgcolor
    Background color of the progress bar.
  • progress
    The progress value (between 0 and 1).
  • inverse
    Whether to inverse the Progress (true) or not (false, the default)
  • vertical
    Whether to show a vertical Progress (true) or show a horizontal one (false, the default)

Usage

Import Progress from './Progress'

render() {
  return (
    <View style={styles.container}>
           <Progress progress={this.state.progress}/>
        </View>
  )
}

Example

Progress

View source on GitHub

Report your AdMob earnings via Only One Single XMLHttpRequest

Send XMLHttpRequest

function reqListener () {
  console.log(this.responseText);
}
function admobReport() {
var url = 'https://content.googleapis.com/adsense/v1.4/accounts/';
var accountId = 'pub-xxx'; // change to your own accountId
url += accountId;  
url += '/reports?dimension=APP_ID';
url += '&filter=AD_CLIENT_ID==ca-app-' + accountId;
url += '&metric=EARNINGS'
url += '&startDate=2018-02-01';  // change start date
url += '&endDate=2018-02-24'; // change end date
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("GET", url);
var AuthorizationToken = 'xxx';  // The way to get it is in this post
oReq.setRequestHeader('Authorization', 'AuthorizationToken');
oReq.send();
}
admobReport();

Response

{
 "kind": "adsense#report",
 "totalMatchedRows": "1",
 "headers": [
  {
   "name": "APP_ID",
   "type": "DIMENSION"
  },
  {
   "name": "EARNINGS",
   "type": "METRIC_CURRENCY",
   "currency": "USD"
  }
 ],
 "rows": [
  [
   "2:com.westminstershortercatechismqa",
   "0.89"
  ]
 ],
 "totals": [
  "",
  "0.89"
 ],
 "averages": [
  "",
  "0.89"
 ],
 "startDate": "2018-02-01",
 "endDate": "2018-02-24"
}
 
We can get the total earnings are 0.89$.

accountId

Just login into your AdSense home page, you will found it.
accountId

AuthorizationToken

Generate Authorization Header at first.
You have to login your AdSense account and grant authorization access.
auth
Press F12 to open developer tool in your browser.
Press "EXECUTE" button again.
Then you will find the Authorization Header.
AuthToken
Remember this Header value and keep it secrect.
Replace the value to the JS code at the begining.
Then you can get your AdMob earnings via just one HTTP get API in any place.

Refers

AdSense Management API
AdMob Reporting
AdSense Management API Get Started

fixed: embedded-redis: Unable to run on macOS Sonoma

Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...