View Issue Details

IDProjectCategoryView StatusLast Update
0029972LazarusIDEpublic2017-04-08 11:26
ReporterMarcus FernstromAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformMacOSOSXOS VersionEl Capitan
Product Version1.6Product Build 
Target VersionFixed in Version 
Summary0029972: When using magic mouse to scroll horizontally, the IDE and software made in Lazarus scrolls up/down and slowly sideways
DescriptionWhen using magic mouse to scroll horizontally, both the Lazarus IDE and software made with it scrolls up/down and slowly sideways, making it impossible to use horizontal scroll on Mac.
Steps To ReproduceI use the latest Lazarus, 1.6, simply install and write long lines and scroll using magic mouse, or make a project with a memo and do the same.
TagsNo tags attached.
Fixed in Revisionr54555, r54571
LazTarget-
WidgetsetCarbon
Attached Files
  • mac-h.diff (1,009 bytes)
    diff --git a/lcl/interfaces/carbon/carbonprivatewindow.inc b/lcl/interfaces/carbon/carbonprivatewindow.inc
    index 1068fd3..730ca6e 100644
    --- a/lcl/interfaces/carbon/carbonprivatewindow.inc
    +++ b/lcl/interfaces/carbon/carbonprivatewindow.inc
    @@ -85,6 +85,19 @@ const
         Result:=Widget.LCLObject.ScreenToClient(Mouse.CursorPos);
       end;
     
    +  function GetMouseWheelAxisHorz: boolean;
    +  var
    +    Val: EventMouseWheelAxis;
    +  begin
    +    Result := False;
    +    if OSError(
    +      GetEventParameter(AEvent, kEventParamMouseWheelAxis, typeMouseWheelAxis, nil,
    +        SizeOf(Val), nil, @Val),
    +      SName, SGetEvent, 'kEventParamMouseWheelAxis') then Exit;
    +
    +    Result := Val=kEventMouseWheelAxisX;
    +  end;
    +
       function GetMouseWheelDelta: Integer;
       var
         WheelDelta: SInt32;
    @@ -232,6 +245,8 @@ const
         Msg^.Y := MousePoint.Y;
         Msg^.State := GetCarbonShiftState;
         Msg^.WheelDelta := GetMouseWheelDelta;
    +    if GetMouseWheelAxisHorz then
    +      Include(Msg^.State, ssExtra1);
       end;
       
     var
    
    mac-h.diff (1,009 bytes)
  • hyper.diff (722 bytes)
    Index: lcl/interfaces/carbon/carbonprivatewindow.inc
    ===================================================================
    --- lcl/interfaces/carbon/carbonprivatewindow.inc	(revision 54557)
    +++ lcl/interfaces/carbon/carbonprivatewindow.inc	(working copy)
    @@ -245,8 +245,12 @@
         Msg^.Y := MousePoint.Y;
         Msg^.State := GetCarbonShiftState;
         Msg^.WheelDelta := GetMouseWheelDelta;
    +
    +    // ssHyper id in TShiftStateEnum is not used in LCL (almost, only n lines in gtk/gtk2, they not needed).
    +    // Key "Hyper" was on non usual weird keyboard (for sci-fi film?)
    +    // Lets use this id
         if GetMouseWheelAxisHorz then
    -      Include(Msg^.State, ssExtra1);
    +      Include(Msg^.State, ssHyper);
       end;
       
     var
    
    hyper.diff (722 bytes)

Activities

Marcus Fernstrom

2016-04-13 23:17

reporter   ~0092018

No idea how to edit the bug report, but I should have marked it higher than Minor, as you can't use the magic mouse to scroll horizontally, something that very much affects usability for anything that is scrollable horizontally.

CudaText man

2017-03-27 12:18

reporter  

mac-h.diff (1,009 bytes)
diff --git a/lcl/interfaces/carbon/carbonprivatewindow.inc b/lcl/interfaces/carbon/carbonprivatewindow.inc
index 1068fd3..730ca6e 100644
--- a/lcl/interfaces/carbon/carbonprivatewindow.inc
+++ b/lcl/interfaces/carbon/carbonprivatewindow.inc
@@ -85,6 +85,19 @@ const
     Result:=Widget.LCLObject.ScreenToClient(Mouse.CursorPos);
   end;
 
+  function GetMouseWheelAxisHorz: boolean;
+  var
+    Val: EventMouseWheelAxis;
+  begin
+    Result := False;
+    if OSError(
+      GetEventParameter(AEvent, kEventParamMouseWheelAxis, typeMouseWheelAxis, nil,
+        SizeOf(Val), nil, @Val),
+      SName, SGetEvent, 'kEventParamMouseWheelAxis') then Exit;
+
+    Result := Val=kEventMouseWheelAxisX;
+  end;
+
   function GetMouseWheelDelta: Integer;
   var
     WheelDelta: SInt32;
@@ -232,6 +245,8 @@ const
     Msg^.Y := MousePoint.Y;
     Msg^.State := GetCarbonShiftState;
     Msg^.WheelDelta := GetMouseWheelDelta;
+    if GetMouseWheelAxisHorz then
+      Include(Msg^.State, ssExtra1);
   end;
   
 var
