Missing $IFDEF in gtk2 for MacOS

Summary

Compile error for gtk2 on MacOS

System Information

  • Operating system: MacOS
  • Processor architecture: unrelated
  • Compiler version: 3.2.2
  • Device: unrelated

Steps to reproduce

Create a project that uses gtk2, and try compiling on MacOS

Example Project

What is the current bug behavior?

Compiler complains that FWSFrameRect is not known when compiling gtk2widgetset.inc.

What is the expected (correct) behavior?

It should compile. ;-)

Relevant logs and/or screenshots

FWSFrameRect appears to be relevant for X11 environments, so it is created inside an $IFDEF HASX. MacOS doesn't use HASX, so trying to access it fails.

Possible fixes

--- share/lazarus/lcl/interfaces/gtk2/gtk2widgetset.in~ 2022-01-02 11:01:25
+++ share/lazarus/lcl/interfaces/gtk2/gtk2widgetset.inc 2023-05-27 22:53:34
@@ -1055,7 +1055,9 @@
   FMainPoll := nil;
   if not FIsLibraryInstance then
   begin
+{$IFDEF HASX}
     FWSFrameRect := Rect(0, 0, 0, 0);
+{$ENDIF}
     Gtk2MPF := g_main_context_get_poll_func(g_main_context_default);
     g_main_context_set_poll_func(g_main_context_default, @Gtk2PollFunction);
   end else
Edited by Joerg Wunsch