Commits

Micah Nordland  committed dda2664

fixed focus handling, and window layout now works mostly,
there are some issues when closing windows.

  • Participants
  • Parent commits 8de78f3

Comments (0)

Files changed (3)

File src/boxTree.cpp

 
 void BoxTree::setFocused(Box *box)
 {
+    std::cout << "setFocused called" << std::endl;
     if (box and box->window)
     {   
         if (box == focused)
             return;
+        std::cout << "box is not already focused" << std::endl;
         focusedLast = focused; 
         focused = box;
         box->window->focus();
 
 void BoxTree::layoutBoxes(Box *box, xcb_rectangle_t area)
 {
+    std::cout << "layoutBoxes called from " << this << std::endl;
     if (not box)
         return;
-    xcb_rectangle_t rect;
 
-    if (box->isLeaf())
+    if (box->window)
     {
         box->window->setGeometry(area);
-        return;
     }
-    
+    xcb_rectangle_t rect;
     rect.x = area.x;
     rect.y = area.y;
     rect.width = area.width/2;
     rect.height = area.height;
     layoutBoxes(box->first, rect);
-    rect.x += area.width/2;
+    rect.x += rect.width;
     layoutBoxes(box->second, rect);
     
     

File src/eventHandlers.cpp

     if (ev->value_mask & XCB_CONFIG_WINDOW_X)
     {
         mask |= XCB_CONFIG_WINDOW_X;
-        values[i++] = ev->x;
+        values[i++] = 50;
                                         
     }
 
     if (ev->value_mask & XCB_CONFIG_WINDOW_Y)
     {
         mask |= XCB_CONFIG_WINDOW_Y;
-        values[i++] = ev->y;
+        values[i++] = 80;
                                                 
     }
 
 
 void EventHandler::handleDestroyNotify(EventPtr event)
 {
-    auto ev = convertEvent<xcb_unmap_notify_event_t>(event);
+    auto ev = convertEvent<xcb_destroy_notify_event_t>(event);
     BoxTree &tree = setup->monitors[0].tagList[0].boxTree;
     Box *winBox = tree.findWindowBox(ev->window);
     if (winBox)
 
 void EventHandler::handleEnterNotify(EventPtr event)
 {
-    auto ev = convertEvent<xcb_unmap_notify_event_t>(event);
+    auto ev = convertEvent<xcb_enter_notify_event_t>(event);
     BoxTree &tree = setup->monitors[0].tagList[0].boxTree;
     Box *winBox = tree.findWindowBox(ev->event);
     if(winBox)

File src/window.cpp

     handleHints();
     handleGeometry();
     handleTransient();
+
+    uint32_t event_mask[] = {XCB_EVENT_MASK_ENTER_WINDOW};
+    xcb_change_window_attributes(setup->conn, id, XCB_CW_EVENT_MASK, event_mask);
+    xcb_flush(setup->conn);
 }
 
 Window::~Window()