Skip to content

Commit

Permalink
Revert "Change offset handling and fix multi-output (a bit)"
Browse files Browse the repository at this point in the history
This reverts commit 67cde89.
  • Loading branch information
Gaspard-- committed Dec 11, 2019
1 parent bc59357 commit ae76097
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 31 deletions.
5 changes: 1 addition & 4 deletions source/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ namespace Commands
[](auto &w) noexcept {
return w.get() == Server::getInstance().outputManager.getActiveWorkspace();
});
if (currentWorkspace == output->getWorkspaces().end())
continue;
if (direction == Workspace::RIGHT ?
currentWorkspace == output->getWorkspaces().end() - 1 :
currentWorkspace == output->getWorkspaces().begin())
Expand All @@ -276,15 +274,14 @@ namespace Commands
auto rootNode(windowTree.getRootIndex());
{
auto &rootNodeData(windowTree.getData(rootNode));

newView->windowNode = rootNodeData.getContainer().addChild(rootNode, windowTree, wm::ClientData{newView.get()});
}
newView->set_tiled(~0u);
newView->workspace = nextWorkspace->get();
nextWorkspace->get()->getViews().emplace_back(std::move(newView));
}
server.outputManager.setActiveWorkspace(nextWorkspace->get());
return;
}
}

Expand Down
9 changes: 0 additions & 9 deletions source/OutputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,8 @@ void OutputManager::render_surface(wlr_surface *surface, int sx, int sy, void *d
oy += sy;
if (!rdata->fullscreen)
{
wlr_box viewBox[1];

if (wlr_surface_is_xdg_surface_v6(surface))
wlr_xdg_surface_v6_get_geometry(wlr_xdg_surface_v6_from_wlr_surface(surface), viewBox);
else if (wlr_surface_is_xdg_surface(surface))
wlr_xdg_surface_get_geometry(wlr_xdg_surface_from_wlr_surface(surface), viewBox);

ox += view->x.getDoubleValue();
ox -= viewBox->x;
oy += view->y.getDoubleValue();
oy -= viewBox->y;
}

wlr_box box = {
Expand Down
11 changes: 2 additions & 9 deletions source/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,8 @@ View::~View() noexcept = default;

bool View::at(double lx, double ly, wlr_surface **out_surface, double *sx, double *sy)
{
wlr_box viewBox[1];

if (wlr_surface_is_xdg_surface_v6(surface))
wlr_xdg_surface_v6_get_geometry(wlr_xdg_surface_v6_from_wlr_surface(surface), viewBox);
else if (wlr_surface_is_xdg_surface(surface))
wlr_xdg_surface_get_geometry(wlr_xdg_surface_from_wlr_surface(surface), viewBox);

double view_sx = lx - x.getDoubleValue() + viewBox->x;
double view_sy = ly - y.getDoubleValue() + viewBox->y;
double view_sx = lx - x.getDoubleValue();
double view_sy = ly - y.getDoubleValue();

double _sx, _sy;
wlr_surface *_surface = nullptr;
Expand Down
33 changes: 24 additions & 9 deletions source/XdgView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ void XdgView::xdg_toplevel_request_fullscreen(wl_listener *listener, void *data)
if (!workspace->getFullscreenView())
{
wlr_box *outputBox = wlr_output_layout_get_box(server.outputManager.getLayout(), getWlrOutput());
Commands::new_workspace(true);
Commands::switch_window_from_workspace(Workspace::RIGHT);
Commands::new_workspace(true);
Commands::switch_window_from_workspace(Workspace::RIGHT);

if constexpr (surfaceType == SurfaceType::xdg_v6)
{
Expand All @@ -222,7 +222,7 @@ void XdgView::xdg_toplevel_request_fullscreen(wl_listener *listener, void *data)
}
else
{
if constexpr (surfaceType == SurfaceType::xdg_v6)
if constexpr (surfaceType == SurfaceType::xdg_v6)
{
wlr_xdg_surface_v6 *xdg_surface = wlr_xdg_surface_v6_from_wlr_surface(surface);

Expand All @@ -239,10 +239,9 @@ void XdgView::xdg_toplevel_request_fullscreen(wl_listener *listener, void *data)
workspace->setFullscreenView(nullptr);
fullscreen = false;

set_tiled(~0u);
Workspace *w = Server::getInstance().outputManager.getActiveWorkspace();
Commands::switch_window_from_workspace(Workspace::LEFT);
Commands::close_workspace(w);
Workspace *w = Server::getInstance().outputManager.getActiveWorkspace();
Commands::switch_window_from_workspace(Workspace::LEFT);
Commands::close_workspace(w);
}
}
}
Expand Down Expand Up @@ -354,14 +353,30 @@ void XdgView::move(wm::WindowNodeIndex, wm::WindowTree &, std::array<FixedPoint<

void XdgView::move(std::array<FixedPoint<-4, int32_t>, 2u> position)
{
x = position[0];
y = position[1];
wlr_box box[1];

if (wlr_surface_is_xdg_surface_v6(surface))
wlr_xdg_surface_v6_get_geometry(wlr_xdg_surface_v6_from_wlr_surface(surface), box);
else if (wlr_surface_is_xdg_surface(surface))
wlr_xdg_surface_get_geometry(wlr_xdg_surface_from_wlr_surface(surface), box);

(x = position[0]) -= FixedPoint<0, int32_t>(box->x);
(y = position[1]) -= FixedPoint<0, int32_t>(box->y);
}

std::array<FixedPoint<-4, int32_t>, 2u> XdgView::getPosition() const noexcept
{
wlr_box box[1];

if (wlr_surface_is_xdg_surface_v6(surface))
wlr_xdg_surface_v6_get_geometry(wlr_xdg_surface_v6_from_wlr_surface(surface), box);
else if (wlr_surface_is_xdg_surface(surface))
wlr_xdg_surface_get_geometry(wlr_xdg_surface_from_wlr_surface(surface), box);

std::array<FixedPoint<-4, int32_t>, 2u> result{{x, y}};

result[0] += FixedPoint<0, int32_t>(box->x);
result[1] += FixedPoint<0, int32_t>(box->y);
return result;
}

Expand Down

0 comments on commit ae76097

Please sign in to comment.