summaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
authorfadhil riyanto <me@fadev.org>2024-08-17 17:36:04 +0700
committerfadhil riyanto <me@fadev.org>2024-08-17 17:36:04 +0700
commitb903602ff02f717469a0aa265a5167a97e91e52d (patch)
tree392f9eb7cc4909890db568687e9bd61f2bd8d358 /init.c
parent405dfcd49f65cc16c8d120f5a28257e82a729ef9 (diff)
done Xorg functions!
Signed-off-by: fadhil riyanto <me@fadev.org>
Diffstat (limited to 'init.c')
-rw-r--r--init.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/init.c b/init.c
index d880ad1..6feb970 100644
--- a/init.c
+++ b/init.c
@@ -35,6 +35,22 @@ struct xorg_data {
Window root;
};
+static void x_start(struct xorg_data *xorg_data)
+{
+ xorg_data->dpy = XOpenDisplay(NULL);
+ xorg_data->screen = DefaultScreen(xorg_data->dpy);
+ xorg_data->root = RootWindow(xorg_data->dpy, xorg_data->screen);
+}
+
+static void xsetroot_summon(struct xorg_data *xorg_data, char* text)
+{
+ XStoreName(xorg_data->dpy, xorg_data->root, text);
+}
+
+static void x_end(struct xorg_data *xorg_data)
+{
+ XCloseDisplay(xorg_data->dpy);
+}
void signal_handler(int signal)
@@ -136,6 +152,9 @@ int main(int argc, char **argv, char *envp[])
{
signal(SIGINT, signal_handler);
struct gc_data gc;
+ struct xorg_data xorg_data;
+
+
char randombuf[100];
@@ -150,7 +169,10 @@ int main(int argc, char **argv, char *envp[])
snprintf(randombuf, 100, "%s %s %s", time, battery, DESKTOP_NAME);
- exec_xsetroot(&gc, envp, randombuf);
+ // exec_xsetroot(&gc, envp, randombuf);
+ x_start(&xorg_data);
+ xsetroot_summon(&xorg_data, randombuf);
+ x_end(&xorg_data);
free(battery);
free(time);
@@ -160,5 +182,6 @@ int main(int argc, char **argv, char *envp[])
run_garbage_collector_clear(&gc);
+
return 0;
} \ No newline at end of file