Recent

Author Topic: Cocoa - How to get started with helping?  (Read 36880 times)

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Cocoa - How to get started with helping?
« on: December 25, 2017, 05:48:12 pm »
Merry Christmas to all ...  :)


I've been using Lazarus for several years now, mostly under MacOS, which limits me to the Carbon widget-set and 32 bit applications.
With Apple's move to 64 bit / Cocoa, I think it's time Lazarus should be doing so as well.
Easier said than done of course, a lot of work still needs to be done, and a lot of work has already been done on the Cocoa widget-set (all respect for that!).


Note worthy is the very awesome bounty placed by Herman (see this bounty and this forum post)
I'd be more than happy to chip in financially, but I'm just an amateur developer and my pockets are not very deep.


Since I'm no expert developer (I just do this for fun), I was wondering how we (Mac users) can do to help in other ways.
Obviously there is the bug reporting, but with the current state of Cocoa I do not even know where to begin since almost every visual component is placed incorrectly on a form. So should I list all the affected visual components in a bug report?


Just a few things I've tested:


1) Compile the IDE with the Cocoa widget set.


I'm aware that, since Cocoa in in Alpha stage, this will be problematic - so what I'm seeing is as expected.
When compiling with Cocoa and 64 bit, compilation simply fails (make clean all).


Code: Pascal  [Select][+][-]
  1. lazarus.pp(57,3) Fatal: Cannot find Interfaces used by Lazarus, incompatible ppu=/Users/hans/freepascal/lazarus/lcl/units/x86_64-darwin/cocoa/interfaces.ppu, package LCL


When leaving the CPU target to default (i386 I presume) however the IDE does compile ... well, after I install Quartz since for some reason the linker seems to require a X11 library.


After installing Quartz (still confused why this is needed) the IDE compiles fine, but starts with a few problems:
  • The menu is gone, the menu is simply not there,
  • Selecting components on a form is challenging at best, and does not show that they are selected,
  • Moving and positing visual components is pretty much undoable,
  • Object Inspector isn't doing all that well (to be expected),
  • the component window is not heigh enough to show the icons of the components.
2) Compiling applications with 64bit and Cocoa.


When compiling applications, with a Carbon IDE, the biggest hurdle is that the form doesn't come out as designed. Pretty much every visual component looks different and seems placed different than designed.
Designing a form with the IDE compiled with Cocoa will compile in the same looking result but ... it's very challenging to place and move components on the form, and when moving the code to another platform (for example Windows) things become a mess. When comparing Carbon vs Windows vs Linux then the form design is pretty much the same. Cocoa however makes a mess out of it.


Having listed all this, I'm wanting to help a hand, but I'm a little stuck in what to do.
Should I report all misplaced components (in one report or in individual bug reports)?
Should I report that Lazarus seems to need X11 to be able to compile with Cocoa?
Is the missing menu related to X11 or is this a bug?


I'm sure other Mac users are eager to get Cocoa to work. If we work together then maybe we can make some progress ...

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Cocoa - How to get started with helping?
« Reply #1 on: December 25, 2017, 07:15:21 pm »
I'm sure other Mac users are eager to get Cocoa to work. If we work together then maybe we can make some progress ...

I hadn't looked at Lazarus since maybe July of last summer and after seeing your post thought this would be a good time to review where it's at with Mac.

I had no trouble building Lazarus against Cocoa widgetset. Here's the instructions I wrote up last summer in conjunction with the TWebBrowser control:

https://macpgmr.github.io/MacXPlatform/UsingCocoaFromTrunk.html

Cocoa doesn't have anything to do with any X server, so you've got something else going on with your setup. I haven't had an X server installed on my Mac for years. What do you need XQuartz for?

I think some of the problems you're seeing are just Lazarus and the incomplete Cocoa widgetset, not XQuartz. Certainly the IDE built with Cocoa seems worse than it was last summer.

