diff options
| author | Po Lu | 2022-03-03 09:05:00 +0800 |
|---|---|---|
| committer | Po Lu | 2022-03-03 09:05:00 +0800 |
| commit | 543640628607ec06e9698cc50c33497ca75155a4 (patch) | |
| tree | 231fdd343517f7e99cb2afa9ca2c2cd04b4ca718 /src/pgtkterm.c | |
| parent | 8c8093aa6f20a7a4f3799cbdb9270cac013ef71d (diff) | |
| download | emacs-543640628607ec06e9698cc50c33497ca75155a4.tar.gz emacs-543640628607ec06e9698cc50c33497ca75155a4.zip | |
Implement `toolkit_position_hook' on PGTK
* src/pgtkterm.c (pgtk_toolkit_position): New function.
(pgtk_create_terminal): Set it as the toolkit position hook.
Diffstat (limited to 'src/pgtkterm.c')
| -rw-r--r-- | src/pgtkterm.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 84e20235fd0..7855b7053ab 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c | |||
| @@ -105,7 +105,35 @@ static void pgtk_fill_rectangle (struct frame *f, unsigned long color, int x, | |||
| 105 | bool respect_alpha_background); | 105 | bool respect_alpha_background); |
| 106 | static void pgtk_clip_to_row (struct window *w, struct glyph_row *row, | 106 | static void pgtk_clip_to_row (struct window *w, struct glyph_row *row, |
| 107 | enum glyph_row_area area, cairo_t * cr); | 107 | enum glyph_row_area area, cairo_t * cr); |
| 108 | static struct frame *pgtk_any_window_to_frame (GdkWindow * window); | 108 | static struct frame *pgtk_any_window_to_frame (GdkWindow *window); |
| 109 | |||
| 110 | static void | ||
| 111 | pgtk_toolkit_position (struct frame *f, int x, int y, | ||
| 112 | bool *menu_bar_p, bool *tool_bar_p) | ||
| 113 | { | ||
| 114 | GdkRectangle test_rect; | ||
| 115 | int scale; | ||
| 116 | |||
| 117 | y += (FRAME_MENUBAR_HEIGHT (f) | ||
| 118 | + FRAME_TOOLBAR_TOP_HEIGHT (f)); | ||
| 119 | x += FRAME_TOOLBAR_LEFT_WIDTH (f); | ||
| 120 | |||
| 121 | if (FRAME_EXTERNAL_MENU_BAR (f)) | ||
| 122 | *menu_bar_p = (x >= 0 && x < FRAME_PIXEL_WIDTH (f) | ||
| 123 | && y >= 0 && y < FRAME_MENUBAR_HEIGHT (f)); | ||
| 124 | |||
| 125 | if (FRAME_X_OUTPUT (f)->toolbar_widget) | ||
| 126 | { | ||
| 127 | scale = xg_get_scale (f); | ||
| 128 | test_rect.x = x / scale; | ||
| 129 | test_rect.y = y / scale; | ||
| 130 | test_rect.width = 1; | ||
| 131 | test_rect.height = 1; | ||
| 132 | |||
| 133 | *tool_bar_p = gtk_widget_intersect (FRAME_X_OUTPUT (f)->toolbar_widget, | ||
| 134 | &test_rect, NULL); | ||
| 135 | } | ||
| 136 | } | ||
| 109 | 137 | ||
| 110 | /* | 138 | /* |
| 111 | * This is not a flip context in the same sense as gpu rendering | 139 | * This is not a flip context in the same sense as gpu rendering |
| @@ -4808,6 +4836,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo) | |||
| 4808 | terminal->focus_frame_hook = pgtk_focus_frame; | 4836 | terminal->focus_frame_hook = pgtk_focus_frame; |
| 4809 | terminal->set_frame_offset_hook = x_set_offset; | 4837 | terminal->set_frame_offset_hook = x_set_offset; |
| 4810 | terminal->free_pixmap = pgtk_free_pixmap; | 4838 | terminal->free_pixmap = pgtk_free_pixmap; |
| 4839 | terminal->toolkit_position_hook = pgtk_toolkit_position; | ||
| 4811 | 4840 | ||
| 4812 | /* Other hooks are NULL by default. */ | 4841 | /* Other hooks are NULL by default. */ |
| 4813 | 4842 | ||