Forráskód Böngészése

pseudo attribute hover

mattias 1 éve
szülő
commit
851900f642

+ 1 - 0
demo/Button/ButtonSkia.lpr

@@ -6,6 +6,7 @@ uses
   Fresnel.App, MainUnit;
 
 begin
+  FresnelApplication.HookFresnelLog:=true;
   FresnelApplication.Initialize;
   FresnelApplication.CreateForm(TMainForm,MainForm);
   FresnelApplication.Run;

+ 12 - 8
demo/Button/MainUnit.pas

@@ -68,14 +68,18 @@ end;
 
 procedure TMainForm.MainFormCreate(Sender: TObject);
 begin
-  Div1.Style:=
-     'background:#44c767;'
-    +'border-width:7px;'
-    +'border-color:#18ab29;'
-    +'padding:16px 31px;'
-    +'font-size:15px; font-family:Arial; font-weight:bold;'
-    +'text-shadow: 0 1 0 #333;'
-    +'color:#fff;';
+  Stylesheet.Add('div {'
+    +'  background:#44cc66;'
+    +'  border:7px solid #18ab29;'
+    +'  padding:16px 31px;'
+    +'  font-size:15px; font-family:Arial; font-weight:bold;'
+    +'  text-shadow: 0 1 0 #333;'
+    +'  color:#fff;'
+    +'}'
+    +'div:hover {'
+    +'  background:#88bb22;'
+    +'};');
+  Div1.Style:='';
 end;
 
 end.

+ 102 - 41
src/base/fresnel.dom.pas

@@ -361,21 +361,12 @@ type
   { TFresnelElement }
 
   TFresnelElement = class(TFresnelComponent, ICSSNode, IFPObserver, IFresnelRenderable)
-  private
-    function GetCSSPseudoClass(Pseudo: TFresnelCSSPseudoClass): boolean;
-    function GetNodeCount: integer;
-    function GetNodes(Index: integer): TFresnelElement;
-    function GetCSSElAttribute(Attr: TFresnelCSSAttribute): string;
-    function GetCSSElComputedAttribute(Attr: TFresnelCSSAttribute): string;
-    procedure SetCSSElComputedAttribute(Attr: TFresnelCSSAttribute; AValue: string);
-    function GetCSSRenderedAttribute(Attr: TFresnelCSSAttribute): string;
-    procedure SetCSSRenderedAttribute(Attr: TFresnelCSSAttribute; const AValue: string
-      );
   private
     FAfterRender: TNotifyEvent;
     FBeforeRender: TNotifyEvent;
     FDOMIndex: integer;
     FFont: IFresnelFont;
+    FHover: boolean;
     FLayoutNode: TFresnelLayoutNode;
     FFontDesc: TFresnelFontDesc;
     FFontDescValid: boolean;
@@ -385,6 +376,14 @@ type
     // Todo: change to dictionary to reduce mem footprint
     FStandardEvents : Array[0..evtLastEvent] of TEventHandlerItem;
     FEventDispatcher : TFresnelEventDispatcher;
+    function GetNodeCount: integer;
+    function GetNodes(Index: integer): TFresnelElement;
+    function GetCSSElAttribute(Attr: TFresnelCSSAttribute): string;
+    function GetCSSElComputedAttribute(Attr: TFresnelCSSAttribute): string;
+    procedure SetCSSElComputedAttribute(Attr: TFresnelCSSAttribute; AValue: string);
+    function GetCSSRenderedAttribute(Attr: TFresnelCSSAttribute): string;
+    procedure SetCSSRenderedAttribute(Attr: TFresnelCSSAttribute; const AValue: string
+      );
     function GetEventHandler(AIndex: Integer): TFresnelEventHandler;
     function GetFocusEventHandler(AIndex: Integer): TFresnelFocusEventHandler;
     function GetMouseEventHandler(AIndex: Integer): TFresnelMouseEventHandler;
