aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-02-24 03:35:25 +0000
committerPo Lu2022-02-24 03:35:25 +0000
commitfe7c0798e879c54f660cc0371fa3ef0fd063a77a (patch)
tree21bd299d484e8e7b82416ac5604858b87b4bb06b /src
parent543ae215c111e175871c6efc891d7816c2dd0f8c (diff)
downloademacs-fe7c0798e879c54f660cc0371fa3ef0fd063a77a.tar.gz
emacs-fe7c0798e879c54f660cc0371fa3ef0fd063a77a.zip
Fix auto-lower when the mouse moves onto a scrollbar on Haiku
* src/haiku_support.cc (MouseMoved): (BView_inside_scroll_bar): New functions. * src/haiku_support.h: Update prototypes. * src/haikuterm.c (haiku_read_socket): Don't auto-lower if the pointer left the view for a scroll bar.
Diffstat (limited to 'src')
-rw-r--r--src/haiku_support.cc41
-rw-r--r--src/haiku_support.h3
-rw-r--r--src/haikuterm.c5
3 files changed, 48 insertions, 1 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 4f6a96568cb..9aeb03c4c90 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1607,6 +1607,30 @@ public:
1607 haiku_write (SCROLL_BAR_DRAG_EVENT, &rq); 1607 haiku_write (SCROLL_BAR_DRAG_EVENT, &rq);
1608 BScrollBar::MouseUp (pt); 1608 BScrollBar::MouseUp (pt);
1609 } 1609 }
1610
1611 void
1612 MouseMoved (BPoint point, uint32 transit, const BMessage *msg)
1613 {
1614 struct haiku_menu_bar_left_event rq;
1615 BPoint conv;
1616
1617 if (transit == B_EXITED_VIEW)
1618 {
1619 conv = ConvertToParent (point);
1620
1621 rq.x = std::lrint (conv.x);
1622 rq.y = std::lrint (conv.y);
1623 rq.window = this->Window ();
1624
1625 if (movement_locker.Lock ())
1626 {
1627 haiku_write (MENU_BAR_LEFT, &rq);
1628 movement_locker.Unlock ();
1629 }
1630 }
1631
1632 BScrollBar::MouseMoved (point, transit, msg);
1633 }
1610}; 1634};
1611 1635
1612class EmacsTitleMenuItem : public BMenuItem 1636class EmacsTitleMenuItem : public BMenuItem
@@ -2266,6 +2290,23 @@ BView_forget_scroll_bar (void *view, int x, int y, int width, int height)
2266 } 2290 }
2267} 2291}
2268 2292
2293bool
2294BView_inside_scroll_bar (void *view, int x, int y)
2295{
2296 EmacsView *vw = (EmacsView *) view;
2297 bool val;
2298
2299 if (vw->LockLooper ())
2300 {
2301 val = vw->sb_region.Contains (BPoint (x, y));
2302 vw->UnlockLooper ();
2303 }
2304 else
2305 val = false;
2306
2307 return val;
2308}
2309
2269void 2310void
2270BView_get_mouse (void *view, int *x, int *y) 2311BView_get_mouse (void *view, int *x, int *y)
2271{ 2312{
diff --git a/src/haiku_support.h b/src/haiku_support.h
index ef433514fe7..1deb867c5f7 100644
--- a/src/haiku_support.h
+++ b/src/haiku_support.h
@@ -666,6 +666,9 @@ extern "C"
666 extern void 666 extern void
667 BView_forget_scroll_bar (void *view, int x, int y, int width, int height); 667 BView_forget_scroll_bar (void *view, int x, int y, int width, int height);
668 668
669 extern bool
670 BView_inside_scroll_bar (void *view, int x, int y);
671
669 extern void 672 extern void
670 BView_get_mouse (void *view, int *x, int *y); 673 BView_get_mouse (void *view, int *x, int *y);
671 674
diff --git a/src/haikuterm.c b/src/haikuterm.c
index c184501a207..83330b5f638 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -2799,7 +2799,10 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
2799 need_flush = 1; 2799 need_flush = 1;
2800 } 2800 }
2801 2801
2802 if (f->auto_lower && !popup_activated_p) 2802 if (f->auto_lower && !popup_activated_p
2803 /* Don't do this if the mouse entered a scroll bar. */
2804 && !BView_inside_scroll_bar (FRAME_HAIKU_VIEW (f),
2805 b->x, b->y))
2803 { 2806 {
2804 /* If we're leaving towards the menu bar, don't 2807 /* If we're leaving towards the menu bar, don't
2805 auto-lower here, and wait for a exit 2808 auto-lower here, and wait for a exit