Bug reporting for something like Cocoa in its current state could end up being a black hole, sucking up every available moment of your free time, so maybe just concentrating on bugs that directly affect your apps would be a place to start. I wouldn't bother with trying to use Lazarus itself built against Cocoa. Just use an IDE built against Carbon and then build your apps against Cocoa.

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #2 on: December 25, 2017, 09:14:39 pm »
Thanks Phil!


I'll follow you instructions to compile the IDE. I have no clue why "ld" was asking for the X11 library, it just did, made no sense to me either.
I did get the the latest from svn trunk (just recompiled it with your instructions and that worked! Thanks!).


As for developing Cocoa apps in a Carbon IDE: for some off reason (and this has been like this for a long time, even along several different Mac's that I have used for Lazarus) the design of a TForm under Carbon gives a very different result when compiled for Cocoa. Components are in the wrong position, different height/width, etc. Quite messy. That's why I was hoping that designing with a Cocoa IDE would make this more workable (obviously not a permanent solution since recompiling it under Windows or Linux requires me to completely reorganize the design).



With this post/question I was hoping I could get something started to get MacOS developers to get more involved as well.
Naturally, if everybody just sits back and waits for a miracle to happen, nothing will get done  :D
(no pun intended to those who actively work on Cocoa and Cocoa bug fixing!)


p.s. when you compiled the IDE with the Cocoa widget set - did you miss the menu as well?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Cocoa - How to get started with helping?
« Reply #3 on: December 26, 2017, 05:57:46 pm »
As for developing Cocoa apps in a Carbon IDE: for some off reason (and this has been like this for a long time, even along several different Mac's that I have used for Lazarus) the design of a TForm under Carbon gives a very different result when compiled for Cocoa. Components are in the wrong position, different height/width, etc. Quite messy. That's why I was hoping that designing with a Cocoa IDE would make this more workable (obviously not a permanent solution since recompiling it under Windows or Linux requires me to completely reorganize the design).

I don't think I see that problem here, although Carbon is now broken on some controls if you try to change the font and font size (bug reported last spring). All fonts are very tiny with Cocoa. This affects control height in some cases. But alignment is generally okay. Bottom line: Both Carbon and Cocoa widgetsets would be completely useless to me if I were still doing desktop app development.

Maybe post a bug report for this, although it's probably a combination of things that are broken or incomplete.

With this post/question I was hoping I could get something started to get MacOS developers to get more involved as well.

Quite frankly, I doubt if there are very many Mac users of Lazarus left. They've emigrated.

p.s. when you compiled the IDE with the Cocoa widget set - did you miss the menu as well?

Correct, no Lazarus menus at all. That was working last summer.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Cocoa - How to get started with helping?
« Reply #4 on: December 26, 2017, 07:41:24 pm »
Gentlemen! are there particular examples the Cocoa issues described? with screenshots?

ChrisR

  • Full Member
  • ***
  • Posts: 247
Re: Cocoa - How to get started with helping?
« Reply #5 on: December 26, 2017, 08:48:46 pm »
The Cocoa widgetset has seen rapid strides over the last month - Dmitry has been applying a lot of patches, and Herman has provided strong incentive. To help, I think it is important to
  1.) be on the latest SVN (as of today, Lazarus 1.9.0 56850) -
  2.) Run "svn update" to stay on the latest version -
if SVN updates any files in lcl/interfaces/cocoa/ you will want to delete your /lazarus/lcl/units folder to force the widgetset to be recompiled.
 3.) If you have any problems, report it on
   https://bugs.freepascal.org/my_view_page.php
Make sure you check that you are not reporting a bug that already exists (in the search page, set the "widgetset" to be "cocoa").
 4.) I agree, there have been a few regressions in building the IDE relative to this summer (e.g. menus are missing, scrollbars missing in the source editor), but it does seem to be coming together for smaller projects. These have been reported, e.g. https://bugs.freepascal.org/view.php?id=32424
« Last Edit: December 26, 2017, 08:57:45 pm by ChrisR »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Cocoa - How to get started with helping?
« Reply #6 on: December 26, 2017, 09:04:56 pm »
Gentlemen! are there particular examples the Cocoa issues described? with screenshots?

The project included with this bug report from last May illustrates both Carbon and Cocoa problems:

https://bugs.freepascal.org/view.php?id=31912

On Carbon, some fonts are too small. Now on Cocoa all fonts are too small (new problem that wasn't present in May on Cocoa).

Carbon bug reported here is also still present:

https://bugs.freepascal.org/view.php?id=31908

Also, I see a tabbing problem on Cocoa too: jumps two controls instead of only one.

Laz SVN r56850. FPC 3.0.2. OS X 10.11.6 (El Capitan).

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Cocoa - How to get started with helping?
« Reply #7 on: December 26, 2017, 09:24:25 pm »
Also, I see a tabbing problem on Cocoa too: jumps two controls instead of only one.
very interesting.
Any local changes to cocoa widgetset?

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #8 on: December 27, 2017, 02:14:15 am »
Running SVN 56852.


When compiling the IDE with Cocoa


- Menu gone (reported in bugtracker)
- Component Window height incorrect (and height can't be changed) - component icons only partially visible (also reported in bugtracker)


Compiled with:


Code: Pascal  [Select][+][-]
  1. make LCL_PLATFORM=cocoa CPU_TARGET=x86_64


Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #9 on: December 27, 2017, 03:35:43 am »
Gentlemen! are there particular examples the Cocoa issues described? with screenshots?


First off all, all respect for all that do such a great job on Lazarus and Cocoa of course.
I'd be more than happy to provide as much as I can! Thanks for asking!  :)


IDE compiled with Cocoa;


I'd consider this less of an issue if I could develop reliably in a Carbon compiled IDE.
It's kind-a hard to take a screenshot when something doesn't happen, so the first issue (IDE compiled with Cocoa) is that I cannot select items on a form.
- some virtual component cannot be selected at all (buttons - they act like they are working in runtime),
- some components can't be selected (TListbox on a TTabSheet)
- Can't resize components (tried button, TImage, TListbox, TPageControl, TLabel) - can however manually type the values in the object inspector.


Cocoa applications build in a Carbon IDE;


So far the biggest issues seems [/size](design Carbon vs Runtime Cocoa)[/size][size=78%];[/size]
- font size not matching
- PaceControls height does not match
- Aligning something in a PageControl (will test others soon) is going goofy
- buttons height does not change


See screenshot (apologies for the poor JPEG compression - the file was larger than the allowed 250Kb).

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #10 on: December 27, 2017, 03:53:38 am »
Anchor problem might be PageControl specific, but as you can see in the screenshots, the different button/font/listbox size can make runtime design challenging.


Is this helpful?
I'd be more than happy to do more experiments.

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #11 on: December 27, 2017, 03:55:31 am »
Forgot to mention;


I usually design an application on my Mac (Carbon) and move the code then to Windows and Linux.
I rarely have to change anything form design wise (just when components get real close to ach other).


When designing in Carbon, the Cocoa result is not so great ...
I'm afraid if I start designing in a Cocoa IDE that bringing the code to other platforms will not be good.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Cocoa - How to get started with helping?
« Reply #12 on: December 27, 2017, 03:58:13 am »
1) awesome samples! could you please share project source?
2) could you also provide  a screenshot of the same projects compiled in Windows (and Linux)?

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #13 on: December 27, 2017, 04:12:40 am »
Of course! No problem - anything I can do to help.


I'll have to post the code in 2 posts, because of the upload limitations of the forum.


Note: I created these projects in a Carbon IDE targeting 64 bit and Cocoa.
A Cocoa IDE would not even let me create a new project since the menu is gone. Menu gone also means keyboard shortcuts gone  :(

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #14 on: December 27, 2017, 04:13:05 am »
Second example (less significant)

 

TinyPortal © 2005-2018