diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7900de26f4a5ac5ee082c82740ecefe1d0745152..abcd1d8d4ca82bcfd9a6658b1043400248560080 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,4 +4,5 @@ cmake_minimum_required(VERSION 2.6)
 project(gtk)
 
 subdirs(o_gtk_image)
+subdirs(c_gtk_image)
 
diff --git a/c_gtk_image/CMakeLists.txt b/c_gtk_image/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..588efeb454b380cbd8f21d4b56167e6f13d56caa
--- /dev/null
+++ b/c_gtk_image/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Set the minimum version of cmake required to build this project
+cmake_minimum_required(VERSION 2.6)
+
+project(c_gtk_image)
+
+#This is to be able to debug and recompile automatically the libs (shared_blc). It is slower, you can remove this line and use  :  ${BLAR_BUILD_DIR}/lib/libblc.dylib instead of shared_blc
+
+find_package(blc_network REQUIRED)
+find_package(blc_channel REQUIRED) #For compatibilité with common.h
+
+find_package(blc_image REQUIRED)  
+find_package(blc_program REQUIRED)
+
+find_package(PkgConfig REQUIRED) 
+pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
+find_package(JPEG REQUIRED) 
+
+add_definitions(-Wall ${BL_DEFINITIONS} -std=c++17 -Wno-deprecated-declarations) #device_manager (mouse) is deprecated
+include_directories(${GTK3_INCLUDE_DIRS} ${BL_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR} ../include)
+link_directories(${GTK3_LIBRARY_DIRS})
+add_definitions(${GTK3_CFLAGS_OTHER})
+add_executable(c_gtk_image c_gtk_image.cpp ../src/image_display.cpp ../src/histogram.cpp)
+target_link_libraries(c_gtk_image ${GTK3_LIBRARIES} ${BL_LIBRARIES} ${JPEG_LIBRARIES} )
+
+
+
+
+
diff --git a/c_gtk_image/c_gtk_image.cpp b/c_gtk_image/c_gtk_image.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..41365f6e14c834695c8e3cd95c2697004a623fb5
--- /dev/null
+++ b/c_gtk_image/c_gtk_image.cpp
@@ -0,0 +1,138 @@
+#include "common.h"
+
+#include <fcntl.h> // O_RDONLY ...
+#include <stdio.h>
+#include <gtk/gtk.h>
+#include <string.h>
+#include <stdint.h> //uint32_t
+//#include <jpeglib.h>
+#include <sys/mman.h>
+#include <errno.h> //errno
+#include "blc_core.h"
+#include "blc_program.h"
+#include "blc_network.h"
+#include <thread>
+
+using namespace std;
+
+float min_val, max_val;
+
+const char *channel_name, *fullscreen_option, *keyboard_mode;
+GtkWidget *window;
+GdkDisplay *main_display;
+GdkDevice *pointer_device;
+int interactive_mode=0;
+GtkApplication *app;
+
+blc_channel mouse_channel;
+blc_channel input;
+
+char const *input_name;
+
+int input_terminal;
+int mode;
+
+char const *format_string;
+uint32_t format;
+
+void ask_fullscreen(){
+    gtk_window_fullscreen(GTK_WINDOW(window));
+    
+}
+
+void ask_quit()
+{
+    g_application_quit(G_APPLICATION(app));
+    blc_quit();
+}
+
+void on_key_press(GtkWidget	     *widget, GdkEventKey	     *event){
+    
+    char key;
+    
+    if (event->type == GDK_KEY_PRESS){
+        key=event->keyval;
+        fwrite(&key, 1, 1, stdout);
+        fflush(stdout);
+    }
+}
+
+void activate_cb(GApplication *app)
+{
+    GtkWidget *display=nullptr;
+    GtkWidget *grid;
+    
+    main_display = gdk_display_get_default ();
+    GdkDeviceManager *device_manager = gdk_display_get_device_manager (main_display);
+    pointer_device = gdk_device_manager_get_client_pointer (device_manager);
+    
+    window=gtk_application_window_new(GTK_APPLICATION(app));
+    gtk_window_set_title(GTK_WINDOW(window), input.name);
+    
+    grid=gtk_grid_new();
+    
+    //  for(i=0; input_names[i]; i++){ This is for displaying multiple images
+    //  input=new blc_channel(/*input_names[i]*/ input_name, BLC_CHANNEL_READ);
+    display=create_image_display(&input);
+    if (display==NULL) EXIT_ON_CHANNEL_ERROR(&input, "Format not managed.");
+    gtk_widget_set_hexpand(display, 1);
+    gtk_widget_set_vexpand(display, 1);
+    gtk_container_add(GTK_CONTAINER(grid), display);
+    //  }
+    gtk_container_add(GTK_CONTAINER(window), grid);
+    gtk_widget_show_all(window);
+    if (keyboard_mode) g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK (on_key_press), NULL);
+    
+}
+
+/** Classical GTK application.
+ * The first optional argument is the name of the experience. Otherwise all the existing shared memory are used.
+ * */
+int main(int argc, char *argv[])
+{
+    int status=0;
+    char const *g_debug, *mouse_name, *min_str, *max_str;
+    
+    blc_program_set_description("Display the content of the blc_channel depending on its type on format");
+    blc_program_add_option(&keyboard_mode, 'k', "keyboard", nullptr, "Send keyboard input to stdout", nullptr);
+    blc_program_add_option(&min_str, 'm', "min", "FL32", "minimal value", nullptr);
+    blc_program_add_option(&max_str, 'M', "max", "FL32", "maximal value", nullptr);
+    blc_program_add_option(&fullscreen_option, 'F', "fullscreen", nullptr, "Set the window in fullscreen", nullptr);
+    blc_program_add_option(&g_debug, 'g', "g-fatal-warnings", nullptr, "Debug gtk.", nullptr);
+    
+    blc_program_init(&argc, &argv, ask_quit);
+    blc_command_forward_blc_channels();
+
+    blc_array_tcp4_client input_client(&input, "127.0.0.1", "31440");
+    input.allocate();
+    fprintf(stderr, "Connecté\n");
+        
+    min_val=0;
+    if (input.type=='UIN8') max_val=256;
+    if (input.type=='INT8'){
+        min_val=-128;
+        max_val=128;
+    }
+    
+    if (input.type=='FL32' && input.format=='Y800'){
+        if (min_str) SSCANF(1, min_str, "%f", &min_val);
+        else min_val=0;
+        if (max_str) SSCANF(1, max_str, "%f", &max_val);
+        else max_val=1;
+    }else if (min_str || max_str) EXIT_ON_ARRAY_ERROR(&input, "Min (-m) and max (-M) have only effect for type FL32 format Y800");
+    
+
+    thread input_thread([&input_client](){
+        while(1) input_client.read_data();
+    });
+
+    gtk_disable_setlocale();
+    gtk_init(&argc, &argv);
+    app = gtk_application_new(nullptr, G_APPLICATION_FLAGS_NONE);
+    g_signal_connect (app, "activate", G_CALLBACK (activate_cb), nullptr);
+    status = g_application_run(G_APPLICATION(app), 0, nullptr);
+    g_object_unref(app);
+    
+    return EXIT_SUCCESS;
+}
+
diff --git a/o_gtk_image/src/common.h b/include/common.h
similarity index 95%
rename from o_gtk_image/src/common.h
rename to include/common.h
index 90eef3433af76c37a4d140d2b5850ecef2078d14..018935268a85ae83fbf09c5b389c5d728bf834ce 100644
--- a/o_gtk_image/src/common.h
+++ b/include/common.h
@@ -5,7 +5,7 @@
 #include <blc_channel.h>
 
 
