Expose w_global.context so it can be seen from Rust.

This commit is contained in:
2025-09-09 20:16:02 -04:00
parent 0a2ff4f055
commit 279f369256
3 changed files with 33 additions and 5 deletions

View File

@@ -504,6 +504,12 @@ extern struct WPreferences {
/****** Global Variables ******/
extern Display *dpy;
struct wmaker_global_variables_context {
XContext client_win;
XContext app_win;
XContext stack;
};
extern struct wmaker_global_variables {
/* Tracking of the state of the program */
struct {
@@ -603,11 +609,7 @@ extern struct wmaker_global_variables {
} atom;
/* X Contexts */
struct {
XContext client_win;
XContext app_win;
XContext stack;
} context;
struct wmaker_global_variables_context context;
/* X Extensions */
struct {
@@ -666,4 +668,9 @@ extern const char WMNWorkspaceNameChanged[];
extern const char WMNResetStacking[];
/****** Accessors/mutators for Rust ******/
struct wmaker_global_variables_context *wGlobalGetContext();
#endif

View File

@@ -63,6 +63,12 @@
/****** Global Variables ******/
struct wmaker_global_variables w_global;
struct wmaker_global_variables_context *wGlobalGetContext()
{
return &w_global.context;
}
/* general info */
Display *dpy;

15
wmakerlib/src/global.rs Normal file
View File

@@ -0,0 +1,15 @@
#[repr(C)]
pub struct Context {
pub client_win: x11::xlib::XContext,
pub app_win: x11::xlib::XContext,
pub stack: x11::xlib::XContext,
}
pub mod ffi {
use super::Context;
unsafe extern "C" {
// w_global.context
pub fn wGlobalGetContext() -> &'static Context;
}
}