diff --git a/meson.build b/meson.build index 89f3a1f..ba47f9a 100644 --- a/meson.build +++ b/meson.build @@ -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' ] diff --git a/src/background.c b/src/background.c index cd62b9d..24d1d10 100644 --- a/src/background.c +++ b/src/background.c @@ -1,4 +1,5 @@ #include "background.h" +#include "session-shell.h" #include #define NAMESPACE "diya_shell_background" diff --git a/src/background.h b/src/background.h index d7f6817..35c7b47 100644 --- a/src/background.h +++ b/src/background.h @@ -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); diff --git a/src/base.h b/src/base.h index 361b61a..94b1da5 100644 --- a/src/base.h +++ b/src/base.h @@ -3,7 +3,10 @@ #include #include +#include +#include +#define USE_CLASS(name) typedef struct _##name name #define DIYA_PROP_SHELL "shell" /** diff --git a/src/foreign.c b/src/foreign.c index fc5b56f..4579e46 100644 --- a/src/foreign.c +++ b/src/foreign.c @@ -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 diff --git a/src/foreign.h b/src/foreign.h index 590f81d..e2ac4e2 100644 --- a/src/foreign.h +++ b/src/foreign.h @@ -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); diff --git a/src/input.c b/src/input.c index bc63442..4ab8ba2 100644 --- a/src/input.c +++ b/src/input.c @@ -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 { diff --git a/src/input.h b/src/input.h index ee0d7d1..8335542 100644 --- a/src/input.h +++ b/src/input.h @@ -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 \ No newline at end of file diff --git a/src/launcher.h b/src/launcher.h index b917725..c6c2b5a 100644 --- a/src/launcher.h +++ b/src/launcher.h @@ -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" diff --git a/src/session-shell.h b/src/session-shell.h index 080d0e7..fda9f84 100644 --- a/src/session-shell.h +++ b/src/session-shell.h @@ -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); diff --git a/src/shell.c b/src/shell.c index 8a49205..80ef655 100644 --- a/src/shell.c +++ b/src/shell.c @@ -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; diff --git a/src/shell.h b/src/shell.h index 97e8a05..b7fb295 100644 --- a/src/shell.h +++ b/src/shell.h @@ -1,6 +1,5 @@ #ifndef DIYA_SHELL_H #define DIYA_SHELL_H -#include #include #include #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); diff --git a/src/virtual-keyboard.c b/src/virtual-keyboard.c index 9ac2887..f573b13 100644 --- a/src/virtual-keyboard.c +++ b/src/virtual-keyboard.c @@ -12,6 +12,7 @@ #include "virtual-keyboard-unstable-v1.h" #include "virtual-keyboard.h" #include "wayland.h" +#include "shell.h" typedef enum { diff --git a/src/virtual-keyboard.h b/src/virtual-keyboard.h index a6c69c5..8b45471 100644 --- a/src/virtual-keyboard.h +++ b/src/virtual-keyboard.h @@ -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*/, diff --git a/src/wayland.c b/src/wayland.c index 014ad00..dd22135 100644 --- a/src/wayland.c +++ b/src/wayland.c @@ -3,8 +3,9 @@ #include #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, diff --git a/src/wayland.h b/src/wayland.h index 3bde8a5..1ffefb9 100644 --- a/src/wayland.h +++ b/src/wayland.h @@ -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);