diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/haiku_support.cc | 49 | ||||
| -rw-r--r-- | src/haikufns.c | 7 |
2 files changed, 38 insertions, 18 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 9e38d9556fb..332321e2db9 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc | |||
| @@ -1517,7 +1517,7 @@ public: | |||
| 1517 | BLocker cr_surface_lock; | 1517 | BLocker cr_surface_lock; |
| 1518 | #endif | 1518 | #endif |
| 1519 | 1519 | ||
| 1520 | BPoint tt_absl_pos; | 1520 | BPoint tooltip_position; |
| 1521 | BMessage *wait_for_release_message; | 1521 | BMessage *wait_for_release_message; |
| 1522 | 1522 | ||
| 1523 | EmacsView () : BView (BRect (0, 0, 0, 0), "Emacs", | 1523 | EmacsView () : BView (BRect (0, 0, 0, 0), "Emacs", |
| @@ -1798,11 +1798,16 @@ public: | |||
| 1798 | int32 windowid; | 1798 | int32 windowid; |
| 1799 | EmacsWindow *window; | 1799 | EmacsWindow *window; |
| 1800 | BToolTip *tooltip; | 1800 | BToolTip *tooltip; |
| 1801 | BPoint target_tooltip_position; | ||
| 1801 | 1802 | ||
| 1802 | window = (EmacsWindow *) Window (); | 1803 | window = (EmacsWindow *) Window (); |
| 1803 | tooltip = ToolTip (); | 1804 | tooltip = ToolTip (); |
| 1804 | 1805 | ||
| 1805 | rq.just_exited_p = transit == B_EXITED_VIEW; | 1806 | if (transit == B_EXITED_VIEW) |
| 1807 | rq.just_exited_p = true; | ||
| 1808 | else | ||
| 1809 | rq.just_exited_p = false; | ||
| 1810 | |||
| 1806 | rq.x = point.x; | 1811 | rq.x = point.x; |
| 1807 | rq.y = point.y; | 1812 | rq.y = point.y; |
| 1808 | rq.window = window; | 1813 | rq.window = window; |
| @@ -1817,8 +1822,14 @@ public: | |||
| 1817 | rq.dnd_message = false; | 1822 | rq.dnd_message = false; |
| 1818 | 1823 | ||
| 1819 | if (tooltip) | 1824 | if (tooltip) |
| 1820 | tooltip->SetMouseRelativeLocation (BPoint (-(point.x - tt_absl_pos.x), | 1825 | { |
| 1821 | -(point.y - tt_absl_pos.y))); | 1826 | target_tooltip_position |
| 1827 | = BPoint (-(point.x - tooltip_position.x), | ||
| 1828 | -(point.y - tooltip_position.y)); | ||
| 1829 | tooltip->SetMouseRelativeLocation (target_tooltip_position); | ||
| 1830 | tooltip->SetSticky (true); | ||
| 1831 | ShowToolTip (tooltip); | ||
| 1832 | } | ||
| 1822 | 1833 | ||
| 1823 | if (!grab_view_locker.Lock ()) | 1834 | if (!grab_view_locker.Lock ()) |
| 1824 | gui_abort ("Couldn't lock grab view locker"); | 1835 | gui_abort ("Couldn't lock grab view locker"); |
| @@ -4309,19 +4320,26 @@ BView_set_tooltip (void *view, const char *tooltip) | |||
| 4309 | 4320 | ||
| 4310 | /* Set VIEW's tooltip to a sticky tooltip at X by Y. */ | 4321 | /* Set VIEW's tooltip to a sticky tooltip at X by Y. */ |
| 4311 | void | 4322 | void |
| 4312 | BView_set_and_show_sticky_tooltip (void *view, const char *tooltip, | 4323 | BView_set_and_show_sticky_tooltip (void *view, const char *tooltip_text, |
| 4313 | int x, int y) | 4324 | int x, int y) |
| 4314 | { | 4325 | { |
| 4315 | BToolTip *tip; | 4326 | BToolTip *tooltip; |
| 4316 | BView *vw = (BView *) view; | 4327 | BView *vw; |
| 4328 | EmacsView *ev; | ||
| 4329 | BPoint pt; | ||
| 4330 | |||
| 4331 | vw = (BView *) view; | ||
| 4332 | |||
| 4317 | if (!vw->LockLooper ()) | 4333 | if (!vw->LockLooper ()) |
| 4318 | gui_abort ("Failed to lock view while showing sticky tooltip"); | 4334 | gui_abort ("Failed to lock view while showing sticky tooltip"); |
| 4319 | vw->SetToolTip (tooltip); | 4335 | |
| 4320 | tip = vw->ToolTip (); | 4336 | vw->SetToolTip (tooltip_text); |
| 4321 | BPoint pt; | 4337 | tooltip = vw->ToolTip (); |
| 4322 | EmacsView *ev = dynamic_cast<EmacsView *> (vw); | 4338 | |
| 4339 | ev = dynamic_cast<EmacsView *> (vw); | ||
| 4340 | |||
| 4323 | if (ev) | 4341 | if (ev) |
| 4324 | ev->tt_absl_pos = BPoint (x, y); | 4342 | ev->tooltip_position = BPoint (x, y); |
| 4325 | 4343 | ||
| 4326 | vw->GetMouse (&pt, NULL, 1); | 4344 | vw->GetMouse (&pt, NULL, 1); |
| 4327 | pt.x -= x; | 4345 | pt.x -= x; |
| @@ -4330,9 +4348,10 @@ BView_set_and_show_sticky_tooltip (void *view, const char *tooltip, | |||
| 4330 | pt.x = -pt.x; | 4348 | pt.x = -pt.x; |
| 4331 | pt.y = -pt.y; | 4349 | pt.y = -pt.y; |
| 4332 | 4350 | ||
| 4333 | tip->SetMouseRelativeLocation (pt); | 4351 | tooltip->SetMouseRelativeLocation (pt); |
| 4334 | tip->SetSticky (1); | 4352 | tooltip->SetSticky (true); |
| 4335 | vw->ShowToolTip (tip); | 4353 | |
| 4354 | vw->ShowToolTip (tooltip); | ||
| 4336 | vw->UnlockLooper (); | 4355 | vw->UnlockLooper (); |
| 4337 | } | 4356 | } |
| 4338 | 4357 | ||
diff --git a/src/haikufns.c b/src/haikufns.c index b79443203ff..878917eeef7 100644 --- a/src/haikufns.c +++ b/src/haikufns.c | |||
| @@ -1290,16 +1290,17 @@ compute_tip_xy (struct frame *f, | |||
| 1290 | static Lisp_Object | 1290 | static Lisp_Object |
| 1291 | haiku_hide_tip (bool delete) | 1291 | haiku_hide_tip (bool delete) |
| 1292 | { | 1292 | { |
| 1293 | Lisp_Object it, frame; | ||
| 1294 | |||
| 1293 | if (!NILP (tip_timer)) | 1295 | if (!NILP (tip_timer)) |
| 1294 | { | 1296 | { |
| 1295 | call1 (Qcancel_timer, tip_timer); | 1297 | call1 (Qcancel_timer, tip_timer); |
| 1296 | tip_timer = Qnil; | 1298 | tip_timer = Qnil; |
| 1297 | } | 1299 | } |
| 1298 | 1300 | ||
| 1299 | Lisp_Object it, frame; | ||
| 1300 | FOR_EACH_FRAME (it, frame) | 1301 | FOR_EACH_FRAME (it, frame) |
| 1301 | if (FRAME_WINDOW_P (XFRAME (frame)) && | 1302 | if (FRAME_WINDOW_P (XFRAME (frame)) |
| 1302 | FRAME_HAIKU_VIEW (XFRAME (frame))) | 1303 | && FRAME_HAIKU_VIEW (XFRAME (frame))) |
| 1303 | BView_set_tooltip (FRAME_HAIKU_VIEW (XFRAME (frame)), NULL); | 1304 | BView_set_tooltip (FRAME_HAIKU_VIEW (XFRAME (frame)), NULL); |
| 1304 | 1305 | ||
| 1305 | if (NILP (tip_frame) | 1306 | if (NILP (tip_frame) |