aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorokan2013-06-10 21:37:30 +0000
committerokan2013-06-10 21:37:30 +0000
commitd4e68ce6f6bb6effbb27c5607734c3da30e7baa9 (patch)
tree037de4d342ccf0585c2808032e762294c46cade1 /client.c
parent047b95bd58c952fb5fbf9a6f97782a916cc9fe87 (diff)
downloadcwm-d4e68ce6f6bb6effbb27c5607734c3da30e7baa9.tar.gz
move synthetic responses and have client_msg only work with WM_PROTOCOLS,
since that's all ClientMessageEvent is for anyway.
Diffstat (limited to 'client.c')
-rw-r--r--client.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/client.c b/client.c
index cb52c50..ce870fe 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.133 2013/05/23 16:52:39 okan Exp $
+ * $OpenBSD: client.c,v 1.134 2013/06/10 21:37:30 okan Exp $
*/
#include <sys/param.h>
@@ -123,7 +123,7 @@ client_init(Window win, struct screen_ctx *sc, int mapped)
client_transient(cc);
/* Notify client of its configuration. */
- xu_configure(cc);
+ client_config(cc);
(state == IconicState) ? client_hide(cc) : client_unhide(cc);
@@ -400,14 +400,14 @@ client_resize(struct client_ctx *cc, int reset)
XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x,
cc->geom.y, cc->geom.w, cc->geom.h);
- xu_configure(cc);
+ client_config(cc);
}
void
client_move(struct client_ctx *cc)
{
XMoveWindow(X_Dpy, cc->win, cc->geom.x, cc->geom.y);
- xu_configure(cc);
+ client_config(cc);
}
void
@@ -423,6 +423,26 @@ client_raise(struct client_ctx *cc)
}
void
+client_config(struct client_ctx *cc)
+{
+ XConfigureEvent cn;
+
+ bzero(&cn, sizeof(cn));
+ cn.type = ConfigureNotify;
+ cn.event = cc->win;
+ cn.window = cc->win;
+ cn.x = cc->geom.x;
+ cn.y = cc->geom.y;
+ cn.width = cc->geom.w;
+ cn.height = cc->geom.h;
+ cn.border_width = cc->bwidth;
+ cn.above = None;
+ cn.override_redirect = 0;
+
+ XSendEvent(X_Dpy, cc->win, False, StructureNotifyMask, (XEvent *)&cn);
+}
+
+void
client_ptrwarp(struct client_ctx *cc)
{
int x = cc->ptr.x, y = cc->ptr.y;
@@ -519,11 +539,26 @@ client_wm_protocols(struct client_ctx *cc)
}
void
+client_msg(struct client_ctx *cc, Atom proto)
+{
+ XClientMessageEvent cm;
+
+ bzero(&cm, sizeof(cm));
+ cm.type = ClientMessage;
+ cm.window = cc->win;
+ cm.message_type = cwmh[WM_PROTOCOLS].atom;
+ cm.format = 32;
+ cm.data.l[0] = proto;
+ cm.data.l[1] = CurrentTime;
+
+ XSendEvent(X_Dpy, cc->win, False, NoEventMask, (XEvent *)&cm);
+}
+
+void
client_send_delete(struct client_ctx *cc)
{
if (cc->xproto & _WM_DELETE_WINDOW)
- xu_sendmsg(cc->win,
- cwmh[WM_PROTOCOLS].atom, cwmh[WM_DELETE_WINDOW].atom);
+ client_msg(cc, cwmh[WM_DELETE_WINDOW].atom);
else
XKillClient(X_Dpy, cc->win);
}