Posts

Showing posts with the label embed application

Embedding GTK applications via XEmbed - 2

Image
In previous post , we learnt the basics of embedding a GTK application in another application. This works fine when the embedded application supports client server architecture like gVim. Note that in this case the client mode invocations are short lived processes while server process runs throughout the lifetime of the application. In contrast, an application like VLC provides a remote control interface to run  multiple operations in the same process. In this case, we need to obtain an input channel of the process and write our commands to the same. Here's an updated version of the code. Remember to update the two bold paths with appropriate video locations. The application starts with one video and then switches to the next one when the button is clicked. embed.c #include <gtk/gtkx.h> gchar *string; GMutex mutex; void send_hello(GtkButton *btn) {   /* Note the \n at the end */   string = g_strdup_printf("add /home/anand/Downloads/test.mp4 \n"); } static vo...

Embedding GTK applications via XEmbed

Image
Together with GtkPlug , GtkSocket provides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates a GtkSocket widget and passes that widget’s window ID to the other process, which then creates a GtkPlug with that window ID . Any widgets contained in the GtkPlug then will appear inside the first application’s window. Here's an updated version of Embedding applications via XEmbed using GTK 3.0. Reference Here are commands for running some GTK applications in embedded mode: gvim --servername %d --socketid %d #GVim server gvim --servername %d --remote-send 'GoHello, World!<Esc><C-O>' #GVim client cvlc --drawable-xid %d out.mp4     #VLC xterm -into %lu    # Terminal emulator mpv --wid=%lu url     # mpv video player surf -e %lu   # Surf web browser from Suckless based on webkitgtk2 embed.c #include <gtk/gtkx.h> #define EXPR "'GoHel...