Add DWM module "src/dwm/wmcheckwin.c"

This commit is contained in:
Alex Kotov 2022-09-10 00:10:22 +04:00
parent e33e206e31
commit 3d277c10fa
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 63 additions and 55 deletions

View file

@ -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 = \

View file

@ -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;

53
src/dwm/wmcheckwin.c Normal file
View file

@ -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);
}

7
src/dwm/wmcheckwin.h Normal file
View file

@ -0,0 +1,7 @@
#ifndef _DWM_WMCHECKWIN_H
#define _DWM_WMCHECKWIN_H
static void wmcheckwin_create();
static void wmcheckwin_destroy();
#endif // _DWM_WMCHECKWIN_H