Skip to content

Commit

Permalink
webrender: add more stub functions for wrterm.
Browse files Browse the repository at this point in the history
  • Loading branch information
harryfei committed Aug 16, 2020
1 parent 577c2a7 commit eda023c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
6 changes: 0 additions & 6 deletions rust_src/src/webrender/font.rs
Expand Up @@ -37,7 +37,6 @@ lazy_static! {
font_driver.list_family = Some(list_family);
font_driver.open = Some(open);
font_driver.close = Some(close);
font_driver.has_char = Some(has_char);
font_driver.encode_char = Some(encode_char);
font_driver.text_extents = Some(text_extents);
font_driver.draw = Some(draw);
Expand Down Expand Up @@ -208,11 +207,6 @@ extern "C" fn open(_f: *mut frame, font_entity: LispObject, pixel_size: i32) ->

extern "C" fn close(_font: *mut font) {}

#[allow(unused_variables)]
extern "C" fn has_char(font: LispObject, c: i32) -> i32 {
unimplemented!();
}

extern "C" fn encode_char(_font: *mut font, c: i32) -> u32 {
c as u32
}
Expand Down
35 changes: 28 additions & 7 deletions rust_src/src/webrender/term.rs
Expand Up @@ -5,8 +5,9 @@ use super::display_info::{DisplayInfo, DisplayInfoRef};
use crate::{
lisp::{ExternalPtr, LispObject},
remacs_sys::{
allocate_kboard, create_terminal, current_kboard, frame_parm_handler, initial_kboard,
output_method, redisplay_interface, terminal, xlispstrdup, Fcons, Qnil, Qwr, KBOARD,
allocate_kboard, create_terminal, current_kboard, frame_parm_handler, glyph_row,
glyph_string, initial_kboard, output_method, redisplay_interface, terminal, xlispstrdup,
Fcons, Lisp_Frame, Lisp_Window, Qnil, Qwr, KBOARD,
},
remacs_sys::{
x_clear_end_of_line, x_clear_window_mouse_face, x_fix_overlapping_area,
Expand Down Expand Up @@ -98,9 +99,9 @@ lazy_static! {
insert_glyphs: None,
clear_end_of_line: Some(x_clear_end_of_line),
scroll_run_hook: None,
after_update_window_line_hook: None,
update_window_begin_hook: None,
update_window_end_hook: None,
after_update_window_line_hook: Some(after_update_window_line),
update_window_begin_hook: Some(update_window_begin),
update_window_end_hook: Some(update_window_end),
flush_display: None,
clear_window_mouse_face: Some(x_clear_window_mouse_face),
get_glyph_overhangs: Some(x_get_glyph_overhangs),
Expand All @@ -109,9 +110,9 @@ lazy_static! {
define_fringe_bitmap: None,
destroy_fringe_bitmap: None,
compute_glyph_string_overhangs: None,
draw_glyph_string: None,
draw_glyph_string: Some(draw_glyph_string),
define_frame_cursor: None,
clear_frame_area: None,
clear_frame_area: Some(clear_frame_area),
draw_window_cursor: None,
draw_vertical_window_border: None,
draw_window_divider: None,
Expand All @@ -124,6 +125,26 @@ lazy_static! {
};
}

#[allow(unused_variables)]
extern "C" fn update_window_begin(w: *mut Lisp_Window) {}

#[allow(unused_variables)]
extern "C" fn update_window_end(
w: *mut Lisp_Window,
cursor_no_p: bool,
mouse_face_overwritten_p: bool,
) {
}

#[allow(unused_variables)]
extern "C" fn after_update_window_line(w: *mut Lisp_Window, desired_row: *mut glyph_row) {}

#[allow(unused_variables)]
extern "C" fn draw_glyph_string(s: *mut glyph_string) {}

#[allow(unused_variables)]
extern "C" fn clear_frame_area(s: *mut Lisp_Frame, x: i32, y: i32, width: i32, height: i32) {}

fn wr_create_terminal(mut dpyinfo: DisplayInfoRef) -> TerminalRef {
let terminal_ptr = unsafe {
create_terminal(
Expand Down
15 changes: 12 additions & 3 deletions rust_src/src/wrterm.rs
Expand Up @@ -64,7 +64,7 @@ pub extern "C" fn wr_get_display_info(output: OutputRef) -> DisplayInfoRef {
#[allow(unused_variables)]
#[no_mangle]
pub extern "C" fn wr_get_display(display_info: DisplayInfoRef) -> DisplayRef {
unimplemented!();
DisplayRef::new(ptr::null_mut())
}

#[allow(unused_variables)]
Expand Down Expand Up @@ -105,10 +105,19 @@ pub extern "C" fn x_get_keysym_name(keysym: i32) -> *mut libc::c_char {
#[no_mangle]
pub extern "C" fn x_clear_under_internal_border(frame: LispFrameRef) {}

// This function should be called by Emacs redisplay code to set the
// name; names set this way will never override names set by the user's
// lisp code.
#[allow(unused_variables)]
#[no_mangle]
pub extern "C" fn x_implicitly_set_name(frame: LispFrameRef, arg: LispObject, oldval: LispObject) {
unimplemented!();
pub extern "C" fn x_implicitly_set_name(
mut frame: LispFrameRef,
arg: LispObject,
oldval: LispObject,
) {
if frame.name.is_nil() {
frame.name = arg;
}
}

#[allow(unused_variables)]
Expand Down

0 comments on commit eda023c

Please sign in to comment.