Commit Graph

100 Commits

Author SHA1 Message Date
Gustavo Sverzut Barbieri cfe460c69a efl_io_queue_example: use eina_slice_endswith().
make the code more readable and clear. Also document when the line may
miss a trailing line delimiter in the slice.
2016-08-23 21:30:18 -03:00
Gustavo Sverzut Barbieri 8c23ab0685 efl_io_queue: basic class to interact with Efl.Io interfaces.
The use of low-level interfaces such as Efl.Io.Reader and
Efl.Io.Writer are not that user-friendly as they can handle partial
data.

Classes such as Efl.Io.Copier makes them easy to use, but they need a
reader (source) or writer (destination) and in our examples we used
fixed buffers or some existing streams (stdin/stdout/stderr,
networking...).

However, if interactively we need to produce some data to be sent,
such as implementing some networking protocols, we'd have to write our
own Efl.Io.Reader and Efl.Io.Writer classes to handle the buffering.

Not anymore! With Efl.Io.Queue you can write stuff to it and it will
buffer to memory. Once stuff is read, it will automatically remove
those bytes from buffer.
2016-08-23 20:17:13 -03:00
Gustavo Sverzut Barbieri 06983d8673 efl_io_copier_example: set loop as parent for Efl.Net.Dialer.Tcp
although it was working, the correct way is to set a loop provider as
Efl.Net.Dialer.Tcp object.
2016-08-23 20:17:13 -03:00
Gustavo Sverzut Barbieri c4d09a7a34 examples: add efl_io_copier_simple_example.c
a simpler example to be listed in wiki.
2016-08-23 12:05:37 -03:00
Gustavo Sverzut Barbieri fdad382158 fixup: http 2016-08-22 19:24:13 -03:00
Gustavo Sverzut Barbieri f33bab2648 fixup: http 2016-08-22 18:51:38 -03:00
Gustavo Sverzut Barbieri fe07b8cdab WIP: efl.net: Introduce Efl.Net.Dialer.Http
This class implements the Efl.Net.Dialer interface using libcurl to
perform HTTP requests. That means it's an Efl.Net.Dialer,
Efl.Net.Socket, Efl.Io.Reader, Efl.Io.Writer and Efl.Io.Closer, thus
being usable with Efl.Io.Copier as demonstrated in the
efl_io_copier_example.c
2016-08-22 18:25:15 -03:00
Gustavo Sverzut Barbieri b0b6757bc5 efl.net: socket, server and dialer for TCP.
Efl.Net.Server defines how to accept new connections, doing the
bind(), listen() and accept() for protocols such as TCP.

Efl.Net.Dialer defines to to reach a server.

Both are based on Efl.Net.Socket as communication interface that is
based on Efl.Io.Reader, Efl.Io.Writer and Efl.Io.Closer, thus being
usable with code such as Efl.Io.Copier.

The Server will emit an event "client,add" with the established
Socket, which is a child and can be closed by both the server or the
user.

The Dialer extends the Socket and allows for creating one given an
address, that will be resolved and connected.

TCP is the initial implementation so we an validate the
interfaces. UDP, Unix-Local and SSL will come later as derivate
classes.

The examples are documented and should cover the basic principles:

 - efl_io_copier_example can accept "tcp://IP:PORT" and will work as a
   "netcat", can send data from socket, file or stdin to a socket,
   file, stdout or stderr.

 - efl_net_server_example listens for connections and can either reply
   "Hello World!" and take some data or work as an echo-server,
   looping back all received data to the user.

More complex interactions that require a "chat" between client and
server will be covered with new classes later, such as a queue that
empties itself once data is read.
2016-08-22 18:25:14 -03:00
Gustavo Sverzut Barbieri d0f0bd20a0 efl.io: introduce basic interfaces and classes.
These interfaces allows generic operations on objects that can store
or provide data, such as a file or a buffer.

