diff --git a/client/displayservers/SDL/sdl.c b/client/displayservers/SDL/sdl.c index 80e9c027..1b1434e1 100644 --- a/client/displayservers/SDL/sdl.c +++ b/client/displayservers/SDL/sdl.c @@ -381,6 +381,7 @@ static int sdlEventFilter(void * userdata, SDL_Event * event) app_handleResizeEvent( event->window.data1, event->window.data2, + 1, border); break; } diff --git a/client/displayservers/Wayland/gl.c b/client/displayservers/Wayland/gl.c index 3f991a15..087ae8e4 100644 --- a/client/displayservers/Wayland/gl.c +++ b/client/displayservers/Wayland/gl.c @@ -80,7 +80,7 @@ void waylandEGLSwapBuffers(EGLDisplay display, EGLSurface surface) wl_surface_set_opaque_region(wlWm.surface, region); wl_region_destroy(region); - app_handleResizeEvent(wlWm.width, wlWm.height, (struct Border) {0, 0, 0, 0}); + app_handleResizeEvent(wlWm.width, wlWm.height, 1, (struct Border) {0, 0, 0, 0}); xdg_surface_ack_configure(wlWm.xdgSurface, wlWm.resizeSerial); wlWm.resizeSerial = 0; } diff --git a/client/displayservers/X11/x11.c b/client/displayservers/X11/x11.c index 661590d7..7a553b1f 100644 --- a/client/displayservers/X11/x11.c +++ b/client/displayservers/X11/x11.c @@ -569,10 +569,10 @@ static int x11EventThread(void * unused) if (x11.fullscreen) { struct Border border = {0}; - app_handleResizeEvent(x11.rect.w, x11.rect.h, border); + app_handleResizeEvent(x11.rect.w, x11.rect.h, 1, border); } else - app_handleResizeEvent(x11.rect.w, x11.rect.h, x11.border); + app_handleResizeEvent(x11.rect.w, x11.rect.h, 1, x11.border); break; } @@ -648,7 +648,7 @@ static int x11EventThread(void * unused) x11.border.right = cardinal[1]; x11.border.top = cardinal[2]; x11.border.bottom = cardinal[3]; - app_handleResizeEvent(x11.rect.w, x11.rect.h, x11.border); + app_handleResizeEvent(x11.rect.w, x11.rect.h, 1, x11.border); } XFree(data); diff --git a/client/include/app.h b/client/include/app.h index 366fa21d..872e9ffc 100644 --- a/client/include/app.h +++ b/client/include/app.h @@ -39,7 +39,7 @@ bool app_isRunning(void); bool app_inputEnabled(void); void app_updateCursorPos(double x, double y); void app_updateWindowPos(int x, int y); -void app_handleResizeEvent(int w, int h, const struct Border border); +void app_handleResizeEvent(int w, int h, double scale, const struct Border border); void app_handleMouseRelative(double normx, double normy, double rawx, double rawy); diff --git a/client/include/interface/renderer.h b/client/include/interface/renderer.h index 3b040327..13853fc0 100644 --- a/client/include/interface/renderer.h +++ b/client/include/interface/renderer.h @@ -109,7 +109,7 @@ typedef bool (* LG_RendererInitialize )(void * opaque); typedef void (* LG_RendererDeInitialize )(void * opaque); typedef bool (* LG_RendererSupports )(void * opaque, LG_RendererSupport support); typedef void (* LG_RendererOnRestart )(void * opaque); -typedef void (* LG_RendererOnResize )(void * opaque, const int width, const int height, const LG_RendererRect destRect, LG_RendererRotate rotate); +typedef void (* LG_RendererOnResize )(void * opaque, const int width, const int height, const double scale, const LG_RendererRect destRect, LG_RendererRotate rotate); typedef bool (* LG_RendererOnMouseShape )(void * opaque, const LG_RendererCursor cursor, const int width, const int height, const int pitch, const uint8_t * data); typedef bool (* LG_RendererOnMouseEvent )(void * opaque, const bool visible , const int x, const int y); typedef bool (* LG_RendererOnFrameFormat)(void * opaque, const LG_RendererFormat format, bool useDMA); diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index ca2288bc..6a1c0c79 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -379,7 +379,7 @@ static void egl_update_scale_type(struct Inst * this) this->scaleType = EGL_DESKTOP_UPSCALE; } -void egl_on_resize(void * opaque, const int width, const int height, +void egl_on_resize(void * opaque, const int width, const int height, const double scale, const LG_RendererRect destRect, LG_RendererRotate rotate) { struct Inst * this = (struct Inst *)opaque; diff --git a/client/renderers/OpenGL/opengl.c b/client/renderers/OpenGL/opengl.c index 74427b1a..f09170cf 100644 --- a/client/renderers/OpenGL/opengl.c +++ b/client/renderers/OpenGL/opengl.c @@ -298,7 +298,7 @@ void opengl_on_restart(void * opaque) this->waiting = true; } -void opengl_on_resize(void * opaque, const int width, const int height, +void opengl_on_resize(void * opaque, const int width, const int height, const double scale, const LG_RendererRect destRect, LG_RendererRotate rotate) { struct Inst * this = (struct Inst *)opaque; diff --git a/client/src/app.c b/client/src/app.c index 2b893994..e98a32b5 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -349,18 +349,19 @@ void app_updateWindowPos(int x, int y) g_state.windowPos.y = y; } -void app_handleResizeEvent(int w, int h, const struct Border border) +void app_handleResizeEvent(int w, int h, double scale, const struct Border border) { memcpy(&g_state.border, &border, sizeof(border)); /* don't do anything else if the window dimensions have not changed */ - if (g_state.windowW == w && g_state.windowH == h) + if (g_state.windowW == w && g_state.windowH == h && g_state.windowScale == scale) return; - g_state.windowW = w; - g_state.windowH = h; - g_state.windowCX = w / 2; - g_state.windowCY = h / 2; + g_state.windowW = w; + g_state.windowH = h; + g_state.windowCX = w / 2; + g_state.windowCY = h / 2; + g_state.windowScale = scale; core_updatePositionInfo(); if (core_inputEnabled()) diff --git a/client/src/main.c b/client/src/main.c index a0130a68..e36cdc82 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -126,7 +126,7 @@ static int renderThread(void * unused) { if (g_state.lgr) g_state.lgr->on_resize(g_state.lgrData, g_state.windowW, g_state.windowH, - g_state.dstRect, g_params.winRotate); + g_state.windowScale, g_state.dstRect, g_params.winRotate); atomic_compare_exchange_weak(&g_state.lgrResize, &resize, 0); } diff --git a/client/src/main.h b/client/src/main.h index 5ab22c75..f427436f 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -58,6 +58,7 @@ struct AppState struct Point windowPos; int windowW, windowH; int windowCX, windowCY; + double windowScale; LG_RendererRotate rotate; bool focused; struct Border border;