Changeset 570 for trunk


Ignore:
Timestamp:
May 13, 2024, 7:00:49 PM (6 months ago)
Author:
chronos
Message:
  • Fixed: Workaround for incorrectly styling TEdit controls under Gtk2.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Inp.pas

    r565 r570  
    9090  if Center then
    9191    CenterToRect(Rect(0, 0, Screen.Width, Screen.Height));
     92  Gtk2DisableControlStyling(EditInput);
    9293end;
    9394
  • trunk/LocalPlayer/MessgEx.pas

    r554 r570  
    187187  if Kind = mkModel then
    188188    EInput.Top := Height - (76 + Border);
     189  Gtk2DisableControlStyling(EInput);
    189190end;
    190191
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r565 r570  
    109109procedure UnshareBitmap(Bitmap: TBitmap);
    110110procedure Gtk2Fix;
     111procedure Gtk2DisableControlStyling(WinControl: TWinControl);
    111112procedure LoadConfig(Key: string);
    112113procedure SaveConfig(Key: string);
     
    214215uses
    215216  {$IFDEF DPI}Dpi.PixelPointer,{$ELSE}PixelPointer,{$ENDIF}
    216   Directories, Sound, Registry;
     217  Directories, Sound, Registry
     218  {$IFDEF LCLGTK2}, gtk2, WSProc{$ENDIF};
    217219
    218220var
     
    17701772end;
    17711773
     1774procedure Gtk2DisableControlStyling(WinControl: TWinControl);
     1775begin
     1776  // https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/38516
     1777  {$IFDEF LCLGTK2}
     1778  // parse gtkrc from string
     1779  gtk_rc_parse_string(PChar('style "noengine" {' + LineEnding +
     1780    'engine "" {}' + LineEnding +
     1781    '}' + LineEnding +
     1782    'widget "*.your-edit" style "noengine"'));
     1783
     1784  if WinControl.HandleAllocated then begin
     1785    // set gtk name to our component
     1786    gtk_widget_set_name({%H-}PGtkWidget(WinControl.Handle), 'your-edit');
     1787  end;
     1788  {$ENDIF}
     1789end;
     1790
    17721791procedure LoadConfig(Key: string);
    17731792var
  • trunk/Packages/DpiControls/Dpi.Controls.pas

    r523 r570  
    244244  public
    245245    Controls: TDpiControls;
     246    function HandleAllocated: Boolean;
    246247    procedure ScreenChanged; override;
    247248    function ControlCount: Integer;
     
    536537end;
    537538
     539function TWinControl.HandleAllocated: Boolean;
     540begin
     541  Result := GetNativeWinControl.HandleAllocated;
     542end;
     543
    538544procedure TWinControl.ScreenChanged;
    539545var
  • trunk/Settings.pas

    r568 r570  
    264264  {$ENDIF}
    265265  UpdateInterface;
     266  Gtk2DisableControlStyling(EditShortCutPrimary);
     267  Gtk2DisableControlStyling(EditShortCutSecondary);
    266268end;
    267269
Note: See TracChangeset for help on using the changeset viewer.