Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix highlight frame
  • Loading branch information
harryfei committed Aug 14, 2020
1 parent 0bf5b3e commit 48972a1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
43 changes: 42 additions & 1 deletion rust_src/src/webrender_backend/term.rs
Expand Up @@ -465,10 +465,51 @@ extern "C" fn read_input_event(terminal: *mut terminal, hold_quit: *mut input_ev
..
} => {
let mut dpyinfo: DisplayInfoRef = unsafe { terminal.display_info.wr }.into();

let mut top_frame = top_frame.as_frame().unwrap();

let focus_frame = if !top_frame.focus_frame.eq(Qnil) {
top_frame.focus_frame.as_frame().unwrap().as_mut()
} else {
top_frame.as_mut()
};

if is_focused {
dpyinfo.x_highlight_frame = top_frame.as_frame().unwrap().as_mut();
dpyinfo.x_highlight_frame = focus_frame;

let mut iev = crate::remacs_sys::input_event {
_bitfield_1: crate::remacs_sys::input_event::new_bitfield_1(
crate::remacs_sys::event_kind::FOCUS_IN_EVENT,
crate::remacs_sys::scroll_bar_part::scroll_bar_nowhere,
),
code: 0,
modifiers: 0,
x: 0.into(),
y: 0.into(),
timestamp: 0,
frame_or_window: top_frame.into(),
arg: Qnil,
};
unsafe { kbd_buffer_store_event_hold(&mut iev, hold_quit) };
count += 1;
} else {
dpyinfo.x_highlight_frame = ptr::null_mut();

let mut iev = crate::remacs_sys::input_event {
_bitfield_1: crate::remacs_sys::input_event::new_bitfield_1(
crate::remacs_sys::event_kind::FOCUS_OUT_EVENT,
crate::remacs_sys::scroll_bar_part::scroll_bar_nowhere,
),
code: 0,
modifiers: 0,
x: 0.into(),
y: 0.into(),
timestamp: 0,
frame_or_window: top_frame.into(),
arg: Qnil,
};
unsafe { kbd_buffer_store_event_hold(&mut iev, hold_quit) };
count += 1;
}
}

Expand Down
5 changes: 5 additions & 0 deletions rust_src/src/wrterm.rs
Expand Up @@ -493,6 +493,11 @@ pub fn x_create_frame(parms: LispObject) -> LispFrameRef {
/* Now consider the frame official. */
unsafe { Vframe_list = Fcons(frame.into(), Vframe_list) };

let output: OutputRef = unsafe { frame.output_data.wr.into() };
let mut dpyinfo = output.display_info();

dpyinfo.x_highlight_frame = frame.as_mut();

frame
}

Expand Down

0 comments on commit 48972a1

Please sign in to comment.