diff --git a/src/backend.cpp b/src/backend.cpp index 79a2d71..7e24585 100644 --- a/src/backend.cpp +++ b/src/backend.cpp @@ -486,6 +486,8 @@ void X11Backend::StackClients(const WManager::Container *proot){ appendixQueue.clear(); for(auto &p : *pstackAppendix){ + if(!p.second) + continue; if(p.first){ appendixQueue.push_back(p); continue; @@ -500,6 +502,8 @@ void X11Backend::StackClients(const WManager::Container *proot){ StackRecursive(proot); for(auto m = appendixQueue.begin(); m != appendixQueue.end();){ + if(!(*m).second) + continue; auto k = std::find_if(appendixQueue.begin(),appendixQueue.end(),[&](auto &p)->bool{ return (*m).first == p.second; }); @@ -519,6 +523,8 @@ void X11Backend::StackClients(const WManager::Container *proot){ } for(auto &p : appendixQueue){ //stack the remaining (untransient) windows + if(!p.second) + continue; X11Client *pclient11 = static_cast(p.second); static uint values[1] = {XCB_STACK_MODE_ABOVE}; @@ -640,7 +646,7 @@ void Default::Start(){ |XCB_EVENT_MASK_STRUCTURE_NOTIFY |XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |XCB_EVENT_MASK_EXPOSURE - |XCB_EVENT_MASK_PROPERTY_CHANGE,0,0,0}; //[2] for later use + |XCB_EVENT_MASK_PROPERTY_CHANGE,0,0,0}; //[4] for later use xcb_void_cookie_t cookie = xcb_change_window_attributes_checked(pcon,pscr->root,XCB_CW_EVENT_MASK,values); xcb_generic_error_t *perr = xcb_request_check(pcon,cookie); @@ -876,7 +882,7 @@ sint Default::HandleEvent(bool forcePoll){ } //center the window to screen, otherwise it might end up to the left upper corner - if(!allowPositionConfig){ + /*if(!allowPositionConfig){ if((rect.x == 0 && pev->value_mask & XCB_CONFIG_WINDOW_X) || (mrect != configCache.end() && (*mrect).second.x == 0 && !(pev->value_mask & XCB_CONFIG_WINDOW_X))){ //TODO: need this same check in MAP_REQUEST rect.x = (pscr->width_in_pixels-rect.w)/2; pev->value_mask |= XCB_CONFIG_WINDOW_X; @@ -885,7 +891,7 @@ sint Default::HandleEvent(bool forcePoll){ rect.y = (pscr->height_in_pixels-rect.h)/2; pev->value_mask |= XCB_CONFIG_WINDOW_Y; } - } + }*/ if(mrect == configCache.end()){ //an entry should always be present, since CREATE_NOTIFY creates one @@ -1153,7 +1159,7 @@ sint Default::HandleEvent(bool forcePoll){ netClientList.push_back(p.first->window); xcb_change_property(pcon,XCB_PROP_MODE_REPLACE,pscr->root,ewmh._NET_CLIENT_LIST,XCB_ATOM_WINDOW,32,netClientList.size(),netClientList.data()); - xcb_grab_button(pcon,0,pev->window,XCB_EVENT_MASK_BUTTON_PRESS,//|XCB_EVENT_MASK_BUTTON_RELEASE, + xcb_grab_button(pcon,0,pev->window,XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_ASYNC,XCB_GRAB_MODE_ASYNC,pscr->root,XCB_NONE,1,XCB_MOD_MASK_1); //check fullscreen @@ -1540,8 +1546,10 @@ sint Default::HandleEvent(bool forcePoll){ dragRootX = pev->root_x; dragRootY = pev->root_y; - xcb_grab_pointer(pcon,0,pscr->root,XCB_EVENT_MASK_BUTTON_RELEASE|XCB_EVENT_MASK_POINTER_MOTION, + xcb_grab_pointer(pcon,0,pscr->root, + XCB_EVENT_MASK_BUTTON_RELEASE|XCB_EVENT_MASK_POINTER_MOTION, XCB_GRAB_MODE_ASYNC,XCB_GRAB_MODE_ASYNC,pscr->root,XCB_NONE,XCB_CURRENT_TIME); + //xcb_allow_events(pcon,XCB_ALLOW_REPLAY_POINTER,pev->time); } break; case XCB_BUTTON_RELEASE:{ diff --git a/src/container.cpp b/src/container.cpp index 6a6fb6b..8fdeadb 100644 --- a/src/container.cpp +++ b/src/container.cpp @@ -269,6 +269,8 @@ void Container::SetFullscreen(bool toggle){ else flags &= ~FLAG_FULLSCREEN; Fullscreen1(); + if(flags & FLAG_FLOATING) + return; Translate(); } @@ -615,6 +617,8 @@ void Container::Stack(){ void Container::SetLayout(LAYOUT layout){ this->layout = layout; + if(flags & FLAG_FLOATING) + return; Translate(); } diff --git a/src/main.cpp b/src/main.cpp index db5b519..2322e2d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -406,7 +406,7 @@ class DefaultBackend : public Backend::Default, public RunBackend{ Backend::X11Container *pcontainer11 = static_cast(containerInt.pcontainer); Backend::X11Client *pclient11 = SetupClient(pcontainer11,pcreateInfo,pshaderName); pcontainer11->SetClient(pclient11); - if(containerInt.pcontainer->flags & WManager::Container::FLAG_FLOATING) + if(pclient11 && containerInt.pcontainer->flags & WManager::Container::FLAG_FLOATING) stackAppendix.push_back(StackAppendixElement(pcreateInfo->pstackClient,pclient11)); containerInt.DeferredPropertyTransfer(); @@ -498,7 +498,8 @@ class DefaultBackend : public Backend::Default, public RunBackend{ static WManager::Client dummyClient(0); //base client being unavailable means that the client is stacked on top of everything else pcontainer->flags |= WManager::Container::FLAG_FLOATING; - stackAppendix.push_back(StackAppendixElement(&dummyClient,pcontainer->pclient)); + if(pcontainer->pclient) + stackAppendix.push_back(StackAppendixElement(&dummyClient,pcontainer->pclient)); pcontainer->pParent = proot; pcontainer->Focus();