@@ -461,8 +460,10 @@ type
     procedure SetComputedCSSValue(AttrID: TCSSNumericalID; const Value: TCSSString); virtual;
     procedure SetCSSClasses(const AValue: TStrings); virtual;
     procedure SetParent(const AValue: TFresnelElement); virtual;
-    procedure SetStyle(const AValue: string); virtual;
+    procedure SetStyle(AValue: string); virtual;
     procedure SetStyleElements(const AValue: TCSSElement); virtual;
+    function GetCSSPseudoClass(Pseudo: TFresnelCSSPseudoClass): boolean;
+    procedure SetCSSPseudoClass(Pseudo: TFresnelCSSPseudoClass; const AValue: boolean);
     class constructor InitFresnelElementClass;
     class destructor FinalFresnelElementClass;
     class function RegisterCSSType(const aName: string): TCSSNumericalID;
@@ -487,6 +488,7 @@ type
   protected
     procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
     procedure SetParentComponent(Value: TComponent); override;
+    procedure ChildDestroying(El: TFresnelElement); virtual;
     procedure DoRender({%H-}aRenderer: IFresnelRenderer); virtual;
     { IFResnelRenderable }
     Procedure BeforeRender;
@@ -548,7 +550,7 @@ type
     property CSSComputedAttribute[Attr: TFresnelCSSAttribute]: string read GetCSSElComputedAttribute write SetCSSElComputedAttribute;
     class property FresnelElementBaseAttrID: TCSSNumericalID read FFresnelElementBaseAttrID;
     // CSS pseudo classes
-    property CSSPseudoClass[Pseudo: TFresnelCSSPseudoClass]: boolean read GetCSSPseudoClass;
+    property CSSPseudoClass[Pseudo: TFresnelCSSPseudoClass]: boolean read GetCSSPseudoClass write SetCSSPseudoClass;
     class property FresnelElementBasePseudoID: TCSSNumericalID read FFresnelElementBasePseudoID;
     // layouter
     function GetMaxWidthIntrinsicContentBox: TFresnelLength; virtual; // this element, excluding children, ignoring max-width
@@ -670,6 +672,7 @@ type
     function AllocateFont(const Desc: TFresnelFontDesc): IFresnelFont; virtual;
     function GetCSSInitialAttribute(const AttrID: TCSSNumericalID): TCSSString; override;
     function GetElementAt(const x, y: TFresnelLength): TFresnelElement; virtual;
+    function GetElementsAt(const x, y: TFresnelLength): TFresnelElementArray; virtual;
     function ContentToPagePos(El: TFresnelElement; const x, y: TFresnelLength): TFresnelPoint; virtual; // content box of El to content of viewport
     function PageToContentPos(El: TFresnelElement; const x, y: TFresnelLength): TFresnelPoint; virtual; // content of viewport to content box of El
     property DPI[IsHorizontal: boolean]: TFresnelLength read GetDPI write SetDPI;
@@ -1392,6 +1395,36 @@ begin
   Result:=Check(LayoutNode,0,0);
 end;
 
+function TFresnelViewport.GetElementsAt(const x, y: TFresnelLength
+  ): TFresnelElementArray;
+
+  procedure Check(Node: TFresnelLayoutNode; const dx, dy: TFresnelLength);
+  var
+    El: TFresnelElement;
+    i: Integer;
+    BorderBox: TFresnelRect;
+    aContentOffset: TFresnelPoint;
+  begin
+    if Node=nil then exit;
+    El:=Node.Element;
+    if not El.Rendered then exit;
+    if Node.NodeCount>0 then begin
+      aContentOffset:=El.RenderedContentBox.TopLeft;
+      for i:=Node.NodeCount-1 downto 0 do
+        Check(Node.Nodes[i],dx+aContentOffset.X,dy+aContentOffset.Y);
+    end;
+    BorderBox:=El.RenderedBorderBox;
+    if BorderBox.Contains(x-dx,y-dy) then
+    begin
+      System.Insert(El,Result,length(Result));
+    end;
+  end;
+
+begin
+  Result:=[];
+  Check(LayoutNode,0,0);
+end;
+
 function TFresnelViewport.ContentToPagePos(El: TFresnelElement; const x,
   y: TFresnelLength): TFresnelPoint;
 var
