HACK: prevent window height of 0

For some reason some apps like LibreSudoku try to create Dialog and
Popup windows with height = 0. Prevent this on the window side until the
measurement error is fixed.
This commit is contained in:
Julian Winkler
2024-12-14 23:37:37 +01:00
parent 47fc749018
commit 167d3856e9
2 changed files with 7 additions and 1 deletions

View File

@@ -93,7 +93,7 @@ public class Window {
}
public void setAttributes(WindowManager.LayoutParams params) {
set_layout(native_window, params.width, params.height);
setLayout(params.width, params.height);
}
public void takeSurface(SurfaceHolder.Callback2 callback) {}
@@ -105,6 +105,8 @@ public class Window {
public void setFormat(int format) {}
public void setLayout(int width, int height) {
if (height == 0) // FIXME: remove this hack once measurement error with composeUI dialogs is fixed
height = 500;
set_layout(native_window, width, height);
}

View File

@@ -8,6 +8,8 @@ public class WindowManagerImpl implements WindowManager, ViewManager {
@Override
public void addView(View view, android.view.ViewGroup.LayoutParams params) {
System.out.println("WindowManagerImpl.addView(" + view + ", " + params + ") called");
if (params.height == 0) // FIXME: remove this hack once measurement error with composeUI popups is fixed
params.height = 200;
view.setLayoutParams(params);
view.onAttachedToWindow();
WindowManager.LayoutParams windowParams = (WindowManager.LayoutParams)params;
@@ -17,6 +19,8 @@ public class WindowManagerImpl implements WindowManager, ViewManager {
@Override
public void updateViewLayout(View view, android.view.ViewGroup.LayoutParams params) {
System.out.println("WindowManagerImpl.updateViewLayout(" + view + ", " + params + ") called");
if (params.height == 0) // FIXME: remove this hack once measurement error with composeUI popups is fixed
params.height = 200;
WindowManager.LayoutParams windowParams = (WindowManager.LayoutParams)params;
view.setLayoutParams(params);
native_updateViewLayout(view.widget, windowParams.x, windowParams.y, params.width, params.height);