fix non-gdk popups on multimon

This commit is contained in:
vaxerski 2022-04-03 10:32:21 +02:00
parent 9d06c61242
commit df6a3c6877
2 changed files with 6 additions and 12 deletions

View file

@ -18,8 +18,8 @@
void addPopupGlobalCoords(void* pPopup, int* x, int* y) { void addPopupGlobalCoords(void* pPopup, int* x, int* y) {
SXDGPopup *const PPOPUP = (SXDGPopup*)pPopup; SXDGPopup *const PPOPUP = (SXDGPopup*)pPopup;
int px = PPOPUP->monitor->vecPosition.x; int px = 0;
int py = PPOPUP->monitor->vecPosition.y; int py = 0;
auto curPopup = PPOPUP; auto curPopup = PPOPUP;
while (true) { while (true) {
@ -72,8 +72,8 @@ void Events::listener_newPopup(void* owner, void* data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
PNEWPOPUP->popup = WLRPOPUP; PNEWPOPUP->popup = WLRPOPUP;
PNEWPOPUP->lx = layersurface->position.x; PNEWPOPUP->lx = layersurface->position.x - PMONITOR->vecPosition.x;
PNEWPOPUP->ly = layersurface->position.y; PNEWPOPUP->ly = layersurface->position.y - PMONITOR->vecPosition.y;
PNEWPOPUP->monitor = PMONITOR; PNEWPOPUP->monitor = PMONITOR;
createNewPopup(WLRPOPUP, PNEWPOPUP); createNewPopup(WLRPOPUP, PNEWPOPUP);
} }
@ -93,8 +93,8 @@ void Events::listener_newPopupXDG(void* owner, void* data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
PNEWPOPUP->popup = WLRPOPUP; PNEWPOPUP->popup = WLRPOPUP;
PNEWPOPUP->lx = PWINDOW->m_vEffectivePosition.x; PNEWPOPUP->lx = PWINDOW->m_vEffectivePosition.x - PMONITOR->vecPosition.x;
PNEWPOPUP->ly = PWINDOW->m_vEffectivePosition.y; PNEWPOPUP->ly = PWINDOW->m_vEffectivePosition.y - PMONITOR->vecPosition.y;
PNEWPOPUP->parentWindow = PWINDOW; PNEWPOPUP->parentWindow = PWINDOW;
PNEWPOPUP->monitor = PMONITOR; PNEWPOPUP->monitor = PMONITOR;
createNewPopup(WLRPOPUP, PNEWPOPUP); createNewPopup(WLRPOPUP, PNEWPOPUP);

View file

@ -18,12 +18,6 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
double outputX = 0, outputY = 0; double outputX = 0, outputY = 0;
wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, RDATA->output, &outputX, &outputY); wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, RDATA->output, &outputX, &outputY);
if (RDATA->pMonitor) { // BUG THIS TODO: this is just to show the popup on a monitor that isnt at 0,0
// the popups are broken.
x -= ((SMonitor*)RDATA->pMonitor)->vecPosition.x;
y -= ((SMonitor*)RDATA->pMonitor)->vecPosition.y;
}
wlr_box windowBox; wlr_box windowBox;
if (RDATA->surface && surface == RDATA->surface) { if (RDATA->surface && surface == RDATA->surface) {
windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, RDATA->w, RDATA->h}; windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, RDATA->w, RDATA->h};