mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 07:36:19 +02:00
build lazarus now always use -w to get entering/leaving marks, improved carbon intf mouse events
git-svn-id: trunk@8514 -
This commit is contained in:
parent
9018eba6c8
commit
6e8ee76fb2
12
Makefile
12
Makefile
@ -354,6 +354,9 @@ endif
|
|||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
override TARGET_UNITS+=runtimetypeinfocontrols.pas
|
override TARGET_UNITS+=runtimetypeinfocontrols.pas
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
|
override TARGET_UNITS+=runtimetypeinfocontrols.pas
|
||||||
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-linux)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override TARGET_PROGRAMS+=lazarus startlazarus
|
override TARGET_PROGRAMS+=lazarus startlazarus
|
||||||
endif
|
endif
|
||||||
@ -471,6 +474,9 @@ endif
|
|||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
|
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
||||||
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-linux)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override TARGET_EXAMPLEDIRS+=examples
|
override TARGET_EXAMPLEDIRS+=examples
|
||||||
endif
|
endif
|
||||||
@ -588,6 +594,9 @@ endif
|
|||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
override COMPILER_OPTIONS+=-gl
|
override COMPILER_OPTIONS+=-gl
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
|
override COMPILER_OPTIONS+=-gl
|
||||||
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-linux)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
||||||
endif
|
endif
|
||||||
@ -3380,6 +3389,9 @@ endif
|
|||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
override COMPILER_UNITDIR+=../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
|
override COMPILER_UNITDIR+=../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
|
override COMPILER_UNITDIR+=../../ideintf/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ .
|
||||||
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-linux)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
TARGET_EXAMPLEDIRS_EXAMPLES=1
|
TARGET_EXAMPLEDIRS_EXAMPLES=1
|
||||||
endif
|
endif
|
||||||
|
@ -362,6 +362,8 @@ begin
|
|||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
if ExtraOptions<>'' then
|
if ExtraOptions<>'' then
|
||||||
Tool.EnvironmentOverrides.Values['OPT'] := ExtraOptions;
|
Tool.EnvironmentOverrides.Values['OPT'] := ExtraOptions;
|
||||||
|
// add -w option to print leaving/entering messages
|
||||||
|
Tool.CmdLineParams:=Tool.CmdLineParams+' -w';
|
||||||
// append target OS
|
// append target OS
|
||||||
if Options.TargetOS<>'' then
|
if Options.TargetOS<>'' then
|
||||||
Tool.CmdLineParams:=Tool.CmdLineParams+' OS_TARGET='+Options.TargetOS;
|
Tool.CmdLineParams:=Tool.CmdLineParams+' OS_TARGET='+Options.TargetOS;
|
||||||
|
@ -1023,50 +1023,55 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
MakeBeginPattern:= 'make' + GetDefaultExecutableExt + '[';
|
MakeBeginPattern:= 'make' + GetDefaultExecutableExt + '[';
|
||||||
i:=length(MakeBeginPattern);
|
i:=length(MakeBeginPattern);
|
||||||
if copy(s,1,i)<>MakeBeginPattern then exit;
|
if copy(s,1,i)=MakeBeginPattern then begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
CurrentMessageParts.Values['Stage']:='make';
|
CurrentMessageParts.Values['Stage']:='make';
|
||||||
|
|
||||||
inc(i);
|
inc(i);
|
||||||
if (i>length(s)) or (not (s[i] in ['0'..'9'])) then exit;
|
if (i>length(s)) or (not (s[i] in ['0'..'9'])) then exit;
|
||||||
while (i<=length(s)) and (s[i] in ['0'..'9']) do inc(i);
|
while (i<=length(s)) and (s[i] in ['0'..'9']) do inc(i);
|
||||||
if (i>length(s)) or (s[i]<>']') then exit;
|
if (i>length(s)) or (s[i]<>']') then exit;
|
||||||
// check for enter directory
|
// check for enter directory
|
||||||
if copy(s,i,length(EnterDirPattern))=EnterDirPattern then
|
if copy(s,i,length(EnterDirPattern))=EnterDirPattern then
|
||||||
begin
|
begin
|
||||||
inc(i,length(EnterDirPattern));
|
inc(i,length(EnterDirPattern));
|
||||||
if (fCurrentDirectory<>'') then begin
|
if (fCurrentDirectory<>'') then begin
|
||||||
if (fMakeDirHistory=nil) then fMakeDirHistory:=TStringList.Create;
|
if (fMakeDirHistory=nil) then fMakeDirHistory:=TStringList.Create;
|
||||||
fMakeDirHistory.Add(fCurrentDirectory);
|
fMakeDirHistory.Add(fCurrentDirectory);
|
||||||
end;
|
end;
|
||||||
InternalSetCurrentDirectory(copy(s,i,length(s)-i));
|
InternalSetCurrentDirectory(copy(s,i,length(s)-i));
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
// check for leaving directory
|
|
||||||
if copy(s,i,length(LeavingDirPattern))=LeavingDirPattern then
|
|
||||||
begin
|
|
||||||
if (fMakeDirHistory<>nil) and (fMakeDirHistory.Count>0) then begin
|
|
||||||
InternalSetCurrentDirectory(fMakeDirHistory[fMakeDirHistory.Count-1]);
|
|
||||||
fMakeDirHistory.Delete(fMakeDirHistory.Count-1);
|
|
||||||
exit;
|
exit;
|
||||||
end else begin
|
|
||||||
// leaving what directory???
|
|
||||||
InternalSetCurrentDirectory('');
|
|
||||||
end;
|
end;
|
||||||
end;
|
// check for leaving directory
|
||||||
// check for make message
|
if copy(s,i,length(LeavingDirPattern))=LeavingDirPattern then
|
||||||
if copy(s,i,length(MakeMsgPattern))=MakeMsgPattern then
|
begin
|
||||||
begin
|
if (fMakeDirHistory<>nil) and (fMakeDirHistory.Count>0) then begin
|
||||||
BracketEnd:=i+length(MakeMsgPattern);
|
InternalSetCurrentDirectory(fMakeDirHistory[fMakeDirHistory.Count-1]);
|
||||||
while (BracketEnd<=length(s)) and (s[BracketEnd]<>']') do inc(BracketEnd);
|
fMakeDirHistory.Delete(fMakeDirHistory.Count-1);
|
||||||
MsgStartPos:=BracketEnd+1;
|
exit;
|
||||||
while (MsgStartPos<=length(s)) and (s[MsgStartPos]=' ') do inc(MsgStartPos);
|
end else begin
|
||||||
MakeMsg:=copy(s,MsgStartPos,length(s)-MsgStartPos+1);
|
// leaving which directory???
|
||||||
DoAddFilteredLine(s);
|
InternalSetCurrentDirectory('');
|
||||||
if AnsiCompareText(copy(MakeMsg,1,5),'Error')=0 then
|
end;
|
||||||
if (ofoExceptionOnError in Options) then
|
end;
|
||||||
raise EOutputFilterError.Create(s);
|
// check for make message
|
||||||
exit;
|
if copy(s,i,length(MakeMsgPattern))=MakeMsgPattern then
|
||||||
|
begin
|
||||||
|
BracketEnd:=i+length(MakeMsgPattern);
|
||||||
|
while (BracketEnd<=length(s)) and (s[BracketEnd]<>']') do inc(BracketEnd);
|
||||||
|
MsgStartPos:=BracketEnd+1;
|
||||||
|
while (MsgStartPos<=length(s)) and (s[MsgStartPos]=' ') do inc(MsgStartPos);
|
||||||
|
MakeMsg:=copy(s,MsgStartPos,length(s)-MsgStartPos+1);
|
||||||
|
DoAddFilteredLine(s);
|
||||||
|
if AnsiCompareText(copy(MakeMsg,1,5),'Error')=0 then
|
||||||
|
if (ofoExceptionOnError in Options) then
|
||||||
|
raise EOutputFilterError.Create(s);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
// TODO: under MacOS X and probably BSD too the make does not write
|
||||||
|
// entering and leaving directory
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1339,7 +1339,7 @@ begin
|
|||||||
if Keys and MK_LButton <> 0 then Include(Result,ssLeft);
|
if Keys and MK_LButton <> 0 then Include(Result,ssLeft);
|
||||||
if Keys and MK_RButton <> 0 then Include(Result,ssRight);
|
if Keys and MK_RButton <> 0 then Include(Result,ssRight);
|
||||||
if Keys and MK_MButton <> 0 then Include(Result,ssMiddle);
|
if Keys and MK_MButton <> 0 then Include(Result,ssMiddle);
|
||||||
if GetKeyState(VK_MENU) < 0 then Include(Result, ssAlt);
|
if GetKeyState(VK_MENU) < 0 then Include(Result,ssAlt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function KeyDataToShiftState(KeyData: Longint): TShiftState;
|
function KeyDataToShiftState(KeyData: Longint): TShiftState;
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
// MCarbonWSWinControl_Hit_UPP: EventHandlerUPP = nil;
|
// MCarbonWSWinControl_Hit_UPP: EventHandlerUPP = nil;
|
||||||
|
|
||||||
|
|
||||||
|
{ CarbonPrivateHIView_Dispose
|
||||||
|
Is called when the control is freed by carbon.
|
||||||
|
Frees the widgetinfo.
|
||||||
|
}
|
||||||
function CarbonPrivateHIView_Dispose(ANextHandler: EventHandlerCallRef;
|
function CarbonPrivateHIView_Dispose(ANextHandler: EventHandlerCallRef;
|
||||||
AEvent: EventRef;
|
AEvent: EventRef;
|
||||||
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
||||||
@ -57,7 +61,7 @@ function CarbonPrivateHIView_MouseMove(ANextHandler: EventHandlerCallRef;
|
|||||||
AEvent: EventRef;
|
AEvent: EventRef;
|
||||||
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
||||||
begin
|
begin
|
||||||
WriteLN('MouseMove');
|
DebugLn('CarbonPrivateHIView_MouseMove');
|
||||||
Result := CallNextEventHandler(ANextHandler, AEvent);
|
Result := CallNextEventHandler(ANextHandler, AEvent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -19,6 +19,61 @@
|
|||||||
// H A N D L E R S
|
// H A N D L E R S
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
|
|
||||||
|
function GetCarbonMsgKeyState: PtrInt;
|
||||||
|
var
|
||||||
|
Modifiers, ButtonState: UInt32;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
|
||||||
|
Modifiers := GetCurrentKeyModifiers; // shift, cpntrol, option, command
|
||||||
|
ButtonState := GetCurrentEventButtonState; // Bit 0 first button (left),
|
||||||
|
// bit 1 second (right), bit2 third (middle) ...
|
||||||
|
|
||||||
|
if (ButtonState and 1)>0 then
|
||||||
|
inc(Result,MK_LButton);
|
||||||
|
if (ButtonState and 2)>0 then
|
||||||
|
inc(Result,MK_RButton);
|
||||||
|
if (ButtonState and 4)>0 then
|
||||||
|
inc(Result,MK_MButton);
|
||||||
|
if (shiftKey and Modifiers)>0 then
|
||||||
|
inc(Result,MK_Shift);
|
||||||
|
if (cmdKey and Modifiers)>0 then
|
||||||
|
inc(Result,MK_Control);
|
||||||
|
|
||||||
|
debugln('GetCarbonMsgKeyState Result=',dbgs(KeysToShiftState(Result)),' Modifiers=',hexstr(Modifiers,8),' ButtonState=',hexstr(ButtonState,8));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetCarbonShiftState: TShiftState;
|
||||||
|
var
|
||||||
|
Modifiers, ButtonState: UInt32;
|
||||||
|
begin
|
||||||
|
Result:=[];
|
||||||
|
|
||||||
|
Modifiers := GetCurrentKeyModifiers; // shift, cpntrol, option, command
|
||||||
|
ButtonState := GetCurrentEventButtonState; // Bit 0 first button (left),
|
||||||
|
// bit 1 second (right), bit2 third (middle) ...
|
||||||
|
|
||||||
|
if (ButtonState and 1)>0 then
|
||||||
|
Include(Result,ssLeft);
|
||||||
|
if (ButtonState and 2)>0 then
|
||||||
|
Include(Result,ssRight);
|
||||||
|
if (ButtonState and 4)>0 then
|
||||||
|
Include(Result,ssMiddle);
|
||||||
|
if (shiftKey and Modifiers)>0 then
|
||||||
|
Include(Result,ssShift);
|
||||||
|
if (cmdKey and Modifiers)>0 then
|
||||||
|
Include(Result,ssCtrl);
|
||||||
|
if (controlKey and Modifiers)>0 then
|
||||||
|
Include(Result,ssMeta);
|
||||||
|
if (optionKey and Modifiers)>0 then
|
||||||
|
Include(Result,ssAlt);
|
||||||
|
if (alphaLock and Modifiers)>0 then
|
||||||
|
Include(Result,ssCaps);
|
||||||
|
|
||||||
|
debugln('GetCarbonShiftState Result=',dbgs(Result),' Modifiers=',hexstr(Modifiers,8),' ButtonState=',hexstr(ButtonState,8));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function CarbonPrivateWindow_Close(ANextHandler: EventHandlerCallRef;
|
function CarbonPrivateWindow_Close(ANextHandler: EventHandlerCallRef;
|
||||||
AEvent: EventRef;
|
AEvent: EventRef;
|
||||||
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
||||||
@ -58,33 +113,33 @@ begin
|
|||||||
FreeWidgetInfo(AInfo);
|
FreeWidgetInfo(AInfo);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//Generic function that handles all types of mouse events
|
|
||||||
|
|
||||||
|
{ TrackProgress:
|
||||||
|
Generic function that handles all mouse dragging events }
|
||||||
procedure TrackProgress(AControl: ControlRef; APartCode: ControlPartCode); {$IFDEF darwin}mwpascal;{$ENDIF}
|
procedure TrackProgress(AControl: ControlRef; APartCode: ControlPartCode); {$IFDEF darwin}mwpascal;{$ENDIF}
|
||||||
var
|
var
|
||||||
Modifiers, ButtonState: UInt32;
|
|
||||||
MousePoint: HIPoint;
|
MousePoint: HIPoint;
|
||||||
pt: FPCMacOSAll.Point;
|
AbsMousePos: FPCMacOSAll.Point;
|
||||||
Window: WindowRef;
|
Window: WindowRef;
|
||||||
R: FPCMacOSAll.Rect;
|
R: FPCMacOSAll.Rect;
|
||||||
Msg: TLMMouseMove;
|
Msg: TLMMouseMove;
|
||||||
Info:PWidgetInfo;
|
Info:PWidgetInfo;
|
||||||
begin
|
begin
|
||||||
debugln('TrackProgress');
|
debugln('TrackProgress');
|
||||||
GetGlobalMouse(Pt);
|
GetGlobalMouse(AbsMousePos);
|
||||||
Window := HIViewGetWindow(AControl);
|
Window := HIViewGetWindow(AControl);
|
||||||
GetWindowBounds(Window, kWindowStructureRgn, R);
|
GetWindowBounds(Window, kWindowStructureRgn, R);
|
||||||
MousePoint.X := pt.h - R.left;
|
MousePoint.X := AbsMousePos.h - R.Left;
|
||||||
MousePoint.Y := pt.v - R.Top;
|
MousePoint.Y := AbsMousePos.v - R.Top;
|
||||||
|
|
||||||
HIViewConvertPoint(MousePoint, nil, AControl);
|
HIViewConvertPoint(MousePoint, nil, AControl);
|
||||||
|
|
||||||
Modifiers := GetCurrentKeyModifiers;
|
FillChar(Msg.Msg,SizeOf(Msg),0);
|
||||||
ButtonState := GetCurrentButtonState;
|
|
||||||
|
|
||||||
Msg.Msg := LM_MOUSEMOVE;
|
Msg.Msg := LM_MOUSEMOVE;
|
||||||
Msg.XPos := Trunc(MousePoint.X);
|
Msg.XPos := Trunc(MousePoint.X);
|
||||||
Msg.YPos := Trunc(MousePoint.Y);
|
Msg.YPos := Trunc(MousePoint.Y);
|
||||||
|
Msg.Keys := GetCarbonMsgKeyState;
|
||||||
|
|
||||||
Info := GetWidgetInfo(AControl);
|
Info := GetWidgetInfo(AControl);
|
||||||
if Info = nil then begin
|
if Info = nil then begin
|
||||||
//AControl should be fine but if it isn't, default to the window
|
//AControl should be fine but if it isn't, default to the window
|
||||||
@ -93,10 +148,12 @@ begin
|
|||||||
|
|
||||||
if Info <> nil
|
if Info <> nil
|
||||||
then DeliverMessage(Info^.LCLObject, Msg);
|
then DeliverMessage(Info^.LCLObject, Msg);
|
||||||
|
|
||||||
DebugLn('-- track, x:%d, y:%d, m:0x%x, b:0x%x', [Round(MousePoint.X), Round(MousePoint.Y), Modifiers, ButtonState]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ CarbonPrivateWindow_ControlTrack
|
||||||
|
Handles/Creates LM_MOUSEMOVE events while dragging.
|
||||||
|
For mouse move events while not dragging see below
|
||||||
|
CarbonPrivateWindow_MouseProc }
|
||||||
function CarbonPrivateWindow_ControlTrack(ANextHandler: EventHandlerCallRef;
|
function CarbonPrivateWindow_ControlTrack(ANextHandler: EventHandlerCallRef;
|
||||||
AEvent: EventRef;
|
AEvent: EventRef;
|
||||||
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
||||||
@ -104,8 +161,7 @@ const
|
|||||||
MSGKIND: array[1..3] of Integer = (LM_LBUTTONUP, LM_RBUTTONUP, LM_MBUTTONUP);
|
MSGKIND: array[1..3] of Integer = (LM_LBUTTONUP, LM_RBUTTONUP, LM_MBUTTONUP);
|
||||||
var
|
var
|
||||||
Control: ControlRef;
|
Control: ControlRef;
|
||||||
Modifiers, ButtonState: UInt32;
|
MousePoint: HIPoint;//QDPoint;
|
||||||
MousePoint: HIPoint;//QDPoint;
|
|
||||||
ActionUPP, OldActionUPP: ControlActionUPP;
|
ActionUPP, OldActionUPP: ControlActionUPP;
|
||||||
pt: FPCMacOSAll.Point;
|
pt: FPCMacOSAll.Point;
|
||||||
MouseButton: EventMouseButton;
|
MouseButton: EventMouseButton;
|
||||||
@ -113,12 +169,10 @@ var
|
|||||||
R: FPCMacOSAll.Rect;
|
R: FPCMacOSAll.Rect;
|
||||||
Msg: TLMMouseMove;
|
Msg: TLMMouseMove;
|
||||||
begin
|
begin
|
||||||
DebugLn('-- Control track A');
|
DebugLn('CarbonPrivateWindow_ControlTrack');
|
||||||
GetEventParameter(AEvent, kEventParamKeyModifiers, typeUInt32, nil, SizeOf(Modifiers), nil, @Modifiers);
|
|
||||||
GetEventParameter(AEvent, kEventParamWindowMouseLocation, typeHIPoint, nil, SizeOf(MousePoint), nil, @MousePoint);
|
GetEventParameter(AEvent, kEventParamWindowMouseLocation, typeHIPoint, nil, SizeOf(MousePoint), nil, @MousePoint);
|
||||||
GetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP, nil, sizeof(ActionUPP), nil, @OldActionUPP);
|
GetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP, nil, sizeof(ActionUPP), nil, @OldActionUPP);
|
||||||
GetEventParameter(AEvent, kEventParamMouseButton, typeMouseButton, nil, SizeOf(MouseButton), nil, @MouseButton);
|
GetEventParameter(AEvent, kEventParamMouseButton, typeMouseButton, nil, SizeOf(MouseButton), nil, @MouseButton);
|
||||||
ButtonState := GetCurrentEventButtonState;
|
|
||||||
|
|
||||||
ActionUPP := NewControlActionUPP(@TrackProgress);
|
ActionUPP := NewControlActionUPP(@TrackProgress);
|
||||||
SetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP, sizeof(ActionUPP), @ActionUPP);
|
SetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP, sizeof(ActionUPP), @ActionUPP);
|
||||||
@ -139,19 +193,16 @@ begin
|
|||||||
|
|
||||||
HIViewConvertPoint(MousePoint, nil, Control);
|
HIViewConvertPoint(MousePoint, nil, Control);
|
||||||
|
|
||||||
Modifiers := GetCurrentKeyModifiers;
|
FillChar(Msg,SizeOf(Msg),0);
|
||||||
ButtonState := GetCurrentButtonState;
|
|
||||||
|
|
||||||
if (MouseButton >= Low(MSGKIND))
|
if (MouseButton >= Low(MSGKIND))
|
||||||
and (MouseButton <= High(MSGKIND))
|
and (MouseButton <= High(MSGKIND))
|
||||||
then Msg.Msg := MSGKIND[MouseButton];
|
then Msg.Msg := MSGKIND[MouseButton];
|
||||||
|
|
||||||
Msg.XPos := Trunc(MousePoint.X);
|
Msg.XPos := Trunc(MousePoint.X);
|
||||||
Msg.YPos := Trunc(MousePoint.Y);
|
Msg.YPos := Trunc(MousePoint.Y);
|
||||||
|
Msg.Keys := GetCarbonMsgKeyState;
|
||||||
|
|
||||||
DeliverMessage(AInfo^.LCLObject, Msg);
|
DeliverMessage(AInfo^.LCLObject, Msg);
|
||||||
|
|
||||||
DebugLn('-- Control track B, x:%d, y:%d, m:0x%x, b:0x%x', [Round(MousePoint.X), Round(MousePoint.Y), Modifiers, ButtonState]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CarbonPrivateWindow_MouseProc(ANextHandler: EventHandlerCallRef;
|
function CarbonPrivateWindow_MouseProc(ANextHandler: EventHandlerCallRef;
|
||||||
@ -170,15 +221,21 @@ var
|
|||||||
var
|
var
|
||||||
ClickCount: UInt32;
|
ClickCount: UInt32;
|
||||||
begin
|
begin
|
||||||
GetEventParameter(AEvent, kEventParamClickCount, typeUInt32, nil, SizeOf(ClickCount), nil, @ClickCount);
|
GetEventParameter(AEvent, kEventParamClickCount, typeUInt32, nil,
|
||||||
|
SizeOf(ClickCount), nil, @ClickCount);
|
||||||
Result := ClickCount;
|
Result := ClickCount;
|
||||||
|
//debugln('GetClickCount ClickCount=',dbgs(ClickCount));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetMouseButton:Integer;
|
function GetMouseButton:Integer;
|
||||||
|
// 1 = left
|
||||||
|
// 2 = right
|
||||||
|
// 3 = middle
|
||||||
var
|
var
|
||||||
MouseButton: EventMouseButton;
|
MouseButton: EventMouseButton;
|
||||||
begin
|
begin
|
||||||
GetEventParameter(AEvent, kEventParamMouseButton, typeMouseButton, nil, SizeOf(MouseButton), nil, @MouseButton);
|
GetEventParameter(AEvent, kEventParamMouseButton, typeMouseButton, nil,
|
||||||
|
SizeOf(MouseButton), nil, @MouseButton);
|
||||||
Result := MouseButton;
|
Result := MouseButton;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -186,17 +243,30 @@ var
|
|||||||
var
|
var
|
||||||
MousePoint: HIPoint;//QDPoint;
|
MousePoint: HIPoint;//QDPoint;
|
||||||
begin
|
begin
|
||||||
GetEventParameter(AEvent, kEventParamWindowMouseLocation, typeHIPoint, nil, SizeOf(MousePoint), nil, @MousePoint);
|
GetEventParameter(AEvent, kEventParamWindowMouseLocation, typeHIPoint, nil,
|
||||||
|
SizeOf(MousePoint), nil, @MousePoint);
|
||||||
HIViewConvertPoint(MousePoint, nil, Control);
|
HIViewConvertPoint(MousePoint, nil, Control);
|
||||||
Result.X := Round(MousePoint.X);
|
Result.X := Round(MousePoint.X);
|
||||||
Result.Y := Round(MousePoint.Y);
|
Result.Y := Round(MousePoint.Y);
|
||||||
// WriteLn('Mouse to Widget Coords: X=',Result.X,' Y=',Result.Y);
|
// WriteLn('Mouse to Widget Coords: X=',Result.X,' Y=',Result.Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetMouseWheelDelta: Integer;
|
||||||
|
var
|
||||||
|
WheelDelta: SInt32;
|
||||||
|
begin
|
||||||
|
GetEventParameter(AEvent, kEventParamMouseWheelDelta, typeSInt32, nil,
|
||||||
|
SizeOf(WheelDelta), nil, @WheelDelta);
|
||||||
|
Result := WheelDelta;
|
||||||
|
debugln('GetMouseWheelDelta WheelDelta=',dbgs(WheelDelta),' ',hexstr(WheelDelta,8));
|
||||||
|
end;
|
||||||
|
|
||||||
//
|
//
|
||||||
// handler functions
|
// handler functions
|
||||||
//
|
//
|
||||||
procedure HandleMouseDownEvent(var AMsg);
|
procedure HandleMouseDownEvent(var AMsg);
|
||||||
const
|
const
|
||||||
|
// array of clickcount x buttontype
|
||||||
MSGKIND: array[1..4, 1..3] of Integer = (
|
MSGKIND: array[1..4, 1..3] of Integer = (
|
||||||
(LM_LBUTTONDOWN, LM_RBUTTONDOWN, LM_MBUTTONDOWN),
|
(LM_LBUTTONDOWN, LM_RBUTTONDOWN, LM_MBUTTONDOWN),
|
||||||
(LM_LBUTTONDBLCLK, LM_RBUTTONDBLCLK, LM_MBUTTONDBLCLK),
|
(LM_LBUTTONDBLCLK, LM_RBUTTONDBLCLK, LM_MBUTTONDBLCLK),
|
||||||
@ -218,23 +288,22 @@ var
|
|||||||
MousePoint := GetMousePoint;
|
MousePoint := GetMousePoint;
|
||||||
|
|
||||||
if (ClickCount < Low(MSGKIND))
|
if (ClickCount < Low(MSGKIND))
|
||||||
or (ClickCount > Low(MSGKIND))
|
or (ClickCount > High(MSGKIND))
|
||||||
then ClickCount := 1;
|
then ClickCount := 1;
|
||||||
|
|
||||||
if (MouseButton >= Low(MSGKIND))
|
if (MouseButton < Low(MSGKIND[1]))
|
||||||
and (MouseButton <= High(MSGKIND))
|
or (MouseButton > High(MSGKIND[1])) then
|
||||||
then Msg^.Msg := MSGKIND[ClickCount, MouseButton];
|
exit;
|
||||||
|
Msg^.Msg := MSGKIND[ClickCount, MouseButton];
|
||||||
|
//debugln('HandleMouseDownEvent CliCount=',dbgs(ClickCount),' MouseButton=',dbgs(MouseButton),' Msg^.Msg=',dbgs(Msg^.Msg));
|
||||||
|
|
||||||
Msg^.XPos := MousePoint.X;
|
Msg^.XPos := MousePoint.X;
|
||||||
Msg^.YPos := MousePoint.Y;
|
Msg^.YPos := MousePoint.Y;
|
||||||
|
Msg^.Keys := GetCarbonMsgKeyState;
|
||||||
|
|
||||||
//LMMouse.Keys;
|
|
||||||
{$Warning CarbonPrivateWindow_MouseProc LMMouse.Keys TODO}
|
|
||||||
|
|
||||||
Spec := MakeEventSpec(kEventClassControl, kEventControlTrack);
|
Spec := MakeEventSpec(kEventClassControl, kEventControlTrack);
|
||||||
InstallControlEventHandler(Control, RegisterEventHandler(@CarbonPrivateWindow_ControlTrack),
|
InstallControlEventHandler(Control, RegisterEventHandler(@CarbonPrivateWindow_ControlTrack),
|
||||||
1, @Spec, Info, nil);
|
1, @Spec, Info, nil);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure HandleMouseUpEvent(var AMsg);
|
procedure HandleMouseUpEvent(var AMsg);
|
||||||
@ -259,8 +328,7 @@ var
|
|||||||
|
|
||||||
Msg^.XPos := MousePoint.X;
|
Msg^.XPos := MousePoint.X;
|
||||||
Msg^.YPos := MousePoint.Y;
|
Msg^.YPos := MousePoint.Y;
|
||||||
|
Msg^.Keys := GetCarbonMsgKeyState;
|
||||||
//LMMouse.Keys;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure HandleMouseMovedEvent(var AMsg);
|
procedure HandleMouseMovedEvent(var AMsg);
|
||||||
@ -268,7 +336,7 @@ var
|
|||||||
MousePoint: TPoint;
|
MousePoint: TPoint;
|
||||||
MSg: ^TLMMouseMove;
|
MSg: ^TLMMouseMove;
|
||||||
begin
|
begin
|
||||||
DebugLN('-- mouse move --');
|
DebugLN('HandleMouseMovedEvent');
|
||||||
Msg := @AMsg;
|
Msg := @AMsg;
|
||||||
|
|
||||||
MousePoint := GetMousePoint;
|
MousePoint := GetMousePoint;
|
||||||
@ -276,6 +344,7 @@ var
|
|||||||
Msg^.Msg := LM_MOUSEMOVE;
|
Msg^.Msg := LM_MOUSEMOVE;
|
||||||
Msg^.XPos := MousePoint.X;
|
Msg^.XPos := MousePoint.X;
|
||||||
Msg^.YPos := MousePoint.Y;
|
Msg^.YPos := MousePoint.Y;
|
||||||
|
Msg^.Keys := GetCarbonMsgKeyState;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure HandleMouseDraggedEvent(var AMsg);
|
procedure HandleMouseDraggedEvent(var AMsg);
|
||||||
@ -285,9 +354,21 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure HandleMouseWheelEvent(var AMsg);
|
procedure HandleMouseWheelEvent(var AMsg);
|
||||||
|
var
|
||||||
|
MousePoint: TPoint;
|
||||||
|
MSg: ^TLMMouseEvent;
|
||||||
begin
|
begin
|
||||||
DebugLN('-- mouse wheel --');
|
DebugLN('HandleMouseWheelEvent');
|
||||||
//TODO should be simple
|
Msg := @AMsg;
|
||||||
|
|
||||||
|
MousePoint := GetMousePoint;
|
||||||
|
|
||||||
|
Msg^.Msg := LM_MOUSEWHEEL;
|
||||||
|
Msg^.Button := GetMouseButton;
|
||||||
|
Msg^.X := MousePoint.X;
|
||||||
|
Msg^.Y := MousePoint.Y;
|
||||||
|
Msg^.State := GetCarbonShiftState;
|
||||||
|
Msg^.WheelDelta := GetMouseWheelDelta;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -310,7 +391,7 @@ begin
|
|||||||
// if a control other than root is found, send the message
|
// if a control other than root is found, send the message
|
||||||
// to the control instead of the window
|
// to the control instead of the window
|
||||||
// if a lower control without widgetInfo is found, use its parent
|
// if a lower control without widgetInfo is found, use its parent
|
||||||
// Note: HIViewGetViewForMouseEvent returns the root if noting found
|
// Note: HIViewGetViewForMouseEvent returns the root if nothing found
|
||||||
Info := nil;
|
Info := nil;
|
||||||
while Control <> Root do
|
while Control <> Root do
|
||||||
begin
|
begin
|
||||||
@ -330,12 +411,13 @@ begin
|
|||||||
|
|
||||||
//For the enter and exit events tracking must be enabled
|
//For the enter and exit events tracking must be enabled
|
||||||
//tracking is enabled by defining a rect that you want to track
|
//tracking is enabled by defining a rect that you want to track
|
||||||
// SEE FPCMacOSAll line 134390
|
|
||||||
// TODO: Tracking
|
// TODO: Tracking
|
||||||
kEventMouseEntered : Msg.Message.Msg := CM_MOUSEENTER;
|
kEventMouseEntered : Msg.Message.Msg := CM_MOUSEENTER;
|
||||||
kEventMouseExited : Msg.Message.Msg := CM_MOUSELEAVE;
|
kEventMouseExited : Msg.Message.Msg := CM_MOUSELEAVE;
|
||||||
|
|
||||||
kEventMouseWheelMoved : HandleMouseWheelEvent(Msg);
|
kEventMouseWheelMoved : HandleMouseWheelEvent(Msg);
|
||||||
|
else
|
||||||
|
exit(EventNotHandledErr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Msg is set in the Appropriate HandleMousexxx procedure
|
// Msg is set in the Appropriate HandleMousexxx procedure
|
||||||
@ -348,6 +430,160 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CarbonPrivateWindow_KeyboardProc(ANextHandler: EventHandlerCallRef;
|
||||||
|
AEvent: EventRef;
|
||||||
|
AWIndowInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
||||||
|
var
|
||||||
|
Control: ControlRef; // the control we are dealing with
|
||||||
|
// or the rootcontrol if none found
|
||||||
|
Info: PWidgetInfo; // the info specific to the mouse event
|
||||||
|
// or the window's widgetinfo if none found
|
||||||
|
|
||||||
|
function GetVKKeyCode: word;
|
||||||
|
var
|
||||||
|
KeyCode: UInt32;
|
||||||
|
KeyChar: char;
|
||||||
|
Buf: array[1..6] of byte;
|
||||||
|
TextLen: UInt32;
|
||||||
|
begin
|
||||||
|
KeyChar:=#0;
|
||||||
|
KeyCode:=0;
|
||||||
|
FillChar(Buf,SizeOf(Buf),0);
|
||||||
|
|
||||||
|
GetEventParameter(AEvent, kEventParamKeyCode, typeUInt32, nil,
|
||||||
|
SizeOf(KeyCode), nil, @KeyCode);
|
||||||
|
GetEventParameter(AEvent, kEventParamKeyMacCharCodes, typeChar, nil,
|
||||||
|
SizeOf(KeyChar), nil, @KeyChar);
|
||||||
|
Result:=0;
|
||||||
|
case KeyCode of
|
||||||
|
0:
|
||||||
|
case KeyChar of
|
||||||
|
'a'..'z': Result:=VK_A+ord(KeyChar)-ord('a');
|
||||||
|
'A'..'Z': Result:=VK_A+ord(KeyChar)-ord('A');
|
||||||
|
'+': Result:=VK_ADD;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
GetEventParameter(AEvent, kEventParamKeyMacCharCodes, typeChar, nil,
|
||||||
|
SizeOf(KeyChar), nil, @KeyChar);
|
||||||
|
GetEventParameter(AEvent, kEventParamKeyUnicodes, typeUnicodeText, nil,
|
||||||
|
6, @TextLen, @Buf[1]);
|
||||||
|
debugln('GetVKKeyCode Result=',dbgs(Result),' KeyCode='+dbgs(KeyCode),' KeyChar='+DbgStr(KeyChar),' TextLen='+dbgs(TextLen),
|
||||||
|
' '+dbgs(Buf[1])+','+dbgs(Buf[2])+','+dbgs(Buf[3])+','+dbgs(Buf[4])+','+dbgs(Buf[5])+','+dbgs(Buf[6]));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetCharacterCode: word;
|
||||||
|
var
|
||||||
|
KeyChar: char;
|
||||||
|
Buf: array[1..6] of byte;
|
||||||
|
TextLen: UInt32;
|
||||||
|
begin
|
||||||
|
KeyChar:=#0;
|
||||||
|
FillChar(Buf,SizeOf(Buf),0);
|
||||||
|
|
||||||
|
GetEventParameter(AEvent, kEventParamKeyMacCharCodes, typeChar, nil,
|
||||||
|
SizeOf(KeyChar), nil, @KeyChar);
|
||||||
|
GetEventParameter(AEvent, kEventParamKeyUnicodes, typeUnicodeText, nil,
|
||||||
|
6, @TextLen, @Buf[1]);
|
||||||
|
Result:=ord(KeyChar);
|
||||||
|
debugln('GetCharacterCode Result=',dbgs(Result),' KeyChar='+DbgStr(KeyChar),
|
||||||
|
' '+dbgs(Buf[1])+','+dbgs(Buf[2])+','+dbgs(Buf[3])+','+dbgs(Buf[4])+','+dbgs(Buf[5])+','+dbgs(Buf[6]));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure HandleRawKeyDownEvent;
|
||||||
|
var
|
||||||
|
KeyMsg: TLMKeyDown;
|
||||||
|
CharMsg: TLMChar;
|
||||||
|
begin
|
||||||
|
DebugLN('HandleRawKeyDownEvent Info^.LCLObject=',DbgSName(Info^.LCLObject));
|
||||||
|
|
||||||
|
// create the LM_KEYDOWN message
|
||||||
|
FillChar(KeyMsg, SizeOf(KeyMsg), 0);
|
||||||
|
KeyMsg.Msg := LM_KEYDOWN;
|
||||||
|
KeyMsg.KeyData := GetCarbonMsgKeyState;
|
||||||
|
KeyMsg.CharCode := GetVKKeyCode;
|
||||||
|
|
||||||
|
// Msg is set in the Appropriate HandleKeyxxx procedure
|
||||||
|
if DeliverMessage(Info^.LCLObject, KeyMsg) = 0 then begin
|
||||||
|
Result := EventNotHandledErr;
|
||||||
|
if KeyMsg.CharCode=0 then
|
||||||
|
exit;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
// the LCL does not want the event propagated
|
||||||
|
Result := noErr;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
// create the LM_CHAR / LM_SYSCHAR message
|
||||||
|
FillChar(CharMsg, SizeOf(CharMsg), 0);
|
||||||
|
if (GetCurrentKeyModifiers and optionKey)>0 then
|
||||||
|
CharMsg.Msg := LM_SYSCHAR
|
||||||
|
else
|
||||||
|
CharMsg.Msg := LM_CHAR;
|
||||||
|
CharMsg.KeyData := GetCarbonMsgKeyState;
|
||||||
|
CharMsg.CharCode := GetCharacterCode;
|
||||||
|
|
||||||
|
// Msg is set in the Appropriate HandleKeyxxx procedure
|
||||||
|
if DeliverMessage(Info^.LCLObject, CharMsg) = 0 then begin
|
||||||
|
Result := EventNotHandledErr;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
// the LCL does not want the event propagated
|
||||||
|
Result := noErr;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Msg: record
|
||||||
|
Message: TLMessage;
|
||||||
|
Extra: array[0..20] of Byte; // some messages are a bit larger, make some room
|
||||||
|
end;
|
||||||
|
EventKind: UInt32;
|
||||||
|
Root: ControlRef;
|
||||||
|
begin
|
||||||
|
FillChar(Msg, SizeOf(Msg), 0);
|
||||||
|
|
||||||
|
GetRootControl(AWindowInfo^.Widget, Root);
|
||||||
|
Control := nil;
|
||||||
|
//HIViewGetViewForMouseEvent(Root, AEvent, Control);
|
||||||
|
if Control = nil
|
||||||
|
then Control := Root;
|
||||||
|
|
||||||
|
// if a control other than root is found, send the message
|
||||||
|
// to the control instead of the window
|
||||||
|
// if a lower control without widgetInfo is found, use its parent
|
||||||
|
Info := nil;
|
||||||
|
while Control <> Root do
|
||||||
|
begin
|
||||||
|
Info := GetWidgetInfo(Pointer(Control));
|
||||||
|
if Info <> nil then Break;
|
||||||
|
Control := HIViewGetSuperview(Control);
|
||||||
|
end;
|
||||||
|
if (Info = nil) or (Control = Root)
|
||||||
|
then Info := AWindowInfo;
|
||||||
|
|
||||||
|
EventKind := GetEventKind(AEvent);
|
||||||
|
case EventKind of
|
||||||
|
kEventRawKeyDown: HandleRawKeyDownEvent;
|
||||||
|
else
|
||||||
|
exit(EventNotHandledErr);
|
||||||
|
end;
|
||||||
|
|
||||||
|
if Msg.Message.Msg=0 then
|
||||||
|
exit(EventNotHandledErr);
|
||||||
|
|
||||||
|
// Msg is set in the Appropriate HandleKeyxxx procedure
|
||||||
|
if DeliverMessage(Info^.LCLObject, Msg) = 0 then begin
|
||||||
|
Result := EventNotHandledErr; //CallNextEventHandler(ANextHandler, AEvent);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
// the LCL does not want the event propagated
|
||||||
|
Result := noErr;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
// C L A S S
|
// C L A S S
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
@ -358,6 +594,7 @@ procedure TCarbonPrivateWindow.RegisterEvents(AInfo: PWidgetInfo);
|
|||||||
var
|
var
|
||||||
MouseSpec: array [0..6] of EventTypeSpec;
|
MouseSpec: array [0..6] of EventTypeSpec;
|
||||||
TmpSpec: EventTypeSpec;
|
TmpSpec: EventTypeSpec;
|
||||||
|
KeySpecs: array[0..2] of EventTypeSpec;
|
||||||
begin
|
begin
|
||||||
TmpSpec := MakeEventSpec(kEventClassWindow, kEventWindowClose);
|
TmpSpec := MakeEventSpec(kEventClassWindow, kEventWindowClose);
|
||||||
InstallWindowEventHandler(AInfo^.Widget,
|
InstallWindowEventHandler(AInfo^.Widget,
|
||||||
@ -387,7 +624,13 @@ begin
|
|||||||
InstallWindowEventHandler(AInfo^.Widget,
|
InstallWindowEventHandler(AInfo^.Widget,
|
||||||
RegisterEventHandler(@CarbonPrivateWindow_MouseProc),
|
RegisterEventHandler(@CarbonPrivateWindow_MouseProc),
|
||||||
7, @MouseSpec[0], Pointer(AInfo), nil);
|
7, @MouseSpec[0], Pointer(AInfo), nil);
|
||||||
|
|
||||||
|
KeySpecs[0].eventClass := kEventClassKeyboard;
|
||||||
|
KeySpecs[0].eventKind := kEventRawKeyDown;
|
||||||
|
|
||||||
|
InstallWindowEventHandler(AInfo^.Widget,
|
||||||
|
RegisterEventHandler(@CarbonPrivateWindow_KeyboardProc),
|
||||||
|
1, @KeySpecs[0], Pointer(AInfo), nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCarbonPrivateWindow.UnregisterEvents;
|
procedure TCarbonPrivateWindow.UnregisterEvents;
|
||||||
|
@ -46,6 +46,8 @@ procedure UnRegisterEventHandler(AHandler: TCarbonWSEventHandlerProc);
|
|||||||
function GetCarbonRect(Left, Top, Width, Height: Integer): FPCMacOSAll.Rect;
|
function GetCarbonRect(Left, Top, Width, Height: Integer): FPCMacOSAll.Rect;
|
||||||
function GetCarbonRect(const ARect: TRect): FPCMacOSAll.Rect;
|
function GetCarbonRect(const ARect: TRect): FPCMacOSAll.Rect;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Dbgs(const ARect: FPCMacOSAll.Rect): string; overload;
|
function Dbgs(const ARect: FPCMacOSAll.Rect): string; overload;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
@ -457,7 +457,23 @@ end;
|
|||||||
|
|
||||||
function TCarbonWidgetSet.GetKeyState(nVirtKey: Integer): Smallint;
|
function TCarbonWidgetSet.GetKeyState(nVirtKey: Integer): Smallint;
|
||||||
begin
|
begin
|
||||||
Result:=inherited GetKeyState(nVirtKey);
|
Result:=0;
|
||||||
|
|
||||||
|
case nVirtKey of
|
||||||
|
VK_MENU:
|
||||||
|
if (GetCurrentKeyModifiers and optionKey)>0 then
|
||||||
|
// the ssAlt/VK_MENU is mapped to optionKey under MacOS
|
||||||
|
Result:=-1;
|
||||||
|
VK_SHIFT:
|
||||||
|
if (GetCurrentKeyModifiers and shiftKey)>0 then
|
||||||
|
Result:=-1;
|
||||||
|
VK_CONTROL:
|
||||||
|
if (GetCurrentKeyModifiers and cmdKey)>0 then
|
||||||
|
// the ssCtrl/VK_CONTROL is mapped to optionKey under MacOS
|
||||||
|
Result:=-1;
|
||||||
|
else
|
||||||
|
debugln('TCarbonWidgetSet.GetKeyState TODO ',dbgs(nVirtkey));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCarbonWidgetSet.GetObject(GDIObj: HGDIOBJ; BufSize: Integer;
|
function TCarbonWidgetSet.GetObject(GDIObj: HGDIOBJ; BufSize: Integer;
|
||||||
|
@ -397,7 +397,7 @@ type
|
|||||||
|
|
||||||
TLMKey = record
|
TLMKey = record
|
||||||
Msg: Cardinal;
|
Msg: Cardinal;
|
||||||
CharCode: Word;
|
CharCode: Word; // VK_XXX constants as TLMKeyDown/Up, ascii if TLMChar
|
||||||
Unused: Word;
|
Unused: Word;
|
||||||
{$ifdef cpu64}
|
{$ifdef cpu64}
|
||||||
Unused2 : Longint;
|
Unused2 : Longint;
|
||||||
@ -583,7 +583,7 @@ type
|
|||||||
PLMMouseEvent = ^TLMMouseEvent;
|
PLMMouseEvent = ^TLMMouseEvent;
|
||||||
TLMMouseEvent = record
|
TLMMouseEvent = record
|
||||||
Msg : Cardinal;
|
Msg : Cardinal;
|
||||||
Button : LongInt;
|
Button : LongInt; // as TMouseButton, 1=left, 2=right, 3=middle
|
||||||
WheelDelta : Longint; { -1 for up, 1 for down }
|
WheelDelta : Longint; { -1 for up, 1 for down }
|
||||||
State : TShiftState;
|
State : TShiftState;
|
||||||
X : Integer;
|
X : Integer;
|
||||||
|
@ -3057,13 +3057,13 @@ var
|
|||||||
{$endif}
|
{$endif}
|
||||||
begin
|
begin
|
||||||
{$IFDEF FPC_BIG_ENDIAN}
|
{$IFDEF FPC_BIG_ENDIAN}
|
||||||
if SizeOf(e)=10 then begin
|
{$IFDEF FPC_HAS_TYPE_EXTENDED}
|
||||||
ReverseBytes(@e,10);
|
ReverseBytes(@e,10);
|
||||||
Write(e,10);
|
Write(e,10);
|
||||||
end else begin
|
{$ELSE}
|
||||||
ConvertEndianBigDoubleToLRSExtended(@e,@LRSExtended);
|
ConvertEndianBigDoubleToLRSExtended(@e,@LRSExtended);
|
||||||
Write(LRSExtended,10);
|
Write(LRSExtended,10);
|
||||||
end;
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Write(e,10);
|
Write(e,10);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user