mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-22 02:35:57 +01:00
csgo-vulkan-fix: some minor fixes
This commit is contained in:
parent
74a845f1c1
commit
b5d0cfdff7
1 changed files with 30 additions and 17 deletions
|
@ -22,7 +22,9 @@ inline wlr_xwayland_surface* pCSGOXWSurface = nullptr;
|
|||
inline int csgoMonitor = 0;
|
||||
|
||||
// Do NOT change this function.
|
||||
APICALL EXPORT std::string PLUGIN_API_VERSION() { return HYPRLAND_API_VERSION; }
|
||||
APICALL EXPORT std::string PLUGIN_API_VERSION() {
|
||||
return HYPRLAND_API_VERSION;
|
||||
}
|
||||
|
||||
void onNewWindow(void* self, std::any data) {
|
||||
// data is guaranteed
|
||||
|
@ -39,7 +41,7 @@ void hkNotifyMotion(wlr_seat* wlr_seat, uint32_t time_msec, double sx, double sy
|
|||
static auto* const RESX = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:csgo-vulkan-fix:res_w")->intValue;
|
||||
static auto* const RESY = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:csgo-vulkan-fix:res_h")->intValue;
|
||||
|
||||
if (g_pCompositor->m_pLastFocus == pCSGOSurface && g_pCompositor->m_pLastMonitor) {
|
||||
if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_szInitialClass == "csgo_linux64" && g_pCompositor->m_pLastMonitor) {
|
||||
// fix the coords
|
||||
sx *= *RESX / g_pCompositor->m_pLastMonitor->vecSize.x;
|
||||
sy *= *RESY / g_pCompositor->m_pLastMonitor->vecSize.y;
|
||||
|
@ -52,7 +54,15 @@ void hkSetWindowSize(wlr_xwayland_surface* surface, int16_t x, int16_t y, uint16
|
|||
static auto* const RESX = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:csgo-vulkan-fix:res_w")->intValue;
|
||||
static auto* const RESY = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:csgo-vulkan-fix:res_h")->intValue;
|
||||
|
||||
if (surface == pCSGOXWSurface) {
|
||||
if (!surface) {
|
||||
(*(origSurfaceSize)g_pSurfaceSizeHook->m_pOriginal)(surface, x, y, width, height);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto SURF = surface->surface;
|
||||
const auto PWINDOW = g_pCompositor->getWindowFromSurface(SURF);
|
||||
|
||||
if (PWINDOW && PWINDOW->m_szInitialClass == "csgo_linux64") {
|
||||
width = *RESX;
|
||||
height = *RESY;
|
||||
}
|
||||
|
@ -66,7 +76,8 @@ void hkSurfaceDamage(wlr_surface* surface, pixman_region32_t* damage) {
|
|||
if (surface == pCSGOSurface) {
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(csgoMonitor);
|
||||
|
||||
if (PMONITOR) pixman_region32_union_rect(damage, damage, 0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
|
||||
if (PMONITOR)
|
||||
pixman_region32_union_rect(damage, damage, 0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,4 +104,6 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
|||
return {"csgo-vulkan-fix", "A plugin to fix incorrect mouse offsets on csgo in Vulkan", "Vaxry", "1.0"};
|
||||
}
|
||||
|
||||
APICALL EXPORT void PLUGIN_EXIT() { ; }
|
||||
APICALL EXPORT void PLUGIN_EXIT() {
|
||||
;
|
||||
}
|
Loading…
Reference in a new issue