-extern float min, max;
+extern float min_val, max_val;
 
 extern blc_channel *channel;
 extern GtkWidget *legend;
diff --git a/o_gtk_image/CMakeLists.txt b/o_gtk_image/CMakeLists.txt
index 15bd5a7f23d9f7421a9b218d50f9755a8af0f7db..a9f91ec1a2837a6f3eee0fb6db9d8b97808103e8 100644
--- a/o_gtk_image/CMakeLists.txt
+++ b/o_gtk_image/CMakeLists.txt
@@ -14,10 +14,10 @@ pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
 find_package(JPEG REQUIRED) 
 
 add_definitions(-Wall ${BL_DEFINITIONS} -Wno-deprecated-declarations) #device_manager (mouse) is deprecated
-include_directories(${GTK3_INCLUDE_DIRS} ${BL_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR})
+include_directories(${GTK3_INCLUDE_DIRS} ${BL_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR} ../include)
 link_directories(${GTK3_LIBRARY_DIRS})
 add_definitions(${GTK3_CFLAGS_OTHER})
-add_executable(o_gtk_image src/o_gtk_image.cpp src/image_display.cpp src/histogram.cpp)
+add_executable(o_gtk_image o_gtk_image.cpp ../src/image_display.cpp ../src/histogram.cpp)
 target_link_libraries(o_gtk_image ${GTK3_LIBRARIES} ${BL_LIBRARIES} ${JPEG_LIBRARIES} )
 
 
diff --git a/o_gtk_image/src/o_gtk_image.cpp b/o_gtk_image/o_gtk_image.cpp
similarity index 93%
rename from o_gtk_image/src/o_gtk_image.cpp
rename to o_gtk_image/o_gtk_image.cpp
index 4ba398bb07f84a60f6d328df5525403f7d1b492b..cc73094d11b38fdbca764d9b351050527fb7ebec 100644
--- a/o_gtk_image/src/o_gtk_image.cpp
+++ b/o_gtk_image/o_gtk_image.cpp
@@ -10,7 +10,7 @@
 #include <errno.h> //errno
 #include "blc_core.h"
 #include "blc_program.h"
-float min, max;
+float min_val, max_val;
 
 const char *channel_name, *fullscreen_option, *keyboard_mode;
 GtkWidget *window;
