Fix keyboard management, and windows cannot have focus anymore on click.

[GB.GTK]
* BUG: Fix keyboard event management for command keys like DEL that have a text associated with.
* BUG: Windows cannot have focus anymore on click.

[GB.GTK3]
* BUG: Fix keyboard event management for command keys like DEL that have a text associated with.
* BUG: Windows cannot have focus anymore on click.
This commit is contained in:
gambas 2021-07-10 04:27:42 +02:00
parent 42005272a9
commit dbded52066
3 changed files with 22 additions and 2 deletions

View file

@ -1290,6 +1290,8 @@ bool gControl::canFocusOnClick() const
{
/*if (_proxy)
return _proxy->canFocusOnClick();*/
if (isWindow())
return false;
if (!GTK_IS_BUTTON(widget))
return true;
return gt_get_focus_on_click(widget);

View file

@ -238,7 +238,7 @@ bool gKey::mustIgnoreEvent(GdkEventKey *event)
if (!_im_has_input_method)
return false;
else
return (event->type == GDK_KEY_PRESS) && (event->keyval == 0 || !event->string || (uchar)*event->string >= 32);
return (event->type == GDK_KEY_PRESS) && (event->keyval == 0 || !event->string || ((uchar)*event->string >= 32 && ((event->keyval & 0xFF00) != 0xFF00)));
}
void gcb_im_commit(GtkIMContext *context, const char *str, gControl *control)

View file

@ -902,7 +902,25 @@ void gMainWindow::setVisible(bool vl)
focus->setFocus();
focus = NULL;
}
else
{
gControl *ctrl = this;
for(;;)
{
ctrl = ctrl->nextFocus();
if (ctrl->isReallyVisible() && ctrl->isEnabled() && ctrl->canFocus())
{
ctrl->setFocus();
break;
}
if (ctrl == this)
break;
}
}
if (isSkipTaskBar())
_activate = true;