diff --git a/lcl/interfaces/gtk2/gtk2widgetset.inc b/lcl/interfaces/gtk2/gtk2widgetset.inc index 40deea6b3b..9b0ba2eee8 100644 --- a/lcl/interfaces/gtk2/gtk2widgetset.inc +++ b/lcl/interfaces/gtk2/gtk2widgetset.inc @@ -783,9 +783,8 @@ begin LM_SYSKEYDOWN, LM_SYSKEYUP: begin - if (ALCLObject is TCustomComboBox) then - ConnectKeyPressReleaseEvents(PgtkObject(PgtkCombo(gObject)^.entry)) - else if (ALCLObject is TCustomForm) then + if ((ALCLObject is TCustomComboBox) and gtk_is_combo_box_entry(gObject)) + or (ALCLObject is TCustomForm) then ConnectKeyPressReleaseEvents(gObject); ConnectKeyPressReleaseEvents(gCore); diff --git a/lcl/interfaces/gtk2/gtk2wsstdctrls.pp b/lcl/interfaces/gtk2/gtk2wsstdctrls.pp index 51f901f853..ea08ab1a4f 100644 --- a/lcl/interfaces/gtk2/gtk2wsstdctrls.pp +++ b/lcl/interfaces/gtk2/gtk2wsstdctrls.pp @@ -1668,6 +1668,9 @@ begin else InputObject := AGtkObject; + Gtk2WidgetSet.SetCallbackDirect(LM_KEYDOWN, InputObject, AWinControl); + Gtk2WidgetSet.SetCallbackDirect(LM_KEYUP, InputObject, AWinControl); + Gtk2WidgetSet.SetCallbackDirect(LM_CHAR, InputObject, AWinControl); Gtk2WidgetSet.SetCallbackDirect(LM_MOUSEMOVE, InputObject, AWinControl); Gtk2WidgetSet.SetCallbackDirect(LM_LBUTTONDOWN, InputObject, AWinControl); Gtk2WidgetSet.SetCallbackDirect(LM_LBUTTONUP, InputObject, AWinControl); @@ -1684,6 +1687,9 @@ begin // And now the same for the Button in the combo if AButton<>nil then begin + Gtk2WidgetSet.SetCallbackDirect(LM_KEYDOWN, AButton, AWinControl); + Gtk2WidgetSet.SetCallbackDirect(LM_KEYUP, AButton, AWinControl); + Gtk2WidgetSet.SetCallbackDirect(LM_CHAR, AButton, AWinControl); if not GtkWidgetIsA(PGtkWidget(AButton),GTK_TYPE_CELL_VIEW) then begin Gtk2WidgetSet.SetCallbackDirect(LM_MOUSEENTER, AButton, AWinControl); Gtk2WidgetSet.SetCallbackDirect(LM_MOUSELEAVE, AButton, AWinControl); @@ -2091,7 +2097,7 @@ begin Entry := GTK_BIN(WidgetInfo^.CoreWidget)^.child; Result:=GTK_WIDGET_CAN_FOCUS(Entry); end else begin - Result:=GTK_WIDGET_CAN_FOCUS(WidgetInfo^.CoreWidget); + Result:=inherited CanFocus(AWinControl); end; //DebugLn(['TGtk2WSCustomComboBox.CanFocus ',dbgsName(AWinControl),' ',gtk_is_combo_box_entry(WidgetInfo^.CoreWidget),' Result=',Result]); end;