sticky is now EWMH compliant
This commit is contained in:
parent
e02ebc27ef
commit
1428873bf9
101
speedwm.c
101
speedwm.c
|
@ -97,43 +97,60 @@ enum { SchemeBorderNorm,
|
|||
SchemeLayout,
|
||||
SchemeStatus,
|
||||
SchemeSystray,
|
||||
SchemePowerline1,
|
||||
SchemePowerline2,
|
||||
SchemePowerline3,
|
||||
SchemePowerline4,
|
||||
SchemePowerline5,
|
||||
SchemePowerline6,
|
||||
SchemePowerline7,
|
||||
SchemePowerline8,
|
||||
SchemePowerline9,
|
||||
SchemePowerline10,
|
||||
SchemePowerline11,
|
||||
SchemePowerline12,
|
||||
SchemePowerline13,
|
||||
SchemePowerline14,
|
||||
SchemePowerline15,
|
||||
SchemePowerline16,
|
||||
};
|
||||
|
||||
enum { NetSupported, NetWMName,
|
||||
NetWMState, NetWMCheck,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDesktop,
|
||||
NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop,
|
||||
/* EWMH atoms */
|
||||
enum { NetSupported,
|
||||
NetWMName,
|
||||
NetWMState,
|
||||
NetWMCheck,
|
||||
NetWMFullscreen,
|
||||
NetActiveWindow,
|
||||
NetWMWindowType,
|
||||
NetWMWindowTypeDesktop,
|
||||
NetWMSticky,
|
||||
NetWMWindowTypeDialog,
|
||||
NetClientList, NetDesktopNames,
|
||||
NetDesktopViewport,
|
||||
NetNumberOfDesktops,
|
||||
NetCurrentDesktop,
|
||||
#if USEFADE
|
||||
NetWMWindowsOpacity,
|
||||
#endif
|
||||
#if USESYSTRAY
|
||||
NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation,
|
||||
NetSystemTrayVisual, NetWMWindowTypeDock, NetSystemTrayOrientationHorz,
|
||||
NetSystemTray,
|
||||
NetSystemTrayOP,
|
||||
NetSystemTrayOrientation,
|
||||
NetSystemTrayVisual,
|
||||
NetWMWindowTypeDock,
|
||||
NetSystemTrayOrientationHorz,
|
||||
#endif
|
||||
#if USEWINICON
|
||||
NetWMIcon,
|
||||
#endif
|
||||
NetClientListStacking, NetClientInfo, NetLast }; /* EWMH atoms */
|
||||
NetClientListStacking,
|
||||
NetClientInfo,
|
||||
NetLast,
|
||||
};
|
||||
|
||||
enum { WMClass, WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
|
||||
/* default atoms */
|
||||
enum { WMClass,
|
||||
WMProtocols,
|
||||
WMDelete,
|
||||
WMState,
|
||||
WMTakeFocus,
|
||||
WMLast,
|
||||
};
|
||||
|
||||
/* clicks */
|
||||
enum { ClkTagBar,
|
||||
ClkLtSymbol,
|
||||
ClkStatusText,
|
||||
ClkWinTitle,
|
||||
ClkClientWin,
|
||||
ClkRootWin,
|
||||
ClkLast,
|
||||
};
|
||||
|
||||
#if USEIPC
|
||||
typedef struct TagState TagState;
|
||||
|
@ -581,6 +598,7 @@ static void setclientstate(Client *c, long state);
|
|||
static void setclienttagprop(Client *c);
|
||||
static void setfocus(Client *c);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
static void setsticky(Client *c, int sticky);
|
||||
static void setgaps(int oh, int ov, int ih, int iv);
|
||||
static void incrgaps(const Arg *arg);
|
||||
static void incrigaps(const Arg *arg);
|
||||
|
@ -1567,6 +1585,9 @@ clientmessage(XEvent *e)
|
|||
|| cme->data.l[2] == netatom[NetWMFullscreen])
|
||||
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|
||||
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
|
||||
if (cme->data.l[1] == netatom[NetWMSticky]
|
||||
|| cme->data.l[2] == netatom[NetWMSticky])
|
||||
setsticky(c, (cme->data.l[0] == 1 || (cme->data.l[0] == 2 && !c->issticky)));
|
||||
} else if (cme->message_type == netatom[NetActiveWindow]) {
|
||||
if (!autofocus) {
|
||||
if (c != selmon->sel && !c->isurgent)
|
||||
|
@ -5170,6 +5191,7 @@ setup(void)
|
|||
netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
|
||||
netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||
netatom[NetWMSticky] = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False);
|
||||
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
|
||||
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
netatom[NetWMWindowTypeDesktop] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DESKTOP", False);
|
||||
|
@ -5581,6 +5603,22 @@ togglefloating(const Arg *arg)
|
|||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
setsticky(Client *c, int sticky)
|
||||
{
|
||||
|
||||
if(sticky && !c->issticky) {
|
||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char *) &netatom[NetWMSticky], 1);
|
||||
c->issticky = 1;
|
||||
} else if(!sticky && c->issticky){
|
||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char *)0, 0);
|
||||
c->issticky = 0;
|
||||
arrange(c->mon);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
togglesticky(const Arg *arg)
|
||||
{
|
||||
|
@ -6074,10 +6112,13 @@ updatewindowtype(Client *c)
|
|||
Atom state = getatomprop(c, netatom[NetWMState]);
|
||||
Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
|
||||
|
||||
if (state == netatom[NetWMFullscreen])
|
||||
setfullscreen(c, 1);
|
||||
if (wtype == netatom[NetWMWindowTypeDialog])
|
||||
c->isfloating = 1;
|
||||
if (state == netatom[NetWMFullscreen])
|
||||
setfullscreen(c, 1);
|
||||
if (state == netatom[NetWMSticky]) {
|
||||
setsticky(c, 1);
|
||||
}
|
||||
if (wtype == netatom[NetWMWindowTypeDialog])
|
||||
c->isfloating = 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue