Skip to content

Commit

Permalink
fix(glsurface): avoid negative size
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias-Boulay committed Jan 25, 2025
1 parent 5b99165 commit 70047f3
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public boolean dispatchGenericMotionEvent(MotionEvent event) {
CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY);
return true;
case MotionEvent.ACTION_SCROLL:
CallbackBridge.sendScroll((double) event.getAxisValue(MotionEvent.AXIS_HSCROLL), (double) event.getAxisValue(MotionEvent.AXIS_VSCROLL));
CallbackBridge.sendScroll(event.getAxisValue(MotionEvent.AXIS_HSCROLL), event.getAxisValue(MotionEvent.AXIS_VSCROLL));
return true;
case MotionEvent.ACTION_BUTTON_PRESS:
return sendMouseButtonUnconverted(event.getActionButton(),true);
Expand Down Expand Up @@ -338,8 +338,14 @@ public void refreshSize(boolean immediate) {
// Use the width and height of the View instead of display dimensions to avoid
// getting squiched/stretched due to inconsistencies between the layout and
// screen dimensions.
windowWidth = Tools.getDisplayFriendlyRes(getWidth(), LauncherPreferences.PREF_SCALE_FACTOR);
windowHeight = Tools.getDisplayFriendlyRes(getHeight(), LauncherPreferences.PREF_SCALE_FACTOR);
int newWidth = Tools.getDisplayFriendlyRes(getWidth(), LauncherPreferences.PREF_SCALE_FACTOR);
int newHeight = Tools.getDisplayFriendlyRes(getHeight(), LauncherPreferences.PREF_SCALE_FACTOR);
if (newHeight < 1 || newWidth < 1) {
Log.e("MGLSurface", String.format("Impossible resolution : %dx%d", newWidth, newHeight));
return;
}
windowWidth = newWidth;
windowHeight = newHeight;
if(mSurface == null){
Log.w("MGLSurface", "Attempt to refresh size on null surface");
return;
Expand Down

0 comments on commit 70047f3

Please sign in to comment.