Merged revision(s) 56112 #b51815cfc0, 56122 #8b3759c88e, 56130-56131 #9abb167fde-#9abb167fde, 56140 #e34b72f9d9 from trunk:

LCL-GTK2: Support 5 button mice. Issue #32562, patch from Marco van de Voort.
........
LCL-GTK2: Support 5 button mice. Issue #32562, patch from accorp.
........
LCL: GTK2: Using nboKeyboardTabSwitch in TabControl options and <Ctrl> + <Tab> now working.
........
LCL: GTK2: TTabControl: Cannot use keyboard to switch tab. Issue #31986
........
LCL: GTK2: Fixed set TPanel visible to false on non visual TabSheet doesn't work. Issue #32593
........

git-svn-id: branches/fixes_1_8@56153 -
This commit is contained in:
maxim 2017-10-22 22:20:08 +00:00
parent c9b5599f2c
commit 3ca590fa95
6 changed files with 47 additions and 18 deletions

View File

@ -3100,6 +3100,7 @@ const
var
IsMultiClick: boolean;
TargetControl: TControl;
Button: Byte;
begin
Result := LM_NULL;
@ -3152,10 +3153,16 @@ begin
end;
LastMouse.Down := AMouseDown;
if AMouseDown then
Result := MSGKINDDOWN[AButton][LastMouse.ClickCount]
// mouse buttons 4,5 share same messages
if AButton = 5 then
Button := 4
else
Result := MSGKINDUP[AButton];
Button := AButton;
if AMouseDown then
Result := MSGKINDDOWN[Button][LastMouse.ClickCount]
else
Result := MSGKINDUP[Button];
end;
function GetKeyShiftState: TShiftState;

View File

@ -808,11 +808,13 @@ begin
begin
if Shift = [ssCtrl] then
begin
Key := 0;
PageIndex := (PageIndex + 1) mod PageCount;
Exit;
end
else if Shift = [ssCtrl, ssShift] then
begin
Key := 0;
PageIndex := (PageIndex + PageCount - 1) mod PageCount;
Exit;
end;

View File

@ -2042,8 +2042,11 @@ var
(csDesigning in AWinControl.ComponentState) then
exit;
MessI.Msg := CheckMouseButtonDownUp({%H-}TLCLIntfHandle(widget), AWinControl, LastMouse, EventXY, MouseButton, True);
MessI.Msg := CheckMouseButtonDownUp({%H-}TLCLIntfHandle(widget), AWinControl,
LastMouse, EventXY, MouseButton, True);
MessI.Keys := MessI.Keys or BtnKey;
if BtnKey in [MK_XBUTTON1, MK_XBUTTON2] then
MessI.Keys := MessI.Keys or BtnKey shl 11;
case LastMouse.ClickCount of
2: MessI.Keys := MessI.Keys or MK_DOUBLECLICK;
3: MessI.Keys := MessI.Keys or MK_TRIPLECLICK;
@ -2103,7 +2106,7 @@ begin
2: if not CheckMouseButtonDown(3, MK_MBUTTON) then Exit;
3: if not CheckMouseButtonDown(2, MK_RBUTTON) then Exit;
8: if not CheckMouseButtonDown(4, MK_XBUTTON1) then Exit;
9: if not CheckMouseButtonDown(4, MK_XBUTTON2) then Exit;
9: if not CheckMouseButtonDown(5, MK_XBUTTON2) then Exit;
else
begin
MessI.Msg := LM_NULL;
@ -2215,11 +2218,11 @@ var
MappedXY: TPoint;
EventXY: TPoint;
function CheckMouseButtonUp(MouseButton, MsgID: longint): boolean;
function CheckMouseButtonUp(MouseButton: longint; BtnShiftState: TShiftStateEnum): boolean;
begin
if MsgID=0 then ;
MessI.Msg := CheckMouseButtonDownUp({%H-}TLCLIntfHandle(widget),
AWinControl, LastMouse, EventXY, MouseButton, False);
Include(ShiftState, BtnShiftState);
Result := True;
end;
@ -2238,11 +2241,11 @@ begin
ShiftState := GTKEventStateToShiftState(Event^.State);
case event^.Button of
1: if not CheckMouseButtonUp(1, LM_LBUTTONUP) then Exit;
2: if not CheckMouseButtonUp(3, LM_MBUTTONUP) then Exit;
3: if not CheckMouseButtonUp(2, LM_RBUTTONUP) then exit;
8: if not CheckMouseButtonUp(4, LM_XBUTTONUP) then exit;
9: if not CheckMouseButtonUp(4, LM_XBUTTONUP) then exit;
1: if not CheckMouseButtonUp(1, ssLeft) then Exit;
2: if not CheckMouseButtonUp(3, ssMiddle) then Exit;
3: if not CheckMouseButtonUp(2, ssRight) then Exit;
8: if not CheckMouseButtonUp(4, ssExtra1) then Exit;
9: if not CheckMouseButtonUp(5, ssExtra2) then Exit;
else
begin
MessI.Msg := LM_NULL;

