mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-05 03:20:39 -08:00
Fix NS frame position update after resize/move
Fixes bug#74074, bug#79164. * src/nsterm.m ([EmacsView windowDidEndLiveResize:]): ([EmacsView updateFramePosition]): New functions. ([EmacsView windowDidMove:]): Move contents of this function into updateFramePosition and call it. Copyright-paperwork-exempt: yes
This commit is contained in:
parent
4293a7678b
commit
5b9f4ee76e
1 changed files with 37 additions and 26 deletions
63
src/nsterm.m
63
src/nsterm.m
|
|
@ -6818,6 +6818,11 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
|
|||
|
||||
@implementation EmacsView
|
||||
|
||||
- (void)windowDidEndLiveResize:(NSNotification *)notification
|
||||
{
|
||||
[self updateFramePosition];
|
||||
}
|
||||
|
||||
/* Needed to inform when window closed from lisp. */
|
||||
- (void) setWindowClosing: (BOOL)closing
|
||||
{
|
||||
|
|
@ -7970,6 +7975,37 @@ ns_in_echo_area (void)
|
|||
}
|
||||
|
||||
|
||||
- (void)updateFramePosition
|
||||
{
|
||||
NSWindow *win = [self window];
|
||||
NSRect r = [win frame];
|
||||
NSArray *screens = [NSScreen screens];
|
||||
NSScreen *screen = [screens objectAtIndex: 0];
|
||||
|
||||
if (!emacsframe->output_data.ns)
|
||||
return;
|
||||
|
||||
if (screen != nil)
|
||||
{
|
||||
emacsframe->left_pos = (NSMinX (r)
|
||||
- NS_PARENT_WINDOW_LEFT_POS (emacsframe));
|
||||
emacsframe->top_pos = (NS_PARENT_WINDOW_TOP_POS (emacsframe)
|
||||
- NSMaxY (r));
|
||||
|
||||
if (emacs_event)
|
||||
{
|
||||
struct input_event ie;
|
||||
EVENT_INIT (ie);
|
||||
ie.kind = MOVE_FRAME_EVENT;
|
||||
XSETFRAME (ie.frame_or_window, emacsframe);
|
||||
XSETINT (ie.x, emacsframe->left_pos);
|
||||
XSETINT (ie.y, emacsframe->top_pos);
|
||||
kbd_buffer_store_event (&ie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
|
||||
/* Normalize frame to gridded text size. */
|
||||
{
|
||||
|
|
@ -8304,34 +8340,9 @@ ns_in_echo_area (void)
|
|||
|
||||
- (void)windowDidMove: sender
|
||||
{
|
||||
NSWindow *win = [self window];
|
||||
NSRect r = [win frame];
|
||||
NSArray *screens = [NSScreen screens];
|
||||
NSScreen *screen = [screens objectAtIndex: 0];
|
||||
|
||||
NSTRACE ("[EmacsView windowDidMove:]");
|
||||
|
||||
if (!emacsframe->output_data.ns)
|
||||
return;
|
||||
|
||||
if (screen != nil)
|
||||
{
|
||||
emacsframe->left_pos = (NSMinX (r)
|
||||
- NS_PARENT_WINDOW_LEFT_POS (emacsframe));
|
||||
emacsframe->top_pos = (NS_PARENT_WINDOW_TOP_POS (emacsframe)
|
||||
- NSMaxY (r));
|
||||
|
||||
if (emacs_event)
|
||||
{
|
||||
struct input_event ie;
|
||||
EVENT_INIT (ie);
|
||||
ie.kind = MOVE_FRAME_EVENT;
|
||||
XSETFRAME (ie.frame_or_window, emacsframe);
|
||||
XSETINT (ie.x, emacsframe->left_pos);
|
||||
XSETINT (ie.y, emacsframe->top_pos);
|
||||
kbd_buffer_store_event (&ie);
|
||||
}
|
||||
}
|
||||
[self updateFramePosition];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue