mirror of
https://github.com/hyprwm/hyprpicker.git
synced 2024-12-22 14:19:48 +01:00
make LSes transparent on not-selecting displays
This commit is contained in:
parent
a110c397e2
commit
ceae5d7357
3 changed files with 68 additions and 54 deletions
|
@ -81,6 +81,8 @@ void Events::handleCapabilities(void *data, wl_seat *wl_seat, uint32_t capabilit
|
|||
}
|
||||
|
||||
void Events::handlePointerEnter(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
||||
g_pHyprpicker->markDirty();
|
||||
|
||||
for (auto& ls : g_pHyprpicker->m_vLayerSurfaces) {
|
||||
if (ls->pSurface == surface) {
|
||||
g_pHyprpicker->m_pLastSurface = ls.get();
|
||||
|
@ -94,7 +96,11 @@ void Events::handlePointerEnter(void *data, struct wl_pointer *wl_pointer, uint3
|
|||
}
|
||||
|
||||
void Events::handlePointerLeave(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface) {
|
||||
// ignored
|
||||
for (auto& ls : g_pHyprpicker->m_vLayerSurfaces) {
|
||||
if (ls->pSurface == surface) {
|
||||
g_pHyprpicker->renderSurface(ls.get(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Events::handlePointerAxis(void *data, wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value) {
|
||||
|
|
|
@ -219,7 +219,7 @@ void CHyprpicker::convertBuffer(SPoolBuffer* pBuffer) {
|
|||
}
|
||||
}
|
||||
|
||||
void CHyprpicker::renderSurface(CLayerSurface* pSurface) {
|
||||
void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) {
|
||||
const auto PBUFFER = getBufferForLS(pSurface);
|
||||
|
||||
if (!PBUFFER || !pSurface->screenBuffer.buffer)
|
||||
|
@ -241,6 +241,7 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface) {
|
|||
cairo_rectangle(PCAIRO, 0, 0, pSurface->m_pMonitor->size.x * pSurface->m_pMonitor->scale, pSurface->m_pMonitor->size.y * pSurface->m_pMonitor->scale);
|
||||
cairo_fill(PCAIRO);
|
||||
|
||||
if (pSurface == g_pHyprpicker->m_pLastSurface && !forceInactive) {
|
||||
const auto SCALEBUFS = Vector2D{pSurface->screenBuffer.pixelSize.x / PBUFFER->pixelSize.x, pSurface->screenBuffer.pixelSize.y / PBUFFER->pixelSize.y};
|
||||
const auto SCALECURSOR = Vector2D{
|
||||
g_pHyprpicker->m_pLastSurface->screenBuffer.pixelSize.x / (g_pHyprpicker->m_pLastSurface->buffers[0].pixelSize.x / g_pHyprpicker->m_pLastSurface->m_pMonitor->scale),
|
||||
|
@ -270,6 +271,7 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface) {
|
|||
// | --------- |
|
||||
//
|
||||
|
||||
|
||||
cairo_restore(PCAIRO);
|
||||
cairo_save(PCAIRO);
|
||||
|
||||
|
@ -307,6 +309,12 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface) {
|
|||
cairo_restore(PCAIRO);
|
||||
|
||||
cairo_pattern_destroy(PATTERN);
|
||||
} else {
|
||||
cairo_set_operator(PCAIRO, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_set_source_rgba(PCAIRO, 0, 0, 0, 0);
|
||||
cairo_rectangle(PCAIRO, 0, 0, pSurface->m_pMonitor->size.x * pSurface->m_pMonitor->scale, pSurface->m_pMonitor->size.y * pSurface->m_pMonitor->scale);
|
||||
cairo_fill(PCAIRO);
|
||||
}
|
||||
|
||||
sendFrame(pSurface);
|
||||
cairo_destroy(PCAIRO);
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
Vector2D m_vLastCoords;
|
||||
|
||||
void renderSurface(CLayerSurface*);
|
||||
void renderSurface(CLayerSurface*, bool forceInactive = false);
|
||||
|
||||
void createBuffer(SPoolBuffer*, int32_t, int32_t, uint32_t);
|
||||
void destroyBuffer(SPoolBuffer*);
|
||||
|
|
Loading…
Reference in a new issue