1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-22 05:51:11 -07:00

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.
This commit is contained in:
Po Lu 2022-02-24 03:35:25 +00:00
parent 543ae215c1
commit fe7c0798e8
3 changed files with 48 additions and 1 deletions

View file

@ -1607,6 +1607,30 @@ public:
haiku_write (SCROLL_BAR_DRAG_EVENT, &rq);
BScrollBar::MouseUp (pt);
}
void
MouseMoved (BPoint point, uint32 transit, const BMessage *msg)
{
struct haiku_menu_bar_left_event rq;
BPoint conv;
if (transit == B_EXITED_VIEW)
{
conv = ConvertToParent (point);
rq.x = std::lrint (conv.x);
rq.y = std::lrint (conv.y);
rq.window = this->Window ();
if (movement_locker.Lock ())
{
haiku_write (MENU_BAR_LEFT, &rq);
movement_locker.Unlock ();
}
}
BScrollBar::MouseMoved (point, transit, msg);
}
};
class EmacsTitleMenuItem : public BMenuItem
@ -2266,6 +2290,23 @@ BView_forget_scroll_bar (void *view, int x, int y, int width, int height)
}
}
bool
BView_inside_scroll_bar (void *view, int x, int y)
{
EmacsView *vw = (EmacsView *) view;
bool val;
if (vw->LockLooper ())
{
val = vw->sb_region.Contains (BPoint (x, y));
vw->UnlockLooper ();
}
else
val = false;
return val;
}
void
BView_get_mouse (void *view, int *x, int *y)
{

View file

@ -666,6 +666,9 @@ extern "C"
extern void
BView_forget_scroll_bar (void *view, int x, int y, int width, int height);
extern bool
BView_inside_scroll_bar (void *view, int x, int y);
extern void
BView_get_mouse (void *view, int *x, int *y);

View file

@ -2799,7 +2799,10 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
need_flush = 1;
}
if (f->auto_lower && !popup_activated_p)
if (f->auto_lower && !popup_activated_p
/* Don't do this if the mouse entered a scroll bar. */
&& !BView_inside_scroll_bar (FRAME_HAIKU_VIEW (f),
b->x, b->y))
{
/* If we're leaving towards the menu bar, don't
auto-lower here, and wait for a exit