With well defined interfaces and events we can create code such as
Efl.Io.Copier, that will link a source with a destination and
progressively copy data as they appear.
2016-08-22 18:25:14 -03:00
Tom Hacohen 25588b5ae3 Eo: Finish the renaming of Eo to the EFL.
This renames all the rest of the API to the EFL namespace except for
Eo_Event that will follow soon.

Obviously breaks both API and ABI.
2016-08-15 15:07:42 +01:00
Tom Hacohen 8d31721145 Change the EFL to follow the new Eo rename. 2016-08-11 17:04:43 +01:00
Tom Hacohen c55d3e28ee Adjust the code according to the eo event stop changes.
This was changed in the previous commit.
2016-06-20 18:02:00 +01:00
Shinwoo Kim 6978d707d6 Ecore_Input: define data type for joysticks
Summary: This adds support for joysticks for ecore_input

Reviewers: cedric, devilhorns, Sergeant_Whitespace, raster, thiepha, zmike, jpeg

Reviewed By: thiepha, zmike, jpeg

Subscribers: thiepha, stefan_schmidt, zmike, singh.amitesh, Sergeant_Whitespace, jgerecke, cedric, seoz

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D1538
2016-06-13 20:33:29 +09:00
Tom Hacohen 250be1e27a Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.

It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.

We would have an issue with references and objects being freed too soon
and in general, issue with the references.

Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.

eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 13:33:21 +01:00
Cedric Bail 6fc198c95a eo: for consistency use object like all our API. 2016-05-18 08:18:04 -07:00
Tom Hacohen 1aee2b602a Eo: Remove eo_del() and make eo_unref() the replacement.
We used to have eo_del() as the mirrored action to eo_add(). No longer,
now you just always eo_unref() to delete an object. This change makes it
so the reference of the parent is shared with the reference the
programmer has. So eo_parent_set(obj, NULL) can free an object, and so
does eo_unref() (even if there is a parent).

This means Eo no longer complains if you have a parent during deletion.
2016-05-17 16:23:23 +01:00
Tom Hacohen 6b4d54df87 Change the EFL according to the renaming of the eo_add() current object. 2016-03-15 15:25:54 +00:00
Tom Hacohen fdb1a24ea0 Revert "Automatic migration to the new eo_add syntax."
This reverts commit 4f949a2757b6332306264d7f126b15ba7bfd37d4.
2016-03-11 12:29:03 +00:00
Tom Hacohen 6a210da20c Automatic migration to the new eo_add syntax. 2016-03-09 16:09:14 +00:00
Tom Hacohen 9cdd16035a Automatic migration to Eo4.
I just ran my script (email to follow) to migrate all of the EFL
automatically. This commit is *only* the automatic conversion, so it can
be easily reverted and re-run.
2016-03-03 09:58:08 +00:00
Tom Hacohen b2b3667513 Eo callbacks: Migrate all of the EFL to the new event cb signatures. 2016-02-29 11:33:27 +00:00
Vincent Torri 81244e1785 Example, Ecore: fix compilation on Windows
Summary:
The socket API is different on Windows and on Linux.

This is the perfect example where we need to abstract the socket API in Eina :
1) to avoid all these includes specific to sockets
2) to avoid on Windows undefined behavior : close(socket); is undefined behavior if socket is indeed a socket

Reviewers: jpeg

Reviewed By: jpeg

Subscribers: cedric, jpeg

Projects: #efl

