Implement _NET_ACTIVE_WINDOW. for now just the informational hint is

supported, the client message to change this will be supported when all
informational hints are working.

ok okan@
This commit is contained in:
oga 2009-12-07 22:21:59 +00:00
parent fe460e3f8a
commit 2a5e34e85e
3 changed files with 25 additions and 6 deletions

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* $Id: calmwm.h,v 1.99 2009/12/07 21:20:52 okan Exp $ * $Id: calmwm.h,v 1.100 2009/12/07 22:21:59 oga Exp $
*/ */
#ifndef _CALMWM_H_ #ifndef _CALMWM_H_
@ -526,7 +526,8 @@ extern struct conf Conf;
#define _NET_SUPPORTED cwm_atoms[7] #define _NET_SUPPORTED cwm_atoms[7]
#define _NET_SUPPORTING_WM_CHECK cwm_atoms[8] #define _NET_SUPPORTING_WM_CHECK cwm_atoms[8]
#define _NET_WM_NAME cwm_atoms[9] #define _NET_WM_NAME cwm_atoms[9]
#define CWM_NO_ATOMS 10 #define _NET_ACTIVE_WINDOW cwm_atoms[10]
#define CWM_NO_ATOMS 11
#define CWM_NETWM_START 7 #define CWM_NETWM_START 7
extern Atom cwm_atoms[CWM_NO_ATOMS]; extern Atom cwm_atoms[CWM_NO_ATOMS];

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* $Id: client.c,v 1.66 2009/11/28 17:52:12 tobias Exp $ * $Id: client.c,v 1.67 2009/12/07 22:21:59 oga Exp $
*/ */
#include "headers.h" #include "headers.h"
@ -23,6 +23,7 @@
static struct client_ctx *client_mrunext(struct client_ctx *); static struct client_ctx *client_mrunext(struct client_ctx *);
static struct client_ctx *client_mruprev(struct client_ctx *); static struct client_ctx *client_mruprev(struct client_ctx *);
static void client_none(struct screen_ctx *);
static void client_placecalc(struct client_ctx *); static void client_placecalc(struct client_ctx *);
static void client_update(struct client_ctx *); static void client_update(struct client_ctx *);
static void client_gethints(struct client_ctx *); static void client_gethints(struct client_ctx *);
@ -142,7 +143,7 @@ client_delete(struct client_ctx *cc)
TAILQ_REMOVE(&Clientq, cc, entry); TAILQ_REMOVE(&Clientq, cc, entry);
if (_curcc == cc) if (_curcc == cc)
_curcc = NULL; client_none(sc);
XFree(cc->size); XFree(cc->size);
@ -202,12 +203,28 @@ client_setactive(struct client_ctx *cc, int fg)
if (fg && _curcc != cc) { if (fg && _curcc != cc) {
client_setactive(NULL, 0); client_setactive(NULL, 0);
_curcc = cc; _curcc = cc;
XChangeProperty(X_Dpy, sc->rootwin, _NET_ACTIVE_WINDOW,
XA_WINDOW, 32, PropModeReplace,
(unsigned char *)&cc->win, 1);
} }
cc->active = fg; cc->active = fg;
client_draw_border(cc); client_draw_border(cc);
} }
/*
* set when there is no active client
*/
static void
client_none(struct screen_ctx *sc)
{
Window none = None;
XChangeProperty(X_Dpy, sc->rootwin, _NET_ACTIVE_WINDOW,
XA_WINDOW, 32, PropModeReplace, (unsigned char *)&none, 1);
_curcc = NULL;
}
struct client_ctx * struct client_ctx *
client_current(void) client_current(void)
{ {
@ -399,7 +416,7 @@ client_hide(struct client_ctx *cc)
xu_setstate(cc, IconicState); xu_setstate(cc, IconicState);
if (cc == _curcc) if (cc == _curcc)
_curcc = NULL; client_none(cc->sc);
} }
void void

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* $Id: xutil.c,v 1.18 2009/12/07 21:20:52 okan Exp $ * $Id: xutil.c,v 1.19 2009/12/07 22:21:59 oga Exp $
*/ */
#include "headers.h" #include "headers.h"
@ -181,6 +181,7 @@ char *atoms[CWM_NO_ATOMS] = {
"_NET_SUPPORTED", "_NET_SUPPORTED",
"_NET_SUPPORTING_WM_CHECK", "_NET_SUPPORTING_WM_CHECK",
"_NET_WM_NAME", "_NET_WM_NAME",
"_NET_ACTIVE_WINDOW",
}; };
void void