Segfault due to the 'socket' symbol referring to the variable instead of the actual libc socket() function: #0 0x0000aaaaaaac0040 in socket () #1 0x0000fffff723c698 in g_socket (domain=1, type=1, protocol=0, error=error@entry=0xffffe6ed79b8) at ../gio/gsocket.c:647 (how was this not caught before? o.0)
51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
#include <gtk/gtk.h>
|
|
#include "casilda-compositor.h"
|
|
|
|
/* Do not listen on any socket by default */
|
|
static gchar *socket = NULL;
|
|
static gchar *dirname;
|
|
|
|
|
|
static void
|
|
activate (GtkApplication *app, G_GNUC_UNUSED gpointer user_data)
|
|
{
|
|
CasildaCompositor *compositor;
|
|
GtkWidget *window;
|
|
|
|
window = gtk_application_window_new (app);
|
|
gtk_window_set_title (GTK_WINDOW (window), "Nested Casilda Compositor");
|
|
gtk_window_set_default_size (GTK_WINDOW (window), 1152, 864);
|
|
|
|
if (socket)
|
|
g_message ("Listening on %s", socket);
|
|
else
|
|
g_message ("Not listening in any socket, you can pass a socket path as parameter");
|
|
|
|
compositor = casilda_compositor_new (socket);
|
|
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (compositor));
|
|
gtk_window_present (GTK_WINDOW (window));
|
|
|
|
gchar *argv[2] = {
|
|
g_build_path ("/", dirname, "compositor", NULL),
|
|
NULL
|
|
};
|
|
|
|
g_message("Running %s", argv[0]);
|
|
casilda_compositor_spawn_async (compositor, NULL, argv, NULL, G_SPAWN_DEFAULT, NULL, NULL, NULL, NULL);
|
|
}
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
g_autoptr(GtkApplication) app = NULL;
|
|
|
|
dirname = g_path_get_dirname (argv[0]);
|
|
|
|
app = gtk_application_new ("ar.xjuan.casilda.NestedExample", G_APPLICATION_DEFAULT_FLAGS);
|
|
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
|
|
|
if (argc >= 2)
|
|
socket = argv[1];
|
|
|
|
return g_application_run (G_APPLICATION (app), 0, NULL);
|
|
}
|