View File

@ -21,10 +21,12 @@ const
type
GtkNotebookPressEventProc = function (widget:PGtkWidget; event:PGdkEventButton):gboolean; cdecl;
GtkNotebookButtonPressEventProc = function (widget:PGtkWidget; event:PGdkEventButton):gboolean; cdecl;
GtkNotebookKeyPressEventProc = function (widget:PGtkWidget; event:PGdkEventKey):gboolean; cdecl;
var
OldNoteBookButtonPress: GtkNotebookPressEventProc = nil;
OldNoteBookButtonPress: GtkNotebookButtonPressEventProc = nil;
OldNoteBookKeyPress: GtkNotebookKeyPressEventProc = nil;
// this was created as a workaround of a tnotebook eating rightclick of custom controls
function Notebook_Button_Press(widget:PGtkWidget; event:PGdkEventButton):gboolean; cdecl;
@ -35,14 +37,29 @@ begin
Result := OldNoteBookButtonPress(widget, event);
end;
// Allow switching tabs per key. Issue #31986
function Notebook_Key_Press(widget:PGtkWidget; event:PGdkEventKey):gboolean; cdecl;
begin
Result := True;
if OldNoteBookKeyPress = nil then exit;
case event^.hardware_keycode of
113: gtk_notebook_prev_page(PGtkNotebook(widget));
114: gtk_notebook_next_page(PGtkNotebook(widget));
else
Result := OldNoteBookKeyPress(widget, event);
end;
end;
procedure HookNoteBookClass;
var
WidgetClass: PGtkWidgetClass;
begin
WidgetClass := GTK_WIDGET_CLASS(gtk_type_class(gtk_notebook_get_type));
OldNoteBookButtonPress := GtkNotebookPressEventProc(WidgetClass^.button_press_event);
OldNoteBookButtonPress := GtkNotebookButtonPressEventProc(WidgetClass^.button_press_event);
WidgetClass^.button_press_event := @Notebook_Button_Press;
OldNoteBookKeyPress := GtkNotebookKeyPressEventProc(WidgetClass^.key_press_event);
WidgetClass^.key_press_event := @Notebook_Key_Press;
end;
{ TGtk2WSCustomTabControl }

View File

@ -238,7 +238,7 @@ begin
// issue #23940. Hide panel if we are not visible, but before setting callbacks.
// so it won't trigger unnecessary events to LCL.
if not AWinControl.Visible and not (csDesigning in AWinControl.ComponentState) then
if not AWinControl.HandleObjectShouldBeVisible and not (csDesigning in AWinControl.ComponentState) then
gtk_widget_hide(Frame);
SetCallbacks(Frame, WidgetInfo);

View File

@ -2305,7 +2305,7 @@ begin
g_object_set_data(PGObject(FrameBox), 'widgetinfo', WidgetInfo);
gtk_widget_show(TempWidget);
gtk_widget_show(P);
if AWinControl.Visible then
if AWinControl.HandleObjectShouldBeVisible then
gtk_widget_show(FrameBox);
Result := TLCLIntfHandle({%H-}PtrUInt(FrameBox));