Cleanup & xwrappers stuff

testing
E. Almqvist 2 years ago
parent b90bf51ae9
commit e7d728a327
  1. 2
      src/config.h
  2. 9
      src/dwm.c
  3. 70
      src/xwrappers.c
  4. 7
      src/xwrappers.h

@ -19,7 +19,7 @@ static const char *fonts[] = { "IBM Plex Mono:size=11" };
static const char dmenufont[] = "IBM Plex Mono:size=15";
static const char bg_alt_color[] = "#272a34";
static const char bg_color[] = "#282c34";
static const char bg_color[] = "#21242b";
static const char text_color[] = "#bbc2cf";
static const char selected_color[] = "#81a2be";
static const char border_color_sel[] = "#444953";

@ -46,6 +46,9 @@
#include "drw.h"
#include "util.h"
/* XWrappers */
#include "xwrappers.h"
/* macros */
#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
@ -2174,14 +2177,18 @@ showhide(Client *c)
return;
if (ISVISIBLE(c)) {
/* show clients top down */
window_map(dpy, c->win, 1);
/*
XMoveWindow(dpy, c->win, c->x, c->y);
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
resize(c, c->x, c->y, c->w, c->h, 0);
*/
showhide(c->snext);
} else {
/* hide clients bottom up */
showhide(c->snext);
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
window_unmap(dpy, c->win, root, 1);
//XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
}
}

@ -0,0 +1,70 @@
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xproto.h>
static Atom atom[LastAtom];
static int atoms_intialised = 0;
static int (*xerrorxlib)(Display *, XErrorEvent *);
Atom *
get_atoms(Display *dpy)
{
if (!atoms_intialised) {
atoms[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
atoms[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
atoms[WMState] = XInternAtom(dpy, "WM_STATE", False);
atoms[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
atoms[WMChangeState] = XInternAtom(dpy, "WM_CHANGE_STATE", False);
atoms[WMWindowRole] = XInternAtom(dpy, "WM_WINDOW_ROLE", False);
atoms[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
atoms[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
atoms[NetSystemTray] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_S0", False);
atoms[NetSystemTrayOP] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_OPCODE", False);
atoms[NetSystemTrayOrientation] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION", False);
atoms[NetSystemTrayOrientationHorz] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION_HORZ", False);
atoms[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
atoms[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
atoms[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
atoms[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
atoms[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
atoms[NetWMWindowTypeDock] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
atoms[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
atoms[NetWMWindowTypeDesktop] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DESKTOP", False);
atoms[NetWMMaximizedVert] = XInternAtom(dpy, "_NET_WM_STATE_MAXIMIZED_VERT", False);
atoms[NetWMMaximizedHorz] = XInternAtom(dpy, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
atoms[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
atoms[NetClientListStacking] = XInternAtom(dpy, "_NET_CLIENT_LIST_STACKING", False);
atoms[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False);
atoms[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES", False);
atoms[NetDesktopViewport] = XInternAtom(dpy, "_NET_DESKTOP_VIEWPORT", False);
atoms[NetNumberOfDesktops] = XInternAtom(dpy, "_NET_NUMBER_OF_DESKTOPS", False);
atoms[NetWMActionClose] = XInternAtom(dpy, "_NET_WM_ACTION_CLOSE", False);
atoms[NetWMDemandsAttention] = XInternAtom(dpy, "_NET_WM_DEMANDS_ATTENTION", False);
atoms[NetWMDesktop] = XInternAtom(dpy, "_NET_WM_DESKTOP", False);
atoms[NetWMMoveResize] = XInternAtom(dpy, "_NET_WM_MOVE_RESIZE", False);
atoms[Manager] = XInternAtom(dpy, "MANAGER", False);
atoms[Xembed] = XInternAtom(dpy, "_XEMBED", False);
atoms[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
atoms[MWMClientTags] = XInternAtom(dpy, "_MWM_CLIENT_TAGS", False);
atoms[MWMCurrentTags] = XInternAtom(dpy, "_MWM_CURRENT_TAGS", False);
atoms[MWMClientMonitor] = XInternAtom(dpy, "_MWM_CLIENT_MONITOR", False);
atoms[MWMBorderWidth] = XInternAtom(dpy, "_MWM_BORDER_WIDTH", False);
atoms[SteamGame] = XInternAtom(dpy, "STEAM_GAME", False);
atoms[KDENetWMWindowTypeOverride] = XInternAtom(dpy, "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE", False);
atoms[Utf8] = XInternAtom(dpy, "UTF8_STRING", False);
atoms[Motif] = XInternAtom(dpy, "_MOTIF_NetLast, WM_HINTS", False);
atoms_intialised = 1;
}
return atoms;
}
void
window_set_state(Display *dpy, Window win, long state) {
long data[] = {state, None};
}

@ -0,0 +1,7 @@
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xproto.h>
void window_set_state(Display*, Window, long);
void window_map(Display*, Window win, long state);
void window_umap(Display*, Window win, Window root, int);
Loading…
Cancel
Save