| 943 | }; |
| 944 | |
| 945 | static void X11Textbox_Measure(struct X11Textbox* t, XFontStruct* font) { |
| 946 | cc_string str = String_FromReadonly(t->text), line; |
| 947 | XCharStruct overall; |
| 948 | int direction, ascent, descent, lines = 0; |
| 949 | |
| 950 | for (; str.length; lines++) { |
| 951 | String_UNSAFE_SplitBy(&str, '\n', &line); |
| 952 | XTextExtents(font, line.buffer, line.length, &direction, &ascent, &descent, &overall); |
| 953 | t->width = max(overall.width, t->width); |
| 954 | } |
| 955 | |
| 956 | t->lineHeight = ascent + descent; |
| 957 | t->descent = descent; |
| 958 | t->height = t->lineHeight * lines; |
| 959 | } |
| 960 | |
| 961 | static void X11Textbox_Draw(struct X11Textbox* t, struct X11MessageBox* m) { |
| 962 | cc_string str = String_FromReadonly(t->text), line; |
no test coverage detected