From fa598571adab4858282f337b45984517e197f8a9 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 13 May 2023 10:27:57 +0800 Subject: [PATCH] Fix detection of tab bar windows on PGTK * src/dispnew.c (adjust_frame_glyphs_for_window_redisplay): Adjust commentary. * src/pgtkfns.c (pgtk_set_doc_edited): Remove unused function. * src/pgtkterm.c (pgtk_clear_under_internal_border): Clean up X related code. * src/pgtkterm.h: Update prototypes. * src/window.h: Define WIDNOW_TAB_BAR_P on PGTK. (bug#63472) --- src/dispnew.c | 14 ++++++++++---- src/pgtkfns.c | 7 ------- src/pgtkterm.c | 23 ++++++++++------------- src/pgtkterm.h | 1 - src/window.h | 2 +- 5 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/dispnew.c b/src/dispnew.c index fe661579daf..a928a5d1b14 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2212,10 +2212,16 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) w->pixel_left = 0; w->left_col = 0; - w->pixel_top = FRAME_MENU_BAR_HEIGHT (f) - + (!NILP (Vtab_bar_position) ? FRAME_TOOL_BAR_HEIGHT (f) : 0); - w->top_line = FRAME_MENU_BAR_LINES (f) - + (!NILP (Vtab_bar_position) ? FRAME_TOOL_BAR_LINES (f) : 0); + + /* Note that tab and tool bar windows appear above the internal + border, as enforced by WINDOW_TOP_EDGE_Y. */ + + w->pixel_top = (FRAME_MENU_BAR_HEIGHT (f) + + (!NILP (Vtab_bar_position) + ? FRAME_TOOL_BAR_HEIGHT (f) : 0)); + w->top_line = (FRAME_MENU_BAR_LINES (f) + + (!NILP (Vtab_bar_position) + ? FRAME_TOOL_BAR_LINES (f) : 0)); w->total_cols = FRAME_TOTAL_COLS (f); w->pixel_width = (FRAME_PIXEL_WIDTH (f) - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); diff --git a/src/pgtkfns.c b/src/pgtkfns.c index 6e5bb22375a..801f97d26d2 100644 --- a/src/pgtkfns.c +++ b/src/pgtkfns.c @@ -398,13 +398,6 @@ pgtk_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) pgtk_set_name_internal (f, name); } - -void -pgtk_set_doc_edited (void) -{ -} - - static void pgtk_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { diff --git a/src/pgtkterm.c b/src/pgtkterm.c index c00e13550bd..6cb1a3a4626 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -4954,22 +4954,19 @@ pgtk_clear_under_internal_border (struct frame *f) if (face) { -#define x_fill_rectangle(f, gc, x, y, w, h) \ - fill_background_by_face (f, face, x, y, w, h) - x_fill_rectangle (f, gc, 0, margin, width, border); - x_fill_rectangle (f, gc, 0, 0, border, height); - x_fill_rectangle (f, gc, width - border, 0, border, height); - x_fill_rectangle (f, gc, 0, height - border, width, border); -#undef x_fill_rectangle + fill_background_by_face (f, face, 0, margin, width, border); + fill_background_by_face (f, face, 0, 0, border, height); + fill_background_by_face (f, face, width - border, 0, border, + height); + fill_background_by_face (f, face, 0, height - border, width, + border); } else { -#define x_clear_area(f, x, y, w, h) pgtk_clear_area (f, x, y, w, h) - x_clear_area (f, 0, 0, border, height); - x_clear_area (f, 0, margin, width, border); - x_clear_area (f, width - border, 0, border, height); - x_clear_area (f, 0, height - border, width, border); -#undef x_clear_area + pgtk_clear_area (f, 0, 0, border, height); + pgtk_clear_area (f, 0, margin, width, border); + pgtk_clear_area (f, width - border, 0, border, height); + pgtk_clear_area (f, 0, height - border, width, border); } unblock_input (); diff --git a/src/pgtkterm.h b/src/pgtkterm.h index 202c6622ce3..8f2f00efdad 100644 --- a/src/pgtkterm.h +++ b/src/pgtkterm.h @@ -553,7 +553,6 @@ extern void pgtk_clear_frame (struct frame *); extern char *pgtk_xlfd_to_fontname (const char *); /* Implemented in pgtkfns.c. */ -extern void pgtk_set_doc_edited (void); extern const char *pgtk_get_defaults_value (const char *); extern const char *pgtk_get_string_resource (XrmDatabase, const char *, const char *); extern void pgtk_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); diff --git a/src/window.h b/src/window.h index 32b5fe14f4f..2f793ebe438 100644 --- a/src/window.h +++ b/src/window.h @@ -750,7 +750,7 @@ wset_next_buffers (struct window *w, Lisp_Object val) #endif /* True if W is a tab bar window. */ -#if defined (HAVE_WINDOW_SYSTEM) && !defined (HAVE_PGTK) +#if defined (HAVE_WINDOW_SYSTEM) # define WINDOW_TAB_BAR_P(W) \ (WINDOWP (WINDOW_XFRAME (W)->tab_bar_window) \ && (W) == XWINDOW (WINDOW_XFRAME (W)->tab_bar_window)) -- 2.39.5