From 7b67e06b352e9a147c15ad40df74c0a6ecfa4efd Mon Sep 17 00:00:00 2001 From: Stu Black Date: Sun, 9 Feb 2025 16:49:23 -0500 Subject: [PATCH] Move the global `dpy` behind a distinct BUILD rule. --- bazel/wmaker/BUILD.bazel | 7 +++++++ bazel/wmaker/WindowMaker.h | 2 -- bazel/wmaker/global_display.c | 5 +++++ bazel/wmaker/global_display.h | 8 ++++++++ bazel/wmaker/main.c | 2 -- 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 bazel/wmaker/global_display.c create mode 100644 bazel/wmaker/global_display.h diff --git a/bazel/wmaker/BUILD.bazel b/bazel/wmaker/BUILD.bazel index 81b72cd9..d1142b52 100644 --- a/bazel/wmaker/BUILD.bazel +++ b/bazel/wmaker/BUILD.bazel @@ -4,6 +4,13 @@ cc_library( visibility = ["//visibility:public"], ) +cc_library( + name = "global_display", + hdrs = ["global_display.h"], + srcs = ["global_display.c"], + deps = ["@x11//:lib"], +) + cc_library( name = "wconfig", hdrs = ["wconfig.h"], diff --git a/bazel/wmaker/WindowMaker.h b/bazel/wmaker/WindowMaker.h index 0927131e..445b5257 100644 --- a/bazel/wmaker/WindowMaker.h +++ b/bazel/wmaker/WindowMaker.h @@ -284,8 +284,6 @@ enum { /****** Global Variables ******/ -extern Display *dpy; - extern struct wmaker_global_variables { /* Tracking of the state of the program */ struct { diff --git a/bazel/wmaker/global_display.c b/bazel/wmaker/global_display.c new file mode 100644 index 00000000..d93594ea --- /dev/null +++ b/bazel/wmaker/global_display.c @@ -0,0 +1,5 @@ +#include "wmaker/global_display.h" + +#include "X11/Xlib.h" + +Display *dpy; diff --git a/bazel/wmaker/global_display.h b/bazel/wmaker/global_display.h new file mode 100644 index 00000000..d512698c --- /dev/null +++ b/bazel/wmaker/global_display.h @@ -0,0 +1,8 @@ +#ifndef WGLOBAL_DISPLAY_H_ +#define WGLOBAL_DISPLAY_H_ + +#include "X11/Xlib.h" + +extern Display *dpy; + +#endif // WGLOBAL_DISPLAY_H_ diff --git a/bazel/wmaker/main.c b/bazel/wmaker/main.c index 3d6acb17..6d605e46 100644 --- a/bazel/wmaker/main.c +++ b/bazel/wmaker/main.c @@ -65,8 +65,6 @@ struct wmaker_global_variables w_global; /* general info */ -Display *dpy; - char *ProgName; struct WPreferences wPreferences;