From 6ce301671959fc198f7d8bfe6815cbd6bfe6d1b2 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Thu, 7 Jan 2021 14:36:46 +0100 Subject: [PATCH] [GTK3] Move GTK widgets into gtk3/widgets --- Makefile | 4 ++-- gtk3/main.c | 10 +++++----- gtk3/types.h | 10 +++++----- gtk3/{ => widgets}/console_window.c | 3 +-- gtk3/{ => widgets}/console_window.h | 1 + gtk3/{ => widgets}/gb_screen.c | 5 ++--- gtk3/{ => widgets}/gb_screen.h | 2 +- gtk3/{ => widgets}/main_menu.c | 3 +-- gtk3/{ => widgets}/main_menu.h | 1 - gtk3/{ => widgets}/main_window.c | 3 --- gtk3/{ => widgets}/main_window.h | 3 ++- gtk3/{ => widgets}/preferences_window.c | 4 ++-- gtk3/{ => widgets}/preferences_window.h | 0 gtk3/{ => widgets}/printer_window.c | 2 +- gtk3/{ => widgets}/printer_window.h | 1 - gtk3/{ => widgets}/vram_viewer_window.c | 3 ++- gtk3/{ => widgets}/vram_viewer_window.h | 1 - 17 files changed, 25 insertions(+), 31 deletions(-) rename gtk3/{ => widgets}/console_window.c (99%) rename gtk3/{ => widgets}/console_window.h (97%) rename gtk3/{ => widgets}/gb_screen.c (99%) rename gtk3/{ => widgets}/gb_screen.h (97%) rename gtk3/{ => widgets}/main_menu.c (98%) rename gtk3/{ => widgets}/main_menu.h (93%) rename gtk3/{ => widgets}/main_window.c (98%) rename gtk3/{ => widgets}/main_window.h (95%) rename gtk3/{ => widgets}/preferences_window.c (99%) rename gtk3/{ => widgets}/preferences_window.h (100%) rename gtk3/{ => widgets}/printer_window.c (99%) rename gtk3/{ => widgets}/printer_window.h (97%) rename gtk3/{ => widgets}/vram_viewer_window.c (99%) rename gtk3/{ => widgets}/vram_viewer_window.h (98%) diff --git a/Makefile b/Makefile index d180673..bdb3466 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ endif # Use clang if it's available. ifeq ($(origin CC),default) ifneq (, $(shell which clang)) -CC := clang +CC := clang endif endif @@ -226,7 +226,7 @@ all: cocoa sdl tester libretro CORE_SOURCES := $(shell ls Core/*.c) SDL_SOURCES := $(shell ls SDL/*.c) $(OPEN_DIALOG) SDL/audio/$(SDL_AUDIO_DRIVER).c -GTK3_SOURCES := $(shell ls gtk3/*.c) gtk3/sameboy-gtk3-resources.c SDL/audio/$(SDL_AUDIO_DRIVER).c +GTK3_SOURCES := $(shell ls gtk3/*.c gtk3/**/*.c) gtk3/sameboy-gtk3-resources.c SDL/audio/$(SDL_AUDIO_DRIVER).c TESTER_SOURCES := $(shell ls Tester/*.c) ifeq ($(PLATFORM),Darwin) diff --git a/gtk3/main.c b/gtk3/main.c index 588baee..5b4a143 100644 --- a/gtk3/main.c +++ b/gtk3/main.c @@ -12,11 +12,11 @@ #include "config.h" #include "util.h" -#include "main_window.h" -#include "console_window.h" -#include "preferences_window.h" -#include "vram_viewer_window.h" -#include "printer_window.h" +#include "widgets/console_window.h" +#include "widgets/main_window.h" +#include "widgets/preferences_window.h" +#include "widgets/printer_window.h" +#include "widgets/vram_viewer_window.h" // used for audio and game controllers #include "SDL.h" diff --git a/gtk3/types.h b/gtk3/types.h index 0d52551..6be0374 100644 --- a/gtk3/types.h +++ b/gtk3/types.h @@ -2,11 +2,11 @@ #define types_h #include "SDL.h" -#include "main_window.h" -#include "console_window.h" -#include "preferences_window.h" -#include "vram_viewer_window.h" -#include "printer_window.h" +#include "widgets/console_window.h" +#include "widgets/main_window.h" +#include "widgets/preferences_window.h" +#include "widgets/printer_window.h" +#include "widgets/vram_viewer_window.h" typedef struct{ int16_t x, y; diff --git a/gtk3/console_window.c b/gtk3/widgets/console_window.c similarity index 99% rename from gtk3/console_window.c rename to gtk3/widgets/console_window.c index 2e2b383..90a4f22 100644 --- a/gtk3/console_window.c +++ b/gtk3/widgets/console_window.c @@ -1,6 +1,5 @@ #include "console_window.h" -#include "util.h" -#include +#include "../util.h" struct Selection { gint start; diff --git a/gtk3/console_window.h b/gtk3/widgets/console_window.h similarity index 97% rename from gtk3/console_window.h rename to gtk3/widgets/console_window.h index 5154ece..0096860 100644 --- a/gtk3/console_window.h +++ b/gtk3/widgets/console_window.h @@ -3,6 +3,7 @@ #include #include +#include #define CONSOLE_WINDOW_TYPE (console_window_get_type()) G_DECLARE_FINAL_TYPE(ConsoleWindow, console_window, SAMEBOY, CONSOLE_WINDOW, GtkWindow) diff --git a/gtk3/gb_screen.c b/gtk3/widgets/gb_screen.c similarity index 99% rename from gtk3/gb_screen.c rename to gtk3/widgets/gb_screen.c index 3ff0cb9..a9f4b1c 100644 --- a/gtk3/gb_screen.c +++ b/gtk3/widgets/gb_screen.c @@ -1,7 +1,6 @@ #include "gb_screen.h" -#include "config.h" -#include "util.h" -#include +#include "../config.h" +#include "../util.h" struct _GbScreen { GtkBin parent; diff --git a/gtk3/gb_screen.h b/gtk3/widgets/gb_screen.h similarity index 97% rename from gtk3/gb_screen.h rename to gtk3/widgets/gb_screen.h index 22c7c98..00262ce 100644 --- a/gtk3/gb_screen.h +++ b/gtk3/widgets/gb_screen.h @@ -5,7 +5,7 @@ #include #include #include -#include "shader.h" +#include "../shader.h" #define GB_SCREEN_TYPE (gb_screen_get_type()) G_DECLARE_FINAL_TYPE(GbScreen, gb_screen, SAMEBOY, GB_SCREEN, GtkBin) diff --git a/gtk3/main_menu.c b/gtk3/widgets/main_menu.c similarity index 98% rename from gtk3/main_menu.c rename to gtk3/widgets/main_menu.c index dfc0e4d..1edbe64 100644 --- a/gtk3/main_menu.c +++ b/gtk3/widgets/main_menu.c @@ -1,8 +1,7 @@ #include "main_menu.h" #include -#include "util.h" #include "gb_screen.h" -#include "check_menu_radio_group.h" +#include "../check_menu_radio_group.h" struct _MainMenu { GtkMenuBar parent_instance; diff --git a/gtk3/main_menu.h b/gtk3/widgets/main_menu.h similarity index 93% rename from gtk3/main_menu.h rename to gtk3/widgets/main_menu.h index 7e4eac3..dc85cce 100644 --- a/gtk3/main_menu.h +++ b/gtk3/widgets/main_menu.h @@ -3,7 +3,6 @@ #include #include -#include "shader.h" #define MAIN_MENU_TYPE (main_menu_get_type()) G_DECLARE_FINAL_TYPE(MainMenu, main_menu, SAMEBOY, MAIN_MENU, GtkMenuBar) diff --git a/gtk3/main_window.c b/gtk3/widgets/main_window.c similarity index 98% rename from gtk3/main_window.c rename to gtk3/widgets/main_window.c index ba53305..9a81ed5 100644 --- a/gtk3/main_window.c +++ b/gtk3/widgets/main_window.c @@ -1,9 +1,6 @@ #include "main_window.h" -#include -#include "util.h" #include "gb_screen.h" #include "main_menu.h" -#include "check_menu_radio_group.h" struct _MainWindow { GtkApplicationWindowClass parent_class; diff --git a/gtk3/main_window.h b/gtk3/widgets/main_window.h similarity index 95% rename from gtk3/main_window.h rename to gtk3/widgets/main_window.h index cf7ca94..9b9f1b7 100644 --- a/gtk3/main_window.h +++ b/gtk3/widgets/main_window.h @@ -1,9 +1,10 @@ #ifndef main_window_h #define main_window_h +#include #include #include -#include "shader.h" +#include "../shader.h" #define MAIN_WINDOW_TYPE (main_window_get_type()) G_DECLARE_FINAL_TYPE(MainWindow, main_window, SAMEBOY, MAIN_WINDOW, GtkApplicationWindow) diff --git a/gtk3/preferences_window.c b/gtk3/widgets/preferences_window.c similarity index 99% rename from gtk3/preferences_window.c rename to gtk3/widgets/preferences_window.c index 4dcac96..466445f 100644 --- a/gtk3/preferences_window.c +++ b/gtk3/widgets/preferences_window.c @@ -1,6 +1,6 @@ #include "preferences_window.h" -#include "config.h" -#include "util.h" +#include "../config.h" +#include "../util.h" struct _PreferencesWindow { GtkWindowClass parent_class; diff --git a/gtk3/preferences_window.h b/gtk3/widgets/preferences_window.h similarity index 100% rename from gtk3/preferences_window.h rename to gtk3/widgets/preferences_window.h diff --git a/gtk3/printer_window.c b/gtk3/widgets/printer_window.c similarity index 99% rename from gtk3/printer_window.c rename to gtk3/widgets/printer_window.c index 0292a10..8d583c0 100644 --- a/gtk3/printer_window.c +++ b/gtk3/widgets/printer_window.c @@ -1,6 +1,6 @@ #include "printer_window.h" #include -#include "util.h" +#include "../util.h" struct _PrinterWindow { GtkWindowClass parent_class; diff --git a/gtk3/printer_window.h b/gtk3/widgets/printer_window.h similarity index 97% rename from gtk3/printer_window.h rename to gtk3/widgets/printer_window.h index 4e9f542..20aa048 100644 --- a/gtk3/printer_window.h +++ b/gtk3/widgets/printer_window.h @@ -3,7 +3,6 @@ #include #include -#include struct PrinterData { uint32_t *image; diff --git a/gtk3/vram_viewer_window.c b/gtk3/widgets/vram_viewer_window.c similarity index 99% rename from gtk3/vram_viewer_window.c rename to gtk3/widgets/vram_viewer_window.c index 400fab0..b240446 100644 --- a/gtk3/vram_viewer_window.c +++ b/gtk3/widgets/vram_viewer_window.c @@ -1,6 +1,7 @@ #include "vram_viewer_window.h" #include -#include "util.h" +#include "../types.h" +#include "../util.h" #define tileset_buffer_length 256 * 192 * 4 #define tilemap_buffer_length 256 * 256 * 4 diff --git a/gtk3/vram_viewer_window.h b/gtk3/widgets/vram_viewer_window.h similarity index 98% rename from gtk3/vram_viewer_window.h rename to gtk3/widgets/vram_viewer_window.h index 5eaba0a..5daaeb6 100644 --- a/gtk3/vram_viewer_window.h +++ b/gtk3/widgets/vram_viewer_window.h @@ -3,7 +3,6 @@ #include #include -#include #define VRAM_VIEWER_WINDOW_TYPE (vram_viewer_window_get_type()) G_DECLARE_FINAL_TYPE(VramViewerWindow, vram_viewer_window, SAMEBOY, VRAM_VIEWER_WINDOW, GtkWindow)