From 133ffd101069e159d59b4eb8ec976709b7a9bbec Mon Sep 17 00:00:00 2001 From: maxim Date: Sat, 6 Jan 2018 13:06:46 +0000 Subject: [PATCH] Merged revision(s) 55920 #c5e11a9e95, 55979 #058c0d8e3a from trunk: LCL: GTK2: Fixed tab cannot go from combobox to combobox. Issue #32458 ........ LCL: TComboBox: GTK2: Fixed KeyUp and KeyDown react like tab key after revision 55920 #c5e11a9e95. Issue #32458 ........ git-svn-id: branches/fixes_1_8@56982 - --- lcl/interfaces/gtk2/gtk2widgetset.inc | 5 ++--- lcl/interfaces/gtk2/gtk2wsstdctrls.pp | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) 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 8c72793750..f18422687b 100644 --- a/lcl/interfaces/gtk2/gtk2wsstdctrls.pp +++ b/lcl/interfaces/gtk2/gtk2wsstdctrls.pp @@ -1670,6 +1670,13 @@ begin else InputObject := AGtkObject; + if TCustomComboBox(AWinControl).Style in [csDropDownList, csOwnerDrawFixed, csOwnerDrawVariable] then + begin + // Just a combobox without a edit should handle its own keys. Issue #32458 + Gtk2WidgetSet.SetCallbackDirect(LM_KEYDOWN, InputObject, AWinControl); + Gtk2WidgetSet.SetCallbackDirect(LM_KEYUP, InputObject, AWinControl); + Gtk2WidgetSet.SetCallbackDirect(LM_CHAR, InputObject, AWinControl); + end; Gtk2WidgetSet.SetCallbackDirect(LM_MOUSEMOVE, InputObject, AWinControl); Gtk2WidgetSet.SetCallbackDirect(LM_LBUTTONDOWN, InputObject, AWinControl); Gtk2WidgetSet.SetCallbackDirect(LM_LBUTTONUP, InputObject, AWinControl); @@ -1686,6 +1693,13 @@ begin // And now the same for the Button in the combo if AButton<>nil then begin + if TCustomComboBox(AWinControl).Style in [csDropDownList, csOwnerDrawFixed, csOwnerDrawVariable] then + begin + // Just a combobox without a edit should handle its own keys. Issue #32458 + Gtk2WidgetSet.SetCallbackDirect(LM_KEYDOWN, AButton, AWinControl); + Gtk2WidgetSet.SetCallbackDirect(LM_KEYUP, AButton, AWinControl); + Gtk2WidgetSet.SetCallbackDirect(LM_CHAR, AButton, AWinControl); + end; if not GtkWidgetIsA(PGtkWidget(AButton),GTK_TYPE_CELL_VIEW) then begin Gtk2WidgetSet.SetCallbackDirect(LM_MOUSEENTER, AButton, AWinControl); Gtk2WidgetSet.SetCallbackDirect(LM_MOUSELEAVE, AButton, AWinControl); @@ -2123,7 +2137,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;