mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 19:56:03 +02:00
gtk: remove LM_INTERNALPAINT and related things
git-svn-id: trunk@13848 -
This commit is contained in:
parent
2cc665010b
commit
b66fdb0bab
@ -238,7 +238,6 @@ type
|
||||
const ALCLObject: TObject);
|
||||
procedure SetCallback(const AMsg: LongInt; const AGTKObject: PGTKObject;
|
||||
const ALCLObject: TObject);
|
||||
procedure SendPaintMessagesForInternalWidgets(AWinControl: TWinControl);
|
||||
function LCLtoGtkMessagePending: boolean;virtual;
|
||||
procedure SendCachedGtkMessages;virtual;
|
||||
// show, hide and invalidate
|
||||
|
@ -972,7 +972,7 @@ var
|
||||
PS: PPaintStruct;
|
||||
DC: TGtkDeviceContext;
|
||||
begin
|
||||
if (Msg^.Msg = LM_PAINT) or (Msg^.Msg = LM_INTERNALPAINT) then
|
||||
if (Msg^.Msg = LM_PAINT) then
|
||||
begin
|
||||
if Msg^.LParam <> 0 then
|
||||
begin
|
||||
@ -1002,7 +1002,7 @@ var
|
||||
PS: PPaintStruct;
|
||||
DC: TGtkDeviceContext;
|
||||
begin
|
||||
if (Msg^.Message = LM_PAINT) or (Msg^.Message = LM_INTERNALPAINT) then
|
||||
if (Msg^.Message = LM_PAINT) then
|
||||
begin
|
||||
if Msg^.LParam <> 0 then
|
||||
begin
|
||||
@ -3595,7 +3595,6 @@ begin
|
||||
' Message=',GetMessageName(TLMessage(AMessage).Msg));
|
||||
{$ENDIF}
|
||||
if (TLMessage(AMessage).Msg=LM_PAINT)
|
||||
or (TLMessage(AMessage).Msg=LM_INTERNALPAINT)
|
||||
or (TLMessage(AMessage).Msg=LM_GTKPAINT) then
|
||||
CurrentSentPaintMessageTarget:=TObject(Target);
|
||||
try
|
||||
|
@ -1095,198 +1095,6 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TGtkWidgetSet.SendPaintMessagesForInternalWidgets(
|
||||
AWinControl: TWinControl);
|
||||
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TGtkWidgetSet.SendPaintMessagesForInternalWidgets(
|
||||
AWinControl: TWinControl);
|
||||
type
|
||||
TInternalPaintContext = record
|
||||
WinControl: TWinControl;
|
||||
MainWidget: PGtkWidget;
|
||||
ClientWidget: PGtkWidget;
|
||||
MainWindow: PGdkWindow;
|
||||
ClientWindow: PGdkWindow;
|
||||
WindowList: TFPList;
|
||||
end;
|
||||
|
||||
var
|
||||
Context: TInternalPaintContext;
|
||||
|
||||
procedure SendPaintMessageForGDkWindow(PaintWindow: PGdkWindow);
|
||||
var
|
||||
AMessage: TLMessage;
|
||||
{$IFDEF VerboseDsgnPaintMsg}
|
||||
Left, Top, Width, Height: integer;
|
||||
{$ENDIF}
|
||||
//Child: PGList;
|
||||
UserData: Pointer;
|
||||
LCLObject: TObject;
|
||||
begin
|
||||
if PaintWindow=nil then exit;
|
||||
// check if PaintWindow is only used internally
|
||||
// and was not already used for an internal paint message
|
||||
if (PaintWindow=nil) or (PaintWindow=Context.MainWindow)
|
||||
or (PaintWindow=Context.ClientWindow)
|
||||
or ((Context.WindowList<>nil)
|
||||
and (Context.WindowList.IndexOf(PaintWindow)>=0))
|
||||
then exit;
|
||||
|
||||
if Context.WindowList=nil then
|
||||
Context.WindowList:=TFPList.Create;
|
||||
Context.WindowList.Add(PaintWindow);
|
||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||
|
||||
if (not gdk_window_is_visible(PaintWindow))
|
||||
or (not gdk_window_is_viewable(PaintWindow))
|
||||
then begin
|
||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||
exit;
|
||||
end;
|
||||
|
||||
// check if window belongs to another LCL control
|
||||
gdk_window_get_user_data(PaintWindow,@UserData);
|
||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||
|
||||
if (UserData<>nil)
|
||||
and (GtkWidgetIsA(PGtkWidget(UserData), GTK_TYPE_WIDGET))
|
||||
then begin
|
||||
LCLObject:=GetLCLObject(UserData);
|
||||
if (LCLObject<>nil) and (LCLObject<>AWinControl) then exit;
|
||||
end;
|
||||
|
||||
AMessage.Msg := LM_INTERNALPAINT;
|
||||
AMessage.WParam := CreateDCForWidget(Context.MainWidget,PaintWindow,false);
|
||||
AMessage.LParam := 0;
|
||||
AMessage.Result := 0;
|
||||
|
||||
{$IFDEF VerboseDsgnPaintMsg}
|
||||
gdk_window_get_size(PaintWindow,@Width,@Height);
|
||||
gdk_window_get_origin(PaintWindow,@Left,@Top);
|
||||
DebugLn('SendInternalPaintMessage ',
|
||||
AWinControl.Name,':',AWinControl.ClassName,
|
||||
' InternalWindow=',DbgS(PaintWindow),
|
||||
' ',Left,',',Top,',',Width,',',Height,
|
||||
' visible=',gdk_window_is_visible(PaintWindow),
|
||||
' viewable=',gdk_window_is_viewable(PaintWindow),
|
||||
'');
|
||||
{$ENDIF}
|
||||
DeliverMessage(AWinControl,AMessage);
|
||||
|
||||
if AMessage.WParam<>0 then
|
||||
ReleaseDC(0,HDC(AMessage.WParam));
|
||||
|
||||
{ Normally the childwindows should be explored too, but there are some
|
||||
widgets with bad gdkwindows. ToDo: find a way to determine, if a
|
||||
gdkwindow is good
|
||||
|
||||
Child:=gdk_window_get_children(PaintWindow);
|
||||
while Child<>nil do begin
|
||||
SendPaintMessageForGDkWindow(PGdkWindow(Child^.Data));
|
||||
Child:=Child^.Next;
|
||||
end;}
|
||||
end;
|
||||
|
||||
procedure ForAllChilds(PaintWidget: PgtkWidget);
|
||||
var
|
||||
LCLObject: TObject;
|
||||
{$IFDEF Gtk2}
|
||||
ChildEntry2: PGList;
|
||||
{$ELSE}
|
||||
ChildEntry: PGSList;
|
||||
{$ENDIF}
|
||||
begin
|
||||
if PaintWidget=nil then exit;
|
||||
LCLObject:=GetLCLObject(PaintWidget);
|
||||
if (LCLObject<>nil) and (LCLObject<>AWinControl) then exit;
|
||||
// send the paint message
|
||||
SendPaintMessageForGDkWindow(GetControlWindow(PaintWidget));
|
||||
|
||||
// search all child widgets
|
||||
if GtkWidgetIsA(PaintWidget, GTK_TYPE_CONTAINER) then
|
||||
begin
|
||||
// this is a container widget -> go through all childs
|
||||
{$IFDEF Gtk2}
|
||||
ChildEntry2:=gtk_container_get_children(PGtkContainer(PaintWidget));
|
||||
while ChildEntry2<>nil do begin
|
||||
if PGtkWidget(ChildEntry2^.Data)<>PaintWidget then
|
||||
ForAllChilds(PGtkWidget(ChildEntry2^.Data));
|
||||
ChildEntry2:=ChildEntry2^.Next;
|
||||
end;
|
||||
{$ELSE}
|
||||
ChildEntry:=PGtkContainer(PaintWidget)^.resize_widgets;
|
||||
while ChildEntry<>nil do begin
|
||||
if PGtkWidget(ChildEntry^.Data)<>PaintWidget then
|
||||
ForAllChilds(PGtkWidget(ChildEntry^.Data));
|
||||
ChildEntry:=ChildEntry^.Next;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
if GtkWidgetIsA(PaintWidget, GTK_TYPE_SCROLLED_WINDOW)
|
||||
then begin
|
||||
ForAllChilds(PGtkScrolledWindow(PaintWidget)^.hscrollbar);
|
||||
ForAllChilds(PGtkScrolledWindow(PaintWidget)^.vscrollbar);
|
||||
end;
|
||||
if GtkWidgetIsA(PaintWidget, GTK_TYPE_BIN) then
|
||||
begin
|
||||
ForAllChilds(PGtkBin(PaintWidget)^.child);
|
||||
end;
|
||||
if GtkWidgetIsA(PaintWidget, GTK_TYPE_COMBO) then begin
|
||||
ForAllChilds(PGtkCombo(PaintWidget)^.entry);
|
||||
ForAllChilds(PGtkCombo(PaintWidget)^.button);
|
||||
end;
|
||||
if GtkWidgetIsA(PaintWidget, GTK_TYPE_RANGE)
|
||||
then begin
|
||||
{$IFDEF Gtk1}
|
||||
SendPaintMessageForGDkWindow(PGtkRange(PaintWidget)^.slider);
|
||||
SendPaintMessageForGDkWindow(PGtkRange(PaintWidget)^.trough);
|
||||
SendPaintMessageForGDkWindow(PGtkRange(PaintWidget)^.step_forw);
|
||||
SendPaintMessageForGDkWindow(PGtkRange(PaintWidget)^.step_back);
|
||||
{$ENDIF}
|
||||
end;
|
||||
if GtkWidgetIsA(PaintWidget, GTK_TYPE_TEXT) then
|
||||
begin
|
||||
SendPaintMessageForGDkWindow(PGtkText(PaintWidget)^.text_area);
|
||||
end;
|
||||
if GtkWidgetIsA(PaintWidget, GTK_TYPE_ENTRY) then
|
||||
begin
|
||||
SendPaintMessageForGDkWindow(PGtkEntry(PaintWidget)^.text_area);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
if AWinControl=nil then exit;
|
||||
Context.WinControl:=AWinControl;
|
||||
with Context do begin
|
||||
MainWidget:=PGtkWidget(WinControl.Handle);
|
||||
if MainWidget=nil then exit;
|
||||
if MainWidget<>nil then
|
||||
MainWindow:=GetControlWindow(MainWidget)
|
||||
else
|
||||
exit;
|
||||
ClientWidget:=GetFixedWidget(MainWidget);
|
||||
if ClientWidget<>nil then
|
||||
ClientWindow:=GetControlWindow(ClientWidget)
|
||||
else
|
||||
ClientWindow:=nil;
|
||||
WindowList:=nil;
|
||||
end;
|
||||
{DebugLn('TGtkWidgetSet.SendPaintMessagesForInternalWidgets START ',
|
||||
' ',AWinControl.Name,':',AWinControl.ClassName,
|
||||
' ',DbgS(Context.MainWidget),
|
||||
' ',DbgS(Context.MainWindow),
|
||||
' ',DbgS(Context.ClientWidget),
|
||||
' ',DbgS(Context.ClientWindow),
|
||||
'');}
|
||||
|
||||
ForAllChilds(Context.MainWidget);
|
||||
|
||||
Context.WindowList.Free;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TGtkWidgetSet.AppProcessMessages
|
||||
Params: None
|
||||
|
@ -8027,22 +8027,13 @@ var
|
||||
if OldMsg = LM_GTKPAINT then
|
||||
begin
|
||||
FinalizePaintMessage(@AMessage);
|
||||
|
||||
//if (csDesigning in TComponent(TargetObject).ComponentState)
|
||||
//and (TargetObject is TWinControl) then
|
||||
// SendPaintMessagesForInternalWidgets(TWinControl(TargetObject));
|
||||
end
|
||||
else
|
||||
if ((AMessage.Msg = LM_PAINT) or (AMessage.Msg = LM_INTERNALPAINT))
|
||||
and (AMessage.WParam <> 0) then
|
||||
if (AMessage.Msg = LM_PAINT) and (AMessage.WParam <> 0) then
|
||||
begin
|
||||
// free DC
|
||||
ReleaseDC(0, AMessage.WParam);
|
||||
AMessage.WParam := 0;
|
||||
|
||||
//if (csDesigning in TComponent(TargetObject).ComponentState)
|
||||
//and (TargetObject is TWinControl) then
|
||||
// SendPaintMessagesForInternalWidgets(TWinControl(TargetObject));
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -8069,7 +8060,7 @@ begin
|
||||
else
|
||||
Result := DeliverMessage(Target, AMessage); // deliver it
|
||||
|
||||
if (Msg = LM_PAINT) or (Msg = LM_INTERNALPAINT) or (Msg = LM_GTKPAINT) then
|
||||
if (Msg = LM_PAINT) or (Msg = LM_GTKPAINT) then
|
||||
DisposePaintMessage(Target, AMessage);
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user