Re: [Lazarus] LCL High-DPI
2017-02-20 17:46 GMT+01:00 Ondrej Pokorny via Lazarus < lazarus@lists.lazarus-ide.org>: > I'd like to announce that I finished the concept of DPI scaling in Lazarus > / LCL. Thanks to your work Lazarus is now much, much better than Delphi in this field ^^. -- Best regards, Maciej Izak -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] GUI freeze under GTK2
On 20.02.2017 22:37, denisgolovan via Lazarus wrote: Hi all Recently, I've started experiencing rather nasty bug - my GUI application started freezing when scrolling VirtualTreeView component vertically using scrollbar. VTV itself is rather old version (last commit from May 17 2015). FPC and Lazarus are from trunk, svn rev.35396 and rev.54204. I am under Gentoo x64, gtk2 widgetset, gtk+ library v2.24.31-r1. When paused after freezing, callstack always shows the following stack trace. So I assume there is some infinite loop running. #0 poll at :0 #1 ?? at :0 #2 ?? at :0 #3 xcb_wait_for_reply at :0 #4 _XReply at :0 #5 XGetGeometry at :0 #6 gdk_window_get_frame_extents at :0 #7 gdk_window_get_root_origin at :0 #8 GETWIDGETRELATIVEPOSITION(0x7fffed8cc490, 0, 0) at gtk2/gtk2proc.inc:7001 #9 SENDSIZENOTIFICATIONTOLCL(0x7fffed8cc490) at gtk2/gtk2proc.inc:6530 #10 GTKSIZE_ALLOCATECB(0x7fffed8cc490, 0x7fffcd20, 0x7fffed90a040) at gtk2/gtk2callback.inc:2530 #11 g_closure_invoke(0x7fffed93ac50, 0x0, 0x0, 2, 0x7fffcab0, 0x7fffcab0, 0x7fffca50, 0x7fffca50) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gclosure.c:804 #12 signal_emit_unlocked_R(0x7fffee036f40, 0x7fffee036f40, 0, 0, 0x7fffed8cc490, 0x7fffed8cc490, 0x0, 0x0, 0x7fffcab0, 0x7fffcab0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3629 #13 g_signal_emit_valist(, , , 0x7fffcc40, 0x7fffcc40) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3385 #14 g_signal_emit(, , ) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3441 #15 gtk_widget_size_allocate at :0 #16 ?? at :0 #17 _g_closure_invoke_va(0x7fffed8c96a0, 0x7fffed8c96a0, 0x0, 0x0, 0x7fffed8cc490, 0x7fffed8cc490, 0x7fffd060, 0x7fffd060, , 0x0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gclosure.c:867 #18 g_signal_emit_valist(0x7fffed8cc490, , 0, 0x7fffd060, 0x7fffd060) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3294 #19 g_signal_emit(, , ) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3441 #20 ?? at :0 #21 ?? at :0 #22 g_main_dispatch(0x7fffee0442c0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3154 #23 g_main_context_dispatch(0x7fffee0442c0, 0x7fffee0442c0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3769 #24 g_main_context_iterate(0x7fffee0442c0, 0x7fffee0442c0, 0, 0, 1, 1, ) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3840 #25 g_main_context_iteration(0x7fffee0442c0, 0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3901 #26 APPPROCESSMESSAGES(0x7fffee1b6040) at gtk2/gtk2widgetset.inc:2328 #27 HANDLEMESSAGE(0x7fffee079540) at include/application.inc:1274 #28 RUNLOOP(0x7fffee079540) at include/application.inc:1411 #29 APPRUN(0x7fffee1b6040, {Proc = {procedure (POINTER)} 0x7fffd430, Self = 0x7fffee079540}) at include/interfacebase.inc:54 #30 RUN(0x7fffee079540) at include/application.inc:1399 Any hints on how to resolve? Can you try attached unit source file? You need to add in your main program sources before any LCL units and after cthreads/cmem units. unit unix_init_xlib; {$mode objfpc}{$H+} interface implementation uses xlib; Var AStatus : TStatus; initialization AStatus := XInitThreads; AStatus := AStatus; finalization end. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] LCL High-DPI
On 21.02.2017 12:21, Maciej Izak via Lazarus wrote: Thanks to your work Lazarus is now much, much better than Delphi in this field ^^. Yes, thanks to Ondrej, very good work -- Regards, Alexey -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] LCL High-DPI request for help adding images
How do i use icon scaling for user project? Regards Torsten. On 2017-02-22 00:33, Ondrej Pokorny via Lazarus wrote: Update: I worked further today (unfortunately...) I also added icon scaling support to the IDE. The IDE now can load 150% and 200% versions of the icons. If a High-DPI icon is missing, the normal icon is upscaled (with the worst algorithm, but that's what is available in the IDE). Request: search for volunteers who would add at least the most important IDE icons (open, save, desktops - basically what is visible in the coolbars). Please see images/README.txt for more info. Note: the High-DPI icons are used only from 144DPI (150%) upwards. 120DPI (125%) uses the original icons (which is default on Windows, AFAIK). Thanks Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] GUI freeze under GTK2
Hi Not sure if it can help, but I rebuilt Lazarus with -dVerboseSizeMsg -dVerboseFormPositioning and I got following in console after GUI freeze. Those exact lines repeat endlessly in console. TEngineObjectTree is virtualtreeview control. TWinControl.WMSize A :TEngineObjectTree Message=192,67 BoundsRealized=l=1,t=1,r=193,b=68 WChg=False HChg=False FromIntf=True ClientRectInvalid=False gtksize_allocate_client: pnlEngineTree:TPanel widget=7FFFED971020 NewSize=194,69 Allocation=194x69 Requisiton=193x68 gtksize_allocateCB: pnlEngineTree:TPanel widget=7FFFED9238E0=GtkFrame [RMVDFStPrNwDb] LCLObject=7FFFEE1E3340=pnlEngineTree:TPanel fixwidget=7FFFED971020 NewSize=194,69 GtkPos=428,0,194x69 LCLPos=428,0,194x69 gdkwindow=622x69 SendSizeNotificationToLCL checking ... pnlEngineTree:TPanel Widget=[RMVDFStPrNwDb] gtksize_allocate_client: frmMain:TfrmMain widget=7FFFED840980 NewSize=622,69 Allocation=622x69 Requisiton=0x0 gtksize_allocateCB: frmMain:TfrmMain widget=7FFFED8CD380=GtkWindow [RMVDStPrApDb] LCLObject=7FFFED850040=frmMain:TfrmMain fixwidget=7FFFED840980 NewSize=622,69 GtkPos=0,0,622x69 LCLPos=2471,264,622x69 gdkwindow=622x69 VFP gtksize_allocateCB: TfrmMain 0,0 SendSizeNotificationToLCL checking ... frmMain:TfrmMain Widget=[RMVDStPrApDb] VFP SendSizeNotificationToLCL frmMain:TfrmMain 2471,264,622x69 7FFFED8CD380=GtkWindow [RMVDStPrApDb] LCLObject=7FFFED850040=frmMain:TfrmMain gtksize_allocate_client: :TEngineObjectTree widget=7FFFED840A30 NewSize=177,65 Allocation=177x65 Requisiton=0x0 gtksize_allocateCB: :TEngineObjectTree widget=7FFFED8BFB50=LCLWinapiWidget [RMVDFStPrNwDb] LCLObject=7FFFED899440=:TEngineObjectTree fixwidget=7FFFED840A30 NewSize=192,67 GtkPos=1,1,192x67 LCLPos=1,1,192x67 gdkwindow=194x69 SendSizeNotificationToLCL checking ... :TEngineObjectTree Widget=[RMVDFStPrNwDb] SendSizeNotificationToLCL :TEngineObjectTree GTK=1,1,192x67 LCL=1,1,192x67 -- Regards, Denis Golovan -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] LCL High-DPI
One more question. Where can I find documentation for TControl.ScaleCoord() or ScaleCoord96()? It is not in the CCR. I will search the source. Don On 02/20/2017 11:46 AM, Ondrej Pokorny via Lazarus wrote: I'd like to announce that I finished the concept of DPI scaling in Lazarus / LCL. It's quite easy for the programmer. Documented here: http://wiki.lazarus.freepascal.org/High_DPI (details are in "High DPI in Lazarus 1.7 and above"). 1.) I made the Lazarus IDE High-DPI aware - the IDE itself and its windows should scale correctly. 2.) To make your own application use the new LCL scaling and to make sure your layouts don't get destroyed, do the following: a.) Make sure you don't change the system DPI settings during the proccess. b.) Update the IDE to the latest trunk and rebuild it. c.) Open your project in the IDE. d.) Enable LCL scaling for your application DPI awarness in Project Options -> Application -> "Use LCL scaling (Hi-DPI). e.) On Windows: enable DPI awarness in Project Options -> Application. Decide if you want to support per monitor DPI awarness or not. f.) Make sure TForm.Scaled=True for all your forms (default value). g.) Make sure you use TControl.ScaleCoord() or ScaleCoord96() to scale coordinates during the run-time. And you are ready. Your forms will scale both in runtime and design time nicely. For those who followed my last announcement: as Zeljko and Michael requested, I removed the LCLScaleForms define and introduced the Application.Scaled property instead (that you set in step 2d). The default value is Application.Scaled=False. If you keep Application.Scaled=False, there won't be any changes in your application. Please report issues or comment on problems. I have still time to change things until Lazarus 1.8 is out (you can expect RC1 in April). Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] LCL High-DPI
On 21.02.2017 19:13, Donald Ziesig via Lazarus wrote: One more question. Where can I find documentation for TControl.ScaleCoord() or ScaleCoord96()? It is not in the CCR. I will search the source. The difference is in the scale basis: ScaleCoord96: hard-coded 96. ScaleCoord: DesignTimePPI (= the PPI of the IDE - be aware that it can change if you open your project on a different system with different DPI). ScaleCoord96 is to use for hard-coded values in 96 PPI. I'll document the functions in the CCR. Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] LCL High-DPI
Hi Ondrej! Your work has made a major improvement in Lazarus. It is much more enjoyable to use. I have converted my most recent major APP using it and it was mostly straight forward. I will continue using it and report back to you as my work permits. Thank you, Don Ziesig On 02/20/2017 11:46 AM, Ondrej Pokorny via Lazarus wrote: I'd like to announce that I finished the concept of DPI scaling in Lazarus / LCL. It's quite easy for the programmer. Documented here: http://wiki.lazarus.freepascal.org/High_DPI (details are in "High DPI in Lazarus 1.7 and above"). 1.) I made the Lazarus IDE High-DPI aware - the IDE itself and its windows should scale correctly. 2.) To make your own application use the new LCL scaling and to make sure your layouts don't get destroyed, do the following: a.) Make sure you don't change the system DPI settings during the proccess. b.) Update the IDE to the latest trunk and rebuild it. c.) Open your project in the IDE. d.) Enable LCL scaling for your application DPI awarness in Project Options -> Application -> "Use LCL scaling (Hi-DPI). e.) On Windows: enable DPI awarness in Project Options -> Application. Decide if you want to support per monitor DPI awarness or not. f.) Make sure TForm.Scaled=True for all your forms (default value). g.) Make sure you use TControl.ScaleCoord() or ScaleCoord96() to scale coordinates during the run-time. And you are ready. Your forms will scale both in runtime and design time nicely. For those who followed my last announcement: as Zeljko and Michael requested, I removed the LCLScaleForms define and introduced the Application.Scaled property instead (that you set in step 2d). The default value is Application.Scaled=False. If you keep Application.Scaled=False, there won't be any changes in your application. Please report issues or comment on problems. I have still time to change things until Lazarus 1.8 is out (you can expect RC1 in April). Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] GUI freeze under GTK2
What revision caused the freezing? http://wiki.freepascal.org/How_do_I_create_a_bug_report#Regression_caused_by_a_certain_revision Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus