Skip to content

Commit

Permalink
fix: do not allow extra key bar overlay the mouse helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
twaik committed Jan 24, 2025
1 parent d28b49a commit 5a63889
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/src/main/java/com/termux/x11/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private void initStylusAuxButtons() {
//Calculate screen border making sure btn is fully inside the view
float maxX = frm.getWidth() - 4 * left.getWidth();
float maxY = frm.getHeight() - 4 * left.getHeight();
if (prefs.adjustHeightForEK.get() && pager.getVisibility() == View.VISIBLE)
if (pager.getVisibility() == View.VISIBLE)
maxY -= pager.getHeight();

//Make sure the Stylus menu is fully inside the screen
Expand All @@ -321,7 +321,7 @@ public void onDrawShadow(@NonNull Canvas canvas) {}
//Calculate screen border making sure btn is fully inside the view
float maxX = frm.getWidth() - visibility.getWidth();
float maxY = frm.getHeight() - visibility.getHeight();
if (prefs.adjustHeightForEK.get() && pager.getVisibility() == View.VISIBLE)
if (pager.getVisibility() == View.VISIBLE)
maxY -= pager.getHeight();

switch (event.getAction()) {
Expand Down Expand Up @@ -369,7 +369,7 @@ private void makeSureHelpersAreVisibleAndInScreenBounds() {
final ViewPager pager = getTerminalToolbarViewPager();
View mouseAuxButtons = findViewById(R.id.mouse_buttons);
View stylusAuxButtons = findViewById(R.id.mouse_helper_visibility);
int maxYDecrement = (prefs.adjustHeightForEK.get() && pager.getVisibility() == View.VISIBLE) ? pager.getHeight() : 0;
int maxYDecrement = (pager.getVisibility() == View.VISIBLE) ? pager.getHeight() : 0;

mouseAuxButtons.setX(MathUtils.clamp(mouseAuxButtons.getX(), frm.getX(), frm.getX() + frm.getWidth() - mouseAuxButtons.getWidth()));
mouseAuxButtons.setY(MathUtils.clamp(mouseAuxButtons.getY(), frm.getY(), frm.getY() + frm.getHeight() - mouseAuxButtons.getHeight() - maxYDecrement));
Expand Down Expand Up @@ -429,7 +429,7 @@ void initMouseAuxButtons() {
handler.postDelayed(() -> {
float maxX = frm.getX() + frm.getWidth() - primaryLayer.getWidth();
float maxY = frm.getY() + frm.getHeight() - primaryLayer.getHeight();
if (prefs.adjustHeightForEK.get() && pager.getVisibility() == View.VISIBLE)
if (pager.getVisibility() == View.VISIBLE)
maxY -= pager.getHeight();
primaryLayer.setX(MathUtils.clamp(primaryLayer.getX(), frm.getX(), maxX));
primaryLayer.setY(MathUtils.clamp(primaryLayer.getY(), frm.getY(), maxY));
Expand Down Expand Up @@ -475,7 +475,7 @@ public boolean onTouch(View v, MotionEvent e) {
primaryLayer.getLocationInWindow(offset);
float maxX = frm.getX() + frm.getWidth() - primaryLayer.getWidth();
float maxY = frm.getY() + frm.getHeight() - primaryLayer.getHeight();
if (prefs.adjustHeightForEK.get() && pager.getVisibility() == View.VISIBLE)
if (pager.getVisibility() == View.VISIBLE)
maxY -= pager.getHeight();

primaryLayer.setX(MathUtils.clamp(offset[0] - startOffset[0] + e.getX(), frm.getX(), maxX));
Expand Down

0 comments on commit 5a63889

Please sign in to comment.