diff options
| author | Po Lu | 2022-05-17 09:40:57 +0000 |
|---|---|---|
| committer | Po Lu | 2022-05-17 09:59:20 +0000 |
| commit | e9ad64ef92e7e8292ba596a97e114cbc91c6faa3 (patch) | |
| tree | ce3845fc02a66a005da8f654cc55009c2d79a974 | |
| parent | dc239872cc248414f121e0455d447ef00f9b4cc4 (diff) | |
| download | emacs-e9ad64ef92e7e8292ba596a97e114cbc91c6faa3.tar.gz emacs-e9ad64ef92e7e8292ba596a97e114cbc91c6faa3.zip | |
Rewrite Haiku frame geometry code to handle decorator frames
* doc/lispref/frames.texi (Frame Layout): Document changes to
Haiku frame layout.
* src/haiku_support.cc (class EmacsWindow, MoveToIncludingFrame)
(EmacsMoveTo, MakeFullscreen): Move to an offset including the
decorator frames.
(be_get_window_decorator_dimensions):
(be_get_window_decorator_frame): New functions.
* src/haiku_support.h: Update prototypes.
* src/haikufns.c (haiku_update_after_decoration_change): New
function.
(haiku_create_frame, haiku_set_undecorated)
(haiku_set_override_redirect): Call that function.
(frame_geometry): Actually calculate frame geometry based on
decorator and frame sizes.
* src/haikuterm.c (haiku_coords_from_parent): Use frame width
instead.
(haiku_read_socket): Set left and top positions based on
decorator width and height.
* src/haikuterm.h (struct haiku_output): New field `frame_x' and
`frame_y'.
| -rw-r--r-- | doc/lispref/frames.texi | 4 | ||||
| -rw-r--r-- | src/haiku_support.cc | 122 | ||||
| -rw-r--r-- | src/haiku_support.h | 3 | ||||
| -rw-r--r-- | src/haikufns.c | 132 | ||||
| -rw-r--r-- | src/haikuterm.c | 42 | ||||
| -rw-r--r-- | src/haikuterm.h | 5 |
6 files changed, 205 insertions, 103 deletions
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 3bbeef005bd..5853c45b79e 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi | |||
| @@ -683,9 +683,9 @@ The position of the top left corner of the native frame specifies the | |||
| 683 | indicate that position for the various builds: | 683 | indicate that position for the various builds: |
| 684 | 684 | ||
| 685 | @itemize @w{} | 685 | @itemize @w{} |
| 686 | @item (1) non-toolkit and terminal frames | 686 | @item (1) non-toolkit, Haiku, and terminal frames |
| 687 | 687 | ||
| 688 | @item (2) Lucid, Motif, MS-Windows, and Haiku frames | 688 | @item (2) Lucid, Motif, and MS-Windows frames |
| 689 | 689 | ||
| 690 | @item (3) GTK+ and NS frames | 690 | @item (3) GTK+ and NS frames |
| 691 | @end itemize | 691 | @end itemize |
diff --git a/src/haiku_support.cc b/src/haiku_support.cc index c883d865343..299b37c1cc9 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc | |||
| @@ -796,11 +796,23 @@ public: | |||
| 796 | } | 796 | } |
| 797 | 797 | ||
| 798 | void | 798 | void |
| 799 | MoveToIncludingFrame (int x, int y) | ||
| 800 | { | ||
| 801 | BRect decorator, frame; | ||
| 802 | |||
| 803 | decorator = DecoratorFrame (); | ||
| 804 | frame = Frame (); | ||
| 805 | |||
| 806 | MoveTo (x + frame.left - decorator.left, | ||
| 807 | y + frame.top - decorator.top); | ||
| 808 | } | ||
| 809 | |||
| 810 | void | ||
| 799 | DoMove (struct child_frame *f) | 811 | DoMove (struct child_frame *f) |
| 800 | { | 812 | { |
| 801 | BRect frame = this->Frame (); | 813 | BRect frame = this->Frame (); |
| 802 | f->window->MoveTo (frame.left + f->xoff, | 814 | f->window->MoveToIncludingFrame (frame.left + f->xoff, |
| 803 | frame.top + f->yoff); | 815 | frame.top + f->yoff); |
| 804 | } | 816 | } |
| 805 | 817 | ||
| 806 | void | 818 | void |
| @@ -1062,7 +1074,7 @@ public: | |||
| 1062 | gui_abort ("Failed to lock child frame state lock"); | 1074 | gui_abort ("Failed to lock child frame state lock"); |
| 1063 | 1075 | ||
| 1064 | if (!this->parent) | 1076 | if (!this->parent) |
| 1065 | this->MoveTo (x, y); | 1077 | this->MoveToIncludingFrame (x, y); |
| 1066 | else | 1078 | else |
| 1067 | this->parent->MoveChild (this, x, y, 0); | 1079 | this->parent->MoveChild (this, x, y, 0); |
| 1068 | child_frame_lock.Unlock (); | 1080 | child_frame_lock.Unlock (); |
| @@ -1173,30 +1185,6 @@ public: | |||
| 1173 | } | 1185 | } |
| 1174 | 1186 | ||
| 1175 | void | 1187 | void |
| 1176 | GetParentWidthHeight (int *width, int *height) | ||
| 1177 | { | ||
| 1178 | if (!child_frame_lock.Lock ()) | ||
| 1179 | gui_abort ("Failed to lock child frame state lock"); | ||
| 1180 | |||
| 1181 | if (parent) | ||
| 1182 | { | ||
| 1183 | BRect frame = parent->Frame (); | ||
| 1184 | *width = BE_RECT_WIDTH (frame); | ||
| 1185 | *height = BE_RECT_HEIGHT (frame); | ||
| 1186 | } | ||
| 1187 | else | ||
| 1188 | { | ||
| 1189 | BScreen s (this); | ||
| 1190 | BRect frame = s.Frame (); | ||
| 1191 | |||
| 1192 | *width = BE_RECT_WIDTH (frame); | ||
| 1193 | *height = BE_RECT_HEIGHT (frame); | ||
| 1194 | } | ||
| 1195 | |||
| 1196 | child_frame_lock.Unlock (); | ||
| 1197 | } | ||
| 1198 | |||
| 1199 | void | ||
| 1200 | OffsetChildRect (BRect *r, EmacsWindow *c) | 1188 | OffsetChildRect (BRect *r, EmacsWindow *c) |
| 1201 | { | 1189 | { |
| 1202 | if (!child_frame_lock.Lock ()) | 1190 | if (!child_frame_lock.Lock ()) |
| @@ -1221,17 +1209,21 @@ public: | |||
| 1221 | MakeFullscreen (int make_fullscreen_p) | 1209 | MakeFullscreen (int make_fullscreen_p) |
| 1222 | { | 1210 | { |
| 1223 | BScreen screen (this); | 1211 | BScreen screen (this); |
| 1212 | uint32 flags; | ||
| 1213 | BRect screen_frame; | ||
| 1224 | 1214 | ||
| 1225 | if (!screen.IsValid ()) | 1215 | if (!screen.IsValid ()) |
| 1226 | gui_abort ("Trying to make a window fullscreen without a screen"); | 1216 | gui_abort ("Trying to make a window fullscreen without a screen"); |
| 1227 | 1217 | ||
| 1218 | screen_frame = screen.Frame (); | ||
| 1228 | UnZoom (); | 1219 | UnZoom (); |
| 1229 | 1220 | ||
| 1230 | if (make_fullscreen_p == fullscreen_p) | 1221 | if (make_fullscreen_p == fullscreen_p) |
| 1231 | return; | 1222 | return; |
| 1232 | 1223 | ||
| 1233 | fullscreen_p = make_fullscreen_p; | 1224 | fullscreen_p = make_fullscreen_p; |
| 1234 | uint32 flags = Flags (); | 1225 | flags = Flags (); |
| 1226 | |||
| 1235 | if (fullscreen_p) | 1227 | if (fullscreen_p) |
| 1236 | { | 1228 | { |
| 1237 | if (zoomed_p) | 1229 | if (zoomed_p) |
| @@ -1240,24 +1232,18 @@ public: | |||
| 1240 | flags |= B_NOT_MOVABLE | B_NOT_ZOOMABLE; | 1232 | flags |= B_NOT_MOVABLE | B_NOT_ZOOMABLE; |
| 1241 | pre_fullscreen_rect = Frame (); | 1233 | pre_fullscreen_rect = Frame (); |
| 1242 | 1234 | ||
| 1243 | if (!child_frame_lock.Lock ()) | 1235 | MoveTo (0, 0); |
| 1244 | gui_abort ("Failed to lock child frame state lock"); | 1236 | ResizeTo (BE_RECT_WIDTH (screen_frame) - 1, |
| 1245 | 1237 | BE_RECT_HEIGHT (screen_frame) - 1); | |
| 1246 | if (parent) | ||
| 1247 | parent->OffsetChildRect (&pre_fullscreen_rect, this); | ||
| 1248 | |||
| 1249 | child_frame_lock.Unlock (); | ||
| 1250 | |||
| 1251 | int w, h; | ||
| 1252 | EmacsMoveTo (0, 0); | ||
| 1253 | GetParentWidthHeight (&w, &h); | ||
| 1254 | ResizeTo (w - 1, h - 1); | ||
| 1255 | } | 1238 | } |
| 1256 | else | 1239 | else |
| 1257 | { | 1240 | { |
| 1258 | flags &= ~(B_NOT_MOVABLE | B_NOT_ZOOMABLE); | 1241 | flags &= ~(B_NOT_MOVABLE | B_NOT_ZOOMABLE); |
| 1259 | EmacsMoveTo (pre_fullscreen_rect.left, | 1242 | |
| 1260 | pre_fullscreen_rect.top); | 1243 | /* Use MoveTo directly since pre_fullscreen_rect isn't |
| 1244 | adjusted for decorator sizes. */ | ||
| 1245 | MoveTo (pre_fullscreen_rect.left, | ||
| 1246 | pre_fullscreen_rect.top); | ||
| 1261 | ResizeTo (BE_RECT_WIDTH (pre_fullscreen_rect) - 1, | 1247 | ResizeTo (BE_RECT_WIDTH (pre_fullscreen_rect) - 1, |
| 1262 | BE_RECT_HEIGHT (pre_fullscreen_rect) - 1); | 1248 | BE_RECT_HEIGHT (pre_fullscreen_rect) - 1); |
| 1263 | } | 1249 | } |
| @@ -5097,3 +5083,55 @@ be_create_pixmap_cursor (void *bitmap, int x, int y) | |||
| 5097 | 5083 | ||
| 5098 | return cursor; | 5084 | return cursor; |
| 5099 | } | 5085 | } |
| 5086 | |||
| 5087 | void | ||
| 5088 | be_get_window_decorator_dimensions (void *window, int *left, int *top, | ||
| 5089 | int *right, int *bottom) | ||
| 5090 | { | ||
| 5091 | BWindow *wnd; | ||
| 5092 | BRect frame, window_frame; | ||
| 5093 | |||
| 5094 | wnd = (BWindow *) window; | ||
| 5095 | |||
| 5096 | if (!wnd->LockLooper ()) | ||
| 5097 | gui_abort ("Failed to lock window looper frame"); | ||
| 5098 | |||
| 5099 | frame = wnd->DecoratorFrame (); | ||
| 5100 | window_frame = wnd->Frame (); | ||
| 5101 | |||
| 5102 | if (left) | ||
| 5103 | *left = window_frame.left - frame.left; | ||
| 5104 | |||
| 5105 | if (top) | ||
| 5106 | *top = window_frame.top - frame.top; | ||
| 5107 | |||
| 5108 | if (right) | ||
| 5109 | *right = frame.right - window_frame.right; | ||
| 5110 | |||
| 5111 | if (bottom) | ||
| 5112 | *bottom = frame.bottom - window_frame.bottom; | ||
| 5113 | |||
| 5114 | wnd->UnlockLooper (); | ||
| 5115 | } | ||
| 5116 | |||
| 5117 | void | ||
| 5118 | be_get_window_decorator_frame (void *window, int *left, int *top, | ||
| 5119 | int *width, int *height) | ||
| 5120 | { | ||
| 5121 | BWindow *wnd; | ||
| 5122 | BRect frame; | ||
| 5123 | |||
| 5124 | wnd = (BWindow *) window; | ||
| 5125 | |||
| 5126 | if (!wnd->LockLooper ()) | ||
| 5127 | gui_abort ("Failed to lock window looper frame"); | ||
| 5128 | |||
| 5129 | frame = wnd->DecoratorFrame (); | ||
| 5130 | |||
| 5131 | *left = frame.left; | ||
| 5132 | *top = frame.top; | ||
| 5133 | *width = BE_RECT_WIDTH (frame); | ||
| 5134 | *height = BE_RECT_HEIGHT (frame); | ||
| 5135 | |||
| 5136 | wnd->UnlockLooper (); | ||
| 5137 | } | ||
diff --git a/src/haiku_support.h b/src/haiku_support.h index bccef2628b1..cdeb40f67c4 100644 --- a/src/haiku_support.h +++ b/src/haiku_support.h | |||
| @@ -686,6 +686,9 @@ extern bool be_select_font (void (*) (void), bool (*) (void), | |||
| 686 | extern int be_find_font_indices (struct haiku_font_pattern *, int *, int *); | 686 | extern int be_find_font_indices (struct haiku_font_pattern *, int *, int *); |
| 687 | extern status_t be_roster_launch (const char *, const char *, char **, | 687 | extern status_t be_roster_launch (const char *, const char *, char **, |
| 688 | ptrdiff_t, void *, team_id *); | 688 | ptrdiff_t, void *, team_id *); |
| 689 | extern void be_get_window_decorator_dimensions (void *, int *, int *, int *, int *); | ||
| 690 | extern void be_get_window_decorator_frame (void *, int *, int *, int *, int *); | ||
| 691 | |||
| 689 | #ifdef __cplusplus | 692 | #ifdef __cplusplus |
| 690 | } | 693 | } |
| 691 | 694 | ||
diff --git a/src/haikufns.c b/src/haikufns.c index d55cdac44dd..e8e303fd279 100644 --- a/src/haikufns.c +++ b/src/haikufns.c | |||
| @@ -104,6 +104,29 @@ get_geometry_from_preferences (struct haiku_display_info *dpyinfo, | |||
| 104 | return parms; | 104 | return parms; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | /* Update the left and top offsets of F after its decorators | ||
| 108 | change. */ | ||
| 109 | static void | ||
| 110 | haiku_update_after_decoration_change (struct frame *f) | ||
| 111 | { | ||
| 112 | int x, y, width, height; | ||
| 113 | struct frame *parent; | ||
| 114 | |||
| 115 | be_get_window_decorator_frame (FRAME_HAIKU_WINDOW (f), | ||
| 116 | &x, &y, &width, &height); | ||
| 117 | |||
| 118 | parent = FRAME_PARENT_FRAME (f); | ||
| 119 | |||
| 120 | if (parent) | ||
| 121 | { | ||
| 122 | x = x - FRAME_OUTPUT_DATA (f)->frame_x; | ||
| 123 | y = y - FRAME_OUTPUT_DATA (f)->frame_x; | ||
| 124 | } | ||
| 125 | |||
| 126 | f->left_pos = x; | ||
| 127 | f->top_pos = y; | ||
| 128 | } | ||
| 129 | |||
| 107 | void | 130 | void |
| 108 | haiku_change_tool_bar_height (struct frame *f, int height) | 131 | haiku_change_tool_bar_height (struct frame *f, int height) |
| 109 | { | 132 | { |
| @@ -827,10 +850,7 @@ haiku_create_frame (Lisp_Object parms) | |||
| 827 | 850 | ||
| 828 | f->terminal->reference_count++; | 851 | f->terminal->reference_count++; |
| 829 | 852 | ||
| 830 | block_input (); | 853 | FRAME_OUTPUT_DATA (f)->window = BWindow_new (&FRAME_OUTPUT_DATA (f)->view); |
| 831 | FRAME_OUTPUT_DATA (f)->window | ||
| 832 | = BWindow_new (&FRAME_OUTPUT_DATA (f)->view); | ||
| 833 | unblock_input (); | ||
| 834 | 854 | ||
| 835 | if (!FRAME_OUTPUT_DATA (f)->window) | 855 | if (!FRAME_OUTPUT_DATA (f)->window) |
| 836 | xsignal1 (Qerror, build_unibyte_string ("Could not create window")); | 856 | xsignal1 (Qerror, build_unibyte_string ("Could not create window")); |
| @@ -842,7 +862,8 @@ haiku_create_frame (Lisp_Object parms) | |||
| 842 | 862 | ||
| 843 | Vframe_list = Fcons (frame, Vframe_list); | 863 | Vframe_list = Fcons (frame, Vframe_list); |
| 844 | 864 | ||
| 845 | Lisp_Object parent_frame = gui_display_get_arg (dpyinfo, parms, Qparent_frame, NULL, NULL, | 865 | Lisp_Object parent_frame = gui_display_get_arg (dpyinfo, parms, |
| 866 | Qparent_frame, NULL, NULL, | ||
| 846 | RES_TYPE_SYMBOL); | 867 | RES_TYPE_SYMBOL); |
| 847 | 868 | ||
| 848 | if (EQ (parent_frame, Qunbound) | 869 | if (EQ (parent_frame, Qunbound) |
| @@ -1315,6 +1336,8 @@ haiku_set_undecorated (struct frame *f, Lisp_Object new_value, | |||
| 1315 | FRAME_UNDECORATED (f) = !NILP (new_value); | 1336 | FRAME_UNDECORATED (f) = !NILP (new_value); |
| 1316 | BWindow_change_decoration (FRAME_HAIKU_WINDOW (f), NILP (new_value)); | 1337 | BWindow_change_decoration (FRAME_HAIKU_WINDOW (f), NILP (new_value)); |
| 1317 | unblock_input (); | 1338 | unblock_input (); |
| 1339 | |||
| 1340 | haiku_update_after_decoration_change (f); | ||
| 1318 | } | 1341 | } |
| 1319 | 1342 | ||
| 1320 | static void | 1343 | static void |
| @@ -1329,6 +1352,8 @@ haiku_set_override_redirect (struct frame *f, Lisp_Object new_value, | |||
| 1329 | !NILP (new_value)); | 1352 | !NILP (new_value)); |
| 1330 | FRAME_OVERRIDE_REDIRECT (f) = !NILP (new_value); | 1353 | FRAME_OVERRIDE_REDIRECT (f) = !NILP (new_value); |
| 1331 | unblock_input (); | 1354 | unblock_input (); |
| 1355 | |||
| 1356 | haiku_update_after_decoration_change (f); | ||
| 1332 | } | 1357 | } |
| 1333 | 1358 | ||
| 1334 | static void | 1359 | static void |
| @@ -1375,47 +1400,74 @@ haiku_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval | |||
| 1375 | static Lisp_Object | 1400 | static Lisp_Object |
| 1376 | frame_geometry (Lisp_Object frame, Lisp_Object attribute) | 1401 | frame_geometry (Lisp_Object frame, Lisp_Object attribute) |
| 1377 | { | 1402 | { |
| 1378 | struct frame *f = decode_live_frame (frame); | 1403 | struct frame *f, *parent; |
| 1379 | check_window_system (f); | 1404 | int outer_x, outer_y, outer_width, outer_height; |
| 1405 | int right_off, bottom_off, top_off; | ||
| 1406 | int native_x, native_y; | ||
| 1407 | |||
| 1408 | f = decode_window_system_frame (frame); | ||
| 1409 | parent = FRAME_PARENT_FRAME (f); | ||
| 1410 | |||
| 1411 | be_get_window_decorator_frame (FRAME_HAIKU_WINDOW (f), &outer_x, | ||
| 1412 | &outer_y, &outer_width, &outer_height); | ||
| 1413 | be_get_window_decorator_dimensions (FRAME_HAIKU_WINDOW (f), NULL, | ||
| 1414 | &top_off, &right_off, &bottom_off); | ||
| 1415 | native_x = FRAME_OUTPUT_DATA (f)->frame_x; | ||
| 1416 | native_y = FRAME_OUTPUT_DATA (f)->frame_y; | ||
| 1417 | |||
| 1418 | if (parent) | ||
| 1419 | { | ||
| 1420 | /* Adjust all the coordinates by the coordinates of the parent | ||
| 1421 | frame. */ | ||
| 1422 | outer_x -= FRAME_OUTPUT_DATA (parent)->frame_x; | ||
| 1423 | outer_y -= FRAME_OUTPUT_DATA (parent)->frame_y; | ||
| 1424 | native_x -= FRAME_OUTPUT_DATA (parent)->frame_x; | ||
| 1425 | native_y -= FRAME_OUTPUT_DATA (parent)->frame_y; | ||
| 1426 | } | ||
| 1380 | 1427 | ||
| 1381 | if (EQ (attribute, Qouter_edges)) | 1428 | if (EQ (attribute, Qouter_edges)) |
| 1382 | return list4i (f->left_pos, f->top_pos, | 1429 | return list4i (outer_x, outer_y, |
| 1383 | f->left_pos, f->top_pos); | 1430 | outer_x + outer_width, |
| 1431 | outer_y + outer_height); | ||
| 1384 | else if (EQ (attribute, Qnative_edges)) | 1432 | else if (EQ (attribute, Qnative_edges)) |
| 1385 | return list4i (f->left_pos, f->top_pos, | 1433 | return list4i (native_x, native_y, |
| 1386 | f->left_pos + FRAME_PIXEL_WIDTH (f), | 1434 | native_x + FRAME_PIXEL_WIDTH (f), |
| 1387 | f->top_pos + FRAME_PIXEL_HEIGHT (f)); | 1435 | native_y + FRAME_PIXEL_HEIGHT (f)); |
| 1388 | else if (EQ (attribute, Qinner_edges)) | 1436 | else if (EQ (attribute, Qinner_edges)) |
| 1389 | return list4i (f->left_pos + FRAME_INTERNAL_BORDER_WIDTH (f), | 1437 | return list4i (native_x + FRAME_INTERNAL_BORDER_WIDTH (f), |
| 1390 | f->top_pos + FRAME_INTERNAL_BORDER_WIDTH (f) + | 1438 | native_y + FRAME_INTERNAL_BORDER_WIDTH (f) |
| 1391 | FRAME_MENU_BAR_HEIGHT (f) + FRAME_TOOL_BAR_HEIGHT (f), | 1439 | + FRAME_MENU_BAR_HEIGHT (f) + FRAME_TOOL_BAR_HEIGHT (f), |
| 1392 | f->left_pos - FRAME_INTERNAL_BORDER_WIDTH (f) + | 1440 | native_x - FRAME_INTERNAL_BORDER_WIDTH (f) |
| 1393 | FRAME_PIXEL_WIDTH (f), | 1441 | + FRAME_PIXEL_WIDTH (f), |
| 1394 | f->top_pos + FRAME_PIXEL_HEIGHT (f) - | 1442 | native_y + FRAME_PIXEL_HEIGHT (f) |
| 1395 | FRAME_INTERNAL_BORDER_WIDTH (f)); | 1443 | - FRAME_INTERNAL_BORDER_WIDTH (f)); |
| 1396 | 1444 | ||
| 1397 | else | 1445 | else |
| 1398 | return | 1446 | return list (Fcons (Qouter_position, |
| 1399 | list (Fcons (Qouter_position, | 1447 | Fcons (make_fixnum (outer_x), |
| 1400 | Fcons (make_fixnum (f->left_pos), | 1448 | make_fixnum (outer_y))), |
| 1401 | make_fixnum (f->top_pos))), | 1449 | Fcons (Qouter_size, |
| 1402 | Fcons (Qouter_size, | 1450 | Fcons (make_fixnum (outer_width), |
| 1403 | Fcons (make_fixnum (FRAME_PIXEL_WIDTH (f)), | 1451 | make_fixnum (outer_height))), |
| 1404 | make_fixnum (FRAME_PIXEL_HEIGHT (f)))), | 1452 | Fcons (Qexternal_border_size, |
| 1405 | Fcons (Qexternal_border_size, | 1453 | Fcons (make_fixnum (right_off), |
| 1406 | Fcons (make_fixnum (0), make_fixnum (0))), | 1454 | make_fixnum (bottom_off))), |
| 1407 | Fcons (Qtitle_bar_size, | 1455 | Fcons (Qtitle_bar_size, |
| 1408 | Fcons (make_fixnum (0), make_fixnum (0))), | 1456 | Fcons (make_fixnum (outer_width), |
| 1409 | Fcons (Qmenu_bar_external, Qnil), | 1457 | make_fixnum (top_off))), |
| 1410 | Fcons (Qmenu_bar_size, Fcons (make_fixnum (FRAME_PIXEL_WIDTH (f) - | 1458 | Fcons (Qmenu_bar_external, Qnil), |
| 1411 | (FRAME_INTERNAL_BORDER_WIDTH (f) * 2)), | 1459 | Fcons (Qmenu_bar_size, |
| 1412 | make_fixnum (FRAME_MENU_BAR_HEIGHT (f)))), | 1460 | Fcons (make_fixnum (FRAME_PIXEL_WIDTH (f) |
| 1413 | Fcons (Qtool_bar_external, Qnil), | 1461 | - (FRAME_INTERNAL_BORDER_WIDTH (f) * 2)), |
| 1414 | Fcons (Qtool_bar_position, Qtop), | 1462 | make_fixnum (FRAME_MENU_BAR_HEIGHT (f)))), |
| 1415 | Fcons (Qtool_bar_size, Fcons (make_fixnum (FRAME_PIXEL_WIDTH (f) - | 1463 | Fcons (Qtool_bar_external, Qnil), |
| 1416 | (FRAME_INTERNAL_BORDER_WIDTH (f) * 2)), | 1464 | Fcons (Qtool_bar_position, Qtop), |
| 1417 | make_fixnum (FRAME_TOOL_BAR_HEIGHT (f)))), | 1465 | Fcons (Qtool_bar_size, |
| 1418 | Fcons (Qinternal_border_width, make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f)))); | 1466 | Fcons (make_fixnum (FRAME_PIXEL_WIDTH (f) |
| 1467 | - (FRAME_INTERNAL_BORDER_WIDTH (f) * 2)), | ||
| 1468 | make_fixnum (FRAME_TOOL_BAR_HEIGHT (f)))), | ||
| 1469 | Fcons (Qinternal_border_width, | ||
| 1470 | make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f)))); | ||
| 1419 | } | 1471 | } |
| 1420 | 1472 | ||
| 1421 | void | 1473 | void |
diff --git a/src/haikuterm.c b/src/haikuterm.c index ed8040edc91..d46228d02ef 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c | |||
| @@ -96,14 +96,9 @@ static void | |||
| 96 | haiku_coords_from_parent (struct frame *f, int *x, int *y) | 96 | haiku_coords_from_parent (struct frame *f, int *x, int *y) |
| 97 | { | 97 | { |
| 98 | struct frame *p = FRAME_PARENT_FRAME (f); | 98 | struct frame *p = FRAME_PARENT_FRAME (f); |
| 99 | eassert (p); | ||
| 100 | 99 | ||
| 101 | for (struct frame *parent = p; parent; | 100 | *x -= FRAME_OUTPUT_DATA (p)->frame_x; |
| 102 | parent = FRAME_PARENT_FRAME (parent)) | 101 | *y -= FRAME_OUTPUT_DATA (p)->frame_y; |
| 103 | { | ||
| 104 | *x -= parent->left_pos; | ||
| 105 | *y -= parent->top_pos; | ||
| 106 | } | ||
| 107 | } | 102 | } |
| 108 | 103 | ||
| 109 | static void | 104 | static void |
| @@ -3535,7 +3530,6 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3535 | SET_FRAME_ICONIFIED (f, 0); | 3530 | SET_FRAME_ICONIFIED (f, 0); |
| 3536 | inev.kind = DEICONIFY_EVENT; | 3531 | inev.kind = DEICONIFY_EVENT; |
| 3537 | 3532 | ||
| 3538 | |||
| 3539 | /* Haiku doesn't expose frames on deiconification, but | 3533 | /* Haiku doesn't expose frames on deiconification, but |
| 3540 | if we are double-buffered, the previous screen | 3534 | if we are double-buffered, the previous screen |
| 3541 | contents should have been preserved. */ | 3535 | contents should have been preserved. */ |
| @@ -3559,30 +3553,40 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3559 | { | 3553 | { |
| 3560 | struct haiku_move_event *b = buf; | 3554 | struct haiku_move_event *b = buf; |
| 3561 | struct frame *f = haiku_window_to_frame (b->window); | 3555 | struct frame *f = haiku_window_to_frame (b->window); |
| 3556 | int decorator_width, decorator_height, top, left; | ||
| 3557 | struct frame *p; | ||
| 3562 | 3558 | ||
| 3563 | if (!f) | 3559 | if (!f) |
| 3564 | continue; | 3560 | continue; |
| 3565 | 3561 | ||
| 3562 | FRAME_OUTPUT_DATA (f)->frame_x = b->x; | ||
| 3563 | FRAME_OUTPUT_DATA (f)->frame_y = b->y; | ||
| 3564 | |||
| 3566 | if (FRAME_PARENT_FRAME (f)) | 3565 | if (FRAME_PARENT_FRAME (f)) |
| 3567 | haiku_coords_from_parent (f, &b->x, &b->y); | 3566 | haiku_coords_from_parent (f, &b->x, &b->y); |
| 3568 | 3567 | ||
| 3569 | if (b->x != f->left_pos || b->y != f->top_pos) | 3568 | be_get_window_decorator_dimensions (b->window, &decorator_width, |
| 3569 | &decorator_height, NULL, | ||
| 3570 | NULL); | ||
| 3571 | |||
| 3572 | left = b->x - decorator_width; | ||
| 3573 | top = b->y - decorator_height; | ||
| 3574 | |||
| 3575 | if (left != f->left_pos || top != f->top_pos) | ||
| 3570 | { | 3576 | { |
| 3571 | inev.kind = MOVE_FRAME_EVENT; | 3577 | inev.kind = MOVE_FRAME_EVENT; |
| 3572 | 3578 | ||
| 3573 | XSETINT (inev.x, b->x); | 3579 | XSETINT (inev.x, left); |
| 3574 | XSETINT (inev.y, b->y); | 3580 | XSETINT (inev.y, top); |
| 3575 | 3581 | ||
| 3576 | f->left_pos = b->x; | 3582 | f->left_pos = left; |
| 3577 | f->top_pos = b->y; | 3583 | f->top_pos = top; |
| 3578 | 3584 | ||
| 3579 | struct frame *p; | 3585 | p = FRAME_PARENT_FRAME (f); |
| 3580 | 3586 | ||
| 3581 | if ((p = FRAME_PARENT_FRAME (f))) | 3587 | if (p) |
| 3582 | { | 3588 | EmacsWindow_move_weak_child (FRAME_HAIKU_WINDOW (p), |
| 3583 | void *window = FRAME_HAIKU_WINDOW (p); | 3589 | b->window, left, top); |
| 3584 | EmacsWindow_move_weak_child (window, b->window, b->x, b->y); | ||
| 3585 | } | ||
| 3586 | 3590 | ||
| 3587 | XSETFRAME (inev.frame_or_window, f); | 3591 | XSETFRAME (inev.frame_or_window, f); |
| 3588 | } | 3592 | } |
diff --git a/src/haikuterm.h b/src/haikuterm.h index 4b124a6ba30..068be826871 100644 --- a/src/haikuterm.h +++ b/src/haikuterm.h | |||
| @@ -196,6 +196,11 @@ struct haiku_output | |||
| 196 | They are changed only when a different background is involved. | 196 | They are changed only when a different background is involved. |
| 197 | -1 means no color has been computed. */ | 197 | -1 means no color has been computed. */ |
| 198 | long relief_background; | 198 | long relief_background; |
| 199 | |||
| 200 | /* The absolute position of this frame. This differs from left_pos | ||
| 201 | and top_pos in that the decorator and parent frames are not taken | ||
| 202 | into account. */ | ||
| 203 | int frame_x, frame_y; | ||
| 199 | }; | 204 | }; |
| 200 | 205 | ||
| 201 | struct x_output | 206 | struct x_output |