commit e6c1913f0d2a61ccb8513cb3b852cfca717d7590
parent 6e7966b3b3a78aeb624c00cb249151631881548d
Author: NunoSempere <nuno.semperelh@protonmail.com>
Date: Sat, 20 Jul 2024 21:19:51 -0400
GTK: continue GTK4 greenfield restart
Diffstat:
2 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/makefile b/makefile
@@ -19,6 +19,13 @@ INCS_4=`pkg-config --cflags ${DEPS_4}` `pkg-config --cflags gtk4`
LIBS_4=`pkg-config --libs ${DEPS_4}` `pkg-config --libs gtk4`
# DEPRECATION_FLAGS=-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED
+# Dependencies starting from scratchpad
+SRC_4_greenfield=rosenrot4_greenfield.c
+DEPS_4_greenfield='webkitgtk-6.0'
+INCS_4_greenfield=`pkg-config --cflags ${DEPS_4_greenfield}` `pkg-config --cflags gtk4`
+LIBS_4_greenfield=`pkg-config --libs ${DEPS_4_greenfield}` `pkg-config --libs gtk4`
+# DEPRECATION_FLAGS=-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED
+
# User config
CONFIG=config.h
@@ -49,6 +56,10 @@ build4: $(SRC_4) $(PLUGINS) $(CONFIG) constants user_cache
$(CC) $(STD) $(WARNINGS) $(DEPRECATION_FLAGS) $(OPTIMIZED_MORE) $(DEBUG) $(INCS_4) $(PLUGINS) $(SRC_4) -o rosenrot $(LIBS_4) $(ADBLOCK)
@echo
+build4_greenfield: $(SRC_4_greenfield) $(PLUGINS) $(CONFIG) constants user_cache
+ $(CC) $(STD) $(WARNINGS) $(DEPRECATION_FLAGS) $(OPTIMIZED_MORE) $(DEBUG) $(INCS_4_greenfield) $(PLUGINS) $(SRC_4_greenfield) -o rosenrot $(LIBS_4_greenfield) $(ADBLOCK)
+ @echo
+
diagnose:
G_ENABLE_DIAGNOSTIC=1 ./rosenrot
diff --git a/rosenrot4_greenfield.c b/rosenrot4_greenfield.c
@@ -0,0 +1,48 @@
+#include <gtk/gtk.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <webkit/webkit.h>
+#include "config.h"
+#include "plugins/plugins.h"
+
+#define WIDTH 1920 // 960 for half-width, 1920 for full width
+// #define HEIGHT 1080
+#define HEIGHT 1080
+
+static GtkNotebook* notebook;
+
+int
+main (int argc, char **argv)
+{
+ GtkWidget *window;
+ // Initialize i18n support with bindtextdomain(), etc.
+
+ // ...
+
+ // Initialize the widget set
+ gtk_init ();
+
+ // Create the main window
+ window = gtk_window_new ();
+ gtk_window_set_default_size(GTK_WINDOW(window), WIDTH, HEIGHT);
+
+ // Set up our GUI elements
+
+ notebook = GTK_NOTEBOOK(gtk_notebook_new());
+ gtk_notebook_set_show_tabs(notebook, false);
+ gtk_notebook_set_show_border(notebook, false);
+
+ // ...
+
+ // Show the application window
+ gtk_window_present (GTK_WINDOW (window));
+ gtk_window_set_child(GTK_WINDOW(window), GTK_WIDGET(notebook));
+
+ // Enter the main event loop, and wait for user interaction
+ while (!0)
+ g_main_context_iteration (NULL, TRUE);
+
+ // The user lost interest
+ return 0;
+}