aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2013-04-17 13:52:20 +0000
committerokan2013-04-17 13:52:20 +0000
commit85984c35a322bce1ae3c3377e4c36b7683891ad3 (patch)
tree41bd2599ff4ea50d524a618ddbd794e4ae3b3925
parent8cf54b8535a9a2d1e38c3f022abfc06c5f1aa406 (diff)
downloadcwm-85984c35a322bce1ae3c3377e4c36b7683891ad3.tar.gz
slightly rework WM_STATE set/get to make it less ambigious; will be more clear
on what needs to change to make it right in the end.
Diffstat (limited to '')
-rw-r--r--calmwm.h4
-rw-r--r--client.c20
-rw-r--r--xutil.c7
3 files changed, 17 insertions, 14 deletions
diff --git a/calmwm.h b/calmwm.h
index 694ec7d..b4140e9 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.h,v 1.189 2013/04/17 13:30:38 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.190 2013/04/17 13:52:20 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -477,7 +477,7 @@ int xu_ptr_regrab(int, Cursor);
void xu_ptr_setpos(Window, int, int);
void xu_ptr_ungrab(void);
void xu_sendmsg(Window, Atom, long);
-void xu_setstate(struct client_ctx *, int);
+void xu_setstate(Window win, int);
void xu_xorcolor(XRenderColor, XRenderColor,
XRenderColor *);
diff --git a/client.c b/client.c
index e1b8b91..1170184 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.125 2013/04/14 16:13:17 okan Exp $
+ * $OpenBSD: client.c,v 1.126 2013/04/17 13:52:20 okan Exp $
*/
#include <sys/param.h>
@@ -101,13 +101,14 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
if (wattr.map_state != IsViewable) {
client_placecalc(cc);
+ client_move(cc);
if ((wmhints = XGetWMHints(X_Dpy, cc->win)) != NULL) {
- if (wmhints->flags & StateHint)
- xu_setstate(cc, wmhints->initial_state);
-
+ if (wmhints->flags & StateHint) {
+ cc->state = wmhints->initial_state;
+ xu_setstate(cc->win, cc->state);
+ }
XFree(wmhints);
}
- client_move(cc);
}
client_draw_border(cc);
@@ -151,7 +152,8 @@ client_delete(struct client_ctx *cc)
group_client_delete(cc);
XGrabServer(X_Dpy);
- xu_setstate(cc, WithdrawnState);
+ cc->state = WithdrawnState;
+ xu_setstate(cc->win, cc->state);
XRemoveFromSaveSet(X_Dpy, cc->win);
XSync(X_Dpy, False);
@@ -451,7 +453,8 @@ client_hide(struct client_ctx *cc)
cc->active = 0;
cc->flags |= CLIENT_HIDDEN;
- xu_setstate(cc, IconicState);
+ cc->state = IconicState;
+ xu_setstate(cc->win, cc->state);
if (cc == client_current())
client_none(cc->sc);
@@ -463,7 +466,8 @@ client_unhide(struct client_ctx *cc)
XMapRaised(X_Dpy, cc->win);
cc->flags &= ~CLIENT_HIDDEN;
- xu_setstate(cc, NormalState);
+ cc->state = NormalState;
+ xu_setstate(cc->win, cc->state);
client_draw_border(cc);
}
diff --git a/xutil.c b/xutil.c
index 603e796..84b564e 100644
--- a/xutil.c
+++ b/xutil.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xutil.c,v 1.54 2013/04/14 16:13:17 okan Exp $
+ * $OpenBSD: xutil.c,v 1.55 2013/04/17 13:52:20 okan Exp $
*/
#include <sys/param.h>
@@ -218,15 +218,14 @@ xu_getstate(Window win, int *state)
}
void
-xu_setstate(struct client_ctx *cc, int state)
+xu_setstate(Window win, int state)
{
long dat[2];
dat[0] = state;
dat[1] = None;
- cc->state = state;
- XChangeProperty(X_Dpy, cc->win,
+ XChangeProperty(X_Dpy, win,
cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 32,
PropModeReplace, (unsigned char *)dat, 2);
}