Differential Revision: https://phab.enlightenment.org/D3441
2015-12-15 15:05:06 +09:00
Vincent Torri d032abcdd4 efl: add binary mode to open() calls
This allows better compatibility with Windows

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-05 21:06:04 +01:00
Stefan Schmidt f5f5b56404 examples ecore_buffer: correct argument order for calloc()
calloc() expects count first and the actual size to allocate as second
argument. Say Thank You to smatch for finding this issues for us.
2015-11-30 16:31:58 +01:00
Srivardhan Hebbar d60eda3e82 ecore_con: updating example with ecore_con_url_status_code_get function.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Differential Revision: https://phab.enlightenment.org/D3288

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-09 16:21:02 -08:00
Srivardhan Hebbar 56f81aba8b ecore_con: preventing possible NULL pointer dereference.
Summary:
Checking if client is NULL before freeing is not of much use. If it is NULL, it would have crashed before when it was dereferenced in printf. So checking NULL before dereferencing.
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3151

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-10-09 10:00:32 +02:00
Srivardhan Hebbar f8d5339532 ecore_example: fix file name in the example's comment.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, stefan_schmidt

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3089

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-09-23 12:43:23 -07:00
Srivardhan Hebbar c24540a8e4 ecore_con: preventing possible NULL pointer dereference.
Summary:
Checking if client is NULL before freeing is not of much use. If it is NULL, it would have crashed before when it was dereferenced in printf. So checking NULL before dereferencing.
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3088

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-09-23 12:42:22 -07:00
Srivardhan Hebbar 8788cf72a3 ecore_example: Fixing NULL deference.
Summary:
pd was dereferenced and then checked for NULL. If it was NULL, the program would crash much before. So fixed that.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, stefan_schmidt

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3031
2015-09-07 13:30:48 +02:00
Srivardhan Hebbar 36a7f59c80 ecore_example: Fixing memory leak.
Summary:
Fixed a memory leak in this example.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, stefan_schmidt

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3010
2015-09-07 11:36:18 +02:00
Srivardhan Hebbar 198b314fa8 ecore_example: Fixing NULL dereference.
Summary:
cd was dereferenced and then was checked for NULL. If cd is NULL, it would crash before itself. So checking for NULL before dereferencing cd.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, stefan_schmidt

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3009
2015-09-07 11:13:48 +02:00
Srivardhan Hebbar bd66cdf989 ecore_example: Cleanup of ecore_compose_get_example.c
Summary:
Relating to D3010. This patch is code cleanup. Have done dos2unix. After this will update D3010 bug.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, stefan_schmidt

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3025
2015-09-07 11:00:20 +02:00
Jihoon Kim 7103ddbfe7 ecore_imf_example: remove unnecessary code to set client window 2015-08-20 16:11:24 +09:00
Stefan Schmidt fe8f57ae16 examples/ecore_con: Mark some unused parameters as such 2015-07-23 17:18:04 +02:00
Jihoon Kim 16589c4ea4 example: check NULL value in ecore imf example 2015-07-14 16:15:35 +09:00
Seunghun Lee dd7ef2dbc5 ecore-buffer: Add ecore_buffer library to EFL.
Summary:
Ecore_Buffer is abstraction of graphic buffer.
it supports backend of shm, x11_dri2 and x11_dri3 for now,
and this library also provides method to share buffers between processes.
Ecore_Buffer_Provider and Ecore_Buffer_Consumer is for this, sharing buffer.
provider draws something in to Ecore_Buffer, and consumer receives and displays it.
the binary, bq_mgr is a connection maker for buffer provider and consumer.
it can be included Enlightenment as a deamon later.

@feature

Test Plan:
1. Configure with --enable-ecore-buffer and --enable-always-build-examples to build examples.
2. Run bq_mgr, it connects consumer and provider.
3. Run ecore_buffer_provider_example and ecore_buffer_consumer_example

Reviewers: lsj119, gwanglim, cedric, zmike, jpeg, raster, devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2197
2015-06-22 10:31:42 -04:00
Tom Hacohen ae79cbf48b Eo base: Remove the free_func parameter from key_data_set.
This was not really useful and against the Eolian guidelines.
While I promised I won't break things until the 27th, I was ill
(still am), so I'm giving myself a 1 day pass. :P
2015-05-28 17:47:59 +01:00
Shinwoo Kim 7c1e2f165e [ecore_evas_extn] add function to block mouse event.
Summary: add ecore_evas_extn_socket_events_block_set/get

Test Plan: add mouse event callback, and check whether it could get event or not

Reviewers: raster, woohyun, jaehwan, Sergeant_Whitespace

Reviewed By: Sergeant_Whitespace

Subscribers: Sergeant_Whitespace, seoz, cedric

