[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 1e1d2f18c6: Obey decorator-specified width and height of tooltip
From: |
Po Lu |
Subject: |
master 1e1d2f18c6: Obey decorator-specified width and height of tooltip frames on Haiku |
Date: |
Sat, 5 Mar 2022 05:21:03 -0500 (EST) |
branch: master
commit 1e1d2f18c6d797f7e49a71f998a82cb255b8bb58
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Obey decorator-specified width and height of tooltip frames on Haiku
* src/haiku_support.cc (BWindow_dimensions): New functions.
* src/haiku_support.h: Update prototypes.
* src/haikufns.c (Fx_show_tip): Use actual dimensions, because
the decorator might specify a minimum width and height for the
tooltip frame.
* src/haikuterm.c (haiku_update_size_hints): Ignore tooltip
frames.
---
src/haiku_support.cc | 10 ++++++++++
src/haiku_support.h | 3 +++
src/haikufns.c | 3 +++
src/haikuterm.c | 3 +++
4 files changed, 19 insertions(+)
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 20d04163fc..057464c908 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -2080,6 +2080,16 @@ BWindow_set_offset (void *window, int x, int y)
wn->MoveTo (x, y);
}
+void
+BWindow_dimensions (void *window, int *width, int *height)
+{
+ BWindow *w = (BWindow *) window;
+ BRect frame = w->Frame ();
+
+ *width = BE_RECT_WIDTH (frame);
+ *height = BE_RECT_HEIGHT (frame);
+}
+
/* Iconify WINDOW. */
void
BWindow_iconify (void *window)
diff --git a/src/haiku_support.h b/src/haiku_support.h
index 9d13cae47c..04079edbbc 100644
--- a/src/haiku_support.h
+++ b/src/haiku_support.h
@@ -939,6 +939,9 @@ extern "C"
extern haiku_font_family_or_style *
be_list_font_families (size_t *length);
+ extern void
+ BWindow_dimensions (void *window, int *width, int *height);
+
#ifdef __cplusplus
extern void *
find_appropriate_view_for_draw (void *vw);
diff --git a/src/haikufns.c b/src/haikufns.c
index ff5082030f..545edb27ae 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -2201,6 +2201,9 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
block_input ();
void *wnd = FRAME_HAIKU_WINDOW (tip_f);
BWindow_resize (wnd, width, height);
+ /* The window decorator might cause the actual width and height to
+ be larger than WIDTH and HEIGHT, so use the actual sizes. */
+ BWindow_dimensions (wnd, &width, &height);
BView_resize_to (FRAME_HAIKU_VIEW (tip_f), width, height);
BView_set_view_cursor (FRAME_HAIKU_VIEW (tip_f),
FRAME_OUTPUT_DATA (f)->current_cursor);
diff --git a/src/haikuterm.c b/src/haikuterm.c
index ac087e3bec..c44b350c58 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -140,6 +140,9 @@ haiku_update_size_hints (struct frame *f)
int base_width, base_height;
eassert (FRAME_HAIKU_P (f) && FRAME_HAIKU_WINDOW (f));
+ if (f->tooltip)
+ return;
+
base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 1e1d2f18c6: Obey decorator-specified width and height of tooltip frames on Haiku,
Po Lu <=