rework popups completely

This commit is contained in:
vaxerski
2022-03-27 17:25:20 +02:00
parent 4c3b9ae207
commit ad36a9dc9e
11 changed files with 314 additions and 285 deletions

View File

@@ -4,6 +4,7 @@
#include "../defines.hpp"
#include "../../wlr-layer-shell-unstable-v1-protocol.h"
#include "../Window.hpp"
#include "SubsurfaceTree.hpp"
struct SLayerSurface {
wlr_layer_surface_v1* layerSurface;
@@ -14,9 +15,9 @@ struct SLayerSurface {
DYNLISTENER(unmapLayerSurface);
DYNLISTENER(commitLayerSurface);
DYNLISTENER(newPopup);
DYNLISTENER(newSubsurface);
wlr_box geometry;
Vector2D position;
zwlr_layer_shell_v1_layer layer;
int monitorID = -1;
@@ -28,22 +29,6 @@ struct SLayerSurface {
}
};
struct SSubsurface {
wlr_subsurface* subsurface = nullptr;
SLayerSurface* pParentSurface = nullptr;
DYNLISTENER(mapSubsurface);
DYNLISTENER(unmapSubsurface);
DYNLISTENER(destroySubsurface);
DYNLISTENER(commitSubsurface);
DYNLISTENER(newSubsurface);
// For the list lookup
bool operator==(const SSubsurface& rhs) {
return subsurface == rhs.subsurface && pParentSurface == rhs.pParentSurface;
}
};
struct SRenderData {
wlr_output* output;
timespec* when;
@@ -68,26 +53,9 @@ struct SKeyboard {
}
};
struct SLayerPopup {
wlr_xdg_popup* popup = nullptr;
SLayerSurface* parentSurface = nullptr;
wlr_xdg_popup* parentPopup = nullptr;
DYNLISTENER(mapPopup);
DYNLISTENER(destroyPopup);
DYNLISTENER(unmapPopup);
DYNLISTENER(commitPopup);
DYNLISTENER(newPopupFromPopup);
// For the list lookup
bool operator==(const SLayerPopup& rhs) {
return popup == rhs.popup;
}
};
struct SXDGPopup {
CWindow* parentWindow = nullptr;
wlr_xdg_popup* parentPopup = nullptr;
SXDGPopup* parentPopup = nullptr;
wlr_xdg_popup* popup = nullptr;
DYNLISTENER(newPopupFromPopupXDG);
@@ -95,6 +63,11 @@ struct SXDGPopup {
DYNLISTENER(mapPopupXDG);
DYNLISTENER(unmapPopupXDG);
double* lx;
double* ly;
SSurfaceTreeNode* pSurfaceTree = nullptr;
// For the list lookup
bool operator==(const SXDGPopup& rhs) {
return popup == rhs.popup;