aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang_complete21
-rw-r--r--.gitignore1
-rw-r--r--Makefile14
-rw-r--r--src/ctakgtk.c52
4 files changed, 83 insertions, 5 deletions
diff --git a/.clang_complete b/.clang_complete
index 3e2e760..a1f8b91 100644
--- a/.clang_complete
+++ b/.clang_complete
@@ -1 +1,22 @@
-Iinclude/
+-I/usr/include/gtk-3.0
+-I/usr/include/pango-1.0
+-I/usr/include/glib-2.0
+-I/usr/lib/glib-2.0/include
+-I/usr/include/harfbuzz
+-I/usr/include/freetype2
+-I/usr/include/libpng16
+-I/usr/include/libmount
+-I/usr/include/blkid
+-I/usr/include/fribidi
+-I/usr/include/cairo
+-I/usr/include/lzo
+-I/usr/include/pixman-1
+-I/usr/include/gdk-pixbuf-2.0
+-I/usr/include/gio-unix-2.0
+-I/usr/include/cloudproviders
+-I/usr/include/atk-1.0
+-I/usr/include/at-spi2-atk/2.0
+-I/usr/include/dbus-1.0
+-I/usr/lib/dbus-1.0/include
+-I/usr/include/at-spi-2.0
diff --git a/.gitignore b/.gitignore
index fae0106..01d5d2b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@ data/
ct1986
ctaklm
pptdb
+ctakgtk
buildroot*
diff --git a/Makefile b/Makefile
index e519a3c..05b4a1f 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ CFLAGS=-O3 -Wall -Wextra -Wpedantic -std=c99 -D_DEFAULT_SOURCE $(DEFINES) -I$(ID
CTAK=include/tak.c
CTAK_OBJS=$(CTAK:.c=.o)
-SRCS=$(wildcard include/*.c)
+SRCS=$(filter-out include/lcdlib.c,$(wildcard include/*.c))
OBJS=$(SRCS:.c=.o)
BUILDROOT_DIR=buildroot-2020.11.1
@@ -16,15 +16,15 @@ CROSS_STRIP=$(BUILDROOT_DIR)/output/host/bin/arm-linux-strip
.DEFAULT_GOAL=native
%.o: %.c
- $(CC) -c $< -o $@ $(CFLAGS)
+ $(CC) -c $< -o $@ $(CFLAGS) $(EXTRA_FLAGS)
ctaklm: src/ctaklm.o $(OBJS)
$(CC) $(CFLAGS) src/ctaklm.o $(OBJS) -o ctaklm
$(STRIP) ctaklm
-ct1986: src/ct1986.o $(OBJS)
- $(CC) $(CFLAGS) src/ct1986.o $(OBJS) -o ct1986
- $(STRIP) ct1986
+ctakgtk: EXTRA_FLAGS=`pkg-config --cflags --libs gtk+-3.0`
+ctakgtk: src/ctakgtk.o $(OBJS)
+ $(CC) $(CFLAGS) $(EXTRA_FLAGS) src/ctakgtk.o $(OBJS) -o ctakgtk
pptdb: src/pptdb.o $(CTAK_OBJS)
$(CC) $(CFLAGS) src/pptdb.o $(CTAK_OBJS) -o pptdb
@@ -38,6 +38,10 @@ native: clean ctaklm pptdb
$(CROSS_CC):
./resources/do_buildroot.sh $(BUILDROOT_DIR)
+ct1986: src/ct1986.o $(OBJS) include/lcdlib.o
+ $(CC) $(CFLAGS) src/ct1986.o $(OBJS) include/lcdlib.o -o ct1986
+ $(STRIP) ct1986
+
pi: CC=$(CROSS_CC)
pi: STRIP=$(CROSS_STRIP)
pi: $(CROSS_CC) clean ctaklm ct1986
diff --git a/src/ctakgtk.c b/src/ctakgtk.c
new file mode 100644
index 0000000..4ab690e
--- /dev/null
+++ b/src/ctakgtk.c
@@ -0,0 +1,52 @@
+#include <gtk-3.0/gtk/gtk.h>
+
+#include <tak.h>
+#include <negamax.h>
+
+inline void negamax_display_progress(const uint8_t cur_depth,
+ const uint32_t length) {
+ (void)(cur_depth);
+ (void)(length);
+
+}
+
+static void print_hello(GtkWidget *widget, gpointer data) {
+ (void)(widget);
+ (void)(data);
+
+ g_print("Exiting\n");
+}
+
+static void activate(GtkApplication* app, gpointer user_data) {
+ GtkWidget *window;
+ GtkWidget *button;
+ GtkWidget *button_box;
+
+ (void)(user_data);
+
+ window = gtk_application_window_new(app);
+ gtk_window_set_title(GTK_WINDOW(window), "ctakgtk");
+ gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
+
+ button_box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
+ gtk_container_add(GTK_CONTAINER(window), button_box);
+
+ button = gtk_button_new_with_label("Hello World");
+ g_signal_connect(button, "clicked", G_CALLBACK(print_hello), NULL);
+ g_signal_connect_swapped(button, "clicked", G_CALLBACK(gtk_widget_destroy), window);
+ gtk_container_add(GTK_CONTAINER(button_box), button);
+
+ gtk_widget_show_all(window);
+}
+
+int main(int argc, char **argv) {
+ GtkApplication *app;
+ int status;
+
+ app = gtk_application_new("org.tslil.xyz", G_APPLICATION_FLAGS_NONE);
+ g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
+ status = g_application_run(G_APPLICATION(app), argc, argv);
+ g_object_unref(app);
+
+ return status;
+}