Differential Revision: https://phab.enlightenment.org/D2268
2015-05-15 16:46:22 +09:00
Srivardhan Hebbar 3e4b061206 ecore_con: example program for ecore_con_eet.
Summary:

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2323

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-04-22 15:10:20 +02:00
Srivardhan Hebbar eaa163600f ecore_con: fix ecore_con_lookup_example to actually exit when done.
Summary:
Without ecore_main_loop_quit the example won't end. So added that and as ecore_init is done in ecore_con_init removed that.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2399

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-04-22 15:10:19 +02:00
Srivardhan Hebbar a4f8fa0679 ecore_con: add example for ftp upload.
Summary:
Added example for ftp upload. In the .gitignore only 2 files added which were missing. The differences it is showing is cos of reordering. I did ls and redirected the file to gitignore. So the files got reordered.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2223

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-25 19:40:41 +01:00
Avi Levin a1336db324 examples: fix bad unref's in ecore and evas.
Summary:
recived Error that object already deleted in the following files:
In evas-object-manipulation-eo.c: d.clipper and d.bg where created with
eo_add ( 1 ref ) but where unrefd twice: once explicity and once when
d.ee were deleted.
In ecore_indler_example: ctxt->idler were again explicity unrefd and
again unrefd by ecore_shutdown.
@fix

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2093

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-06 20:19:22 +01:00
Srivardhan Hebbar d0032ae571 ecore_con: remove code in examples that triggered warnings.
Summary:
When the examples were compiled they used to through the below warning
$ gcc -o ecore_con_client_simple_example ecore_con_client_simple_example.c `pkg-config --libs --cflags ecore ecore-con eina`
ecore_con_client_simple_example.c:11:0: warning: "EINA_UNUSED" redefined
 # define EINA_UNUSED
 ^
In file included from /usr/include/eina-1/Eina.h:215:0,
                 from /usr/include/ecore-1/Ecore.h:304,
                 from ecore_con_client_simple_example.c:5:
/usr/include/eina-1/eina/eina_types.h:112:0: note: this is the location of the previous definition
 #  define EINA_UNUSED __attribute__ ((__unused__))
 ^
So removed these defines as they are no longer required now.

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1919

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-03 14:30:27 +01:00
Tom Hacohen ffdd193100 Eo: Get rid of eo_add_custom.
We decided to deprecate this one in favour of setting thing in the
construction between the constructor and the finalizer.
2014-09-25 10:30:56 +01:00
Jihoon Kim 6ef671c7ae Add example code of ecore_imf_context_bidi_direction_set in ecore_imf_example 2014-09-23 10:20:49 +09:00
WooHyun Jung 9f23418088 examples: Change EINA_TRUE/FALSE to ECORE_CALLBACK_RENEW/CANCEL 2014-09-18 13:30:07 +09:00
Savio Sena 159eaea005 examples: Removed compilation warnings. 2014-07-18 18:55:56 -03:00
Tom Hacohen 0bb21a2ee9 Ecore examples: Add ecore_compose_get() example.
Example created by Vincent Torri.
2014-06-30 17:42:58 +01:00
Vyacheslav Reutskiy 752873866d Ecore_Evas: add new API for unset the cursor from Ecore_Evas.
Summary:
Add ecore_evas_cursor_unset function.
Use the new function in the ecore_evas_object_example.

@feature

Test Plan: ecore_evas_object_example

Reviewers: raster, cedric, seoz, Hermet

CC: cedric

Differential Revision: https://phab.enlightenment.org/D812
2014-06-10 17:32:11 +09:00
Savio Sena 5e471fd9e4 efl: remove some warnings.
Summary:
Mainly from the examples but also from libunibreak and tests/eet.

I'm not sure if it's really worth to remove warnings from the examples
-- because it adds pedantic-ness to something supposed to be didatic,
but I leave for you guys to judge.

Reviewers: tasn, cedric

CC: felipealmeida, raster, smohanty, cedric

Differential Revision: https://phab.enlightenment.org/D896

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-24 02:27:15 +02:00