@@ -1456,10 +1489,23 @@ function TFresnelElement.GetCSSPseudoClass(Pseudo: TFresnelCSSPseudoClass
 begin
   Result:=false;
   case Pseudo of
-    fcpcHover: ;
+    fcpcHover: Result:=FHover;
   end;
 end;
 
+procedure TFresnelElement.SetCSSPseudoClass(Pseudo: TFresnelCSSPseudoClass;
+  const AValue: boolean);
+begin
+  case Pseudo of
+    fcpcHover:
+      begin
+        if FHover=AValue then exit;
+        FHover:=AValue;
+      end;
+  end;
+  DomChanged;
+end;
+
 function TFresnelElement.GetNodeCount: integer;
 begin
   Result:=FChildren.Count;
@@ -2586,7 +2632,6 @@ begin
   aOffsetX:='';
   aOffsetY:='';
   aRadius:='';
-  writeln('AAA1 TFresnelElement.CheckCSSTextShadow START ',AValue);
   for i:=1 to 4 do
   begin
     s:=CSSReadNextValue(AValue,p);
@@ -2795,42 +2840,50 @@ begin
   end;
 end;
 
-procedure TFresnelElement.SetStyle(const AValue: string);
+procedure TFresnelElement.SetStyle(AValue: string);
 var
   ss: TStringStream;
   aParser: TCSSParser;
   NewStyleElements: TCSSElement;
 begin
+  AValue:=Trim(AValue);
   if FStyle=AValue then Exit;
   FStyle:=AValue;
   aParser:=nil;
-  ss:=TStringStream.Create(Style);
-  try
-    NewStyleElements:=nil;
-    aParser:=TCSSParser.Create(ss);
+  NewStyleElements:=nil;
+  if Style='' then
+  begin
+    if FStyleElements=nil then
+      exit;
+    FreeAndNil(FStyleElements);
+  end else begin
+    ss:=TStringStream.Create(Style);
     try
-      NewStyleElements:=aParser.ParseInline;
-    except
-      on CSSE: ECSSException do begin
-        DoLog(etError,'TFresnelElement.SetStyle '+Name+':'+ClassName+' '+CSSE.Message);
-        exit;
+      aParser:=TCSSParser.Create(ss);
+      try
+        NewStyleElements:=aParser.ParseInline;
+      except
+        on CSSE: ECSSException do begin
+          DoLog(etError,'TFresnelElement.SetStyle '+Name+':'+ClassName+' '+CSSE.Message);
+          exit;
+        end;
+        on FresnelE: EFresnel do begin
+          DoLog(etError,'TFresnelElement.SetStyle '+Name+':'+ClassName+' '+FresnelE.Message);
+          exit;
+        end;
       end;
-      on FresnelE: EFresnel do begin
-        DoLog(etError,'TFresnelElement.SetStyle '+Name+':'+ClassName+' '+FresnelE.Message);
-        exit;
+      if FStyleElements=nil then
+      begin
+        if NewStyleElements=nil then exit;
+      end else begin
+        if (NewStyleElements<>nil)
+            and FStyleElements.Equals(NewStyleElements) then exit;
       end;
+      FreeAndNil(FStyleElements);
+      FStyleElements:=NewStyleElements;
+    finally
+      aParser.Free;
     end;
-    if (FStyleElements=nil) then
-    begin
-      if NewStyleElements=nil then exit;
-    end else begin
-      if (NewStyleElements<>nil)
-          and FStyleElements.Equals(NewStyleElements) then exit;
-    end;
-    FreeAndNil(FStyleElements);
-    FStyleElements:=NewStyleElements;
-  finally
-    aParser.Free;
   end;
   //debugln(['TFresnelElement.SetStyle ',DbgSName(Self),' ',Style]);
   DomChanged;
@@ -3516,7 +3569,7 @@ procedure TFresnelElement.SetParentComponent(Value: TComponent);
 var
   aStreamRoot: IFresnelStreamRoot;
 begin
-  DoLog(etDebug,'TFresnelElement.SetParentComponent Self=%s NewParent=%s',[DbgSName(Self),DbgSName(Value)]);
+  //DoLog(etDebug,'TFresnelElement.SetParentComponent Self=%s NewParent=%s',[DbgSName(Self),DbgSName(Value)]);
   if Value=nil then
   begin
     Parent:=nil
@@ -3527,13 +3580,19 @@ begin
   end
   else if Supports(Value,IFresnelStreamRoot,aStreamRoot) then
   begin
-    DoLog(etDebug,'TFresnelElement.SetParentComponent Self=%s redirecting to viewport',[ToString]);
+    //DoLog(etDebug,'TFresnelElement.SetParentComponent Self=%s redirecting to viewport',[ToString]);
     Parent:=aStreamRoot.GetViewport;
   end
   else
     raise EFresnel.CreateFmt('TFresnelElement.SetParentComponent Self=%s NewParentComponent=%s',[Name+':'+ClassName,Value.Name+':'+Value.ClassName]);
 end;
 
+procedure TFresnelElement.ChildDestroying(El: TFresnelElement);
+begin
+  if FParent<>nil then
+    FParent.ChildDestroying(El);
+end;
+
 procedure TFresnelElement.DoRender(aRenderer: IFresnelRenderer);
 begin
   //
@@ -3588,11 +3647,13 @@ end;
 destructor TFresnelElement.Destroy;
 begin
   Clear;
-  FCSSClasses.FPOAttachObserver(Self);
   FreeAndNil(FLayoutNode);
   FreeAndNil(FChildren);
   FreeAndNil(FCSSClasses);
   FreeAndNil(FEventDispatcher);
+  if FParent<>nil then
+    FParent.ChildDestroying(Self);
+
   inherited Destroy;
 end;
 

+ 90 - 18
src/base/fresnel.forms.pas

@@ -63,6 +63,7 @@ type
     procedure SetFormWidth(const AValue: TFresnelLength);
     procedure SetVisible(const AValue: boolean);
   protected
+    procedure ChildDestroying(El: TFresnelElement); override;
     procedure DoCreate; virtual;
     procedure DoDestroy; virtual;
     procedure Loaded; override;
@@ -230,15 +231,17 @@ type
   private
     FAsyncCall: TAsyncCallQueues;
     FEventDispatcher: TFresnelEventDispatcher;
-    procedure DoFresnelLog(aType: TEventType; const Msg: UTF8String);
-    function GetHookFresnelLog: Boolean;
-    procedure SetHookFresnelLog(AValue: Boolean);
+    FHoverElements: TFresnelElementArray;
+    procedure SetHoverElements(const AValue: TFresnelElementArray);
   protected
+    procedure DoFresnelLog(aType: TEventType; const Msg: UTF8String); virtual;
+    function GetHookFresnelLog: Boolean; virtual;
+    procedure SetHookFresnelLog(AValue: Boolean); virtual;
     function CreateEventDispatcher(aDefaultSender : TObject) : TFresnelEventDispatcher; virtual;
     procedure DoHandleAsyncCalls; virtual;
     class procedure RegisterApplicationEvents; virtual;
     procedure DoProcessMessages; virtual;
-    procedure ShowMainForm;
+    procedure ShowMainForm; virtual;
     Property AsyncCalls: TAsyncCallQueues Read FAsyncCall;
   public
     constructor Create(AOwner: TComponent); override;
@@ -248,10 +251,13 @@ type
     procedure RemoveAsyncCalls(const aObject: TObject);
     Procedure CreateForm(aClass : TComponentClass; Out FormVariable); virtual; // use this for designed forms and components
     Procedure CreateFormNew(aClass : TComponentClass; Out FormVariable); virtual;
+    procedure ElementDestroying(El: TFresnelElement); virtual;
     function AddEventListener(aID : TEventID; const aHandler : TFresnelEventHandler) : Integer;
     function AddEventListener(Const aName: TEventName; const aHandler : TFresnelEventHandler): Integer;
+    function IsHoverElement(El: TFresnelElement): boolean; virtual;
     property EventDispatcher : TFresnelEventDispatcher Read FEventDispatcher;
     Property HookFresnelLog : Boolean Read GetHookFresnelLog Write SetHookFresnelLog;
+    property HoverElements: TFresnelElementArray read FHoverElements write SetHoverElements;
   end;
 
 var
@@ -371,7 +377,7 @@ begin
   if AValue.Bottom<AValue.Top then
     AValue.Bottom:=AValue.Top;
   if FFormBounds=AValue then exit;
-  FLLog(etDebug,['TFresnelCustomForm.SetFormBounds ',ToString,' ',AValue.ToString]);
+  //FLLog(etDebug,['TFresnelCustomForm.SetFormBounds ',ToString,' ',AValue.ToString]);
   FFormBounds:=AValue;
   if Designer<>nil then
     Designer.SetDesignerFormBounds(Self,FFormBounds.GetRect)
@@ -415,6 +421,13 @@ begin
     Hide;
 end;
 
+procedure TFresnelCustomForm.ChildDestroying(El: TFresnelElement);
+begin
+  inherited ChildDestroying(El);
+  if Application<>nil then
+    Application.ElementDestroying(El);
+end;
+
 procedure TFresnelCustomForm.DoCreate;
 begin
   if Assigned(OnCreate) then
@@ -429,7 +442,7 @@ end;
 
 procedure TFresnelCustomForm.Loaded;
 begin
-  FLLog(etDebug,['TFresnelCustomForm.Loaded ',ToString]);
+  //FLLog(etDebug,['TFresnelCustomForm.Loaded ',ToString]);
   inherited Loaded;
   if Visible then
     Show
@@ -547,7 +560,7 @@ end;
 
 procedure TFresnelCustomForm.Hide;
 begin
-  FLLog(etDebug,'TFresnelCustomForm.Hide '+ToString);
+  //FLLog(etDebug,'TFresnelCustomForm.Hide '+ToString);
   if (Designer<>nil)
       or ([csLoading,csDesigning]*ComponentState<>[])
       or not WSFormAllocated then
@@ -558,7 +571,7 @@ end;
 
 procedure TFresnelCustomForm.Show;
 begin
-  FLLog(etDebug,'TFresnelCustomForm.Show '+ToString);
+  //FLLog(etDebug,'TFresnelCustomForm.Show '+ToString);
   if (Designer<>nil) or ([csLoading,csDesigning,csDestroying]*ComponentState<>[]) then
     FVisible:=true
   else
@@ -591,7 +604,7 @@ begin
   if csDestroying in ComponentState then exit;
 
   // consistency checks
-  FLLog(etDebug,['TFresnelCustomForm.CreateWSForm ',ToString]);
+  //FLLog(etDebug,['TFresnelCustomForm.CreateWSForm ',ToString]);
   if Designer<>nil then
     raise Exception.Create('TFresnelCustomForm.CreateWSForm Designer<>nil');
   if Parent = Self then
@@ -612,8 +625,8 @@ end;
 
 procedure TFresnelCustomForm.WSDraw;
 begin
-  FLLog(etDebug,'TFresnelCustomForm.WSDraw (%s)',[ToString]);
-  FLLog(etDebug,'TFresnelCustomForm.WSDraw Have renderer: %b',[Assigned(Renderer)]);
+  //FLLog(etDebug,'TFresnelCustomForm.WSDraw (%s)',[ToString]);
+  //FLLog(etDebug,'TFresnelCustomForm.WSDraw Have renderer: %b',[Assigned(Renderer)]);
   Renderer.Draw(Self);
 end;
 
@@ -621,7 +634,7 @@ procedure TFresnelCustomForm.WSResize(const NewFormBounds: TFresnelRect;
   NewWidth, NewHeight: TFresnelLength);
 begin
   if (FFormBounds=NewFormBounds) and (Width=NewWidth) and (Height=NewHeight) then exit;
-  FLLog(etDebug,['TFresnelCustomForm.WSResize ',ToString,' OldForm=',FFormBounds.ToString,' NewForm=',NewFormBounds.ToString,' OldWH=',FloatToStr(Width),',',FloatToStr(Height),' NewWH=',FloatToStr(NewWidth),',',FloatToStr(NewHeight)]);
+  //FLLog(etDebug,['TFresnelCustomForm.WSResize ',ToString,' OldForm=',FFormBounds.ToString,' NewForm=',NewFormBounds.ToString,' OldWH=',FloatToStr(Width),',',FloatToStr(Height),' NewWH=',FloatToStr(NewWidth),',',FloatToStr(NewHeight)]);
   FFormBounds:=NewFormBounds;
   Width:=NewWidth;
   Height:=NewHeight;
@@ -635,18 +648,23 @@ var
   MouseEvt: TFresnelMouseEvent;
   X, Y: TFresnelLength;
   ClickEvt: TFresnelMouseClickEvent;
+  NewHoverElements: TFresnelElementArray;
 begin
   X:=WSData.PagePos.X;
   Y:=WSData.PagePos.Y;
-  El:=GetElementAt(X,Y);
-  if El=Nil then
+
+  NewHoverElements:=GetElementsAt(X,Y);
+  Application.HoverElements:=NewHoverElements;
+  if length(NewHoverElements)>0 then
   begin
+    El:=NewHoverElements[0];
+    WSData.ControlPos:=PageToContentPos(El,X,Y);
+  end else begin
     El:=Self;
     WSData.ControlPos:=WSData.PagePos;
-  end else begin
-    WSData.ControlPos:=PageToContentPos(El,X,Y);
   end;
-  FLLog(etDebug,'TFresnelCustomForm.WSMouseXY El=%s PagePos=%s ControlPos=%s',[El.ToString, WSData.PagePos.ToString, WSData.ControlPos.ToString]);
+
+  //FLLog(etDebug,'TFresnelCustomForm.WSMouseXY El=%s PagePos=%s ControlPos=%s',[El.ToString, WSData.PagePos.ToString, WSData.ControlPos.ToString]);
   case MouseEventId of
   evtMouseDown:
     fMouseDownElement:=El;
@@ -819,14 +837,49 @@ begin
     TFresnelComponent._LogHook:=Nil;
 end;
 
+procedure TFresnelBaseApplication.SetHoverElements(
+  const AValue: TFresnelElementArray);
+var
+  i: SizeInt;
+  OldEls: TFresnelElementArray;
+  El: TFresnelElement;
+begin
+  if FHoverElements=AValue then Exit;
+  if length(FHoverElements)=length(AValue) then
+  begin
+    i:=length(FHoverElements)-1;
+    while (i>=0)and (FHoverElements[i]=AValue[i]) do dec(i);
+    if i<0 then exit;
+  end;
+  OldEls:=FHoverElements;
+  FHoverElements:=AValue;
+  writeln('TFresnelBaseApplication.SetHoverElements START ',Name,':',ClassName);
+  // notify old hover elements
+  for i:=0 to length(OldEls)-1 do
+  begin
+    El:=OldEls[i];
+    writeln('TFresnelBaseApplication.SetHoverElements Old[',i,']=',El.GetPath);
+    if IsHoverElement(El) then continue;
+    El.CSSPseudoClass[fcpcHover]:=false;
+  end;
+  // notify new hover elements
+  for i:=0 to length(FHoverElements)-1 do
+  begin
+    El:=FHoverElements[i];
+    writeln('TFresnelBaseApplication.SetHoverElements New[',i,']=',El.GetPath);
+    El.CSSPseudoClass[fcpcHover]:=true;
+  end;
+end;
+
 procedure TFresnelBaseApplication.DoFresnelLog(aType: TEventType; const Msg: UTF8String);
 begin
+  writeln('TFresnelBaseApplication.DoFresnelLog ',aType,' ',Msg);
   Log(aType,Msg);
 end;
 
 function TFresnelBaseApplication.GetHookFresnelLog: Boolean;
 begin
-    Result:=(TFresnelComponent._LogHook=@DoFresnelLog);
+  Result:=(TFresnelComponent._LogHook=@DoFresnelLog);
 end;
 
 function TFresnelBaseApplication.CreateEventDispatcher(aDefaultSender: TObject): TFresnelEventDispatcher;
@@ -914,6 +967,15 @@ begin
     TComponent(FormVariable):=aClass.Create(Self)
 end;
 
+procedure TFresnelBaseApplication.ElementDestroying(El: TFresnelElement);
+var
+  i: SizeInt;
+begin
+  for i:=length(FHoverElements)-1 downto 0 do
+    if FHoverElements[i]=El then
+      System.Delete(FHoverElements,i,1);
+end;
+
 function TFresnelBaseApplication.AddEventListener(aID: TEventID;
   const aHandler: TFresnelEventHandler): Integer;
 begin
@@ -926,6 +988,16 @@ begin
   Result:=FEventDispatcher.RegisterHandler(aHandler,aName).ID;
 end;
 
+function TFresnelBaseApplication.IsHoverElement(El: TFresnelElement): boolean;
+var
+  i: Integer;
+begin
+  for i:=0 to length(FHoverElements)-1 do
+    if fHoverElements[i]=El then
+      exit(true);
+  Result:=false;
+end;
+
 
 initialization
   TFresnelBaseApplication.RegisterApplicationEvents;

+ 4 - 4
src/base/fresnel.layouter.pas

@@ -619,7 +619,7 @@ var
   var
     N: TFLBFCNode;
   begin
-    FLLog(etDebug,['AddLineNodeCache ',ChildEl.GetPath,' L=',FloatToStr(ChildLeft),',R=',FloatToStr(ChildRight),',W=',FloatToStr(ChildWidth),',H=',FloatToStr(ChildHeight)]);
+    //FLLog(etDebug,['AddLineNodeCache ',ChildEl.GetPath,' L=',FloatToStr(ChildLeft),',R=',FloatToStr(ChildRight),',W=',FloatToStr(ChildWidth),',H=',FloatToStr(ChildHeight)]);
     N:=AddLineNode(ChildNode);
     N.BorderLeft:=ChildBorderLeft;
     N.BorderRight:=ChildBorderRight;
@@ -1186,7 +1186,7 @@ var
   NewParent: TFresnelElement;
   ParentLNode: TSimpleFresnelLayoutNode;
 begin
-  FLLog(etDebug,['TSimpleFresnelLayouter.UpdateLayoutParent ',El.GetPath]);
+  //FLLog(etDebug,['TSimpleFresnelLayouter.UpdateLayoutParent ',El.GetPath]);
   if LNode.SkipLayout or (El.Parent=nil) then
     LNode.Parent:=nil
   else begin
@@ -1303,7 +1303,7 @@ var
   aDisplayBox, aVisibility: String;
   {%H-}Code: integer;
 begin
-  FLLog(etDebug,['TSimpleFresnelLayouter.ComputeCSS ',El.GetPath]);
+  //FLLog(etDebug,['TSimpleFresnelLayouter.ComputeCSS ',El.GetPath]);
   // every node gets a layout node
   LNode:=CreateLayoutNode(El);
 
@@ -1339,7 +1339,7 @@ begin
 
   // block container
   LNode.BlockContainer:=GetBlockContainer(El);
-  FLLog(etDebug,['TSimpleFresnelLayouter.ComputeCSS ',El.Name,' BlockContainer=',LNode.BlockContainer.ToString]);
+  //FLLog(etDebug,['TSimpleFresnelLayouter.ComputeCSS ',El.Name,' BlockContainer=',LNode.BlockContainer.ToString]);
 
   // LayoutParent
   UpdateLayoutParent(El,LNode);

+ 1 - 1
src/base/fresnel.renderer.pas

@@ -115,7 +115,7 @@ var
   Corner: TFresnelCSSCorner;
 
 begin
-  FLLog(etDebug,'TFresnelRenderer.DrawElement %s Origin=%s',[El.GetPath,Origin.ToString]);
+  //FLLog(etDebug,'TFresnelRenderer.DrawElement %s Origin=%s',[El.GetPath,Origin.ToString]);
   LNode:=TSimpleFresnelLayoutNode(El.LayoutNode);
   if LNode.SkipRendering then exit;
   aRenderable:=El as IFresnelRenderable;

+ 0 - 1
src/base/fresnel.widgetset.pas

@@ -25,7 +25,6 @@ type
     procedure SetVisible(const AValue: boolean); virtual; abstract;
     procedure Notification(AComponent: TComponent; Operation: TOperation); override;
   public
-
     function GetClientSize: TFresnelPoint; virtual; abstract;
     procedure Invalidate; virtual;
     procedure InvalidateRect(const aRect: TFresnelRect); virtual; abstract;

+ 8 - 4
src/gtk3/fresnel.gtk3.pas

@@ -367,11 +367,13 @@ end;
 
 function TGtk3WSForm.GtkEventKeyDown(Event: PGdkEvent): Boolean;
 begin
+  if Event=nil then ;
   Result:=false;
 end;
 
 function TGtk3WSForm.GtkEventKeyUp(Event: PGdkEvent): Boolean;
 begin
+  if Event=nil then ;
   Result:=false;
 end;
 
@@ -453,11 +455,13 @@ end;
 
 function TGtk3WSForm.GtkEventMouseEnter(Event: PGdkEvent): Boolean;
 begin
+  if Event=nil then ;
   Result:=false;
 end;
 
 function TGtk3WSForm.GtkEventMouseLeave(Event: PGdkEvent): Boolean;
 begin
+  if Event=nil then ;
   Result:=false;
 end;
 
@@ -481,11 +485,11 @@ begin
   GDK_LEAVE_NOTIFY:
     Result := GtkEventMouseLeave(Event);
   GDK_FOCUS_CHANGE:
-    FLLog(etDebug,'TSkiaGtk3WSForm.GtkEvent_Event GDK_FOCUS_CHANGE %s',[Self.ToString]);
+    ; //FLLog(etDebug,'TSkiaGtk3WSForm.GtkEvent_Event GDK_FOCUS_CHANGE %s',[Self.ToString]);
   GDK_CONFIGURE:
     ; //Result := GtkEventResize(Event);
   GDK_VISIBILITY_NOTIFY:
-    FLLog(etDebug,'TSkiaGtk3WSForm.GtkEvent_Event GDK_VISIBILITY_NOTIFY %s',[Self.ToString]);
+    ; //FLLog(etDebug,'TSkiaGtk3WSForm.GtkEvent_Event GDK_VISIBILITY_NOTIFY %s',[Self.ToString]);
   end;
 end;
 
@@ -560,7 +564,7 @@ end;
 
 procedure TGtk3WSForm.SetVisible(const AValue: boolean);
 begin
-  FLLog(etDebug,'TGtk3WSForm.SetVisible %s AValue= %b',[Form.ToString,AValue]);
+  //FLLog(etDebug,'TGtk3WSForm.SetVisible %s AValue= %b',[Form.ToString,AValue]);
   if FWindow=nil then
     raise Exception.Create('TGtk3WSForm.SetVisible Window=nil');
   if AValue then
@@ -604,7 +608,7 @@ const
 var
   ARect: TGdkRectangle;
 begin
-  FLLog(etDebug,'TGtk3WSForm.CreateGtkWindow Bounds= %s',[Form.FormBounds.ToString]);
+  //FLLog(etDebug,'TGtk3WSForm.CreateGtkWindow Bounds= %s',[Form.FormBounds.ToString]);
   FWindow := TGtkWindow.new(GTK_WINDOW_TOPLEVEL);
   Result:=Window;