GTK: continue GTK4 greenfield restart

This commit is contained in:
NunoSempere 2024-07-20 21:19:51 -04:00
parent 6e7966b3b3
commit e6c1913f0d
2 changed files with 59 additions and 0 deletions

View File

@ -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

48
rosenrot4_greenfield.c Normal file
View File

@ -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;
}