From 3d277c10fa12ab13ce67ad341c0134ce2c7a80a9 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sat, 10 Sep 2022 00:10:22 +0400 Subject: [PATCH] Add DWM module "src/dwm/wmcheckwin.c" --- Makefile | 1 + src/dwm.c | 57 ++------------------------------------------ src/dwm/wmcheckwin.c | 53 ++++++++++++++++++++++++++++++++++++++++ src/dwm/wmcheckwin.h | 7 ++++++ 4 files changed, 63 insertions(+), 55 deletions(-) create mode 100644 src/dwm/wmcheckwin.c create mode 100644 src/dwm/wmcheckwin.h diff --git a/Makefile b/Makefile index bba31e4..ebe2acf 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,7 @@ DWM_SRC = \ src/dwm/bar.c \ src/dwm/handlers.c \ src/dwm/layouts.c \ + src/dwm/wmcheckwin.c \ src/dwm/xerror.c TEST_SRC = \ diff --git a/src/dwm.c b/src/dwm.c index 8639d6e..c48c453 100644 --- a/src/dwm.c +++ b/src/dwm.c @@ -212,13 +212,12 @@ static void updatewindowtype(Client *c); static void updatewmhints(Client *c); static Client *wintoclient(Window w); static Monitor *wintomon(Window w); -static void wmcheckwin_create(); -static void wmcheckwin_destroy(); static void zoom(const Arg *arg); #include "dwm/bar.h" #include "dwm/handlers.h" #include "dwm/layouts.h" +#include "dwm/wmcheckwin.h" #include "dwm/xerror.h" /************* @@ -236,7 +235,6 @@ static Cur *cursor[CurLast]; static Clr **scheme; static Drw *drw; static Monitor *mons, *selmon; -static Window wmcheckwin; static void (*handler[LASTEvent])(XEvent*) = { [ButtonPress] = on_button_press, @@ -336,6 +334,7 @@ static Button buttons[] = { #include "dwm/bar.c" #include "dwm/handlers.c" #include "dwm/layouts.c" +#include "dwm/wmcheckwin.c" #include "dwm/xerror.c" /*********************************** @@ -2333,58 +2332,6 @@ Monitor *wintomon(Window w) return selmon; } -void wmcheckwin_create() -{ - wmcheckwin = XCreateSimpleWindow( - xbase->x_display, - xbase->x_root, - 0, - 0, - 1, - 1, - 0, - 0, - 0 - ); - - XChangeProperty( - xbase->x_display, - wmcheckwin, - xbase->atoms->netatom[NetWMCheck], - XA_WINDOW, - 32, - PropModeReplace, - (unsigned char*)&wmcheckwin, - 1 - ); - XChangeProperty( - xbase->x_display, - wmcheckwin, - xbase->atoms->netatom[NetWMName], - xbase->atoms->utf8string, - 8, - PropModeReplace, - (unsigned char*) - xbase->program_title, - strlen(xbase->program_title) - ); - XChangeProperty( - xbase->x_display, - xbase->x_root, - xbase->atoms->netatom[NetWMCheck], - XA_WINDOW, - 32, - PropModeReplace, - (unsigned char*)&wmcheckwin, - 1 - ); -} - -void wmcheckwin_destroy() -{ - XDestroyWindow(xbase->x_display, wmcheckwin); -} - void zoom(__attribute__((unused)) const Arg *arg) { Client *c = selmon->sel; diff --git a/src/dwm/wmcheckwin.c b/src/dwm/wmcheckwin.c new file mode 100644 index 0000000..71ec58a --- /dev/null +++ b/src/dwm/wmcheckwin.c @@ -0,0 +1,53 @@ +static Window wmcheckwin = 0; + +void wmcheckwin_create() +{ + wmcheckwin = XCreateSimpleWindow( + xbase->x_display, + xbase->x_root, + 0, + 0, + 1, + 1, + 0, + 0, + 0 + ); + + XChangeProperty( + xbase->x_display, + wmcheckwin, + xbase->atoms->netatom[NetWMCheck], + XA_WINDOW, + 32, + PropModeReplace, + (unsigned char*)&wmcheckwin, + 1 + ); + XChangeProperty( + xbase->x_display, + wmcheckwin, + xbase->atoms->netatom[NetWMName], + xbase->atoms->utf8string, + 8, + PropModeReplace, + (unsigned char*) + xbase->program_title, + strlen(xbase->program_title) + ); + XChangeProperty( + xbase->x_display, + xbase->x_root, + xbase->atoms->netatom[NetWMCheck], + XA_WINDOW, + 32, + PropModeReplace, + (unsigned char*)&wmcheckwin, + 1 + ); +} + +void wmcheckwin_destroy() +{ + XDestroyWindow(xbase->x_display, wmcheckwin); +} diff --git a/src/dwm/wmcheckwin.h b/src/dwm/wmcheckwin.h new file mode 100644 index 0000000..4df5c52 --- /dev/null +++ b/src/dwm/wmcheckwin.h @@ -0,0 +1,7 @@ +#ifndef _DWM_WMCHECKWIN_H +#define _DWM_WMCHECKWIN_H + +static void wmcheckwin_create(); +static void wmcheckwin_destroy(); + +#endif // _DWM_WMCHECKWIN_H