@@ -104,18 +104,18 @@ int main(int argc, char *argv[])
     
     input.open(input_name, mode);
     
-    min=0;
-    if (input.type=='UIN8') max=256;
+    min_val=0;
+    if (input.type=='UIN8') max_val=256;
     if (input.type=='INT8'){
-        min=-128;
-        max=128;
+        min_val=-128;
+        max_val=128;
     }
     
     if (input.type=='FL32' && input.format=='Y800'){
-        if (min_str) SSCANF(1, min_str, "%f", &min);
-        else min=0;
-        if (max_str) SSCANF(1, max_str, "%f", &max);
-        else max=1;
+        if (min_str) SSCANF(1, min_str, "%f", &min_val);
+        else min_val=0;
+        if (max_str) SSCANF(1, max_str, "%f", &max_val);
+        else max_val=1;
     }else if (min_str || max_str) EXIT_ON_ARRAY_ERROR(&input, "Min (-m) and max (-M) have only effect for type FL32 format Y800");
     
     gtk_disable_setlocale();
diff --git a/o_gtk_image/src/histogram.cpp b/src/histogram.cpp
similarity index 97%
rename from o_gtk_image/src/histogram.cpp
rename to src/histogram.cpp
index 7f9464a5345e3872adb1527e2572fc7b81836dae..1591a40605e2e7b13d914f1392b2f9662b332f3c 100644
--- a/o_gtk_image/src/histogram.cpp
+++ b/src/histogram.cpp
@@ -63,7 +63,7 @@ static gboolean update_histogram_cb(GtkImage *image, GdkFrameClock *, gpointer p
                     }
                     break;
                 case 'FL32':
-                    FOR(i, channel->total_length) histogram[(int)CLIP_UCHAR(((channel->floats[i]-min)/(max-min)*256+0.5))]++;
+                    FOR(i, channel->total_length) histogram[(int)CLIP_UCHAR(((channel->floats[i]-min_val)/(max_val-min_val)*256+0.5))]++;
                     FOR(i, 256) hist_max=MAX(histogram[i], hist_max);
                     FOR(i, 256)
                 {
@@ -73,7 +73,7 @@ static gboolean update_histogram_cb(GtkImage *image, GdkFrameClock *, gpointer p
                 }
                     if (y>=0 && y<256 && x >=0 && x<256)
                     {
-                        SPRINTF(text, "Y[%f]=%f.2%%", x*(max-min-0.5)/256+min, histogram[x]*100/(float)channel->total_length);
+                        SPRINTF(text, "Y[%f]=%f.2%%", x*(max_val-min_val-0.5)/256+min_val, histogram[x]*100/(float)channel->total_length);
                         gtk_statusbar_push(GTK_STATUSBAR(pointer_statusbar), 0, text);
                     }
                     break;
@@ -189,10 +189,10 @@ void histogram_cb(GtkToolButton *toolbutton, gpointer pointer_statusbar )
         gtk_container_add(GTK_CONTAINER(histogram), histogram_scrolled_window);
         gtk_container_add(GTK_CONTAINER(histogram), legend_box);
         
-        SPRINTF(text, "%f", min);
+        SPRINTF(text, "%f", min_val);
         label=gtk_label_new(text);
         gtk_box_pack_start(GTK_BOX(legend_box), label, FALSE, FALSE, 0);
-        SPRINTF(text, "%f", max);
+        SPRINTF(text, "%f", max_val);
         label=gtk_label_new(text);
         gtk_box_pack_end(GTK_BOX(legend_box), label, FALSE, FALSE, 0);
         
diff --git a/o_gtk_image/src/image_display.cpp b/src/image_display.cpp
similarity index 99%
rename from o_gtk_image/src/image_display.cpp
rename to src/image_display.cpp
index a4c6d36f01f16a39cae8031945b5879d0a70fe55..959a493f8cdcfe4a8bc7da2be3fb97949cbd3e3e 100644
--- a/o_gtk_image/src/image_display.cpp
+++ b/src/image_display.cpp
@@ -168,14 +168,14 @@ gboolean update_Y800_image(GtkImage *image, GdkFrameClock *, gpointer pointer_st
     uint32_t *values;
     char text[64];
     
-    gain=1/(max-min);
+    gain=1/(max_val-min_val);
     
     if (blc_command_loop_start()){
         values = (uint32_t*)image_buffer;
         if (channel->type=='UIN8')
             FOR(i, channel->size) values[i]=color_map[channel->uchars[i]];
         else if (channel->type=='FL32')
-            FOR(i, channel->total_length) values[i]=color_map[CLIP_UCHAR((channel->floats[i]-min)*256*gain-0.5f)];
+            FOR(i, channel->total_length) values[i]=color_map[CLIP_UCHAR((channel->floats[i]-min_val)*256*gain-0.5f)];
         else EXIT_ON_ARRAY_ERROR(channel, "Type not managed");
         gtk_image_set_from_surface(image, image_surface);