aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorMartin Rudalics2025-12-22 11:01:53 +0100
committerMartin Rudalics2025-12-22 11:01:53 +0100
commitf3d9371a890699fe4047f693adfcd4d8dbe2fb7d (patch)
treed37fd603addf836483df8ebcf78c53cd0407d991 /src/xterm.c
parent5cf8af22900d359c18a75d9efed44f7c1d8fc06c (diff)
downloademacs-f3d9371a890699fe4047f693adfcd4d8dbe2fb7d.tar.gz
emacs-f3d9371a890699fe4047f693adfcd4d8dbe2fb7d.zip
Add functions to set frame size and position in one compound step
* lisp/frame.el (set-frame-size-and-position): New function. * src/frame.c (adjust_frame_size): Handle requests to set size and position. (Fset_frame_size_and_position_pixelwise): New function. * src/gtkutil.c (xg_frame_set_size_and_position): New function. (xg_wm_set_size_hint): Handle any non-NorthWestGravity values for child frames only. Some GTK implementations don't like them. * src/gtkutil.h (xg_frame_set_size_and_position.): Add external declaration. * src/termhooks.h (set_window_size_and_position_hook): New hook. * src/w32term.c (w32_set_window_size_and_position): New function. (w32_create_terminal): Make it the Microsoft Windows API set_window_size_and_position_hook. * src/xterm.c (x_set_window_size_and_position_1) (x_set_window_size_and_position): New functions. (x_create_terminal): Make x_set_window_size_and_position the set_window_size_and_position_hook for the X protocol. * src/xterm.h (x_set_window_size_and_position): Add external declaration. * etc/NEWS: Announce new functions.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 9a6131ebb7d..088eaee83c9 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -28563,6 +28563,59 @@ x_set_window_size (struct frame *f, bool change_gravity,
28563 do_pending_window_change (false); 28563 do_pending_window_change (false);
28564} 28564}
28565 28565
28566static void
28567x_set_window_size_and_position_1 (struct frame *f, int width, int height)
28568{
28569 int x = f->left_pos;
28570 int y = f->top_pos;
28571
28572 x_wm_set_size_hint (f, 0, false);
28573
28574 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
28575 x, y, width, height + FRAME_MENUBAR_HEIGHT (f));
28576
28577 SET_FRAME_GARBAGED (f);
28578
28579 if (FRAME_VISIBLE_P (f))
28580 x_wait_for_event (f, ConfigureNotify);
28581 else
28582 /* Call adjust_frame_size right away as with GTK. It might be
28583 tempting to clear out f->new_width and f->new_height here. */
28584 adjust_frame_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, width),
28585 FRAME_PIXEL_TO_TEXT_HEIGHT (f, height),
28586 5, 0, Qx_set_window_size_1);
28587}
28588
28589void
28590x_set_window_size_and_position (struct frame *f, int width, int height)
28591{
28592 block_input ();
28593
28594#ifdef USE_GTK
28595 if (FRAME_GTK_WIDGET (f))
28596 xg_frame_set_size_and_position (f, width, height);
28597 else
28598 x_set_window_size_and_position_1 (f, width, height);
28599#else /* not USE_GTK */
28600 x_set_window_size_and_position_1 (f, width, height);
28601#endif /* USE_GTK */
28602
28603 x_clear_under_internal_border (f);
28604
28605 /* If cursor was outside the new size, mark it as off. */
28606 mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f)));
28607
28608 /* Clear out any recollection of where the mouse highlighting was,
28609 since it might be in a place that's outside the new frame size.
28610 Actually checking whether it is outside is a pain in the neck,
28611 so don't try--just let the highlighting be done afresh with new size. */
28612 cancel_mouse_face (f);
28613
28614 unblock_input ();
28615
28616 do_pending_window_change (false);
28617}
28618
28566/* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ 28619/* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */
28567 28620
28568void 28621void
@@ -32148,6 +32201,7 @@ x_create_terminal (struct x_display_info *dpyinfo)
32148 terminal->fullscreen_hook = XTfullscreen_hook; 32201 terminal->fullscreen_hook = XTfullscreen_hook;
32149 terminal->iconify_frame_hook = x_iconify_frame; 32202 terminal->iconify_frame_hook = x_iconify_frame;
32150 terminal->set_window_size_hook = x_set_window_size; 32203 terminal->set_window_size_hook = x_set_window_size;
32204 terminal->set_window_size_and_position_hook = x_set_window_size_and_position;
32151 terminal->set_frame_offset_hook = x_set_offset; 32205 terminal->set_frame_offset_hook = x_set_offset;
32152 terminal->set_frame_alpha_hook = x_set_frame_alpha; 32206 terminal->set_frame_alpha_hook = x_set_frame_alpha;
32153 terminal->set_new_font_hook = x_new_font; 32207 terminal->set_new_font_hook = x_new_font;