some code improvements
This commit is contained in:
parent
8ba652eb07
commit
65047855e9
16
src/fapp.cpp
16
src/fapp.cpp
|
@ -297,17 +297,17 @@ void FApplication::processKeyboardEvent()
|
|||
|
||||
if ( key == fc::Fkey_mouse )
|
||||
{
|
||||
int n, len;
|
||||
int n;
|
||||
const int len = 6;
|
||||
x11_mouse[0] = fifo_buf[3];
|
||||
x11_mouse[1] = fifo_buf[4];
|
||||
x11_mouse[2] = fifo_buf[5];
|
||||
x11_mouse[3] = '\0';
|
||||
len = 6;
|
||||
n = len;
|
||||
|
||||
for (; n < fifo_buf_size; n++) // Remove founded entry
|
||||
for (n=len; n < fifo_buf_size; n++) // Remove founded entry
|
||||
fifo_buf[n-len] = fifo_buf[n];
|
||||
for (; n-len < len; n++) // Fill rest with '\0'
|
||||
n = fifo_buf_size-len-1;
|
||||
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
||||
fifo_buf[n-len] = '\0';
|
||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
||||
processMouseEvent();
|
||||
|
@ -327,7 +327,8 @@ void FApplication::processKeyboardEvent()
|
|||
sgr_mouse[n-3] = '\0';
|
||||
for (n=len; n < fifo_buf_size; n++) // Remove founded entry
|
||||
fifo_buf[n-len] = fifo_buf[n];
|
||||
for (; n-len < len; n++) // Fill rest with '\0'
|
||||
n = fifo_buf_size-len-1;
|
||||
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
||||
fifo_buf[n-len] = '\0';
|
||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
||||
processMouseEvent();
|
||||
|
@ -347,7 +348,8 @@ void FApplication::processKeyboardEvent()
|
|||
urxvt_mouse[n-2] = '\0';
|
||||
for (n=len; n < fifo_buf_size; n++) // Remove founded entry
|
||||
fifo_buf[n-len] = fifo_buf[n];
|
||||
for (; n-len < len; n++) // Fill rest with '\0'
|
||||
n = fifo_buf_size-len-1;
|
||||
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
||||
fifo_buf[n-len] = '\0';
|
||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
||||
processMouseEvent();
|
||||
|
|
|
@ -229,7 +229,7 @@ void FMenu::adjustItems()
|
|||
int FMenu::adjustX (int x_pos)
|
||||
{
|
||||
// Is menu outside on the right of the screen?
|
||||
if ( x_pos+int(maxItemWidth)+2 > getColumnNumber() )
|
||||
if ( x_pos+int(maxItemWidth) >= getColumnNumber()-1 )
|
||||
{
|
||||
x_pos = getColumnNumber() - int(maxItemWidth + 1);
|
||||
// Menu to large for the screen
|
||||
|
@ -1004,13 +1004,13 @@ void FMenu::onMouseDown (FMouseEvent* ev)
|
|||
int x1, x2, y, mouse_x, mouse_y;
|
||||
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth() - 1;
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
||||
y = (*iter)->getY();
|
||||
mouse_x = mouse_pos.getX();
|
||||
mouse_y = mouse_pos.getY();
|
||||
|
||||
if ( mouse_x >= x1
|
||||
&& mouse_x <= x2
|
||||
&& mouse_x < x2
|
||||
&& mouse_y == y )
|
||||
{
|
||||
// Mouse pointer over item
|
||||
|
@ -1102,7 +1102,7 @@ void FMenu::onMouseUp (FMouseEvent* ev)
|
|||
int x1, x2, y;
|
||||
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth() - 1;
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
||||
y = (*iter)->getY();
|
||||
|
||||
if ( (*iter)->isSelected() )
|
||||
|
@ -1111,7 +1111,7 @@ void FMenu::onMouseUp (FMouseEvent* ev)
|
|||
int mouse_y = mouse_pos.getY();
|
||||
|
||||
if ( mouse_x >= x1
|
||||
&& mouse_x <= x2
|
||||
&& mouse_x < x2
|
||||
&& mouse_y == y )
|
||||
{
|
||||
// Mouse pointer over item
|
||||
|
@ -1208,13 +1208,13 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
int x1, x2, y, mouse_x, mouse_y;
|
||||
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth() - 1;
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
||||
y = (*iter)->getY();
|
||||
mouse_x = mouse_pos.getX();
|
||||
mouse_y = mouse_pos.getY();
|
||||
|
||||
if ( mouse_x >= x1
|
||||
&& mouse_x <= x2
|
||||
&& mouse_x < x2
|
||||
&& mouse_y == y )
|
||||
{
|
||||
if ( (*iter)->isEnabled()
|
||||
|
|
|
@ -402,7 +402,7 @@ void FMenuBar::drawItems()
|
|||
gotoxy(screenWidth-1,1);
|
||||
print (vmenubar, "..");
|
||||
}
|
||||
else if ( startpos-2 < screenWidth )
|
||||
else if ( startpos-1 <= screenWidth )
|
||||
{
|
||||
gotoxy(screenWidth,1);
|
||||
print (vmenubar, ' ');
|
||||
|
@ -579,10 +579,10 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
|
|||
{
|
||||
int x1, x2;
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth() - 1;
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
||||
|
||||
if ( mouse_x >= x1
|
||||
&& mouse_x <= x2
|
||||
&& mouse_x < x2
|
||||
&& mouse_y == 1 )
|
||||
{
|
||||
// Mouse pointer over item
|
||||
|
@ -656,10 +656,10 @@ void FMenuBar::onMouseUp (FMouseEvent* ev)
|
|||
int x1, x2;
|
||||
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth() - 1;
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
||||
|
||||
if ( mouse_x >= x1
|
||||
&& mouse_x <= x2
|
||||
&& mouse_x < x2
|
||||
&& mouse_y == 1
|
||||
&& (*iter)->isEnabled()
|
||||
&& (*iter)->isSelected() )
|
||||
|
@ -744,10 +744,10 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
|
|||
int x1, x2;
|
||||
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth() - 1;
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
||||
|
||||
if ( mouse_x >= x1
|
||||
&& mouse_x <= x2
|
||||
&& mouse_x < x2
|
||||
&& mouse_y == 1 )
|
||||
{
|
||||
// Mouse pointer over item
|
||||
|
|
|
@ -2862,8 +2862,8 @@ void FTerm::updateTerminal()
|
|||
}
|
||||
|
||||
vt = vterm;
|
||||
term_width = term->getWidth();
|
||||
term_height = term->getHeight();
|
||||
term_width = term->getWidth() - 1;
|
||||
term_height = term->getHeight() - 1;
|
||||
|
||||
for (register uInt y=0; y < uInt(vt->height); y++)
|
||||
{
|
||||
|
@ -2880,8 +2880,8 @@ void FTerm::updateTerminal()
|
|||
char_data* print_char;
|
||||
print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
|
||||
if ( x_term_pos == term_width - 1
|
||||
&& y_term_pos == term_height - 1 )
|
||||
if ( x_term_pos == term_width
|
||||
&& y_term_pos == term_height )
|
||||
appendLowerRight (print_char);
|
||||
else
|
||||
appendCharacter (print_char);
|
||||
|
@ -2892,9 +2892,9 @@ void FTerm::updateTerminal()
|
|||
vt->changes[y].xmax = 0;
|
||||
}
|
||||
// cursor wrap
|
||||
if ( x_term_pos >= term_width )
|
||||
if ( x_term_pos > term_width )
|
||||
{
|
||||
if ( y_term_pos == term_height - 1 )
|
||||
if ( y_term_pos == term_height )
|
||||
x_term_pos--;
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue