Recent

Author Topic: Cocoa - content mirrored or upside down  (Read 564 times)

dbannon

  • Hero Member
  • *****
  • Posts: 1294
    • tomboy-ng, a rewrite of the classic Tomboy
Cocoa - content mirrored or upside down
« on: January 27, 2021, 06:20:12 am »
I have seen a few references to a problem like this but none so bad as mine (everyone thinks they are worse off ...)

Using FPC3.2.0, Lazarus Trunk (yesterdays and a month old one), Mac Sierra. 10.12

Yesterday, doing some normal pre-release testing of my app, this time on the Sierra box, one of my forms is partially mirrored, content that should be near the bottom, appears at the top. And flipped upside down and left to right. A real mess. Its like that in the designer and at run time, in design mode, I click down where I know a component should be to select it up where it is !  I see text displayed in the flipped components that belong in another component !

I had recently upgraded to FPC320 and suspected the Lazarus rebuild, but even going back to Laz 2.0.10 has a similar problem, but only at run time. I even went back to FPC304 but problem remained.

This form displays fine on  GTK2, Qt5, Windows and even Carbon but in Cocoa, its terrible.

I believe it may relate to having a couple of panels, one above the other, anchored together, so by setting height to '1', they appear to disappear.

I can duplicate the problem, or something close to it (??!) in a simple one form app but I need to drop a KMemo (from Kcontrols) on the form.  I have not posted that demo as few people will have KControls installed. Its an easy install from Online Package Manager (thank GetMem!) if anyone is interested.

I have seen a few other posts from people, all working with MacOS, with things being upside down, mirrored etc. Anyone have any ideas about this particular ugly problem ?

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

jwdietrich

  • Hero Member
  • *****
  • Posts: 1170
    • formatio reticularis
Re: Cocoa - content mirrored or upside down
« Reply #1 on: January 27, 2021, 10:12:31 pm »
This reminds me of a very similar issue that Lazarus and some programs written with Lazarus have with Reactos.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.12 | FPC 3.2.0 | PPC, Intel, ARM | macOS, Windows, Linux

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1279
  • Former Delphi 1-7, 10.2 User
Re: Cocoa - content mirrored or upside down
« Reply #2 on: January 27, 2021, 10:41:15 pm »
Similar issue here: https://forum.lazarus.freepascal.org/index.php/topic,41623.0.html

I also encountered it in Lazarus 2.0.6 when using the lhelp recently  - the table of contents window had the entries at the bottom and they were upside down until clicked on, after which they went to the top and the right way up. Tested OK in 2.0.10 and trunk.
Lazarus 2.1 r64368 FPC 3.3.1 r48100 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.1 r64455 3.3.1 r48688  macOS 11.2 aarch64 Xcode 12.4
Lazarus 2.1 r61574 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 3.2.0 Win10 Parallels VM

AL

  • Full Member
  • ***
  • Posts: 217
Re: Cocoa - content mirrored or upside down
« Reply #3 on: January 28, 2021, 12:59:29 am »
I had a similar issue.
I found that using a speedbutton on my form was causing that.  The flip (or fold) happened exactly where the speedbutton was placed.
I removed that speedbutton and the problem went away.
Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

dbannon

  • Hero Member
  • *****
  • Posts: 1294
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Cocoa - content mirrored or upside down
« Reply #4 on: January 28, 2021, 08:47:44 am »
Yes, interesting.  I cannot replicate it with Speedbuttons, I think it involves the 'right' interaction, probably via anchors, between particular components.  It must be easier on average to avoid than to demonstrate but its obvious affecting a wide range of components.

Would there be any point in me putting together a minimalist project to demo it ?  If, as I suspect, it has to use KMemo ?

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

AL

  • Full Member
  • ***
  • Posts: 217
Re: Cocoa - content mirrored or upside down
« Reply #5 on: January 28, 2021, 06:59:21 pm »
I also was not able to replicate in a new project. But removing that speedbutton surely solved my problem
Probably  it involve like you said, anchors or a combination of some other positionning parameters.   
Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2562
    • havefunsoft.com
Re: Cocoa - content mirrored or upside down
« Reply #6 on: January 31, 2021, 07:03:18 am »
Anyone have any ideas about this particular ugly problem ?
it has been haunting CocoaWS from the start.
I do believe that it is related to the fact LCL mirrors the cocoa drawing context to save on recalculations for each drawing call.

I've just committed r64451, which should cleanup drawing state to keep things clean.
The patch was introduced for a different issue, but could help with the problem you're experiencing.

If you've an easy way to replicate the problem, please test the latest trunk.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

dbannon

  • Hero Member
  • *****
  • Posts: 1294
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Cocoa - content mirrored or upside down
« Reply #7 on: February 01, 2021, 10:08:29 am »
 skalogryz, thanks for jumping in, a great relief.

I will most certainly test but right now, I am flat out getting an app ready before the Debian Bullseye freeze in a few days.  So, hope you don't mind, I will most certainly test your update as soon as I can. A few days is absolutely no indication I am not interested !

Thanks, Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

dbannon

  • Hero Member
  • *****
  • Posts: 1294
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Cocoa - content mirrored or upside down
« Reply #8 on: February 06, 2021, 11:25:56 am »
skalogryz, sorry for the delay, utf8 issues elsewhere !

Anyway, I just updated the Lazarus Trunk on my Mac, its using FPC320, and I am afraid the problem is still there.  In my case, very repeatable if I have a KMemo on a form.

So, I tried poking around, I have been using KMemo on the Mac for some time now, not seen this problem before so assumed it has to be triggered by something (other than just adding a KMemo to the form).  The one thing that seems to affect it is the Z-Order. 

Now, no definition of just what Z-Order is can be found (by me) but seems to relate to the order controls are created in time ?  Sure you know.... 

If I can help any way to clarify this, please let me know.

Incidentally, KMemo is an easy Online Package Manager install. :-)

Davo


Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

 

TinyPortal © 2005-2018