diff options
| author | Po Lu | 2022-04-18 09:21:45 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-18 09:24:36 +0800 |
| commit | d1f315751d960f003317713a65cc480b3d0ee726 (patch) | |
| tree | 7ece9d47381ad535b5ff37b75aeec06f8cb5aae2 /src/pgtkterm.c | |
| parent | 0bb8e127b08dcddc67c7fd62b966d89db5135a79 (diff) | |
| download | emacs-d1f315751d960f003317713a65cc480b3d0ee726.tar.gz emacs-d1f315751d960f003317713a65cc480b3d0ee726.zip | |
Minor cleanups to PGTK code
* src/gtkutil.c (xg_set_geometry):
(xg_frame_set_char_size):
(x_wm_set_size_hint): Rename to `xg_wm_set_size_hint'. All
callers changed.
* src/gtkutil.h: Update prototypes.
* src/pgtkfns.c (unwind_create_frame):
(Fx_create_frame):
(compute_tip_xy):
* src/pgtkterm.c (x_free_frame_resources):
(x_destroy_window):
(x_calc_absolute_position):
(x_set_offset):
(pgtk_set_window_size):
(x_display_pixel_height):
(x_display_pixel_width):
(x_set_parent_frame): Rename `x_foo' functions to `pgtk_foo'.
Get rid of some copy-pasted code from various places.
(pgtk_create_terminal): Clean up coding style.
* src/pgtkterm.h: Update prototypes.
Diffstat (limited to 'src/pgtkterm.c')
| -rw-r--r-- | src/pgtkterm.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c index a59abba625a..2b04699fb32 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c | |||
| @@ -410,7 +410,7 @@ pgtk_frame_raise_lower (struct frame *f, bool raise_flag) | |||
| 410 | /* Free X resources of frame F. */ | 410 | /* Free X resources of frame F. */ |
| 411 | 411 | ||
| 412 | void | 412 | void |
| 413 | x_free_frame_resources (struct frame *f) | 413 | pgtk_free_frame_resources (struct frame *f) |
| 414 | { | 414 | { |
| 415 | struct pgtk_display_info *dpyinfo; | 415 | struct pgtk_display_info *dpyinfo; |
| 416 | Mouse_HLInfo *hlinfo; | 416 | Mouse_HLInfo *hlinfo; |
| @@ -511,7 +511,7 @@ x_free_frame_resources (struct frame *f) | |||
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | void | 513 | void |
| 514 | x_destroy_window (struct frame *f) | 514 | pgtk_destroy_window (struct frame *f) |
| 515 | /* -------------------------------------------------------------------------- | 515 | /* -------------------------------------------------------------------------- |
| 516 | External: Delete the window | 516 | External: Delete the window |
| 517 | -------------------------------------------------------------------------- */ | 517 | -------------------------------------------------------------------------- */ |
| @@ -520,7 +520,7 @@ x_destroy_window (struct frame *f) | |||
| 520 | 520 | ||
| 521 | check_window_system (f); | 521 | check_window_system (f); |
| 522 | if (dpyinfo->gdpy != NULL) | 522 | if (dpyinfo->gdpy != NULL) |
| 523 | x_free_frame_resources (f); | 523 | pgtk_free_frame_resources (f); |
| 524 | 524 | ||
| 525 | dpyinfo->reference_count--; | 525 | dpyinfo->reference_count--; |
| 526 | } | 526 | } |
| @@ -529,7 +529,7 @@ x_destroy_window (struct frame *f) | |||
| 529 | from its current recorded position values and gravity. */ | 529 | from its current recorded position values and gravity. */ |
| 530 | 530 | ||
| 531 | static void | 531 | static void |
| 532 | x_calc_absolute_position (struct frame *f) | 532 | pgtk_calc_absolute_position (struct frame *f) |
| 533 | { | 533 | { |
| 534 | int flags = f->size_hint_flags; | 534 | int flags = f->size_hint_flags; |
| 535 | struct frame *p = FRAME_PARENT_FRAME (f); | 535 | struct frame *p = FRAME_PARENT_FRAME (f); |
| @@ -563,7 +563,7 @@ x_calc_absolute_position (struct frame *f) | |||
| 563 | f->left_pos = (FRAME_PIXEL_WIDTH (p) - width - 2 * f->border_width | 563 | f->left_pos = (FRAME_PIXEL_WIDTH (p) - width - 2 * f->border_width |
| 564 | + f->left_pos); | 564 | + f->left_pos); |
| 565 | else | 565 | else |
| 566 | f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f)) | 566 | f->left_pos = (pgtk_display_pixel_width (FRAME_DISPLAY_INFO (f)) |
| 567 | - width + f->left_pos); | 567 | - width + f->left_pos); |
| 568 | 568 | ||
| 569 | } | 569 | } |
| @@ -589,7 +589,7 @@ x_calc_absolute_position (struct frame *f) | |||
| 589 | f->top_pos = (FRAME_PIXEL_HEIGHT (p) - height - 2 * f->border_width | 589 | f->top_pos = (FRAME_PIXEL_HEIGHT (p) - height - 2 * f->border_width |
| 590 | + f->top_pos); | 590 | + f->top_pos); |
| 591 | else | 591 | else |
| 592 | f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) | 592 | f->top_pos = (pgtk_display_pixel_height (FRAME_DISPLAY_INFO (f)) |
| 593 | - height + f->top_pos); | 593 | - height + f->top_pos); |
| 594 | } | 594 | } |
| 595 | 595 | ||
| @@ -620,18 +620,16 @@ pgtk_set_offset (struct frame *f, int xoff, int yoff, int change_gravity) | |||
| 620 | f->win_gravity = NorthWestGravity; | 620 | f->win_gravity = NorthWestGravity; |
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | x_calc_absolute_position (f); | 623 | pgtk_calc_absolute_position (f); |
| 624 | 624 | ||
| 625 | block_input (); | 625 | block_input (); |
| 626 | x_wm_set_size_hint (f, 0, false); | 626 | xg_wm_set_size_hint (f, 0, false); |
| 627 | 627 | ||
| 628 | if (change_gravity != 0) | 628 | if (change_gravity != 0) |
| 629 | { | 629 | { |
| 630 | if (FRAME_GTK_OUTER_WIDGET (f)) | 630 | if (FRAME_GTK_OUTER_WIDGET (f)) |
| 631 | { | 631 | gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), |
| 632 | gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), | 632 | f->left_pos, f->top_pos); |
| 633 | f->left_pos, f->top_pos); | ||
| 634 | } | ||
| 635 | else | 633 | else |
| 636 | { | 634 | { |
| 637 | GtkWidget *fixed = FRAME_GTK_WIDGET (f); | 635 | GtkWidget *fixed = FRAME_GTK_WIDGET (f); |
| @@ -672,7 +670,7 @@ pgtk_set_window_size (struct frame *f, bool change_gravity, | |||
| 672 | 670 | ||
| 673 | f->output_data.pgtk->preferred_width = pixelwidth; | 671 | f->output_data.pgtk->preferred_width = pixelwidth; |
| 674 | f->output_data.pgtk->preferred_height = pixelheight; | 672 | f->output_data.pgtk->preferred_height = pixelheight; |
| 675 | x_wm_set_size_hint (f, 0, 0); | 673 | xg_wm_set_size_hint (f, 0, 0); |
| 676 | xg_frame_set_char_size (f, pixelwidth, pixelheight); | 674 | xg_frame_set_char_size (f, pixelwidth, pixelheight); |
| 677 | gtk_widget_queue_resize (FRAME_WIDGET (f)); | 675 | gtk_widget_queue_resize (FRAME_WIDGET (f)); |
| 678 | 676 | ||
| @@ -881,18 +879,20 @@ pgtk_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 881 | } | 879 | } |
| 882 | 880 | ||
| 883 | int | 881 | int |
| 884 | x_display_pixel_height (struct pgtk_display_info *dpyinfo) | 882 | pgtk_display_pixel_height (struct pgtk_display_info *dpyinfo) |
| 885 | { | 883 | { |
| 886 | GdkDisplay *gdpy = dpyinfo->gdpy; | 884 | GdkDisplay *gdpy = dpyinfo->gdpy; |
| 887 | GdkScreen *gscr = gdk_display_get_default_screen (gdpy); | 885 | GdkScreen *gscr = gdk_display_get_default_screen (gdpy); |
| 886 | |||
| 888 | return gdk_screen_get_height (gscr); | 887 | return gdk_screen_get_height (gscr); |
| 889 | } | 888 | } |
| 890 | 889 | ||
| 891 | int | 890 | int |
| 892 | x_display_pixel_width (struct pgtk_display_info *dpyinfo) | 891 | pgtk_display_pixel_width (struct pgtk_display_info *dpyinfo) |
| 893 | { | 892 | { |
| 894 | GdkDisplay *gdpy = dpyinfo->gdpy; | 893 | GdkDisplay *gdpy = dpyinfo->gdpy; |
| 895 | GdkScreen *gscr = gdk_display_get_default_screen (gdpy); | 894 | GdkScreen *gscr = gdk_display_get_default_screen (gdpy); |
| 895 | |||
| 896 | return gdk_screen_get_width (gscr); | 896 | return gdk_screen_get_width (gscr); |
| 897 | } | 897 | } |
| 898 | 898 | ||
| @@ -962,7 +962,7 @@ pgtk_set_parent_frame (struct frame *f, Lisp_Object new_value, | |||
| 962 | gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget), fixed, TRUE, TRUE, 0); | 962 | gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget), fixed, TRUE, TRUE, 0); |
| 963 | f->output_data.pgtk->preferred_width = alloc.width; | 963 | f->output_data.pgtk->preferred_width = alloc.width; |
| 964 | f->output_data.pgtk->preferred_height = alloc.height; | 964 | f->output_data.pgtk->preferred_height = alloc.height; |
| 965 | x_wm_set_size_hint (f, 0, 0); | 965 | xg_wm_set_size_hint (f, 0, 0); |
| 966 | xg_frame_set_char_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, alloc.width), | 966 | xg_frame_set_char_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, alloc.width), |
| 967 | FRAME_PIXEL_TO_TEXT_HEIGHT (f, alloc.height)); | 967 | FRAME_PIXEL_TO_TEXT_HEIGHT (f, alloc.height)); |
| 968 | gtk_widget_queue_resize (FRAME_WIDGET (f)); | 968 | gtk_widget_queue_resize (FRAME_WIDGET (f)); |
| @@ -4860,7 +4860,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo) | |||
| 4860 | terminal->redeem_scroll_bar_hook = pgtk_redeem_scroll_bar; | 4860 | terminal->redeem_scroll_bar_hook = pgtk_redeem_scroll_bar; |
| 4861 | terminal->judge_scroll_bars_hook = pgtk_judge_scroll_bars; | 4861 | terminal->judge_scroll_bars_hook = pgtk_judge_scroll_bars; |
| 4862 | terminal->get_string_resource_hook = pgtk_get_string_resource; | 4862 | terminal->get_string_resource_hook = pgtk_get_string_resource; |
| 4863 | terminal->delete_frame_hook = x_destroy_window; | 4863 | terminal->delete_frame_hook = pgtk_destroy_window; |
| 4864 | terminal->delete_terminal_hook = pgtk_delete_terminal; | 4864 | terminal->delete_terminal_hook = pgtk_delete_terminal; |
| 4865 | terminal->query_frame_background_color = pgtk_query_frame_background_color; | 4865 | terminal->query_frame_background_color = pgtk_query_frame_background_color; |
| 4866 | terminal->defined_color_hook = pgtk_defined_color; | 4866 | terminal->defined_color_hook = pgtk_defined_color; |
| @@ -4868,10 +4868,10 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo) | |||
| 4868 | terminal->set_bitmap_icon_hook = pgtk_bitmap_icon; | 4868 | terminal->set_bitmap_icon_hook = pgtk_bitmap_icon; |
| 4869 | terminal->implicit_set_name_hook = pgtk_implicitly_set_name; | 4869 | terminal->implicit_set_name_hook = pgtk_implicitly_set_name; |
| 4870 | terminal->iconify_frame_hook = pgtk_iconify_frame; | 4870 | terminal->iconify_frame_hook = pgtk_iconify_frame; |
| 4871 | terminal->set_scroll_bar_default_width_hook = | 4871 | terminal->set_scroll_bar_default_width_hook |
| 4872 | pgtk_set_scroll_bar_default_width; | 4872 | = pgtk_set_scroll_bar_default_width; |
| 4873 | terminal->set_scroll_bar_default_height_hook = | 4873 | terminal->set_scroll_bar_default_height_hook |
| 4874 | pgtk_set_scroll_bar_default_height; | 4874 | = pgtk_set_scroll_bar_default_height; |
| 4875 | terminal->set_window_size_hook = pgtk_set_window_size; | 4875 | terminal->set_window_size_hook = pgtk_set_window_size; |
| 4876 | terminal->query_colors = pgtk_query_colors; | 4876 | terminal->query_colors = pgtk_query_colors; |
| 4877 | terminal->get_focus_frame = x_get_focus_frame; | 4877 | terminal->get_focus_frame = x_get_focus_frame; |