aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-03-23 02:27:21 +0000
committerPo Lu2022-03-23 02:27:21 +0000
commitbd2734f0b6b4342f02ce18b5a950a41c3fa35a29 (patch)
treed16b677159872f3995e43e9f51a8045102a0e96b /src
parent9cef919692590e351f52ccee48246bd9d7f4873d (diff)
downloademacs-bd2734f0b6b4342f02ce18b5a950a41c3fa35a29.tar.gz
emacs-bd2734f0b6b4342f02ce18b5a950a41c3fa35a29.zip
Don't allocate duplicate cursors for each frame on Haiku
* src/haikufns.c (haiku_create_frame) (haiku_free_frame_resources): Stop creating cursors. * src/haikuterm.c (haiku_delete_terminal, haiku_term_init): Create and free cursors here instead. * src/haikuterm.h (struct haiku_display_info): New fields for cursors.
Diffstat (limited to 'src')
-rw-r--r--src/haikufns.c72
-rw-r--r--src/haikuterm.c50
-rw-r--r--src/haikuterm.h17
3 files changed, 88 insertions, 51 deletions
diff --git a/src/haikufns.c b/src/haikufns.c
index 14d4c870c1f..767f555317c 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -761,38 +761,27 @@ haiku_create_frame (Lisp_Object parms)
761 f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !NILP (tem)); 761 f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !NILP (tem));
762 762
763 block_input (); 763 block_input ();
764#define ASSIGN_CURSOR(cursor, be_cursor) \ 764#define ASSIGN_CURSOR(cursor) \
765 (FRAME_OUTPUT_DATA (f)->cursor = be_cursor) 765 (FRAME_OUTPUT_DATA (f)->cursor = dpyinfo->cursor)
766 766
767 ASSIGN_CURSOR (text_cursor, BCursor_create_i_beam ()); 767 ASSIGN_CURSOR (text_cursor);
768 ASSIGN_CURSOR (nontext_cursor, BCursor_create_default ()); 768 ASSIGN_CURSOR (nontext_cursor);
769 ASSIGN_CURSOR (modeline_cursor, BCursor_create_modeline ()); 769 ASSIGN_CURSOR (modeline_cursor);
770 ASSIGN_CURSOR (hand_cursor, BCursor_create_grab ()); 770 ASSIGN_CURSOR (hand_cursor);
771 ASSIGN_CURSOR (hourglass_cursor, BCursor_create_progress_cursor ()); 771 ASSIGN_CURSOR (hourglass_cursor);
772 ASSIGN_CURSOR (horizontal_drag_cursor, 772 ASSIGN_CURSOR (horizontal_drag_cursor);
773 BCursor_from_id (CURSOR_ID_RESIZE_EAST_WEST)); 773 ASSIGN_CURSOR (vertical_drag_cursor);
774 ASSIGN_CURSOR (vertical_drag_cursor, 774 ASSIGN_CURSOR (left_edge_cursor);
775 BCursor_from_id (CURSOR_ID_RESIZE_NORTH_SOUTH)); 775 ASSIGN_CURSOR (top_left_corner_cursor);
776 ASSIGN_CURSOR (left_edge_cursor, 776 ASSIGN_CURSOR (top_edge_cursor);
777 BCursor_from_id (CURSOR_ID_RESIZE_WEST)); 777 ASSIGN_CURSOR (top_right_corner_cursor);
778 ASSIGN_CURSOR (top_left_corner_cursor, 778 ASSIGN_CURSOR (right_edge_cursor);
779 BCursor_from_id (CURSOR_ID_RESIZE_NORTH_WEST)); 779 ASSIGN_CURSOR (bottom_right_corner_cursor);
780 ASSIGN_CURSOR (top_edge_cursor, 780 ASSIGN_CURSOR (bottom_edge_cursor);
781 BCursor_from_id (CURSOR_ID_RESIZE_NORTH)); 781 ASSIGN_CURSOR (bottom_left_corner_cursor);
782 ASSIGN_CURSOR (top_right_corner_cursor, 782 ASSIGN_CURSOR (no_cursor);
783 BCursor_from_id (CURSOR_ID_RESIZE_NORTH_EAST)); 783
784 ASSIGN_CURSOR (right_edge_cursor, 784 FRAME_OUTPUT_DATA (f)->current_cursor = dpyinfo->text_cursor;
785 BCursor_from_id (CURSOR_ID_RESIZE_EAST));
786 ASSIGN_CURSOR (bottom_right_corner_cursor,
787 BCursor_from_id (CURSOR_ID_RESIZE_SOUTH_EAST));
788 ASSIGN_CURSOR (bottom_edge_cursor,
789 BCursor_from_id (CURSOR_ID_RESIZE_SOUTH));
790 ASSIGN_CURSOR (bottom_left_corner_cursor,
791 BCursor_from_id (CURSOR_ID_RESIZE_SOUTH_WEST));
792 ASSIGN_CURSOR (no_cursor,
793 BCursor_from_id (CURSOR_ID_NO_CURSOR));
794
795 ASSIGN_CURSOR (current_cursor, FRAME_OUTPUT_DATA (f)->text_cursor);
796#undef ASSIGN_CURSOR 785#undef ASSIGN_CURSOR
797 786
798 f->terminal->reference_count++; 787 f->terminal->reference_count++;
@@ -1555,25 +1544,6 @@ haiku_free_frame_resources (struct frame *f)
1555 if (window) 1544 if (window)
1556 BWindow_quit (window); 1545 BWindow_quit (window);
1557 1546
1558 /* Free cursors */
1559
1560 BCursor_delete (f->output_data.haiku->text_cursor);
1561 BCursor_delete (f->output_data.haiku->nontext_cursor);
1562 BCursor_delete (f->output_data.haiku->modeline_cursor);
1563 BCursor_delete (f->output_data.haiku->hand_cursor);
1564 BCursor_delete (f->output_data.haiku->hourglass_cursor);
1565 BCursor_delete (f->output_data.haiku->horizontal_drag_cursor);
1566 BCursor_delete (f->output_data.haiku->vertical_drag_cursor);
1567 BCursor_delete (f->output_data.haiku->left_edge_cursor);
1568 BCursor_delete (f->output_data.haiku->top_left_corner_cursor);
1569 BCursor_delete (f->output_data.haiku->top_edge_cursor);
1570 BCursor_delete (f->output_data.haiku->top_right_corner_cursor);
1571 BCursor_delete (f->output_data.haiku->right_edge_cursor);
1572 BCursor_delete (f->output_data.haiku->bottom_right_corner_cursor);
1573 BCursor_delete (f->output_data.haiku->bottom_edge_cursor);
1574 BCursor_delete (f->output_data.haiku->bottom_left_corner_cursor);
1575 BCursor_delete (f->output_data.haiku->no_cursor);
1576
1577 xfree (FRAME_OUTPUT_DATA (f)); 1547 xfree (FRAME_OUTPUT_DATA (f));
1578 FRAME_OUTPUT_DATA (f) = NULL; 1548 FRAME_OUTPUT_DATA (f) = NULL;
1579 1549
diff --git a/src/haikuterm.c b/src/haikuterm.c
index b0bbee9e3bc..c2e8375a10c 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -122,7 +122,26 @@ haiku_delete_terminal (struct terminal *terminal)
122 return; 122 return;
123 123
124 block_input (); 124 block_input ();
125
125 be_app_quit (); 126 be_app_quit ();
127 delete_port (port_application_to_emacs);
128
129 BCursor_delete (dpyinfo->text_cursor);
130 BCursor_delete (dpyinfo->nontext_cursor);
131 BCursor_delete (dpyinfo->modeline_cursor);
132 BCursor_delete (dpyinfo->hand_cursor);
133 BCursor_delete (dpyinfo->hourglass_cursor);
134 BCursor_delete (dpyinfo->horizontal_drag_cursor);
135 BCursor_delete (dpyinfo->vertical_drag_cursor);
136 BCursor_delete (dpyinfo->left_edge_cursor);
137 BCursor_delete (dpyinfo->top_left_corner_cursor);
138 BCursor_delete (dpyinfo->top_edge_cursor);
139 BCursor_delete (dpyinfo->top_right_corner_cursor);
140 BCursor_delete (dpyinfo->right_edge_cursor);
141 BCursor_delete (dpyinfo->bottom_right_corner_cursor);
142 BCursor_delete (dpyinfo->bottom_edge_cursor);
143 BCursor_delete (dpyinfo->bottom_left_corner_cursor);
144 BCursor_delete (dpyinfo->no_cursor);
126 145
127 /* Close all frames and delete the generic struct terminal. */ 146 /* Close all frames and delete the generic struct terminal. */
128 for (t = terminal_list; t; t = t->next_terminal) 147 for (t = terminal_list; t; t = t->next_terminal)
@@ -3911,6 +3930,37 @@ haiku_term_init (void)
3911 dpyinfo->smallest_char_width = 1; 3930 dpyinfo->smallest_char_width = 1;
3912 3931
3913 gui_init_fringe (terminal->rif); 3932 gui_init_fringe (terminal->rif);
3933
3934#define ASSIGN_CURSOR(cursor, be_cursor) (dpyinfo->cursor = be_cursor)
3935 ASSIGN_CURSOR (text_cursor, BCursor_create_i_beam ());
3936 ASSIGN_CURSOR (nontext_cursor, BCursor_create_default ());
3937 ASSIGN_CURSOR (modeline_cursor, BCursor_create_modeline ());
3938 ASSIGN_CURSOR (hand_cursor, BCursor_create_grab ());
3939 ASSIGN_CURSOR (hourglass_cursor, BCursor_create_progress_cursor ());
3940 ASSIGN_CURSOR (horizontal_drag_cursor,
3941 BCursor_from_id (CURSOR_ID_RESIZE_EAST_WEST));
3942 ASSIGN_CURSOR (vertical_drag_cursor,
3943 BCursor_from_id (CURSOR_ID_RESIZE_NORTH_SOUTH));
3944 ASSIGN_CURSOR (left_edge_cursor,
3945 BCursor_from_id (CURSOR_ID_RESIZE_WEST));
3946 ASSIGN_CURSOR (top_left_corner_cursor,
3947 BCursor_from_id (CURSOR_ID_RESIZE_NORTH_WEST));
3948 ASSIGN_CURSOR (top_edge_cursor,
3949 BCursor_from_id (CURSOR_ID_RESIZE_NORTH));
3950 ASSIGN_CURSOR (top_right_corner_cursor,
3951 BCursor_from_id (CURSOR_ID_RESIZE_NORTH_EAST));
3952 ASSIGN_CURSOR (right_edge_cursor,
3953 BCursor_from_id (CURSOR_ID_RESIZE_EAST));
3954 ASSIGN_CURSOR (bottom_right_corner_cursor,
3955 BCursor_from_id (CURSOR_ID_RESIZE_SOUTH_EAST));
3956 ASSIGN_CURSOR (bottom_edge_cursor,
3957 BCursor_from_id (CURSOR_ID_RESIZE_SOUTH));
3958 ASSIGN_CURSOR (bottom_left_corner_cursor,
3959 BCursor_from_id (CURSOR_ID_RESIZE_SOUTH_WEST));
3960 ASSIGN_CURSOR (no_cursor,
3961 BCursor_from_id (CURSOR_ID_NO_CURSOR));
3962#undef ASSIGN_CURSOR
3963
3914 unblock_input (); 3964 unblock_input ();
3915 3965
3916 return dpyinfo; 3966 return dpyinfo;
diff --git a/src/haikuterm.h b/src/haikuterm.h
index bce1c627eb2..5f8052f0f99 100644
--- a/src/haikuterm.h
+++ b/src/haikuterm.h
@@ -107,6 +107,23 @@ struct haiku_display_info
107 Time last_mouse_movement_time; 107 Time last_mouse_movement_time;
108 108
109 Window root_window; 109 Window root_window;
110
111 Emacs_Cursor text_cursor;
112 Emacs_Cursor nontext_cursor;
113 Emacs_Cursor modeline_cursor;
114 Emacs_Cursor hand_cursor;
115 Emacs_Cursor hourglass_cursor;
116 Emacs_Cursor horizontal_drag_cursor;
117 Emacs_Cursor vertical_drag_cursor;
118 Emacs_Cursor left_edge_cursor;
119 Emacs_Cursor top_left_corner_cursor;
120 Emacs_Cursor top_edge_cursor;
121 Emacs_Cursor top_right_corner_cursor;
122 Emacs_Cursor right_edge_cursor;
123 Emacs_Cursor bottom_right_corner_cursor;
124 Emacs_Cursor bottom_edge_cursor;
125 Emacs_Cursor bottom_left_corner_cursor;
126 Emacs_Cursor no_cursor;
110}; 127};
111 128
112struct haiku_output 129struct haiku_output