]> git.lizzy.rs Git - bspwm.git/commitdiff
On button release: use the stored window
authorBastien Dejean <nihilhill@gmail.com>
Sat, 6 Oct 2012 09:36:16 +0000 (11:36 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Sat, 6 Oct 2012 09:36:16 +0000 (11:36 +0200)
When the mouse button was released the window under the pointer was
considered as being the window being previously moved. This is false in
the general case and therefore, the window stored inside the
frozen_state variable must be used.

events.c
events.h

index 4cbf221cc0a2e688f101500a2c42f84c0d118d29..62d28313b21e4772345c4bde277adbe42c048c4c 100644 (file)
--- a/events.c
+++ b/events.c
@@ -42,7 +42,7 @@ void handle_event(xcb_generic_event_t *evt)
             motion_notify(evt);
             break;
         case XCB_BUTTON_RELEASE:
-            button_release(evt);
+            button_release();
             break;
         default:
             break;
@@ -223,7 +223,7 @@ void unmap_notify(xcb_generic_event_t *evt)
 {
     xcb_unmap_notify_event_t *e = (xcb_unmap_notify_event_t *) evt;
 
-    PRINTF("unmap notify %X %u\n", e->window);
+    PRINTF("unmap notify %X\n", e->window);
 
     window_location_t loc;
     if (locate_window(e->window, &loc)) {
@@ -385,19 +385,12 @@ void motion_notify(xcb_generic_event_t *evt)
     }
 }
 
-void button_release(xcb_generic_event_t *evt)
+void button_release(void)
 {
-    xcb_button_press_event_t *e = (xcb_button_press_event_t *) evt;
-    xcb_window_t win = e->child;
-
-    PRINTF("button release %X\n", win);
+    PUTS("button release");
 
     xcb_ungrab_pointer(dpy, XCB_CURRENT_TIME);
-
-    window_location_t loc;
-    if (locate_window(win, &loc)) {
-        update_floating_rectangle(loc.node->client);
-    }
+    update_floating_rectangle(frozen_pointer->node->client);
 }
 
 void handle_state(node_t *n, xcb_atom_t state, unsigned int action)
index dd2787669fa930b9e5c6ef526e8dd446292e08dc..46f49d5ac2ea5f7480150f429a385dcf6e5920b7 100644 (file)
--- a/events.h
+++ b/events.h
@@ -13,7 +13,7 @@ void client_message(xcb_generic_event_t *);
 void property_notify(xcb_generic_event_t *);
 void button_press(xcb_generic_event_t *);
 void motion_notify(xcb_generic_event_t *);
-void button_release(xcb_generic_event_t *);
+void button_release(void);
 void handle_state(node_t *, xcb_atom_t, unsigned int);
 
 #endif