mac-h.diff (1,009 bytes)

CudaText man

2017-03-27 12:22

reporter   ~0099248

I need to fix it very much. CudaText needs horz scrolling by Mac trackpad.

Added step 1: mac-h.diff
It adds to Carbon reaction to horiz mouse wheel move, it detects it by using kEventParamMouseWheelAxis.
If scroll is horz, then LCL makes DoMouseWheel, where Shift has item ssExtra1 set.
If scroll usual, ssExtra1 cleared.

My demo detects horz scroll in Memo1.OnMouseWheel by (ssExtra1 in Shift).

CudaText man

2017-04-05 14:09

reporter   ~0099386

Can you apply it?

Juha Manninen

2017-04-07 11:48

developer   ~0099457

I applied it without testing so it will not be ignored longer.
We will hear from other Mac users if there is a problem.

CudaText man

2017-04-07 13:12

reporter   ~0099464

Okay. I see LCL parts where ssExtra1 used (this pch sets it).
here:
function KeysToShiftState(Keys: PtrUInt): TShiftState;
begin
  Result := [];
  if Keys and MK_Shift <> 0 then Include(Result, ssShift);
  if Keys and MK_Control <> 0 then Include(Result, ssCtrl);
  if Keys and MK_LButton <> 0 then Include(Result, ssLeft);
  if Keys and MK_RButton <> 0 then Include(Result, ssRight);
  if Keys and MK_MButton <> 0 then Include(Result, ssMiddle);
  if Keys and MK_XBUTTON1 <> 0 then Include(Result, ssExtra1);
  if Keys and MK_XBUTTON2 <> 0 then Include(Result, ssExtra2);

and in back function.
So ssExtra1 using not ok with XButton1 mouses. Mac mouses dont have XButton1.

CudaText man

2017-04-07 14:12

reporter   ~0099466

Last edited: 2017-04-07 14:13

View 2 revisions

Found ssHyper item on TShiftStateEnum. Can i use it here and fix this diff?
ssHyper used only in gtk/gtk2 in 4 lines. Key "Hyper" not exists on pc

ps. key "Hyper" exists only here
https://upload.wikimedia.org/wikipedia/commons/4/47/Space-cadet.jpg

CudaText man

2017-04-07 20:37

reporter  

hyper.diff (722 bytes)
Index: lcl/interfaces/carbon/carbonprivatewindow.inc
===================================================================
--- lcl/interfaces/carbon/carbonprivatewindow.inc	(revision 54557)
+++ lcl/interfaces/carbon/carbonprivatewindow.inc	(working copy)
@@ -245,8 +245,12 @@
     Msg^.Y := MousePoint.Y;
     Msg^.State := GetCarbonShiftState;
     Msg^.WheelDelta := GetMouseWheelDelta;
+
+    // ssHyper id in TShiftStateEnum is not used in LCL (almost, only n lines in gtk/gtk2, they not needed).
+    // Key "Hyper" was on non usual weird keyboard (for sci-fi film?)
+    // Lets use this id
     if GetMouseWheelAxisHorz then
-      Include(Msg^.State, ssExtra1);
+      Include(Msg^.State, ssHyper);
   end;
   
 var
hyper.diff (722 bytes)

CudaText man

2017-04-07 20:38

reporter   ~0099480

@Juha
For the last comment,
hyper.diff

Juha Manninen

2017-04-08 11:26

developer   ~0099497

Applied. Resolving again.

Issue History

Date Modified Username Field Change
2016-04-05 22:10 Marcus Fernstrom New Issue
2016-04-13 23:17 Marcus Fernstrom Note Added: 0092018
2017-03-27 12:18 CudaText man File Added: mac-h.diff
2017-03-27 12:22 CudaText man Note Added: 0099248
2017-04-05 14:09 CudaText man Note Added: 0099386
2017-04-07 11:44 Juha Manninen Assigned To => Juha Manninen
2017-04-07 11:44 Juha Manninen Status new => assigned
2017-04-07 11:48 Juha Manninen Fixed in Revision => r54555
2017-04-07 11:48 Juha Manninen LazTarget => -
2017-04-07 11:48 Juha Manninen Note Added: 0099457
2017-04-07 11:48 Juha Manninen Status assigned => resolved
2017-04-07 11:48 Juha Manninen Resolution open => fixed
2017-04-07 13:12 CudaText man Note Added: 0099464
2017-04-07 14:12 CudaText man Note Added: 0099466
2017-04-07 14:13 CudaText man Note Edited: 0099466 View Revisions
2017-04-07 20:37 CudaText man File Added: hyper.diff
2017-04-07 20:38 CudaText man Note Added: 0099480
2017-04-08 11:03 Juha Manninen Status resolved => assigned
2017-04-08 11:03 Juha Manninen Resolution fixed => reopened
2017-04-08 11:26 Juha Manninen Fixed in Revision r54555 => r54555, r54571
2017-04-08 11:26 Juha Manninen Note Added: 0099497
2017-04-08 11:26 Juha Manninen Status assigned => resolved
2017-04-08 11:26 Juha Manninen Resolution reopened => fixed