aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuuki Harano2021-01-31 00:49:56 +0900
committerYuuki Harano2021-01-31 00:49:56 +0900
commitae18c8ec4f0ef37c8c9cda473770ff47e41291e2 (patch)
tree7e3e56e5208b4185f08079e25bf553b7801027bd /src
parent50c76b844bc79309b4f5d9e28a2386b9a6f735b7 (diff)
downloademacs-ae18c8ec4f0ef37c8c9cda473770ff47e41291e2.tar.gz
emacs-ae18c8ec4f0ef37c8c9cda473770ff47e41291e2.zip
Support child frame border width
* src/pgtkfns.c (x_set_child_frame_border_width): Port code for X. (pgtk_frame_parm_handlers): Add hook. (Fx_create_frame): Get default parameter. * src/pgtkterm.c (x_draw_stretch_glyph_string): Re-port code for X. (pgtk_clear_under_internal_border): Re-port code for X.
Diffstat (limited to 'src')
-rw-r--r--src/pgtkfns.c38
-rw-r--r--src/pgtkterm.c73
2 files changed, 82 insertions, 29 deletions
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 620680fbdaa..cee24c1ad12 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -534,6 +534,24 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
534 534
535} 535}
536 536
537static void
538x_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
539{
540 int border = check_int_nonnegative (arg);
541
542 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f))
543 {
544 f->child_frame_border_width = border;
545
546 if (FRAME_X_WINDOW (f))
547 {
548 adjust_frame_size (f, -1, -1, 3, false, Qchild_frame_border_width);
549 pgtk_clear_under_internal_border (f);
550 }
551 }
552
553}
554
537 555
538static void 556static void
539x_set_internal_border_width (struct frame *f, Lisp_Object arg, 557x_set_internal_border_width (struct frame *f, Lisp_Object arg,
@@ -963,6 +981,7 @@ frame_parm_handler pgtk_frame_parm_handlers[] = {
963 x_set_foreground_color, 981 x_set_foreground_color,
964 x_set_icon_name, 982 x_set_icon_name,
965 x_set_icon_type, 983 x_set_icon_type,
984 x_set_child_frame_border_width,
966 x_set_internal_border_width, /* generic OK */ 985 x_set_internal_border_width, /* generic OK */
967 gui_set_right_divider_width, 986 gui_set_right_divider_width,
968 gui_set_bottom_divider_width, 987 gui_set_bottom_divider_width,
@@ -1422,6 +1441,25 @@ This function is an internal primitive--use `make-frame' instead. */ )
1422 if (!EQ (value, Qunbound)) 1441 if (!EQ (value, Qunbound))
1423 parms = Fcons (Fcons (Qinternal_border_width, value), parms); 1442 parms = Fcons (Fcons (Qinternal_border_width, value), parms);
1424 } 1443 }
1444
1445 /* Same for child frames. */
1446 if (NILP (Fassq (Qchild_frame_border_width, parms)))
1447 {
1448 Lisp_Object value;
1449
1450 value = gui_display_get_arg (dpyinfo, parms, Qchild_frame_border_width,
1451 "childFrameBorderWidth", "childFrameBorderWidth",
1452 RES_TYPE_NUMBER);
1453 if (! EQ (value, Qunbound))
1454 parms = Fcons (Fcons (Qchild_frame_border_width, value),
1455 parms);
1456
1457 }
1458
1459 gui_default_parameter (f, parms, Qchild_frame_border_width,
1460 make_fixnum (0),
1461 "childFrameBorderWidth", "childFrameBorderWidth",
1462 RES_TYPE_NUMBER);
1425 gui_default_parameter (f, parms, Qinternal_border_width, 1463 gui_default_parameter (f, parms, Qinternal_border_width,
1426 make_fixnum (0), 1464 make_fixnum (0),
1427 "internalBorderWidth", "internalBorderWidth", 1465 "internalBorderWidth", "internalBorderWidth",
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 5d1716adcb8..437249abeba 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -2367,14 +2367,29 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
2367 else if (!s->background_filled_p) 2367 else if (!s->background_filled_p)
2368 { 2368 {
2369 int background_width = s->background_width; 2369 int background_width = s->background_width;
2370 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); 2370 int x = s->x, text_left_x = window_box_left_offset (s->w, TEXT_AREA);
2371 2371
2372 /* Don't draw into left margin, fringe or scrollbar area 2372 /* Don't draw into left fringe or scrollbar area except for
2373 except for header line and mode line. */ 2373 header line and mode line. */
2374 if (x < left_x && !s->row->mode_line_p) 2374 if (x < text_left_x && !s->row->mode_line_p)
2375 { 2375 {
2376 background_width -= left_x - x; 2376 int left_x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w);
2377 x = left_x; 2377 int right_x = text_left_x;
2378
2379 if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
2380 left_x += WINDOW_LEFT_FRINGE_WIDTH (s->w);
2381 else
2382 right_x -= WINDOW_LEFT_FRINGE_WIDTH (s->w);
2383
2384 /* Adjust X and BACKGROUND_WIDTH to fit inside the space
2385 between LEFT_X and RIGHT_X. */
2386 if (x < left_x)
2387 {
2388 background_width -= left_x - x;
2389 x = left_x;
2390 }
2391 if (x + background_width > right_x)
2392 background_width = right_x - x;
2378 } 2393 }
2379 if (background_width > 0) 2394 if (background_width > 0)
2380 x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); 2395 x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
@@ -5261,37 +5276,37 @@ pgtk_clear_under_internal_border (struct frame *f)
5261 int border = FRAME_INTERNAL_BORDER_WIDTH (f); 5276 int border = FRAME_INTERNAL_BORDER_WIDTH (f);
5262 int width = FRAME_PIXEL_WIDTH (f); 5277 int width = FRAME_PIXEL_WIDTH (f);
5263 int height = FRAME_PIXEL_HEIGHT (f); 5278 int height = FRAME_PIXEL_HEIGHT (f);
5264 int margin = 0; 5279 int margin = FRAME_TOP_MARGIN_HEIGHT (f);
5265 struct face *face = FACE_FROM_ID_OR_NULL (f, INTERNAL_BORDER_FACE_ID); 5280 int face_id =
5281 (FRAME_PARENT_FRAME (f)
5282 ? (!NILP (Vface_remapping_alist)
5283 ? lookup_basic_face (NULL, f, CHILD_FRAME_BORDER_FACE_ID)
5284 : CHILD_FRAME_BORDER_FACE_ID)
5285 : (!NILP (Vface_remapping_alist)
5286 ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
5287 : INTERNAL_BORDER_FACE_ID));
5288 struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
5266 5289
5267 block_input (); 5290 block_input ();
5268 5291
5269 struct
5270 {
5271 int x, y, w, h;
5272 } rects[] = {
5273 {0, margin, width, border},
5274 {0, 0, border, height},
5275 {width - border, 0, border, height},
5276 {0, height - border, width, border},
5277 };
5278
5279 if (face) 5292 if (face)
5280 { 5293 {
5281 for (int i = 0; i < 4; i++) 5294#define x_fill_rectangle(f, gc, x, y, w, h) \
5282 { 5295 fill_background_by_face (f, face, x, y, w, h)
5283 int x = rects[i].x; 5296 x_fill_rectangle (f, gc, 0, margin, width, border);
5284 int y = rects[i].y; 5297 x_fill_rectangle (f, gc, 0, 0, border, height);
5285 int w = rects[i].w; 5298 x_fill_rectangle (f, gc, width - border, 0, border, height);
5286 int h = rects[i].h; 5299 x_fill_rectangle (f, gc, 0, height - border, width, border);
5287 fill_background_by_face (f, face, x, y, w, h); 5300#undef x_fill_rectangle
5288 }
5289 } 5301 }
5290 else 5302 else
5291 { 5303 {
5292 for (int i = 0; i < 4; i++) 5304#define x_clear_area(f, x, y, w, h) pgtk_clear_area (f, x, y, w, h)
5293 pgtk_clear_area (f, rects[i].x, rects[i].y, rects[i].w, 5305 x_clear_area (f, 0, 0, border, height);
5294 rects[i].h); 5306 x_clear_area (f, 0, margin, width, border);
5307 x_clear_area (f, width - border, 0, border, height);
5308 x_clear_area (f, 0, height - border, width, border);
5309#undef x_clear_area
5295 } 5310 }
5296 5311
5297 unblock_input (); 5312 unblock_input ();