refactor: cleanup include headers

This commit is contained in:
DanyLE
2025-07-07 18:35:05 +02:00
parent d2ca1732f1
commit a0456516b5
16 changed files with 56 additions and 16 deletions

View File

@ -37,6 +37,7 @@ wayland_targets=[]
wl_protocols = [
wl_protocol_dir / 'staging/ext-session-lock/ext-session-lock-v1',
wl_protocol_dir / 'staging/ext-idle-notify/ext-idle-notify-v1',
'protocols/wlr-foreign-toplevel-management-unstable-v1',
'protocols/virtual-keyboard-unstable-v1'
]

View File

@ -1,4 +1,5 @@
#include "background.h"
#include "session-shell.h"
#include <assert.h>
#define NAMESPACE "diya_shell_background"

View File

@ -1,7 +1,8 @@
#ifndef DIYA_SHELL_BACKGROUND_H
#define DIYA_SHELL_BACKGROUND_H
#include "session-shell.h"
#include "base.h"
USE_CLASS(DiyaSessionShell);
void diya_session_shell_init_background(DiyaSessionShell * shell);

View File

@ -3,7 +3,10 @@
#include <glib-object.h>
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#define USE_CLASS(name) typedef struct _##name name
#define DIYA_PROP_SHELL "shell"
/**

View File

@ -3,6 +3,7 @@
#include "wlr-foreign-toplevel-management-unstable-v1.h"
#include "foreign.h"
#include "wayland.h"
#include "session-shell.h"
/**
* @DiyaForeignWindow Object definition

View File

@ -1,6 +1,10 @@
#ifndef DIYA_SHELL_FOREIGN_H
#define DIYA_SHELL_FOREIGN_H
#include "session-shell.h"
#include "base.h"
#define DIYA_TYPE_FOREIGN_WINDOW (diya_foreign_window_get_type ())
G_DECLARE_FINAL_TYPE (DiyaForeignWindow, diya_foreign_window, DIYA, FOREIGN_WINDOW, DiyaShellObject)
#define DIYA_PROP_FOREIGN_WINDOW_APPID "appid"
#define DIYA_PROP_FOREIGN_WINDOW_TITLE "title"
@ -17,6 +21,9 @@ enum diya_win_state
DIYA_WIN_STATE_FOCUS = 1 << 3,
};
USE_CLASS(DiyaShell);
USE_CLASS(GAppInfo);
void diya_session_shell_foreign_toplevel_register(struct wl_registry *registry, uint32_t name, DiyaShell * shell);
DiyaShell* diya_foreign_window_get_shell(DiyaForeignWindow* window);

View File

@ -18,6 +18,7 @@
#include "wlr-foreign-toplevel-management-unstable-v1.h"
#include "virtual-keyboard-unstable-v1.h"
#include "wayland.h"
#include "shell.h"
struct _DiyaInput
{

View File

@ -1,10 +1,12 @@
#ifndef DIYA_INPUT_H
#define DIYA_INPUT_H
#include "shell.h"
#include "base.h"
USE_CLASS(DiyaShell);
#define DIYA_TYPE_INPUT (diya_input_get_type ())
G_DECLARE_FINAL_TYPE (DiyaInput, diya_input, DIYA, INPUT, DiyaShellObject)
DiyaInput* diya_input_new(DiyaShell* shell);
#endif

View File

@ -1,7 +1,9 @@
#ifndef DIYA_SHELL_LAUNCHER_H
#define DIYA_SHELL_LAUNCHER_H
#include "session-shell.h"
#include "base.h"
USE_CLASS(DiyaSessionShell);
#define DIYA_PROP_LAUNCHER_DASHBOARD "dashboard"
#define DIYA_PROP_LAUNCHER_TASKBAR "taskbar"

View File

@ -20,8 +20,7 @@
#define DIYA_TYPE_SESSION_SHELL (diya_session_shell_get_type ())
G_DECLARE_FINAL_TYPE (DiyaSessionShell, diya_session_shell, DIYA, SESSION_SHELL, DiyaShell)
#define DIYA_TYPE_FOREIGN_WINDOW (diya_foreign_window_get_type ())
G_DECLARE_FINAL_TYPE (DiyaForeignWindow, diya_foreign_window, DIYA, FOREIGN_WINDOW, DiyaShellObject)
USE_CLASS(DiyaForeignWindow);
DiyaForeignWindow* diya_session_shell_get_window(DiyaSessionShell * shell, gpointer handle);
gboolean diya_session_shell_add_window(DiyaSessionShell * shell, DiyaForeignWindow * win);

View File

@ -338,6 +338,7 @@ static void diya_shell_class_init(DiyaShellClass *class)
class->foreign_register = NULL;
class->virtual_keyboard_register = diya_virtual_keyboard_register;
class->idle_notifier_register = NULL;
class->monitor_changed_handle = NULL;
class->startup_handle = NULL;
class->active_handle = NULL;

View File

@ -1,6 +1,5 @@
#ifndef DIYA_SHELL_H
#define DIYA_SHELL_H
#include <stdint.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include "base.h"
@ -23,12 +22,6 @@
#define DIYA_TYPE_SHELL (diya_shell_get_type())
G_DECLARE_DERIVABLE_TYPE(DiyaShell, diya_shell, DIYA, SHELL, DiyaObject)
#define DIYA_TYPE_WAYLAND (diya_wayland_get_type ())
G_DECLARE_FINAL_TYPE (DiyaWayland, diya_wayland, DIYA, WAYLAND, DiyaShellObject)
#define DIYA_TYPE_VIRTUAL_KEYBOARD (diya_virtual_keyboard_get_type ())
G_DECLARE_FINAL_TYPE (DiyaVirtualKeyboard, diya_virtual_keyboard, DIYA, VIRTUAL_KEYBOARD, DiyaShellObject)
struct wl_registry;
typedef void (*wl_protocol_manager_register_t)(struct wl_registry*, uint32_t,DiyaShell*);
@ -38,12 +31,16 @@ struct _DiyaShellClass
DiyaObjectClass parent_class;
wl_protocol_manager_register_t foreign_register;
wl_protocol_manager_register_t virtual_keyboard_register;
wl_protocol_manager_register_t idle_notifier_register;
void (*monitor_changed_handle)(GListModel* /*list*/,guint /*position*/, guint /*removed*/,guint /*added*/, gpointer);
void (*startup_handle)(DiyaShell*);
void (*active_handle)(DiyaShell*);
void (*reload_handle)(DiyaShell*);
};
USE_CLASS(DiyaWayland);
USE_CLASS(DiyaVirtualKeyboard);
DiyaWayland * diya_shell_get_wayland(DiyaShell* shell);
GtkApplication* diya_shell_get_application(DiyaShell* shell);
const char* diya_shell_get_name(DiyaShell* shell);

