Re: [Lazarus] Gtk2 ExtTextOut internal helper is slow

2020-06-11 Thread Martin Frb via lazarus

On 11/06/2020 16:20, Alexey Tor. via lazarus wrote:


to call ExtTextOut() 20 times with the same x/y/s ?
so I suggest to del checks - just call pango_layout_set_text and 
that's it.

I do not know if this is related.

But test your changes with Synedit extra-char-width.

You can set the extra char width to 1 (or greater) in the IDE for the 
source editor. Make sure that works.
Also test with Japanese double width chars in SynEdit. アkj (randomly 
typed, no idea if or what it means)
And maybe Arabic right to left script. (checking that the caret works, 
and text is stable while selection is changed char by char)



--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2 Linux detect user logoff?

2020-03-23 Thread Michael Van Canneyt via lazarus



On Mon, 23 Mar 2020, Anthony Walter via lazarus wrote:


Does anyone here know how to detect user log off and gracefully terminate
under Gtk2 Linux? I have an app which uses some temporary files (in /tmp)
and I want to ensure those files are deleted when the user logs off. The
application query/end session events don't seem to be connected when using
the Gtk2 widgetset.


From this stack overflow answer it would seem there is a 'save-yourself'

sinal to notify you when the user logs off, but I don't know what the LCL
value of client might be. Could it be application handle? Is there a better
way to detect user log off on Gtk2?

https://stackoverflow.com/a/2519829/269630


I suspect this is a dbus signal. 
Maybe gnome API interfaces expose an api for the signals of the session

manager. I doubt GTK handles these signals, and I don't think Lazarus uses
the Gnome signals or the Gnome API.

So I would attempt to connect to the gnome session manager using dbus. 
FPC has a DBUS client component, so this should not be too hard.


I have some uncommitted example programs that may help you if you decide to
go this path.

Michael.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] gtk2: GetOrCreateWidgetInfo: MainWidget info was created causing a memory leak

2019-09-13 Thread Martin Frb via lazarus

On 13/09/2019 17:45, Martin Frb via lazarus wrote:

On 13/09/2019 16:17, AlexeyT via lazarus wrote:

It is fixed; thanks.
New build of Lazarus (trunk) gives errors with CudaText gtk2 build. 
How to fix that? 



If you mean it now longer *prints*

now => no

Now I have No idea where the w came from

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] gtk2: GetOrCreateWidgetInfo: MainWidget info was created causing a memory leak

2019-09-13 Thread Martin Frb via lazarus

On 13/09/2019 16:17, AlexeyT via lazarus wrote:

It is fixed; thanks.
New build of Lazarus (trunk) gives errors with CudaText gtk2 build. 
How to fix that? 


If you mean it now longer *prints* the message then yes. (This has been 
converted to a compile time warning, if you compile the LCL/interfaces.)
If you mean the leak itself (if indeed that exists/existed), then not 
necessarily. Unless there are more fixes, that I am not aware off.

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] gtk2: GetOrCreateWidgetInfo: MainWidget info was created causing a memory leak

2019-09-13 Thread AlexeyT via lazarus

It is fixed; thanks.
New build of Lazarus (trunk) gives errors with CudaText gtk2 build. 
How to fix that? 


--
Regards,
Alexey

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2

2018-02-24 Thread Schindler Karl-Michael via Lazarus
Hi

> Date: Fri, 23 Feb 2018 18:06:59 +0100
> From: Adriaan van Os <f...@microbizz.nl>
> To: Lazarus mailing list <lazarus@lists.lazarus-ide.org>
> Subject: Re: [Lazarus] Gtk2
> Message-ID: <5a904a33.6010...@microbizz.nl>
> Content-Type: text/plain; charset=ISO-8859-15; format=flowed
> 
> Schindler Karl-Michael via Lazarus wrote:
>> How about fink? If sources and prerequisites are available, I could have a 
>> go at a package description. I did so successfully for lazarus-gkt2.
> 
> Not quite sure what you mean. There are some fink gtk packages, they seem to 
> be based on gtk2.18 
> rather than 2.24 ? e.g. 
> <http://pdb.finkproject.org/pdb/package.php/gtk+2?rel_id=10.5-i386-current-stable>.
>  The binary 
> distributions don't look to be complete.
> 
> Regards,
> 
> Adriaan van Os

You are right. The version (2.18)  is not the most recent. But to the best of 
my knowledge, it is sufficient to build the gtk2 based lcl and gtk2-based 
lazarus. So, maybe it is also sufficient for your purpose. Do you really need 
2.24? Actually, the maintainers of gtk2 are working on updates, but they 
haven't completely finished it and the updated descriptions are in their 
experimental branches only. What is the oldest version of macOS you want to 
support? The easiest requirement is 64bit and 10.9 and newer, but if need be 
stepping back to i386 and 10.7 would also be possible. 

