]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
let you specify return codes for the different buttons in a prompt, and specify a...
[chaz/openbox] / openbox / client.c
index 6534e1b35dded385f9d5041dccd336fa8345b0eb..aad9202918238ceb29191660dd3c080f8f9aeefc 100644 (file)
@@ -29,6 +29,7 @@
 #include "session.h"
 #include "event.h"
 #include "grab.h"
+#include "prompt.h"
 #include "focus.h"
 #include "stacking.h"
 #include "openbox.h"
@@ -174,7 +175,7 @@ void client_set_list(void)
     stacking_set_list();
 }
 
-void client_manage(Window window)
+void client_manage(Window window, ObPrompt *prompt)
 {
     ObClient *self;
     XSetWindowAttributes attrib_set;
@@ -188,8 +189,10 @@ void client_manage(Window window)
 
     map_time = event_get_server_time();
 
-    /* choose the events we want to receive on the CLIENT window */
-    attrib_set.event_mask = CLIENT_EVENTMASK;
+    /* choose the events we want to receive on the CLIENT window
+       (ObPrompt windows can request events too) */
+    attrib_set.event_mask = CLIENT_EVENTMASK |
+        (prompt ? prompt->event_mask : 0);
     attrib_set.do_not_propagate_mask = CLIENT_NOPROPAGATEMASK;
     XChangeWindowAttributes(obt_display, window,
                             CWEventMask|CWDontPropagate, &attrib_set);
@@ -199,6 +202,7 @@ void client_manage(Window window)
     self = g_new0(ObClient, 1);
     self->obwin.type = OB_WINDOW_CLASS_CLIENT;
     self->window = window;
+    self->prompt = prompt;
 
     /* non-zero defaults */
     self->wmstate = WithdrawnState; /* make sure it gets updated first time */
@@ -218,7 +222,8 @@ void client_manage(Window window)
 
     /* specify that if we exit, the window should not be destroyed and
        should be reparented back to root automatically */
-    XChangeSaveSet(obt_display, window, SetModeInsert);
+    if (!self->prompt)
+        XChangeSaveSet(obt_display, window, SetModeInsert);
 
     /* create the decoration frame for the client window */
     self->frame = frame_new(self);
@@ -617,7 +622,8 @@ void client_unmanage(ObClient *self)
     mouse_grab_for_client(self, FALSE);
 
     /* remove the window from our save set */
-    XChangeSaveSet(obt_display, self->window, SetModeDelete);
+    if (!self->prompt)
+        XChangeSaveSet(obt_display, self->window, SetModeDelete);
 
     /* update the focus lists */
     focus_order_remove(self);
@@ -3250,6 +3256,11 @@ void client_close(ObClient *self)
 {
     if (!(self->functions & OB_CLIENT_FUNC_CLOSE)) return;
 
+    if (self->prompt) {
+        prompt_cancel(self->prompt);
+        return;
+    }
+
     /* in the case that the client provides no means to requesting that it
        close, we just kill it */
     if (!self->delete_window)
This page took 0.026936 seconds and 4 git commands to generate.