View File

@ -12,6 +12,7 @@
#include "virtual-keyboard-unstable-v1.h"
#include "virtual-keyboard.h"
#include "wayland.h"
#include "shell.h"
typedef enum
{

View File

@ -1,11 +1,17 @@
#ifndef DIYA_VIRTUAL_KEYBOARD_H
#define DIYA_VIRTUAL_KEYBOARD_H
#include "shell.h"
#include "base.h"
#define DIYA_SIGNAL_VKB_MODIFIER_CHANGED "modifier-changed"
#define DIYA_SIGNAL_VKB_KEY_PRESSED "pressed"
#define DIYA_SIGNAL_VKB_KEY_RELEASED "released"
#define DIYA_TYPE_VIRTUAL_KEYBOARD (diya_virtual_keyboard_get_type ())
G_DECLARE_FINAL_TYPE (DiyaVirtualKeyboard, diya_virtual_keyboard, DIYA, VIRTUAL_KEYBOARD, DiyaShellObject)
USE_CLASS(DiyaShell);
typedef enum
{
VKB_KEY_STATE_RELEASED = 0 /*WL_KEYBOARD_KEY_STATE_RELEASED*/,

View File

@ -3,8 +3,9 @@
#include <assert.h>
#include "wlr-foreign-toplevel-management-unstable-v1.h"
#include "virtual-keyboard-unstable-v1.h"
#include "ext-idle-notify-v1.h"
#include "wayland.h"
#include "shell.h"
struct _DiyaWayland
{
@ -103,6 +104,13 @@ static void handle_global(void *data, struct wl_registry *registry, uint32_t nam
{
wayland->seat = wl_registry_bind(registry, name, &wl_seat_interface, 7);
}
else if(strcmp(interface, ext_idle_notifier_v1_interface.name) == 0)
{
if(class->idle_notifier_register)
{
class->idle_notifier_register(registry, name, data);
}
}
}
static void handle_global_remove(void *data, struct wl_registry *registry,

View File

@ -1,7 +1,16 @@
#ifndef DIYA_SHELL_WAYLAND_H
#define DIYA_SHELL_WAYLAND_H
#include "shell.h"
#include "base.h"
USE_CLASS(DiyaShell);
//#define DIYA_TYPE_WAYLAND_PROTOCOL_MANAGER (diya_wayland_protocol_manager_get_type())
//G_DECLARE_DERIVABLE_TYPE(DiyaWaylandProtocolManager, diya_wayland_protocol_manager, DIYA, WAYLAND_PROTOCOL_MANAGER, DiyaObject)
#define DIYA_TYPE_WAYLAND (diya_wayland_get_type ())
G_DECLARE_FINAL_TYPE (DiyaWayland, diya_wayland, DIYA, WAYLAND, DiyaShellObject)
struct wl_surface* diya_wayland_create_surface(DiyaWayland * self);
struct wl_output* diya_wayland_get_output(DiyaWayland * self, int index);