Regarding fink packages, I meant that if the source code of your program is 
available, I could have a go at a package description.

Michael.

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2

2018-02-23 Thread Adriaan van Os via Lazarus

Schindler Karl-Michael via Lazarus wrote:

How about fink? If sources and prerequisites are available, I could have a go 
at a package description. I did so successfully for lazarus-gkt2.


Not quite sure what you mean. There are some fink gtk packages, they seem to be based on gtk2.18 
rather than 2.24 ? e.g. 
. The binary 
distributions don't look to be complete.


Regards,

Adriaan van Os

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2

2018-02-23 Thread Schindler Karl-Michael via Lazarus
Am 23.02.2018 um 10:56 schrieb lazarus-requ...@lists.lazarus-ide.org:
> 
> Message: 6
> Date: Fri, 23 Feb 2018 10:50:50 +0100
> From: Adriaan van Os <f...@microbizz.nl>
> To: Lazarus mailing list <lazarus@lists.lazarus-ide.org>
> Subject: Re: [Lazarus] Gtk2
> Message-ID: <5a8fe3fa.6030...@microbizz.nl>
> 
> Anthony Walter via Lazarus wrote:
>> Maybe homebrew as well. I've heard from most people that brew is better 
>> than ports.
> 
> Thanks for the hint. I looked at <https://brew.sh/> but they don't even have 
> a list of packages 
> without having to install their software, which requires OS X 10.10. Not for 
> me.
> 
> The MacPorts install of gtk2 worked for default x86-64 but not for 
> +universal. And MacPorts is 
> quite unflexible when it comes to skipping (unneeded but failing) 
> dependencies. So, I grabbed the 
> binaries from a server by hand. I have a FreePascal GTK applcation now 
> running on OSX.
> 
> Regards,
> 
> Adriaan van Os

How about fink? If sources and prerequisites are available, I could have a go 
at a package description. I did so successfully for lazarus-gkt2.

Michael aka MiSchi.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2

2018-02-23 Thread Adriaan van Os via Lazarus

Anthony Walter via Lazarus wrote:
Maybe homebrew as well. I've heard from most people that brew is better 
than ports.


Thanks for the hint. I looked at  but they don't even have a list of packages 
without having to install their software, which requires OS X 10.10. Not for me.


The MacPorts install of gtk2 worked for default x86-64 but not for +universal. And MacPorts is 
quite unflexible when it comes to skipping (unneeded but failing) dependencies. So, I grabbed the 
binaries from a server by hand. I have a FreePascal GTK applcation now running on OSX.


Regards,

Adriaan van Os

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2

2018-02-19 Thread Anthony Walter via Lazarus
Maybe homebrew as well. I've heard from most people that brew is better
than ports.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2

2018-02-19 Thread Adriaan van Os via Lazarus

Adriaan van Os via Lazarus wrote:
Any suggestions on where to download gtk2 binaries for OS X (e.g. 
version 2.24) ?


To answer my own question, maybe MacPorts is the best source ?

Regards,

Adriaan van Os

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] GTK2/X Appcrash when TPen.Pattern has invalid value

2018-01-07 Thread Alexander Hofmann via Lazarus
Hi,

Am 07.01.2018 um 11:39 schrieb Marc Weustink via Lazarus:
> Imo the QT implementation should be adapted to behave the same.
> Wat does Delphi in this case?
Thank's for your reply.
I only have an old Delphi 7 version here - they all don't have the
Pattern option for TPen. When done manually, the ExtCreatePen function
of the Windows GDI also expects an array with the length(s) of
individual strokes in the pattern (see
https://msdn.microsoft.com/en-us/library/windows/desktop/dd162705(v=vs.85).aspx
), so I would expect newer Delphi versions to implement it that way
(same as on X).

Of course this is still MY failure, not any of the LCL...

Best regards,
Alex


-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] GTK2/X Appcrash when TPen.Pattern has invalid value

2018-01-07 Thread Marc Weustink via Lazarus


On January 6, 2018 8:14:30 PM GMT+01:00, Alexander Hofmann via Lazarus 
 wrote:
