Improvements for the window focus

This commit is contained in:
Markus Gans 2016-07-28 23:38:17 +02:00
parent d3f5979873
commit 15793868fe
6 changed files with 142 additions and 110 deletions

View File

@ -1,4 +1,4 @@
2016-07-27 Markus Gans <guru.mail@muenster.de>
2016-07-28 Markus Gans <guru.mail@muenster.de>
* Improvements for the window focus
2016-07-24 Markus Gans <guru.mail@muenster.de>

View File

@ -302,10 +302,13 @@ void FApplication::processKeyboardEvent()
{
key = modifierKeyCorrection (key);
if ( key == fc::Fckey_l ) // Ctrl-L (redraw the screen)
switch ( key )
{
case fc::Fckey_l: // Ctrl-L (redraw the screen)
redraw();
break;
if ( key == fc::Fkey_mouse )
case fc::Fkey_mouse:
{
int n;
const int len = 6;
@ -314,18 +317,22 @@ void FApplication::processKeyboardEvent()
x11_mouse[2] = fifo_buf[5];
x11_mouse[3] = '\0';
for (n=len; n < fifo_buf_size; n++) // Remove founded entry
// Remove founded entry
for (n=len; n < fifo_buf_size; n++)
fifo_buf[n-len] = fifo_buf[n];
n = fifo_buf_size-len-1;
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
// Fill rest with '\0'
for (; n < fifo_buf_size; n++)
fifo_buf[n-len] = '\0';
input_data_pending = bool(fifo_buf[0] != '\0');
processMouseEvent();
}
else if ( key == fc::Fkey_extended_mouse )
break;
case fc::Fkey_extended_mouse:
{
int n = 3;
int len = int(strlen(fifo_buf));
@ -352,7 +359,9 @@ void FApplication::processKeyboardEvent()
input_data_pending = bool(fifo_buf[0] != '\0');
processMouseEvent();
}
else if ( key == fc::Fkey_urxvt_mouse )
break;
case fc::Fkey_urxvt_mouse:
{
int n = 2;
int len = int(strlen(fifo_buf));
@ -379,7 +388,9 @@ void FApplication::processKeyboardEvent()
input_data_pending = bool(fifo_buf[0] != '\0');
processMouseEvent();
}
else
break;
default:
{
// send key down event
FKeyEvent k_down_ev (fc::KeyDown_Event, key);
@ -416,7 +427,10 @@ void FApplication::processKeyboardEvent()
accpt = processAccelerator (root_widget);
}
}
} // end of else
}
break;
} // end of switch
}
fifo_offset = int(strlen(fifo_buf));

View File

@ -1018,6 +1018,7 @@ void FDialog::activateDialog()
FWidget* old_focus = FWidget::getFocusWidget();
FWidget* win_focus_widget = getWindowFocusWidget();
setActiveWindow(this);
setFocus();
if ( win_focus_widget && numOfFocusableChildren() > 1 )
{

View File

@ -1040,6 +1040,19 @@ void FMenu::onKeyPress (FKeyEvent* ev)
flush_out();
break;
case fc::Fmkey_1:
case fc::Fmkey_2:
case fc::Fmkey_3:
case fc::Fmkey_4:
case fc::Fmkey_5:
case fc::Fmkey_6:
case fc::Fmkey_7:
case fc::Fmkey_8:
case fc::Fmkey_9:
// do nothing:
// handle the dialog switch accelerator in FApplication
return;
default:
break;
}

View File

@ -314,8 +314,9 @@ void FMenuItem::cb_destroyDialog (FWidget* widget, void* data_ptr)
{
FDialog* win = static_cast<FDialog*>(widget);
FMenuItem* win_item = static_cast<FMenuItem*>(data_ptr);
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
if ( win_item && win )
if ( win_item && win && fapp && ! fapp->isQuit() )
{
win_item->delAccelerator(win);
win_item->delCallback(this);

View File

@ -39,6 +39,7 @@ FObject::~FObject() // destructor
if ( parentObj )
parentObj->delChild(this);
parentObj = 0;
delOwnTimer(); // delete all timers of this object
if ( ! has_parent && timer_list )
@ -61,6 +62,8 @@ FObject::~FObject() // destructor
++iter;
}
}
}
// public methods of FObject