Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-12

GTK2 paint event

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

José Mejuto

Hello Lazarus-List,

Working in the gecko port in GTK2 I had discovered something that looks like a bug, but maybe not.

The gecko browser is using a GTK Window which is a TCustomControl, once put in the form and started it does nothing unless the mouse is moved over the form (not need to move over the control), so it looks like a non processed message. After some tests I had decided to add a timer to the form and in the event handler add
"Application.ProcessMessages" and now the window is rendered as expected :-?

So for me it looks like the message filter in GTK2 is not being fired with external paints.

Now a second problem with maybe same roots, once the control is painted thanks to the Application.ProcessMessages every 100 ms if I resize the window the control receives the paint message but the painted content is not displayed unless I manually raise some kind of form change like a caption change, so now my Paint handler looks like:

procedure TCustomGecko.Paint;
begin
  GeckoWindow.Paint(true); //force paint
  Self.Parent.Caption:=floattostr(now); //forces a form caption change
end;

This behavior does not look fine to me, but maybe anybody have a different opinion. I'm using yesterday SVN of both fpc and Lazarus in Ubuntu running in a VirtualBox VM.

If anybody have a suspect about the problem source I'll try any change that anybody suggest. Thank you.

Best regards, Jos?

Reply by email

José Mejuto
to José Mejuto

Hello Jos?,

Wednesday, December 8, 2010, 6:32:39 PM, you wrote:

JM> The gecko browser is using a GTK Window which is a TCustomControl, JM> once put in the form and started it does nothing unless the mouse is JM> moved over the form (not need to move over the control), so it looks JM> like a non processed message. After some tests I had decided to add a JM> timer to the form and in the event handler add JM> "Application.ProcessMessages" and now the window is rendered as JM> expected :-?

This problem is resolved using "-dUSE_GTK_MAIN_OLD_ITERATION" so it looks like some kind of "regression" (I had not tested with 0.9.28).

JM> So for me it looks like the message filter in GTK2 is not being fired JM> with external paints.
JM> Now a second problem with maybe same roots, once the control is JM> painted thanks to the Application.ProcessMessages every 100 ms if I JM> resize the window the control receives the paint message but the JM> painted content is not displayed unless I manually raise some kind of JM> form change like a caption change, so now my Paint handler looks like: JM> procedure TCustomGecko.Paint;
JM> begin
JM> GeckoWindow.Paint(true); //force paint
JM> Self.Parent.Caption:=floattostr(now); //forces a form caption change JM> end;

This one is still present.

Best regards, Jos?

Reply by email

José Mejuto
to José Mejuto

Hello Jos?,

Wednesday, December 8, 2010, 6:47:09 PM, you wrote:

JM>> So for me it looks like the message filter in GTK2 is not being fired JM>> with external paints.
JM>> Now a second problem with maybe same roots, once the control is JM>> painted thanks to the Application.ProcessMessages every 100 ms if I JM>> resize the window the control receives the paint message but the JM>> painted content is not displayed unless I manually raise some kind of JM>> form change like a caption change, so now my Paint handler looks like: JM>> procedure TCustomGecko.Paint;
JM>> begin
JM>> GeckoWindow.Paint(true); //force paint
JM>> Self.Parent.Caption:=floattostr(now); //forces a form caption change JM>> end;
JM> This one is still present.

More information:

1) If I align the control alTop/alBottom I lost the painted information if I resize horizontally, but not vertically. I recover the image if resized vertically after horizontally.

2) If I align the control alLeft/alRight I lost the painted information if I resize vertically, but not horizontally. I recover the image if resized horizontally after vertically.

3) if I align the control alClient I lost the painted information when resized in any direction and I can not recover it.

Best regards, Jos?

Reply by email

Henry Vermaak
to José Mejuto: Working in the gecko port in GTK2 I had discovered something that looks like a bug, but…
Jos? Mejuto wrote 12 lines
Hello Lazarus-List, Working in the gecko port in GTK2 I had discovered something that looks like a bug, but maybe not. The gecko browser is using a GTK Window which is a TCustomControl, once put in the form and started it does nothing unless the mouse is moved over the form (not need to move over the control), so it looks like a non processed message. After some tests I had decided to add a timer to the form and in the event handler add "Application.ProcessMessages" and now the window is rendered as expected :-?

May be related:

http://bugs.freepascal.org/view.php?id=13120

Henry

Reply by email

José Mejuto
to Henry Vermaak

Hello Henry,

Wednesday, December 8, 2010, 7:05:44 PM, you wrote:

Jos? Mejuto wrote 7 lines
> The gecko browser is using a GTK Window which is a TCustomControl, > once put in the form and started it does nothing unless the mouse is > moved over the form (not need to move over the control), so it looks > like a non processed message. After some tests I had decided to add a > timer to the form and in the event handler add > "Application.ProcessMessages" and now the window is rendered as > expected :-?

HV> May be related:
HV> http://bugs.freepascal.org/view.php?id=13120

I don't think so, it does not happend in Windows and it is solved with the old GTK2 message processing, so it should work in previous Lazarus releases, and that report is about 0.9.26.

Best regards, Jos?

Reply by email

zeljko
to José Mejuto: JM> The gecko browser is using a GTK Window which is a TCustomControl, JM> once put in…
Jos? Mejuto wrote 14 lines
Hello Jos?, Wednesday, December 8, 2010, 6:32:39 PM, you wrote: JM> The gecko browser is using a GTK Window which is a TCustomControl, JM> once put in the form and started it does nothing unless the mouse is JM> moved over the form (not need to move over the control), so it looks JM> like a non processed message. After some tests I had decided to add a JM> timer to the form and in the event handler add JM> "Application.ProcessMessages" and now the window is rendered as JM> expected :-? This problem is resolved using "-dUSE_GTK_MAIN_OLD_ITERATION" so it looks like some kind of "regression" (I had not tested with 0.9.28).

Please open an issue with this problem.It should work without -dUSE_GTK_MAIN_OLD_ITERATION. Also attach example which reproduces problem.

zeljko

Reply by email

José Mejuto
to zeljko

Hello zeljko,

you wrote
> This problem is resolved using "-dUSE_GTK_MAIN_OLD_ITERATION" so it > looks like some kind of "regression" (I had not tested with 0.9.28).

z> Please open an issue with this problem.It should work z> without -dUSE_GTK_MAIN_OLD_ITERATION. Also attach example which reproduces z> problem.

I had not post it because writing an example that raises the problem seems to not be an easy task :( Seems like any change that happends by means of the LCL works. Anyway I'll try to produce one and them post a bugreport.

Best regards, Jos?

Reply by email