>Dear all,
>
>I spend some time debugging a programming error (read:
>misinterpretation
>of available documentation) and though I should share my findings...
>
>I wanted to have a TChart series drawn with a dashed line, the
>pen-style
>"psDashed" had two short dashes for my eyes, so I used "psPattern" and
>set the Pen-Pattern as such:
>
>const
>  Pattern:array [0..7] of longint=(1, 1, 1, 1, 0, 0, 0, 0)
>
>This is wrong of course; however reading some google I thought that
>each
>array element in the TPenPattern array describes one pixel. The problem
>now was, that Qt produces quite reasonable results: a 4-pixel dashed
>line. Also GTK2 did the job - if the line was drawn _outside_ any
>Paint-Message.
>
>In that case (e.g. when actually setting this as a Pen-Pattern for a
>Chart series), the X-Function 58 (SetDashes) produced the Errorcode 2
>(Out of range) and the Program ended directly at the 1st Paint-Event -
>leaving Lazarus and GDB in the wild with no backtrace or alike.
>
>Of course it works now with the Pattern
>
>const
>  Pattern:array [0..1] of longint=(4, 4)
>
>But: I think that, if this is the correct way to do it, and the value
>"0" for any portion of the pattern is indeed not allowed (as stated in
>the X-Documentation e.g. here:
>https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:SetDashes),
>shouldn't TPen.SetPattern raise an exception when an invalid pattern is
>given?

Don't think so. The gtk implementation should have checked this and probably 
skip the 0


>I don't know about other OSes / Widgestsets, if there are the same
>"rules".

Imo the QT implementation should be adapted to behave the same.
Wat does Delphi in this case?

>I could try to file a bugreport / try to provide a patch; but maybe
>it's
>enough to cite the X-Docs somewhere in the Lazarus-Documentation? What
>do you think?

We shouldn't "copy"the x behaviour, but behave the same as Delphi.

Marc
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2 missed try-finally

2017-07-25 Thread Marc Weustink via Lazarus
How do you get an exception there ?

Marc

On July 25, 2017 4:35:50 PM GMT+02:00, Alexey via Lazarus 
 wrote:
>
>>How did you manage to create a mem leak there?
>
>If not using try-finally, and exception, Bitmap will not be freed.
>
>-- 
>Regards,
>Alexey
>
>-- 
>___
>Lazarus mailing list
>Lazarus@lists.lazarus-ide.org
>https://lists.lazarus-ide.org/listinfo/lazarus
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2 missed try-finally

2017-07-25 Thread Alexey via Lazarus



How did you manage to create a mem leak there?


If not using try-finally, and exception, Bitmap will not be freed.

--
Regards,
Alexey

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2 missed try-finally

2017-07-25 Thread Mattias Gaertner via Lazarus
On Tue, 25 Jul 2017 13:16:50 +0300
Alexey via Lazarus  wrote:

> gtk2proc.inc, procedure DrawImageListIconOnWidget: it allocates Bitmap + 
> DC. Pls add try-finally for Bitmap; and (not sure) try-finally for DC:

How did you manage to create a mem leak there?

 
>  finally
>ReleaseDC(HDC({%H-}PtrUInt(DestWidget)),DestDC);
>  end;
>finally
>  Bitmap.Free;
>end;


Mattias
 
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2 log "Refused invalidating during paint msg": how to check

2017-05-01 Thread Mattias Gaertner via Lazarus
On Sun, 30 Apr 2017 18:59:17 +0300
Alexey via Lazarus  wrote:

> How can I check that im inside Paint code?
> 
> Maybe come control flag, or something, exists.

if csCustomPaint in ControlState then

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] GTK2 version and backspace key in Edit fields

2016-10-11 Thread David Copeland via Lazarus
The bug is still present here.

FPC 3.0, Lazarus r53093.
OpenSuse 42.1
glib2 2.44.1
gtk2 2.24.31

Dave Copeland.

>
> On 2016-10-10 23:08, Juha Manninen via Lazarus wrote:
>> Regarding issue:
>>   http://bugs.freepascal.org/view.php?id=30596
>>
>> GTK2 users please test if there is any version that needs special
>> treatment.
>> If not, then I will remove the GTK2 version checks.
>> See the last 2 notes in the bug report for details please.
>>
>> Juha
>
>


-- 
David Copeland
JSI Data Systems Limited
613-727-9353
www.jsidata.ca

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] GTK2 version and backspace key in Edit fields

2016-10-11 Thread Torsten Bonde Christiansen via Lazarus
I have no idea about the versioning with the glib2/gtk2 lib, but I can 
confirm that the patch works here:


Free Pascal Compiler version 3.0.0

Compiler date  : 2015/11/26
Compiler CPU target: x86_64

Lazarus trunk: r53093
glib2: 2.48.2
gtk2:  2.24.31

Torsten.



On 2016-10-10 23:08, Juha Manninen via Lazarus wrote:

Regarding issue:
  http://bugs.freepascal.org/view.php?id=30596

GTK2 users please test if there is any version that needs special treatment.
If not, then I will remove the GTK2 version checks.
See the last 2 notes in the bug report for details please.

Juha



--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus