aboutsummaryrefslogtreecommitdiff
path: root/monsterwm.c
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2012-01-22 22:19:12 +0200
committerIvan Kanakarakis <ivan.kanak@gmail.com>2012-01-22 22:22:59 +0200
commitcca26e1f1f03f960a178d49fa0a22f2b53e58059 (patch)
tree1c10f3bab873ff93d591f1b4e05bc734b78cf3aa /monsterwm.c
parentc002e7142b772aff155a3f97cde8e46a87ad3fd2 (diff)
rename sendevent() to deletewindow() as it was the only message sent
also it implemented a crappy check for the existance of the atom
Diffstat (limited to 'monsterwm.c')
-rw-r--r--monsterwm.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/monsterwm.c b/monsterwm.c
index 3da7b35..6a7fb8d 100644
--- a/monsterwm.c
+++ b/monsterwm.c
@@ -115,6 +115,7 @@ static void cleanup(void);
static void client_to_desktop(const Arg *arg);
static void clientmessage(XEvent *e);
static void configurerequest(XEvent *e);
+static void deletewindow(Window w);
static void desktopinfo(void);
static void destroynotify(XEvent *e);
static void die(const char* errstr, ...);
@@ -143,7 +144,6 @@ static void rotate_desktop(const Arg *arg);
static void run(void);
static void save_desktop(int i);
static void select_desktop(int i);
-static void sendevent(Window w, int atom);
static void setfullscreen(client *c, Bool fullscreen);
static void setup(void);
static void sigchld();
@@ -268,7 +268,7 @@ void cleanup(void) {
XUngrabKey(dis, AnyKey, AnyModifier, root);
XQueryTree(dis, root, &root_return, &parent_return, &children, &nchildren);
- for (unsigned int i = 0; i<nchildren; i++) sendevent(children[i], WM_DELETE_WINDOW);
+ for (unsigned int i = 0; i<nchildren; i++) deletewindow(children[i]);
if (children) XFree(children);
XSync(dis, False);
XSetInputFocus(dis, PointerRoot, RevertToPointerRoot, CurrentTime);
@@ -346,6 +346,18 @@ void configurerequest(XEvent *e) {
tile();
}
+/* send the given event - WM_DELETE_WINDOW for now */
+void deletewindow(Window w) {
+ XEvent ev;
+ ev.type = ClientMessage;
+ ev.xclient.window = w;
+ ev.xclient.message_type = wmatoms[WM_PROTOCOLS];
+ ev.xclient.format = 32;
+ ev.xclient.data.l[0] = wmatoms[WM_DELETE_WINDOW];
+ ev.xclient.data.l[1] = CurrentTime;
+ XSendEvent(dis, w, False, NoEventMask, &ev);
+}
+
/* output info about the desktops on standard output stream
*
* the info is a list of ':' separated values for each desktop
@@ -475,7 +487,7 @@ void keypress(XEvent *e) {
*/
void killclient() {
if (!current) return;
- sendevent(current->win, WM_DELETE_WINDOW);
+ deletewindow(current->win);
removeclient(current);
}
@@ -783,19 +795,6 @@ void select_desktop(int i) {
current_desktop = i;
}
-/* send the given event - WM_DELETE_WINDOW for now */
-void sendevent(Window w, int atom) {
- if (atom >= WM_COUNT) return;
- XEvent ev;
- ev.type = ClientMessage;
- ev.xclient.window = w;
- ev.xclient.message_type = wmatoms[WM_PROTOCOLS];
- ev.xclient.format = 32;
- ev.xclient.data.l[0] = wmatoms[atom];
- ev.xclient.data.l[1] = CurrentTime;
- XSendEvent(dis, w, False, NoEventMask, &ev);
-}
-
/* set or unset fullscreen state of client */
void setfullscreen(client *c, Bool fullscreen) {
XChangeProperty(dis, c->win, netatoms[NET_WM_STATE], XA_ATOM, 32, PropModeReplace, (unsigned char*)