Treat resize as another Action
This commit is contained in:
@@ -71,3 +71,9 @@ void UserByte::act_on_terminal( Terminal::Emulator *emu )
|
|||||||
emu->dispatch.terminal_to_host.append( emu->user.input( this,
|
emu->dispatch.terminal_to_host.append( emu->user.input( this,
|
||||||
emu->fb.ds.application_mode_cursor_keys ) );
|
emu->fb.ds.application_mode_cursor_keys ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Resize::act_on_terminal( Terminal::Emulator *emu )
|
||||||
|
{
|
||||||
|
emu->resize( width, height );
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -98,6 +98,20 @@ namespace Parser {
|
|||||||
|
|
||||||
UserByte( int s_c ) : c( s_c ) {}
|
UserByte( int s_c ) : c( s_c ) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Resize : public Action {
|
||||||
|
/* resize event -- not part of the host-source state machine*/
|
||||||
|
public:
|
||||||
|
size_t width, height;
|
||||||
|
|
||||||
|
std::string name( void ) { return std::string( "Resize" ); }
|
||||||
|
void act_on_terminal( Terminal::Emulator *emu );
|
||||||
|
|
||||||
|
Resize( size_t s_width, size_t s_height )
|
||||||
|
: width( s_width ),
|
||||||
|
height( s_height )
|
||||||
|
{}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+2
-1
@@ -207,7 +207,8 @@ void emulate_terminal( int fd, int debug_fd )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* tell emulator */
|
/* tell emulator */
|
||||||
terminal.resize( window_size.ws_col, window_size.ws_row );
|
Parser::Resize r( window_size.ws_col, window_size.ws_row );
|
||||||
|
r.act_on_terminal( &terminal );
|
||||||
|
|
||||||
/* tell child process */
|
/* tell child process */
|
||||||
if ( ioctl( fd, TIOCSWINSZ, &window_size ) < 0 ) {
|
if ( ioctl( fd, TIOCSWINSZ, &window_size ) < 0 ) {
|
||||||
|
|||||||
+2
-3
@@ -24,6 +24,7 @@ namespace Terminal {
|
|||||||
friend void Parser::OSC_Put::act_on_terminal( Emulator * );
|
friend void Parser::OSC_Put::act_on_terminal( Emulator * );
|
||||||
friend void Parser::OSC_End::act_on_terminal( Emulator * );
|
friend void Parser::OSC_End::act_on_terminal( Emulator * );
|
||||||
friend void Parser::UserByte::act_on_terminal( Emulator * );
|
friend void Parser::UserByte::act_on_terminal( Emulator * );
|
||||||
|
friend void Parser::Resize::act_on_terminal( Emulator * );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Framebuffer fb;
|
Framebuffer fb;
|
||||||
@@ -36,6 +37,7 @@ namespace Terminal {
|
|||||||
void CSI_dispatch( Parser::CSI_Dispatch *act );
|
void CSI_dispatch( Parser::CSI_Dispatch *act );
|
||||||
void Esc_dispatch( Parser::Esc_Dispatch *act );
|
void Esc_dispatch( Parser::Esc_Dispatch *act );
|
||||||
void OSC_end( Parser::OSC_End *act );
|
void OSC_end( Parser::OSC_End *act );
|
||||||
|
void resize( size_t s_width, size_t s_height );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Emulator( size_t s_width, size_t s_height );
|
Emulator( size_t s_width, size_t s_height );
|
||||||
@@ -46,9 +48,6 @@ namespace Terminal {
|
|||||||
|
|
||||||
std::string open( void ); /* put user cursor keys in application mode */
|
std::string open( void ); /* put user cursor keys in application mode */
|
||||||
std::string close( void ); /* restore user cursor keys */
|
std::string close( void ); /* restore user cursor keys */
|
||||||
|
|
||||||
void resize( size_t s_width, size_t s_height );
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user